Changeset 97945 in webkit


Ignore:
Timestamp:
Oct 20, 2011 12:22:49 AM (13 years ago)
Author:
carol@webkit.org
Message:

Tiled Backing Store does not regenerate tiles when it should
https://bugs.webkit.org/show_bug.cgi?id=57798

Reviewed by Darin Adler.

Source/WebCore:

Changed TiledBackingStore::adjustVisibleRect to take into account
contentsSize, the same way as it is done when tiles are generated.

This is an issue that requires a certain sequence of API calls which
may not be easily simulated from DumpRenderTree, but which is
easily reproduced with QtTest. This is why I have provided only
a Qt specific test despite this being a generic problem.

  • platform/graphics/TiledBackingStore.cpp:

(WebCore::TiledBackingStore::adjustVisibleRect):
Changed to take into account ContentsSize.
(WebCore::TiledBackingStore::visibleContentsRect):
Added to return the intersection of the viewport's visible rect with
the ContentsRect.
(WebCore::TiledBackingStore::createTiles):
Changed to take into account the ContentsSize when calculating the
previously visible rect.

  • platform/graphics/TiledBackingStore.h:

Source/WebKit/qt:

Provided test for this bug. Changed the name of the resource I added
for a previous test so that the name is descriptive such that it can
be shared across several tests.

  • tests/qgraphicswebview/tst_qgraphicswebview.cpp:

(tst_QGraphicsWebView::bug57798):
(tst_QGraphicsWebView::bug56929):

  • tests/qgraphicswebview/tst_qgraphicswebview.qrc:
Location:
trunk/Source
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r97944 r97945  
     12011-10-20  Carol Szabo  <carol@webkit.org>
     2
     3        Tiled Backing Store does not regenerate tiles when it should
     4        https://bugs.webkit.org/show_bug.cgi?id=57798
     5
     6        Reviewed by Darin Adler.
     7
     8        Changed TiledBackingStore::adjustVisibleRect to take into account
     9        contentsSize, the same way as it is done when tiles are generated.
     10
     11        This is an issue that requires a certain sequence of API calls which
     12        may not be easily simulated from DumpRenderTree, but which is
     13        easily reproduced with QtTest. This is why I have provided only
     14        a Qt specific test despite this being a generic problem.
     15
     16        * platform/graphics/TiledBackingStore.cpp:
     17        (WebCore::TiledBackingStore::adjustVisibleRect):
     18        Changed to take into account ContentsSize.
     19        (WebCore::TiledBackingStore::visibleContentsRect):
     20        Added to return the intersection of the viewport's visible rect with
     21        the ContentsRect.
     22        (WebCore::TiledBackingStore::createTiles):
     23        Changed to take into account the ContentsSize when calculating the
     24        previously visible rect.
     25        * platform/graphics/TiledBackingStore.h:
     26
    1272011-10-19  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp

    r97571 r97945  
    174174void TiledBackingStore::adjustVisibleRect()
    175175{
    176     IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
     176    IntRect visibleRect = visibleContentsRect();
    177177    if (m_previousVisibleRect == visibleRect)
    178178        return;
     
    180180
    181181    startTileCreationTimer();
     182}
     183
     184IntRect TiledBackingStore::visibleContentsRect()
     185{
     186    return mapFromContents(intersection(m_client->tiledBackingStoreVisibleRect(), m_client->tiledBackingStoreContentsRect()));
    182187}
    183188
     
    243248        return;
    244249   
    245     IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
     250    IntRect visibleRect = visibleContentsRect();
    246251    m_previousVisibleRect = visibleRect;
    247252
  • trunk/Source/WebCore/platform/graphics/TiledBackingStore.h

    r97571 r97945  
    106106   
    107107    void paintCheckerPattern(GraphicsContext*, const IntRect&, const Tile::Coordinate&);
     108    IntRect visibleContentsRect();
    108109
    109110private:
  • trunk/Source/WebKit/qt/ChangeLog

    r97766 r97945  
     12011-10-20  Carol Szabo  <carol@webkit.org>
     2
     3        Tiled Backing Store does not regenerate tiles when it should
     4        https://bugs.webkit.org/show_bug.cgi?id=57798
     5
     6        Reviewed by Darin Adler.
     7
     8        Provided test for this bug. Changed the name of the resource I added
     9        for a previous test so that the name is descriptive such that it can
     10        be shared across several tests.
     11
     12        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
     13        (tst_QGraphicsWebView::bug57798):
     14        (tst_QGraphicsWebView::bug56929):
     15        * tests/qgraphicswebview/tst_qgraphicswebview.qrc:
     16
    1172011-10-18  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    218
  • trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp

    r97571 r97945  
    5050    void renderHints();
    5151#if defined(WTF_USE_TILED_BACKING_STORE) && WTF_USE_TILED_BACKING_STORE
     52    void bug57798();
    5253    void bug56929();
    5354#endif
     
    202203
    203204#if defined(WTF_USE_TILED_BACKING_STORE) && WTF_USE_TILED_BACKING_STORE
    204 void tst_QGraphicsWebView::bug56929()
    205 {
    206     // When rendering from tiles sychronous layout should not be triggered
    207     // and scrollbars should be in sync with the size of the document in the displayed state.
     205void tst_QGraphicsWebView::bug57798()
     206{
     207    // When content size grows from less than viewport size to more than that, tiles may need to be regenerated.
    208208
    209209    QGraphicsWebView* webView = new QGraphicsWebView();
     
    213213    view.scene()->addItem(webView);
    214214    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
    215     QUrl url("qrc:///resources/56929.html");
     215    QStyleOptionGraphicsItem option;
     216    option.exposedRect = view.sceneRect();
     217    QImage img(view.width(), view.height(),
     218    QImage::Format_ARGB32_Premultiplied);
     219    QPainter painter(&img);
     220    // This will not paint anything as the tiles are not ready, but will trigger tile creation with size (0, 0).
     221    webView->paint(&painter, &option);
     222    QApplication::processEvents();
     223    QUrl url("qrc:///resources/greendiv.html");
     224    webView->load(url);
     225    QVERIFY(waitForSignal(webView, SIGNAL(loadFinished(bool))));
     226    // This should trigger the recreation of the tiles.
     227    webView->paint(&painter, &option);
     228    QApplication::processEvents();
     229    painter.fillRect(option.exposedRect, Qt::red); // This is here to ensure failure if paint does not paint anything
     230    webView->paint(&painter, &option);
     231    QCOMPARE(img.pixel(option.exposedRect.width() / 4, option.exposedRect.height() / 4), qRgba(0, 128, 0, 255));
     232}
     233
     234void tst_QGraphicsWebView::bug56929()
     235{
     236    // When rendering from tiles sychronous layout should not be triggered
     237    // and scrollbars should be in sync with the size of the document in the displayed state.
     238
     239    QGraphicsWebView* webView = new QGraphicsWebView();
     240    webView->setGeometry(QRectF(0.0, 0.0, 100.0, 100.0));
     241    QGraphicsView view(new QGraphicsScene());
     242    view.scene()->setParent(&view);
     243    view.scene()->addItem(webView);
     244    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
     245    QUrl url("qrc:///resources/greendiv.html");
    216246    webView->load(url);
    217247    QVERIFY(waitForSignal(webView, SIGNAL(loadFinished(bool))));
  • trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc

    r82676 r97945  
    44        <file>resources/pointing_right.html</file>
    55        <file>resources/pointing_up.html</file>
    6         <file>resources/56929.html</file>
     6        <file>resources/greendiv.html</file>
    77    </qresource>
    88</RCC>
Note: See TracChangeset for help on using the changeset viewer.