[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric at webkit.org eric at webkit.org
Thu Feb 4 21:27:19 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 0f020a463b3fdf0532aabefd42b1191b120fac7e
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 25 15:08:24 2010 +0000

    2010-01-25  Simon Hausmann  <hausmann at webkit.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] In the StyledPainter determine the style from the Render and Scrollbar theme instead of from the paint device
            https://bugs.webkit.org/show_bug.cgi?id=34054
    
            Getting the style from the painter's paint device is a hack that breaks when
            the paint device's style is different than the style that is used when
            calculating the metries earlier when there is no painter available.
    
            This change moves us closer to always using the same style.
    
            * platform/qt/RenderThemeQt.cpp:
            (WebCore::StylePainter::StylePainter):
            (WebCore::StylePainter::init):
            (WebCore::RenderThemeQt::paintButton):
            (WebCore::RenderThemeQt::paintTextField):
            (WebCore::RenderThemeQt::paintMenuList):
            (WebCore::RenderThemeQt::paintMenuListButton):
            (WebCore::RenderThemeQt::paintSliderTrack):
            (WebCore::RenderThemeQt::paintMediaMuteButton):
            (WebCore::RenderThemeQt::paintMediaPlayButton):
            (WebCore::RenderThemeQt::paintMediaSliderTrack):
            (WebCore::RenderThemeQt::paintMediaSliderThumb):
            * platform/qt/RenderThemeQt.h:
            * platform/qt/ScrollbarThemeQt.cpp:
            (WebCore::ScrollbarThemeQt::paint):
            (WebCore::ScrollbarThemeQt::hitTest):
            (WebCore::ScrollbarThemeQt::shouldCenterOnThumb):
            (WebCore::ScrollbarThemeQt::scrollbarThickness):
            (WebCore::ScrollbarThemeQt::thumbLength):
            (WebCore::ScrollbarThemeQt::trackPosition):
            (WebCore::ScrollbarThemeQt::trackLength):
            (WebCore::ScrollbarThemeQt::paintScrollCorner):
            (WebCore::ScrollbarThemeQt::style):
            * platform/qt/ScrollbarThemeQt.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53803 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a45713b..4f334c1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,44 @@
 
         Reviewed by Kenneth Rohde Christiansen.
 
+        [Qt] In the StyledPainter determine the style from the Render and Scrollbar theme instead of from the paint device
+        https://bugs.webkit.org/show_bug.cgi?id=34054
+
+        Getting the style from the painter's paint device is a hack that breaks when
+        the paint device's style is different than the style that is used when
+        calculating the metries earlier when there is no painter available.
+
+        This change moves us closer to always using the same style.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::StylePainter::StylePainter):
+        (WebCore::StylePainter::init):
+        (WebCore::RenderThemeQt::paintButton):
+        (WebCore::RenderThemeQt::paintTextField):
+        (WebCore::RenderThemeQt::paintMenuList):
+        (WebCore::RenderThemeQt::paintMenuListButton):
+        (WebCore::RenderThemeQt::paintSliderTrack):
+        (WebCore::RenderThemeQt::paintMediaMuteButton):
+        (WebCore::RenderThemeQt::paintMediaPlayButton):
+        (WebCore::RenderThemeQt::paintMediaSliderTrack):
+        (WebCore::RenderThemeQt::paintMediaSliderThumb):
+        * platform/qt/RenderThemeQt.h:
+        * platform/qt/ScrollbarThemeQt.cpp:
+        (WebCore::ScrollbarThemeQt::paint):
+        (WebCore::ScrollbarThemeQt::hitTest):
+        (WebCore::ScrollbarThemeQt::shouldCenterOnThumb):
+        (WebCore::ScrollbarThemeQt::scrollbarThickness):
+        (WebCore::ScrollbarThemeQt::thumbLength):
+        (WebCore::ScrollbarThemeQt::trackPosition):
+        (WebCore::ScrollbarThemeQt::trackLength):
+        (WebCore::ScrollbarThemeQt::paintScrollCorner):
+        (WebCore::ScrollbarThemeQt::style):
+        * platform/qt/ScrollbarThemeQt.h:
+
+2010-01-25  Simon Hausmann  <hausmann at webkit.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
         [Qt] In RenderThemeQt determine the QStyle from the page client instead of the page's view
         https://bugs.webkit.org/show_bug.cgi?id=34053
 
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 21d801e..e474f1b 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -47,6 +47,7 @@
 #include "RenderBox.h"
 #include "RenderSlider.h"
 #include "RenderTheme.h"
+#include "ScrollbarThemeQt.h"
 #include "UserAgentStyleSheets.h"
 #include "qwebpage.h"
 
@@ -69,17 +70,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;
@@ -88,7 +89,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,
@@ -465,7 +466,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;
 
@@ -498,7 +499,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;
 
@@ -567,7 +568,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;
 
@@ -607,7 +608,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;
 
@@ -628,7 +629,7 @@ bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::Pai
 bool RenderThemeQt::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& pi,
                                      const IntRect& r)
 {
-    StylePainter p(pi);
+    StylePainter p(this, pi);
     if (!p.isValid())
        return true;
 
@@ -899,7 +900,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;
 
@@ -928,7 +929,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;
 
@@ -967,7 +968,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;
 
@@ -984,7 +985,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/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
index be277fa..e6bab7e 100644
--- a/WebCore/platform/qt/RenderThemeQt.h
+++ b/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;
@@ -142,7 +145,6 @@ private:
 
     void setPaletteFromPageClientIfExists(QPalette&) const;
 
-    QStyle* qStyle() const;
     QStyle* fallbackStyle();
 
     Page* m_page;
@@ -157,8 +159,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; }
@@ -175,7 +177,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/WebCore/platform/qt/ScrollbarThemeQt.cpp b/WebCore/platform/qt/ScrollbarThemeQt.cpp
index 93709b2..c0c80ba 100644
--- a/WebCore/platform/qt/ScrollbarThemeQt.cpp
+++ b/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), DeviceColorSpace);
 #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/WebCore/platform/qt/ScrollbarThemeQt.h b/WebCore/platform/qt/ScrollbarThemeQt.h
index 6ca44ea..cf4882d 100644
--- a/WebCore/platform/qt/ScrollbarThemeQt.h
+++ b/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;
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list