Title: [97945] trunk/Source
Revision
97945
Author
ca...@webkit.org
Date
2011-10-20 00:22:49 -0700 (Thu, 20 Oct 2011)

Log 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:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97944 => 97945)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 07:22:49 UTC (rev 97945)
@@ -1,3 +1,29 @@
+2011-10-20  Carol Szabo  <ca...@webkit.org>
+
+        Tiled Backing Store does not regenerate tiles when it should
+        https://bugs.webkit.org/show_bug.cgi?id=57798
+
+        Reviewed by Darin Adler.
+
+        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:
+
 2011-10-19  Jer Noble  <jer.no...@apple.com>
 
         compositing/video tests time out on Lion

Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp (97944 => 97945)


--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.cpp	2011-10-20 07:22:49 UTC (rev 97945)
@@ -173,7 +173,7 @@
 
 void TiledBackingStore::adjustVisibleRect()
 {
-    IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
+    IntRect visibleRect = visibleContentsRect();
     if (m_previousVisibleRect == visibleRect)
         return;
     m_previousVisibleRect = visibleRect;
@@ -181,6 +181,11 @@
     startTileCreationTimer();
 }
 
+IntRect TiledBackingStore::visibleContentsRect()
+{
+    return mapFromContents(intersection(m_client->tiledBackingStoreVisibleRect(), m_client->tiledBackingStoreContentsRect()));
+}
+
 void TiledBackingStore::setContentsScale(float scale)
 {
     if (m_pendingScale == m_contentsScale) {
@@ -242,7 +247,7 @@
     if (m_contentsFrozen)
         return;
     
-    IntRect visibleRect = mapFromContents(m_client->tiledBackingStoreVisibleRect());
+    IntRect visibleRect = visibleContentsRect();
     m_previousVisibleRect = visibleRect;
 
     if (visibleRect.isEmpty())

Modified: trunk/Source/WebCore/platform/graphics/TiledBackingStore.h (97944 => 97945)


--- trunk/Source/WebCore/platform/graphics/TiledBackingStore.h	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebCore/platform/graphics/TiledBackingStore.h	2011-10-20 07:22:49 UTC (rev 97945)
@@ -105,6 +105,7 @@
     IntRect contentsRect() const;
     
     void paintCheckerPattern(GraphicsContext*, const IntRect&, const Tile::Coordinate&);
+    IntRect visibleContentsRect();
 
 private:
     TiledBackingStoreClient* m_client;

Modified: trunk/Source/WebKit/qt/ChangeLog (97944 => 97945)


--- trunk/Source/WebKit/qt/ChangeLog	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-10-20 07:22:49 UTC (rev 97945)
@@ -1,3 +1,19 @@
+2011-10-20  Carol Szabo  <ca...@webkit.org>
+
+        Tiled Backing Store does not regenerate tiles when it should
+        https://bugs.webkit.org/show_bug.cgi?id=57798
+
+        Reviewed by Darin Adler.
+
+        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:
+
 2011-10-18  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
 
         [Qt] Merge QML plugin for WebKit2 with the original WebKit1 plugin

Deleted: trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html (97944 => 97945)


--- trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html	2011-10-20 07:22:49 UTC (rev 97945)
@@ -1,8 +0,0 @@
-<body style="background-color: white">
- <div id="1" style="width: 50%; height: 50%; background-color: green"/>
- <script>
-  function resizeDiv() {
-      document.getElementById("1").setAttribute("style", "width: 150%; height: 150%; background-color: green");
-  }
- </script>
-</body>

Copied: trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/greendiv.html (from rev 97944, trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html) (0 => 97945)


--- trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/greendiv.html	                        (rev 0)
+++ trunk/Source/WebKit/qt/tests/qgraphicswebview/resources/greendiv.html	2011-10-20 07:22:49 UTC (rev 97945)
@@ -0,0 +1,8 @@
+<body style="background-color: white">
+ <div id="1" style="width: 50%; height: 50%; background-color: green"/>
+ <script>
+  function resizeDiv() {
+      document.getElementById("1").setAttribute("style", "width: 150%; height: 150%; background-color: green");
+  }
+ </script>
+</body>

Modified: trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp (97944 => 97945)


--- trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp	2011-10-20 07:22:49 UTC (rev 97945)
@@ -49,6 +49,7 @@
 #endif
     void renderHints();
 #if defined(WTF_USE_TILED_BACKING_STORE) && WTF_USE_TILED_BACKING_STORE
+    void bug57798();
     void bug56929();
 #endif
 #if defined(ENABLE_WEBGL) && ENABLE_WEBGL
@@ -201,6 +202,35 @@
 }
 
 #if defined(WTF_USE_TILED_BACKING_STORE) && WTF_USE_TILED_BACKING_STORE
+void tst_QGraphicsWebView::bug57798()
+{
+    // When content size grows from less than viewport size to more than that, tiles may need to be regenerated.
+
+    QGraphicsWebView* webView = new QGraphicsWebView();
+    webView->setGeometry(QRectF(0.0, 0.0, 100.0, 100.0));
+    QGraphicsView view(new QGraphicsScene());
+    view.scene()->setParent(&view);
+    view.scene()->addItem(webView);
+    webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
+    QStyleOptionGraphicsItem option;
+    option.exposedRect = view.sceneRect();
+    QImage img(view.width(), view.height(),
+    QImage::Format_ARGB32_Premultiplied);
+    QPainter painter(&img);
+    // This will not paint anything as the tiles are not ready, but will trigger tile creation with size (0, 0).
+    webView->paint(&painter, &option);
+    QApplication::processEvents();
+    QUrl url("qrc:///resources/greendiv.html");
+    webView->load(url);
+    QVERIFY(waitForSignal(webView, SIGNAL(loadFinished(bool))));
+    // This should trigger the recreation of the tiles.
+    webView->paint(&painter, &option);
+    QApplication::processEvents();
+    painter.fillRect(option.exposedRect, Qt::red); // This is here to ensure failure if paint does not paint anything
+    webView->paint(&painter, &option);
+    QCOMPARE(img.pixel(option.exposedRect.width() / 4, option.exposedRect.height() / 4), qRgba(0, 128, 0, 255));
+}
+
 void tst_QGraphicsWebView::bug56929()
 {
     // When rendering from tiles sychronous layout should not be triggered
@@ -212,7 +242,7 @@
     view.scene()->setParent(&view);
     view.scene()->addItem(webView);
     webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
-    QUrl url("qrc:///resources/56929.html");
+    QUrl url("qrc:///resources/greendiv.html");
     webView->load(url);
     QVERIFY(waitForSignal(webView, SIGNAL(loadFinished(bool))));
     QStyleOptionGraphicsItem option;

Modified: trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc (97944 => 97945)


--- trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc	2011-10-20 07:20:55 UTC (rev 97944)
+++ trunk/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc	2011-10-20 07:22:49 UTC (rev 97945)
@@ -3,6 +3,6 @@
         <file>resources/input_types.html</file>
         <file>resources/pointing_right.html</file>
         <file>resources/pointing_up.html</file>
-        <file>resources/56929.html</file>
+        <file>resources/greendiv.html</file>
     </qresource>
 </RCC>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to