Title: [147682] trunk
Revision
147682
Author
[email protected]
Date
2013-04-04 16:57:33 -0700 (Thu, 04 Apr 2013)

Log Message

Page content missing when flipping from an empty layer to a tiled layer
https://bugs.webkit.org/show_bug.cgi?id=113977
<rdar://problem/13444219>

Source/WebCore:

Reviewed by Tim Horton.

Some articles on USA Today were missing content on load, when a large GraphicsLayer
which did not draw content needed to draw content (and become tiled in the process).

The bug was an ordering dependency in GraphicsLayerCA::commitLayerChangesBeforeSublayers().
swapFromOrToTiledLayer() sets some dirty flags, but for some properties which have
already been committed in the current flush cycle.

Fix by moving the swapFromOrToTiledLayer() to the top of the commit, which is
safe since it only consults GraphicsLayer properties, not CALayer properties.

Test: compositing/tiling/empty-to-tiled.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateGeometry):
(WebCore::GraphicsLayerCA::updateLayerDrawsContent):
(WebCore::GraphicsLayerCA::updateContentsScale):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):

LayoutTests:

Reviewed by Tim Horton.

Ref test that adds visible content to a larger layer.

* compositing/tiling/empty-to-tiled-expected.html: Added.
* compositing/tiling/empty-to-tiled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147681 => 147682)


--- trunk/LayoutTests/ChangeLog	2013-04-04 23:56:13 UTC (rev 147681)
+++ trunk/LayoutTests/ChangeLog	2013-04-04 23:57:33 UTC (rev 147682)
@@ -1,3 +1,16 @@
+2013-04-04  Simon Fraser  <[email protected]>
+
+        Page content missing when flipping from an empty layer to a tiled layer
+        https://bugs.webkit.org/show_bug.cgi?id=113977
+        <rdar://problem/13444219>
+
+        Reviewed by Tim Horton.
+        
+        Ref test that adds visible content to a larger layer.
+
+        * compositing/tiling/empty-to-tiled-expected.html: Added.
+        * compositing/tiling/empty-to-tiled.html: Added.
+
 2013-04-04  Eric Carlson  <[email protected]>
 
         Unreviewed, fix a test and some results missed in r147675

Added: trunk/LayoutTests/compositing/tiling/empty-to-tiled-expected.html (0 => 147682)


--- trunk/LayoutTests/compositing/tiling/empty-to-tiled-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/empty-to-tiled-expected.html	2013-04-04 23:57:33 UTC (rev 147682)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #box {
+            margin: 10px;
+            width: 200px;
+            height: 2500px;
+            background-color: silver;
+            -webkit-transform: translateZ(0);
+        }
+    </style>
+</head>
+<body>
+    <div id="box" class="empty">
+        <div class="content">
+            Here is some text.
+        </div>
+    </div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/tiling/empty-to-tiled-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/tiling/empty-to-tiled.html (0 => 147682)


--- trunk/LayoutTests/compositing/tiling/empty-to-tiled.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/empty-to-tiled.html	2013-04-04 23:57:33 UTC (rev 147682)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #box {
+            margin: 10px;
+            width: 200px;
+            height: 2500px;
+            background-color: silver;
+            -webkit-transform: translateZ(0);
+        }
+        
+        #box.empty .content {
+            display: none;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        function doTest()
+        {
+            if (window.internals)
+                window.internals.layerTreeAsText(document); // Force layer update.
+
+            document.getElementById('box').classList.remove('empty');
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div id="box" class="empty">
+        <div class="content">
+            Here is some text.
+        </div>
+    </div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/tiling/empty-to-tiled.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (147681 => 147682)


--- trunk/Source/WebCore/ChangeLog	2013-04-04 23:56:13 UTC (rev 147681)
+++ trunk/Source/WebCore/ChangeLog	2013-04-04 23:57:33 UTC (rev 147682)
@@ -1,3 +1,31 @@
+2013-04-04  Simon Fraser  <[email protected]>
+
+        Page content missing when flipping from an empty layer to a tiled layer
+        https://bugs.webkit.org/show_bug.cgi?id=113977
+        <rdar://problem/13444219>
+
+        Reviewed by Tim Horton.
+        
+        Some articles on USA Today were missing content on load, when a large GraphicsLayer
+        which did not draw content needed to draw content (and become tiled in the process).
+        
+        The bug was an ordering dependency in GraphicsLayerCA::commitLayerChangesBeforeSublayers().
+        swapFromOrToTiledLayer() sets some dirty flags, but for some properties which have
+        already been committed in the current flush cycle.
+        
+        Fix by moving the swapFromOrToTiledLayer() to the top of the commit, which is
+        safe since it only consults GraphicsLayer properties, not CALayer properties.
+
+        Test: compositing/tiling/empty-to-tiled.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+        (WebCore::GraphicsLayerCA::updateGeometry):
+        (WebCore::GraphicsLayerCA::updateLayerDrawsContent):
+        (WebCore::GraphicsLayerCA::updateContentsScale):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (GraphicsLayerCA):
+
 2013-04-04  Christophe Dumez  <[email protected]>
 
         Regression(r147639) Causes assertion hit in HashTable

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (147681 => 147682)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-04-04 23:56:13 UTC (rev 147681)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-04-04 23:57:33 UTC (rev 147682)
@@ -1125,6 +1125,10 @@
     if (!m_uncommittedChanges)
         return;
 
+    bool needTiledLayer = requiresTiledLayer(pageScaleFactor);
+    if (needTiledLayer != m_usingTiledBacking)
+        swapFromOrToTiledLayer(needTiledLayer);
+
     // Need to handle Preserves3DChanged first, because it affects which layers subsequent properties are applied to
     if (m_uncommittedChanges & (Preserves3DChanged | ReplicatedLayerChanged))
         updateStructuralLayer();
@@ -1133,7 +1137,7 @@
         updateGeometry(pageScaleFactor, positionRelativeToBase);
 
     if (m_uncommittedChanges & DrawsContentChanged)
-        updateLayerDrawsContent(pageScaleFactor);
+        updateLayerDrawsContent();
 
     if (m_uncommittedChanges & NameChanged)
         updateLayerNames();
@@ -1297,10 +1301,6 @@
     FloatSize pixelAlignmentOffset;
     computePixelAlignment(pageScaleFactor, positionRelativeToBase, scaledPosition, scaledSize, scaledAnchorPoint, pixelAlignmentOffset);
 
-    bool needTiledLayer = requiresTiledLayer(pageScaleFactor);
-    if (needTiledLayer != m_usingTiledBacking)
-        swapFromOrToTiledLayer(needTiledLayer);
-
     FloatSize usedSize = m_usingTiledBacking ? constrainedSize() : scaledSize;
     FloatRect adjustedBounds(m_boundsOrigin - pixelAlignmentOffset, usedSize);
 
@@ -1567,12 +1567,8 @@
     return NoStructuralLayer;
 }
 
-void GraphicsLayerCA::updateLayerDrawsContent(float pageScaleFactor)
+void GraphicsLayerCA::updateLayerDrawsContent()
 {
-    bool needTiledLayer = requiresTiledLayer(pageScaleFactor);
-    if (needTiledLayer != m_usingTiledBacking)
-        swapFromOrToTiledLayer(needTiledLayer);
-
     if (m_drawsContent)
         m_layer->setNeedsDisplay();
     else {
@@ -2567,10 +2563,6 @@
 
 void GraphicsLayerCA::updateContentsScale(float pageScaleFactor)
 {
-    bool needTiledLayer = requiresTiledLayer(pageScaleFactor);
-    if (needTiledLayer != m_usingTiledBacking)
-        swapFromOrToTiledLayer(needTiledLayer);
-
     float contentsScale = clampedContentsScaleForScale(pageScaleFactor * deviceScaleFactor());
     
     m_layer->setContentsScale(contentsScale);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (147681 => 147682)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2013-04-04 23:56:13 UTC (rev 147681)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2013-04-04 23:57:33 UTC (rev 147682)
@@ -329,7 +329,7 @@
     void updateContentsOpaque();
     void updateBackfaceVisibility();
     void updateStructuralLayer();
-    void updateLayerDrawsContent(float pixelAlignmentScale);
+    void updateLayerDrawsContent();
     void updateBackgroundColor();
 
     void updateContentsImage();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to