<rdar://problem/10098679> Assertion failure in RenderLayer::paintPaginatedChildLayer()
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 21:04:04 +0000 (21:04 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 21:04:04 +0000 (21:04 +0000)
Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/dynamic/layer-no-longer-paginated.html

FrameView::layout() calls adjustViewSize() before calling RenderLayer::updateLayerPositions().
The former may trigger painting with a layer tree that is not entirely up-to-date. Specifically,
the isPaginated() state of a layer may be incorrect, leading to the assertion in this bug. Instead
of asserting, return early and count on the upcoming updateLayerPositions() to repaint as needed.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintPaginatedChildLayer): Replaced the assertion with an early return.

LayoutTests:

* fast/dynamic/layer-no-longer-paginated-expected.txt: Added.
* fast/dynamic/layer-no-longer-paginated.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/dynamic/layer-no-longer-paginated-expected.txt [new file with mode: 0644]
LayoutTests/fast/dynamic/layer-no-longer-paginated.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index d7e2c1ac8987c2bef457747e0d9d4fc4c653d8f3..103e4e5be54a4e3e151b1a14bd50753de916f4da 100644 (file)
@@ -1,3 +1,12 @@
+2011-09-27  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10098679> Assertion failure in RenderLayer::paintPaginatedChildLayer()
+
+        Reviewed by Simon Fraser.
+
+        * fast/dynamic/layer-no-longer-paginated-expected.txt: Added.
+        * fast/dynamic/layer-no-longer-paginated.html: Added.
+
 2011-09-27  Ojan Vafai  <ojan@chromium.org>
 
         offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl writing modes
diff --git a/LayoutTests/fast/dynamic/layer-no-longer-paginated-expected.txt b/LayoutTests/fast/dynamic/layer-no-longer-paginated-expected.txt
new file mode 100644 (file)
index 0000000..4f2fa6b
--- /dev/null
@@ -0,0 +1,5 @@
+Test for <rdar://problem/10098679> Assertion failure in RenderLayer::paintPaginatedChildLayer().
+
+The test passes if it does not cause an assertion failure or a crash.
+
+
diff --git a/LayoutTests/fast/dynamic/layer-no-longer-paginated.html b/LayoutTests/fast/dynamic/layer-no-longer-paginated.html
new file mode 100644 (file)
index 0000000..e981d6a
--- /dev/null
@@ -0,0 +1,32 @@
+<body style="overflow: hidden;">
+    <p>
+        Test for <i><a href="rdar://problem/10098679">&lt;rdar://problem/10098679></a>
+        Assertion failure in <tt>RenderLayer::paintPaginatedChildLayer()</tt></i>.
+    </p>
+    <p>
+        The test passes if it does not cause an assertion failure or a crash.
+    </p>
+    <!-- specifying opacity < 1 so that the transition from having columns
+         to not having columns does not cause the layer to go away -->
+    <div id="target" style="-webkit-column-count: 2; opacity: 0.5; height: 20px;">
+        <div style="position:relative;"></div>
+    </div>
+    <div id="widener" style="height: 10px; width: 200%;"></div>
+    <script>
+        function test()
+        {
+            document.getElementById("widener").style.removeProperty("width");
+            document.getElementById("target").style.removeProperty("-webkit-column-count");
+        }
+               window.scrollBy(1, 0);
+
+        if (window.layoutTestController) {
+            layoutTestController.display();
+            layoutTestController.dumpAsText();
+            test();
+        } else
+            setTimeout(test, 500);
+
+    </script>
+</body>
index 1f110ca820a9a8a6c97fee0439e36a31e7ff33c3..a2595562d3c8011f7b10f042cdbb8f7973613674 100644 (file)
@@ -1,3 +1,19 @@
+2011-09-27  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10098679> Assertion failure in RenderLayer::paintPaginatedChildLayer()
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/dynamic/layer-no-longer-paginated.html
+
+        FrameView::layout() calls adjustViewSize() before calling RenderLayer::updateLayerPositions().
+        The former may trigger painting with a layer tree that is not entirely up-to-date. Specifically,
+        the isPaginated() state of a layer may be incorrect, leading to the assertion in this bug. Instead
+        of asserting, return early and count on the upcoming updateLayerPositions() to repaint as needed.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintPaginatedChildLayer): Replaced the assertion with an early return.
+
 2011-09-27  Ojan Vafai  <ojan@chromium.org>
 
         offsetTop/offsetLeft return the wrong values for horizontal-bt/vertical-rl writing modes
index ea7aa2495a7823eefb3151a0211d7daaeb26e677..4467d0db990c9849ebea8aca06135acbe25eee2b 100644 (file)
@@ -2859,8 +2859,12 @@ void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer*
             break;
     }
 
-    ASSERT(columnLayers.size());
-    
+    // It is possible for paintLayer() to be called after the child layer ceases to be paginated but before
+    // updateLayerPositions() is called and resets the isPaginated() flag, see <rdar://problem/10098679>.
+    // If this is the case, just bail out, since the upcoming call to updateLayerPositions() will repaint the layer.
+    if (!columnLayers.size())
+        return;
+
     paintChildLayerIntoColumns(childLayer, rootLayer, context, paintDirtyRect, paintBehavior, paintingRoot, overlapTestRequests, paintFlags, columnLayers, columnLayers.size() - 1);
 }