[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

benjamin.poulain at nokia.com benjamin.poulain at nokia.com
Wed Dec 22 14:51:24 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1854eddccc2f6308a30048415b99baed8a6a8026
Author: benjamin.poulain at nokia.com <benjamin.poulain at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 22 09:57:59 2010 +0000

    [Qt] All widgets are rendered incorrectly when rendered through a cache
    https://bugs.webkit.org/show_bug.cgi?id=47767
    
    Reviewed by Simon Hausmann.
    
    WebCore:
    
    When a widget is not available to the RenderTheme, default
    value are used for the state.
    
    * platform/qt/RenderThemeQt.cpp:
    (WebCore::initStyleOption):
    (WebCore::RenderThemeQt::paintButton):
    (WebCore::RenderThemeQt::paintTextField):
    (WebCore::RenderThemeQt::paintMenuList):
    (WebCore::RenderThemeQt::paintMenuListButton):
    (WebCore::RenderThemeQt::paintProgressBar):
    (WebCore::RenderThemeQt::paintSliderTrack):
    
    WebKit/qt:
    
    Add a new test for rendering with tiling.
    
    * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
    (tst_QGraphicsWebView::widgetsRenderingThroughCache):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70297 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 529c77b..90d1903 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-22  Benjamin Poulain  <benjamin.poulain at nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] All widgets are rendered incorrectly when rendered through a cache
+        https://bugs.webkit.org/show_bug.cgi?id=47767
+
+        When a widget is not available to the RenderTheme, default
+        value are used for the state.
+
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::initStyleOption):
+        (WebCore::RenderThemeQt::paintButton):
+        (WebCore::RenderThemeQt::paintTextField):
+        (WebCore::RenderThemeQt::paintMenuList):
+        (WebCore::RenderThemeQt::paintMenuListButton):
+        (WebCore::RenderThemeQt::paintProgressBar):
+        (WebCore::RenderThemeQt::paintSliderTrack):
+
 2010-10-22  Zoltan Herczeg  <zherczeg at webkit.org>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 50b5de6..7ef4ab7 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -80,6 +80,19 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
+inline static void initStyleOption(QWidget *widget, QStyleOption& option)
+{
+    if (widget)
+        option.initFrom(widget);
+    else {
+        /*
+          If a widget is not directly available for rendering, we fallback to default
+          value for an active widget.
+         */
+        option.state = QStyle::State_Active | QStyle::State_Enabled;
+    }
+}
+
 
 StylePainter::StylePainter(RenderThemeQt* theme, const PaintInfo& paintInfo)
 {
@@ -538,9 +551,7 @@ bool RenderThemeQt::paintButton(RenderObject* o, const PaintInfo& i, const IntRe
        return true;
 
     QStyleOptionButton option;
-    if (p.widget)
-       option.initFrom(p.widget);
-
+    initStyleOption(p.widget, option);
     option.rect = r;
     option.state |= QStyle::State_Small;
 
@@ -571,9 +582,7 @@ bool RenderThemeQt::paintTextField(RenderObject* o, const PaintInfo& i, const In
         return true;
 
     QStyleOptionFrameV2 panel;
-    if (p.widget)
-        panel.initFrom(p.widget);
-
+    initStyleOption(p.widget, panel);
     panel.rect = r;
     panel.lineWidth = findFrameLineWidth(qStyle());
     panel.state |= QStyle::State_Sunken;
@@ -640,8 +649,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const PaintInfo& i, const Int
         return true;
 
     QtStyleOptionWebComboBox opt(o);
-    if (p.widget)
-        opt.initFrom(p.widget);
+    initStyleOption(p.widget, opt);
     initializeCommonQStyleOptions(opt, o);
 
     const QPoint topLeft = r.topLeft();
@@ -684,8 +692,7 @@ bool RenderThemeQt::paintMenuListButton(RenderObject* o, const PaintInfo& i,
         return true;
 
     QtStyleOptionWebComboBox option(o);
-    if (p.widget)
-        option.initFrom(p.widget);
+    initStyleOption(p.widget, option);
     initializeCommonQStyleOptions(option, o);
     option.rect = r;
 
@@ -735,8 +742,7 @@ bool RenderThemeQt::paintProgressBar(RenderObject* o, const PaintInfo& pi, const
        return true;
 
     QStyleOptionProgressBarV2 option;
-    if (p.widget)
-       option.initFrom(p.widget);
+    initStyleOption(p.widget, option);
     initializeCommonQStyleOptions(option, o);
 
     RenderProgress* renderProgress = toRenderProgress(o);
@@ -777,8 +783,7 @@ bool RenderThemeQt::paintSliderTrack(RenderObject* o, const PaintInfo& pi,
        return true;
 
     QStyleOptionSlider option;
-    if (p.widget)
-       option.initFrom(p.widget);
+    initStyleOption(p.widget, option);
     option.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
     ControlPart appearance = initializeCommonQStyleOptions(option, o);
 
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 75d89e9..410f90b 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-22  Benjamin Poulain  <benjamin.poulain at nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] All widgets are rendered incorrectly when rendered through a cache
+        https://bugs.webkit.org/show_bug.cgi?id=47767
+
+        Add a new test for rendering with tiling.
+
+        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
+        (tst_QGraphicsWebView::widgetsRenderingThroughCache):
+
 2010-10-21  Robert Hogan  <robert at webkit.org>
 
         Reviewed by Simon Hausmann.
diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index a04ff17..5673488 100644
--- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -35,6 +35,7 @@ private slots:
     void microFocusCoordinates();
     void focusInputTypes();
     void crashOnSetScaleBeforeSetUrl();
+    void widgetsRenderingThroughCache();
 };
 
 void tst_QGraphicsWebView::qgraphicswebview()
@@ -140,6 +141,41 @@ void tst_QGraphicsWebView::crashOnSetScaleBeforeSetUrl()
     delete webView;
 }
 
+void tst_QGraphicsWebView::widgetsRenderingThroughCache()
+{
+    // Widgets should be rendered the same way with and without
+    // intermediate cache (tiling for example).
+    // See bug https://bugs.webkit.org/show_bug.cgi?id=47767 where
+    // widget are rendered as disabled when caching is using.
+
+    QGraphicsWebView* webView = new QGraphicsWebView;
+    webView->setHtml(QLatin1String("<body style=\"background-color: white\"><input type=range></input><input type=checkbox></input><input type=radio></input><input type=file></input></body>"));
+
+    QGraphicsView view;
+    view.show();
+    QGraphicsScene* scene = new QGraphicsScene(&view);
+    view.setScene(scene);
+    scene->addItem(webView);
+    view.setGeometry(QRect(0, 0, 500, 500));
+    QWidget *const widget = &view;
+    QTest::qWaitForWindowShown(widget);
+
+    // 1. Reference without tiling.
+    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, false);
+    QPixmap referencePixmap(view.size());
+    widget->render(&referencePixmap);
+
+    // 2. With tiling.
+    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
+    QPixmap viewWithTiling(view.size());
+    widget->render(&viewWithTiling);
+    QApplication::processEvents();
+    viewWithTiling.fill();
+    widget->render(&viewWithTiling);
+
+    QCOMPARE(referencePixmap.toImage(), viewWithTiling.toImage());
+}
+
 void tst_QGraphicsWebView::microFocusCoordinates()
 {
     QWebPage* page = new QWebPage;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list