Title: [87290] trunk/Source/WebCore
Revision
87290
Author
[email protected]
Date
2011-05-25 04:39:41 -0700 (Wed, 25 May 2011)

Log Message

2011-05-25  Alexis Menard  <[email protected]>

        Reviewed by Antonio Gomes.

        [Qt] When QWebView has a different style set on it then the scrollbars are not rendered correctly
        https://bugs.webkit.org/show_bug.cgi?id=34635

        Make sure the scrollbar is properly rendered on Mac with another style than the Mac style. The code had
        two paths, one for Mac and one for any other styles. The problem is that on Mac you can still run the
        application with -style plastique for example, therefore the code used for other styles should also be
        used whenever the current style is not the Mac style.

        * platform/qt/ScrollbarThemeQt.cpp:
        (WebCore::ScrollbarThemeQt::paint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87289 => 87290)


--- trunk/Source/WebCore/ChangeLog	2011-05-25 11:21:29 UTC (rev 87289)
+++ trunk/Source/WebCore/ChangeLog	2011-05-25 11:39:41 UTC (rev 87290)
@@ -1,3 +1,18 @@
+2011-05-25  Alexis Menard  <[email protected]>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] When QWebView has a different style set on it then the scrollbars are not rendered correctly
+        https://bugs.webkit.org/show_bug.cgi?id=34635
+
+        Make sure the scrollbar is properly rendered on Mac with another style than the Mac style. The code had
+        two paths, one for Mac and one for any other styles. The problem is that on Mac you can still run the
+        application with -style plastique for example, therefore the code used for other styles should also be
+        used whenever the current style is not the Mac style.
+
+        * platform/qt/ScrollbarThemeQt.cpp:
+        (WebCore::ScrollbarThemeQt::paint):
+
 2011-05-25  Yuta Kitamura  <[email protected]>
 
         Reviewed by Kent Tamura.

Modified: trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp (87289 => 87290)


--- trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp	2011-05-25 11:21:29 UTC (rev 87289)
+++ trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp	2011-05-25 11:39:41 UTC (rev 87290)
@@ -35,7 +35,9 @@
 #include "Scrollbar.h"
 
 #include <QApplication>
-#include <QDebug>
+#ifdef Q_WS_MAC
+#include <QMacStyle>
+#endif
 #include <QMenu>
 #include <QPainter>
 #include <QStyle>
@@ -154,18 +156,23 @@
     p.painter->setClipRect(opt->rect.intersected(damageRect), Qt::IntersectClip);
 
 #ifdef Q_WS_MAC
-    p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
-#else
-    const QPoint topLeft = opt->rect.topLeft();
-    p.painter->translate(topLeft);
-    opt->rect.moveTo(QPoint(0, 0));
+    // FIXME: We also need to check the widget style but today ScrollbarTheme is not aware of the page so we
+    // can't get the widget.
+    if (qobject_cast<QMacStyle*>(style()))
+        p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
+    else
+#endif
+    {
+        const QPoint topLeft = opt->rect.topLeft();
+        p.painter->translate(topLeft);
+        opt->rect.moveTo(QPoint(0, 0));
 
-    // The QStyle expects the background to be already filled
-    p.painter->fillRect(opt->rect, opt->palette.background());
+        // The QStyle expects the background to be already filled.
+        p.painter->fillRect(opt->rect, opt->palette.background());
 
-    p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
-    opt->rect.moveTo(topLeft);
-#endif
+        p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
+        opt->rect.moveTo(topLeft);
+    }
     p.painter->restore();
 
     return true;
@@ -182,7 +189,7 @@
 
 bool ScrollbarThemeQt::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt)
 {
-    // Middle click centers slider thumb (if supported)
+    // Middle click centers slider thumb (if supported).
     return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to