TileGrid revalidates tiles twice during flush, first with wrong visible rect
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2016 03:06:35 +0000 (03:06 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Dec 2016 03:06:35 +0000 (03:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166406

Reviewed by Simon Fraser.

No new tests; existing tests cover this code, this is just a perf win,
specifically reducing the amount of layer churn during zooming.

* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::setScale):
Schedule a revalidation, which will happen later in the same flush,
instead of doing it immediately. Doing it immediately is problematic,
because we're currently in the middle of a GraphicsLayer tree flush,
and don't have the complete picture of the new state yet. We're guaranteed
to get the new scale *before* the flush calls revalidateTiles.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210095 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/TileGrid.cpp

index 5535dc1..c446a34 100644 (file)
@@ -1,5 +1,23 @@
 2016-12-21  Tim Horton  <timothy_horton@apple.com>
 
+        TileGrid revalidates tiles twice during flush, first with wrong visible rect
+        https://bugs.webkit.org/show_bug.cgi?id=166406
+
+        Reviewed by Simon Fraser.
+
+        No new tests; existing tests cover this code, this is just a perf win,
+        specifically reducing the amount of layer churn during zooming.
+
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::setScale):
+        Schedule a revalidation, which will happen later in the same flush,
+        instead of doing it immediately. Doing it immediately is problematic,
+        because we're currently in the middle of a GraphicsLayer tree flush,
+        and don't have the complete picture of the new state yet. We're guaranteed
+        to get the new scale *before* the flush calls revalidateTiles.
+
+2016-12-21  Tim Horton  <timothy_horton@apple.com>
+
         TileGrid creates new tiles when there are recyclable tiles about to be removed
         https://bugs.webkit.org/show_bug.cgi?id=166408
 
index 6acd905..0b99509 100644 (file)
@@ -78,8 +78,7 @@ void TileGrid::setScale(float scale)
     transform.scale(1 / m_scale);
     m_containerLayer->setTransform(transform);
 
-    // FIXME: we may revalidateTiles twice in this commit.
-    revalidateTiles(PruneSecondaryTiles);
+    m_controller.setNeedsRevalidateTiles();
 
     m_containerLayer.get().setContentsScale(m_controller.deviceScaleFactor());