Assertion ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRec...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2012 22:26:55 +0000 (22:26 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2012 22:26:55 +0000 (22:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90919

Reviewed by Antti Koivisto.

Source/WebCore:

r121124 added a fast path for geometry mapping that goes via layers
when possible. However, this broke paginated pages, which put
the root (RenderView) layer into column mode, because it failed
to check for columns on the ancestor layer.

Rather than make a risky change to convertToLayerCoords(), add a local
function canMapViaLayer(), which is like RenderLayer::canUseConvertToLayerCoords(),
but doesn't check for compositing (compositing itself is not a reason
to avoid convertToLayerCoords). Call canMapViaLayer() with the ancestorLayer
to check whether the ancestor has columns, which fixes the bug.

Test: compositing/columns/geometry-map-paginated-assert.html

* rendering/RenderGeometryMap.cpp:
(WebCore::canMapViaLayer):
(WebCore::RenderGeometryMap::pushMappingsToAncestor):

LayoutTests:

Test with a composited element in a document which is put into paginated mode.

* compositing/columns/geometry-map-paginated-assert-expected.txt: Added.
* compositing/columns/geometry-map-paginated-assert.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/columns/geometry-map-paginated-assert-expected.txt [new file with mode: 0644]
LayoutTests/compositing/columns/geometry-map-paginated-assert.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGeometryMap.cpp

index a27a41f..06679a9 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-10  Simon Fraser  <simon.fraser@apple.com>
+
+        Assertion ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) when compositing in paginated mode
+        https://bugs.webkit.org/show_bug.cgi?id=90919
+
+        Reviewed by Antti Koivisto.
+
+        Test with a composited element in a document which is put into paginated mode.
+
+        * compositing/columns/geometry-map-paginated-assert-expected.txt: Added.
+        * compositing/columns/geometry-map-paginated-assert.html: Added.
+
 2012-07-11  Ojan Vafai  <ojan@chromium.org>
 
         Simplify css3/flexbox/repaint-rtl-column.html
diff --git a/LayoutTests/compositing/columns/geometry-map-paginated-assert-expected.txt b/LayoutTests/compositing/columns/geometry-map-paginated-assert-expected.txt
new file mode 100644 (file)
index 0000000..13e675f
--- /dev/null
@@ -0,0 +1,3 @@
+This test should not assert.
+
+
diff --git a/LayoutTests/compositing/columns/geometry-map-paginated-assert.html b/LayoutTests/compositing/columns/geometry-map-paginated-assert.html
new file mode 100644 (file)
index 0000000..30ac50c
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<head>
+    <script>
+        if (window.testRunner)
+          testRunner.dumpAsText();
+
+        if (window.internals)
+            internals.setPagination(document, "LeftToRightPaginated", 0);
+    </script>
+    <style>
+    .spacer {
+      height: 350px;
+      width: 100%;
+      margin: 10px;
+      background-color: silver;
+    }
+    
+    .box {
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: blue;
+    }
+    .composited {
+      -webkit-transform: translateZ(0);
+    }
+    </style>
+</head>
+<body>
+
+  <p>This test should not assert.</p>
+  <div class="spacer"></div>
+  <div class="spacer"></div>
+  <div class="composited box"></div>
+
+
+</body>
+</html>
index 9872157..3ecedd0 100644 (file)
@@ -1,3 +1,27 @@
+2012-07-10  Simon Fraser  <simon.fraser@apple.com>
+
+        Assertion ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) when compositing in paginated mode
+        https://bugs.webkit.org/show_bug.cgi?id=90919
+
+        Reviewed by Antti Koivisto.
+
+        r121124 added a fast path for geometry mapping that goes via layers
+        when possible. However, this broke paginated pages, which put
+        the root (RenderView) layer into column mode, because it failed
+        to check for columns on the ancestor layer.
+        
+        Rather than make a risky change to convertToLayerCoords(), add a local
+        function canMapViaLayer(), which is like RenderLayer::canUseConvertToLayerCoords(),
+        but doesn't check for compositing (compositing itself is not a reason
+        to avoid convertToLayerCoords). Call canMapViaLayer() with the ancestorLayer
+        to check whether the ancestor has columns, which fixes the bug.
+
+        Test: compositing/columns/geometry-map-paginated-assert.html
+
+        * rendering/RenderGeometryMap.cpp:
+        (WebCore::canMapViaLayer):
+        (WebCore::RenderGeometryMap::pushMappingsToAncestor):
+
 2012-07-11  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Rename layerRect to contentRect for rects that live in content space
index e6993db..8c6fa0b 100644 (file)
@@ -138,14 +138,31 @@ void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con
     } while (renderer && renderer != ancestorRenderer);
 }
 
+static bool canMapViaLayer(const RenderLayer* layer)
+{
+    RenderStyle* style = layer->renderer()->style();
+    if (style->position() == FixedPosition || style->isFlippedBlocksWritingMode())
+        return false;
+    
+    if (layer->renderer()->hasColumns() || layer->renderer()->hasTransform())
+        return false;
+
+#if ENABLE(SVG)
+    if (layer->renderer()->isSVGRoot())
+        return false;
+#endif
+
+    return true;
+}
+
 void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const RenderLayer* ancestorLayer)
 {
     const RenderObject* renderer = layer->renderer();
 
     // The simple case can be handled fast in the layer tree.
-    bool canConvertInLayerTree = ancestorLayer && renderer->style()->position() != FixedPosition && !renderer->style()->isFlippedBlocksWritingMode();
+    bool canConvertInLayerTree = ancestorLayer ? canMapViaLayer(ancestorLayer) : false;
     for (const RenderLayer* current = layer; current != ancestorLayer && canConvertInLayerTree; current = current->parent())
-        canConvertInLayerTree = current->canUseConvertToLayerCoords();
+        canConvertInLayerTree = canMapViaLayer(current);
 
     if (canConvertInLayerTree) {
         TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size());