[CSSRegions]Assert failure when layout positioned objects in regions
authormihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 13:59:48 +0000 (13:59 +0000)
committermihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 13:59:48 +0000 (13:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90792

Reviewed by Andreas Kling.

Before clamping the containing block (for an out-of-flow positioned element
inside a named flow) to the region, we have to test whether the region is not
null, which can happen when the named flow does not have attached regions.

Source/WebCore:

Tests: fast/regions/positioned-vrl-in-named-flow.html
       fast/regions/positioned-vrl-in-parent-named-flow.html
       fast/regions/positioned-with-vrl-parent-in-named-flow.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
(WebCore::RenderBox::computePositionedLogicalWidth):
(WebCore::RenderBox::computePositionedLogicalHeight):

LayoutTests:

* fast/regions/positioned-vrl-in-named-flow-expected.txt: Added.
* fast/regions/positioned-vrl-in-named-flow.html: Added.
* fast/regions/positioned-vrl-in-parent-named-flow-expected.txt: Added.
* fast/regions/positioned-vrl-in-parent-named-flow.html: Added.
* fast/regions/positioned-with-vrl-parent-in-named-flow-expected.txt: Added.
* fast/regions/positioned-with-vrl-parent-in-named-flow.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/regions/positioned-vrl-in-named-flow-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/positioned-vrl-in-named-flow.html [new file with mode: 0644]
LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow.html [new file with mode: 0644]
LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp

index 07ae10b..a6c98aa 100644 (file)
@@ -1,3 +1,21 @@
+2012-07-20  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        [CSSRegions]Assert failure when layout positioned objects in regions
+        https://bugs.webkit.org/show_bug.cgi?id=90792
+
+        Reviewed by Andreas Kling.
+
+        Before clamping the containing block (for an out-of-flow positioned element
+        inside a named flow) to the region, we have to test whether the region is not
+        null, which can happen when the named flow does not have attached regions.
+
+        * fast/regions/positioned-vrl-in-named-flow-expected.txt: Added.
+        * fast/regions/positioned-vrl-in-named-flow.html: Added.
+        * fast/regions/positioned-vrl-in-parent-named-flow-expected.txt: Added.
+        * fast/regions/positioned-vrl-in-parent-named-flow.html: Added.
+        * fast/regions/positioned-with-vrl-parent-in-named-flow-expected.txt: Added.
+        * fast/regions/positioned-with-vrl-parent-in-named-flow.html: Added.
+
 2012-07-20  Stephen Chenney  <schenney@chromium.org>
 
         SVG Filter Effect sub-region not applied for some filters
diff --git a/LayoutTests/fast/regions/positioned-vrl-in-named-flow-expected.txt b/LayoutTests/fast/regions/positioned-vrl-in-named-flow-expected.txt
new file mode 100644 (file)
index 0000000..0c514fe
--- /dev/null
@@ -0,0 +1,7 @@
+Test for WebKit Bug 90792 Assert failure when layout positioned objects in regions.
+
+This test collects an absolutely positioned element in a flow thread without any regions attached. The positioned element has a different writing mode than its positioned parent.
+
+The test passes if it does not crash or assert.
+
+PASS
diff --git a/LayoutTests/fast/regions/positioned-vrl-in-named-flow.html b/LayoutTests/fast/regions/positioned-vrl-in-named-flow.html
new file mode 100644 (file)
index 0000000..0f86f33
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            #article { -webkit-flow-into: article; position: relative; }
+            #absoluteVertRL { -webkit-writing-mode: vertical-rl; position: absolute; }
+        </style>
+    </head>
+    <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=90792">WebKit Bug 90792</a> Assert failure when layout positioned objects in regions.</p>
+    <p>This test collects an absolutely positioned element in a flow thread without any regions attached. The positioned element has a different writing mode than its positioned parent.</p>
+    <p>The test passes if it does not crash or assert.</p>
+    <div id="article">
+        <div id="absoluteVertRL"></div>
+    </div>
+    <p>PASS</p>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText();
+    </script>
+</html>
diff --git a/LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow-expected.txt b/LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow-expected.txt
new file mode 100644 (file)
index 0000000..9bce66d
--- /dev/null
@@ -0,0 +1,7 @@
+Test for WebKit Bug 90792 Assert failure when layout positioned objects in regions.
+
+This test collects an absolutely positioned element with a writing mode different than the document writing mode into a flow thread without any regions attached.
+
+The test passes if it does not crash or assert.
+
+PASS
diff --git a/LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow.html b/LayoutTests/fast/regions/positioned-vrl-in-parent-named-flow.html
new file mode 100644 (file)
index 0000000..280b34e
--- /dev/null
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            #absoluteVertRL { -webkit-writing-mode: vertical-rl; -webkit-flow-into: article; position: absolute; }
+        </style>
+    </head>
+    <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=90792">WebKit Bug 90792</a> Assert failure when layout positioned objects in regions.</p>
+    <p>This test collects an absolutely positioned element with a writing mode different than the document writing mode into a flow thread without any regions attached.</p>
+    <p>The test passes if it does not crash or assert.</p>
+    <div id="absoluteVertRL"></div>
+    <p>PASS</p>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText();
+    </script>
+</html>
diff --git a/LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow-expected.txt b/LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow-expected.txt
new file mode 100644 (file)
index 0000000..2fba101
--- /dev/null
@@ -0,0 +1,7 @@
+Test for WebKit Bug 90792 Assert failure when layout positioned objects in regions
+
+This test collects an absolutely positioned element into a flow thread without any regions attached. The absolutely positioned element has a different writing mode than its parent but the same writing mode as the containing block.
+
+The test passes if it does not crash or assert.
+
+PASS
diff --git a/LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow.html b/LayoutTests/fast/regions/positioned-with-vrl-parent-in-named-flow.html
new file mode 100644 (file)
index 0000000..5496fc3
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            #articleVertRL { -webkit-flow-into: article; -webkit-writing-mode: vertical-rl; }
+            #absoluteHorizTB { position: absolute; -webkit-writing-mode: horizontal-tb; }
+        </style>
+    </head>
+    <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=90792">WebKit Bug 90792</a> Assert failure when layout positioned objects in regions</p>
+    <p>This test collects an absolutely positioned element into a flow thread without any regions attached. The absolutely positioned element has a different writing mode than its parent but the same writing mode as the containing block.</p>
+    <p>The test passes if it does not crash or assert.</p>
+    <div id="articleVertRL">
+        <div id="absoluteHorizTB"></div>
+    </div>
+    <p>PASS</p>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText();
+    </script>
+</html>
index ed161ce..e235266 100644 (file)
@@ -1,3 +1,23 @@
+2012-07-20  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        [CSSRegions]Assert failure when layout positioned objects in regions
+        https://bugs.webkit.org/show_bug.cgi?id=90792
+
+        Reviewed by Andreas Kling.
+
+        Before clamping the containing block (for an out-of-flow positioned element
+        inside a named flow) to the region, we have to test whether the region is not
+        null, which can happen when the named flow does not have attached regions.
+
+        Tests: fast/regions/positioned-vrl-in-named-flow.html
+               fast/regions/positioned-vrl-in-parent-named-flow.html
+               fast/regions/positioned-with-vrl-parent-in-named-flow.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
+        (WebCore::RenderBox::computePositionedLogicalWidth):
+        (WebCore::RenderBox::computePositionedLogicalHeight):
+
 2012-07-20  Stephen Chenney  <schenney@chromium.org>
 
         SVG Filter Effect sub-region not applied for some filters
index eca1e08..d2de4b8 100644 (file)
@@ -2365,8 +2365,10 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
                 if (isWritingModeRoot()) {
                     LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop();
                     RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
-                    cbRegion = cb->clampToStartAndEndRegions(cbRegion);
-                    boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
+                    if (cbRegion) {
+                        cbRegion = cb->clampToStartAndEndRegions(cbRegion);
+                        boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
+                    }
                 }
             } else if (region && enclosingRenderFlowThread()->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) {
                 RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region);
@@ -2628,11 +2630,13 @@ void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit o
         const RenderBlock* cb = toRenderBlock(containerBlock);
         LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop();
         RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
-        cbRegion = cb->clampToStartAndEndRegions(cbRegion);
-        RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
-        if (boxInfo) {
-            logicalLeftPos += boxInfo->logicalLeft();
-            setLogicalLeft(logicalLeftPos);
+        if (cbRegion) {
+            cbRegion = cb->clampToStartAndEndRegions(cbRegion);
+            RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
+            if (boxInfo) {
+                logicalLeftPos += boxInfo->logicalLeft();
+                setLogicalLeft(logicalLeftPos);
+            }
         }
     }
 }
@@ -2950,11 +2954,13 @@ void RenderBox::computePositionedLogicalHeight()
         const RenderBlock* cb = toRenderBlock(containerBlock);
         LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage() - logicalLeft();
         RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
-        cbRegion = cb->clampToStartAndEndRegions(cbRegion);
-        RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
-        if (boxInfo) {
-            logicalTopPos += boxInfo->logicalLeft();
-            setLogicalTop(logicalTopPos);
+        if (cbRegion) {
+            cbRegion = cb->clampToStartAndEndRegions(cbRegion);
+            RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion, cbPageOffset);
+            if (boxInfo) {
+                logicalTopPos += boxInfo->logicalLeft();
+                setLogicalTop(logicalTopPos);
+            }
         }
     }
 }