diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-02-05 14:58:26 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-02-05 14:58:26 (GMT) |
commit | 440aa04f0dec0eb9742a774723e1d27e42078c9c (patch) | |
tree | 8a0e99c1b54fa1531fd723a0d396393a85f6b03d /src/3rdparty/webkit/WebCore/platform | |
parent | 906f77bcfd4358f35155075b6d5fd8a383adadba (diff) | |
download | Qt-440aa04f0dec0eb9742a774723e1d27e42078c9c.zip Qt-440aa04f0dec0eb9742a774723e1d27e42078c9c.tar.gz Qt-440aa04f0dec0eb9742a774723e1d27e42078c9c.tar.bz2 |
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( da5d96a26e80162027bc95ce7e5725fe4b277ff7 )
Changes in WebKit/qt since the last update:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform')
4 files changed, 42 insertions, 27 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 6a1eee8..37a6408 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -44,6 +44,7 @@ #include "Page.h" #include "RenderBox.h" #include "RenderTheme.h" +#include "ScrollbarThemeQt.h" #include "UserAgentStyleSheets.h" #include "QWebPageClient.h" #include "qwebpage.h" @@ -66,17 +67,17 @@ namespace WebCore { using namespace HTMLNames; -StylePainter::StylePainter(const RenderObject::PaintInfo& paintInfo) +StylePainter::StylePainter(RenderThemeQt* theme, const RenderObject::PaintInfo& paintInfo) { - init(paintInfo.context ? paintInfo.context : 0); + init(paintInfo.context ? paintInfo.context : 0, theme->qStyle()); } -StylePainter::StylePainter(GraphicsContext* context) +StylePainter::StylePainter(ScrollbarThemeQt* theme, GraphicsContext* context) { - init(context); + init(context, theme->style()); } -void StylePainter::init(GraphicsContext* context) +void StylePainter::init(GraphicsContext* context, QStyle* themeStyle) { painter = static_cast<QPainter*>(context->platformContext()); widget = 0; @@ -85,7 +86,7 @@ void StylePainter::init(GraphicsContext* context) dev = painter->device(); if (dev && dev->devType() == QInternal::Widget) widget = static_cast<QWidget*>(dev); - style = (widget ? widget->style() : QApplication::style()); + style = themeStyle; if (painter) { // the styles often assume being called with a pristine painter where no brush is set, @@ -464,7 +465,7 @@ void RenderThemeQt::setButtonPadding(RenderStyle* style) const bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -497,7 +498,7 @@ void RenderThemeQt::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -566,7 +567,7 @@ void RenderThemeQt::setPopupPadding(RenderStyle* style) const bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -606,7 +607,7 @@ void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* st bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -837,7 +838,7 @@ bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::Pa if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -866,7 +867,7 @@ bool RenderThemeQt::paintMediaPlayButton(RenderObject* o, const RenderObject::Pa if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -905,7 +906,7 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::P if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -932,7 +933,7 @@ bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::P if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 19337ac..13fb42f 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -35,6 +35,7 @@ namespace WebCore { class RenderStyle; class HTMLMediaElement; +class ScrollbarThemeQt; class RenderThemeQt : public RenderTheme { private: @@ -75,6 +76,8 @@ public: virtual String extraMediaControlsStyleSheet(); #endif + QStyle* qStyle() const; + protected: virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); virtual void setCheckboxSize(RenderStyle*) const; @@ -137,7 +140,6 @@ private: void setButtonPadding(RenderStyle*) const; void setPopupPadding(RenderStyle*) const; - QStyle* qStyle() const; QStyle* fallbackStyle() const; Page* m_page; @@ -152,8 +154,8 @@ private: class StylePainter { public: - explicit StylePainter(const RenderObject::PaintInfo& paintInfo); - explicit StylePainter(GraphicsContext* context); + explicit StylePainter(RenderThemeQt*, const RenderObject::PaintInfo&); + explicit StylePainter(ScrollbarThemeQt*, GraphicsContext*); ~StylePainter(); bool isValid() const { return painter && style; } @@ -170,7 +172,7 @@ public: { style->drawComplexControl(cc, &opt, painter, widget); } private: - void init(GraphicsContext* context); + void init(GraphicsContext* context, QStyle*); QBrush oldBrush; bool oldAntialiasing; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp index 561e55f..c0692ca 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp @@ -140,7 +140,7 @@ bool ScrollbarThemeQt::paint(Scrollbar* scrollbar, GraphicsContext* graphicsCont return false; } - StylePainter p(graphicsContext); + StylePainter p(this, graphicsContext); if (!p.isValid()) return true; @@ -172,14 +172,14 @@ ScrollbarPart ScrollbarThemeQt::hitTest(Scrollbar* scrollbar, const PlatformMous QStyleOptionSlider* opt = styleOptionSlider(scrollbar); const QPoint pos = scrollbar->convertFromContainingWindow(evt.pos()); opt->rect.moveTo(QPoint(0, 0)); - QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0); + QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0); return scrollbarPart(sc); } bool ScrollbarThemeQt::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) { // Middle click centers slider thumb (if supported) - return QApplication::style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton; + return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton; } void ScrollbarThemeQt::invalidatePart(Scrollbar* scrollbar, ScrollbarPart) @@ -190,13 +190,12 @@ void ScrollbarThemeQt::invalidatePart(Scrollbar* scrollbar, ScrollbarPart) int ScrollbarThemeQt::scrollbarThickness(ScrollbarControlSize controlSize) { - QStyle* s = QApplication::style(); QStyleOptionSlider o; o.orientation = Qt::Vertical; o.state &= ~QStyle::State_Horizontal; if (controlSize != RegularScrollbar) o.state |= QStyle::State_Mini; - return s->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0); + return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0); } int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar) @@ -209,21 +208,21 @@ int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar) int ScrollbarThemeQt::thumbLength(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect thumb = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0); + IntRect thumb = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0); return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height(); } int ScrollbarThemeQt::trackPosition(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); + IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y(); } int ScrollbarThemeQt::trackLength(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); + IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height(); } @@ -237,7 +236,7 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext #if QT_VERSION < 0x040500 context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window)); #else - StylePainter p(context); + StylePainter p(this, context); if (!p.isValid()) return; @@ -247,5 +246,10 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext #endif } +QStyle* ScrollbarThemeQt::style() const +{ + return QApplication::style(); +} + } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h index 6ca44ea..cf4882d 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h @@ -28,6 +28,12 @@ #include "ScrollbarTheme.h" +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE +class QStyle; +QT_END_NAMESPACE + namespace WebCore { class ScrollbarThemeQt : public ScrollbarTheme { @@ -49,6 +55,8 @@ public: virtual int trackLength(Scrollbar*); virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); + + QStyle* style() const; }; } |