Changeset 70297 in webkit


Ignore:
Timestamp:
Oct 22, 2010 2:57:59 AM (13 years ago)
Author:
benjamin.poulain@nokia.com
Message:

[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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r70296 r70297  
     12010-10-22  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] All widgets are rendered incorrectly when rendered through a cache
     6        https://bugs.webkit.org/show_bug.cgi?id=47767
     7
     8        When a widget is not available to the RenderTheme, default
     9        value are used for the state.
     10
     11        * platform/qt/RenderThemeQt.cpp:
     12        (WebCore::initStyleOption):
     13        (WebCore::RenderThemeQt::paintButton):
     14        (WebCore::RenderThemeQt::paintTextField):
     15        (WebCore::RenderThemeQt::paintMenuList):
     16        (WebCore::RenderThemeQt::paintMenuListButton):
     17        (WebCore::RenderThemeQt::paintProgressBar):
     18        (WebCore::RenderThemeQt::paintSliderTrack):
     19
    1202010-10-22  Zoltan Herczeg  <zherczeg@webkit.org>
    221
  • trunk/WebCore/platform/qt/RenderThemeQt.cpp

    r69411 r70297  
    8181using namespace HTMLNames;
    8282
     83inline static void initStyleOption(QWidget *widget, QStyleOption& option)
     84{
     85    if (widget)
     86        option.initFrom(widget);
     87    else {
     88        /*
     89          If a widget is not directly available for rendering, we fallback to default
     90          value for an active widget.
     91         */
     92        option.state = QStyle::State_Active | QStyle::State_Enabled;
     93    }
     94}
     95
    8396
    8497StylePainter::StylePainter(RenderThemeQt* theme, const PaintInfo& paintInfo)
     
    539552
    540553    QStyleOptionButton option;
    541     if (p.widget)
    542        option.initFrom(p.widget);
    543 
     554    initStyleOption(p.widget, option);
    544555    option.rect = r;
    545556    option.state |= QStyle::State_Small;
     
    572583
    573584    QStyleOptionFrameV2 panel;
    574     if (p.widget)
    575         panel.initFrom(p.widget);
    576 
     585    initStyleOption(p.widget, panel);
    577586    panel.rect = r;
    578587    panel.lineWidth = findFrameLineWidth(qStyle());
     
    641650
    642651    QtStyleOptionWebComboBox opt(o);
    643     if (p.widget)
    644         opt.initFrom(p.widget);
     652    initStyleOption(p.widget, opt);
    645653    initializeCommonQStyleOptions(opt, o);
    646654
     
    685693
    686694    QtStyleOptionWebComboBox option(o);
    687     if (p.widget)
    688         option.initFrom(p.widget);
     695    initStyleOption(p.widget, option);
    689696    initializeCommonQStyleOptions(option, o);
    690697    option.rect = r;
     
    736743
    737744    QStyleOptionProgressBarV2 option;
    738     if (p.widget)
    739        option.initFrom(p.widget);
     745    initStyleOption(p.widget, option);
    740746    initializeCommonQStyleOptions(option, o);
    741747
     
    778784
    779785    QStyleOptionSlider option;
    780     if (p.widget)
    781        option.initFrom(p.widget);
     786    initStyleOption(p.widget, option);
    782787    option.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
    783788    ControlPart appearance = initializeCommonQStyleOptions(option, o);
  • trunk/WebKit/qt/ChangeLog

    r70259 r70297  
     12010-10-22  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] All widgets are rendered incorrectly when rendered through a cache
     6        https://bugs.webkit.org/show_bug.cgi?id=47767
     7
     8        Add a new test for rendering with tiling.
     9
     10        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
     11        (tst_QGraphicsWebView::widgetsRenderingThroughCache):
     12
    1132010-10-21  Robert Hogan  <robert@webkit.org>
    214
  • trunk/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp

    r61984 r70297  
    3636    void focusInputTypes();
    3737    void crashOnSetScaleBeforeSetUrl();
     38    void widgetsRenderingThroughCache();
    3839};
    3940
     
    141142}
    142143
     144void tst_QGraphicsWebView::widgetsRenderingThroughCache()
     145{
     146    // Widgets should be rendered the same way with and without
     147    // intermediate cache (tiling for example).
     148    // See bug https://bugs.webkit.org/show_bug.cgi?id=47767 where
     149    // widget are rendered as disabled when caching is using.
     150
     151    QGraphicsWebView* webView = new QGraphicsWebView;
     152    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>"));
     153
     154    QGraphicsView view;
     155    view.show();
     156    QGraphicsScene* scene = new QGraphicsScene(&view);
     157    view.setScene(scene);
     158    scene->addItem(webView);
     159    view.setGeometry(QRect(0, 0, 500, 500));
     160    QWidget *const widget = &view;
     161    QTest::qWaitForWindowShown(widget);
     162
     163    // 1. Reference without tiling.
     164    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, false);
     165    QPixmap referencePixmap(view.size());
     166    widget->render(&referencePixmap);
     167
     168    // 2. With tiling.
     169    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
     170    QPixmap viewWithTiling(view.size());
     171    widget->render(&viewWithTiling);
     172    QApplication::processEvents();
     173    viewWithTiling.fill();
     174    widget->render(&viewWithTiling);
     175
     176    QCOMPARE(referencePixmap.toImage(), viewWithTiling.toImage());
     177}
     178
    143179void tst_QGraphicsWebView::microFocusCoordinates()
    144180{
Note: See TracChangeset for help on using the changeset viewer.