Title: [200492] trunk
Revision
200492
Author
[email protected]
Date
2016-05-05 16:25:39 -0700 (Thu, 05 May 2016)

Log Message

Stop traversing at the container block when computing RTL inline static distance.
https://bugs.webkit.org/show_bug.cgi?id=157349
<rdar://problem/25994087>

Reviewed by David Hyatt.

When computing the inline static distance for a child renderer, we start at its enclosing box
and traverse up all the way to the container block.
However when the enclosing box is the ancestor of the container block, we
should just bail out right away since there's no container to use to adjust the position.

Source/WebCore:

Test: fast/multicol/positioned-rtl-column-crash.html

* rendering/RenderBox.cpp:
(WebCore::computeInlineStaticDistance):

LayoutTests:

* fast/multicol/positioned-rtl-column-crash-expected.txt: Added.
* fast/multicol/positioned-rtl-column-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200491 => 200492)


--- trunk/LayoutTests/ChangeLog	2016-05-05 23:22:47 UTC (rev 200491)
+++ trunk/LayoutTests/ChangeLog	2016-05-05 23:25:39 UTC (rev 200492)
@@ -1,3 +1,19 @@
+2016-05-05  Zalan Bujtas  <[email protected]>
+
+        Stop traversing at the container block when computing RTL inline static distance.
+        https://bugs.webkit.org/show_bug.cgi?id=157349
+        <rdar://problem/25994087>
+
+        Reviewed by David Hyatt.
+
+        When computing the inline static distance for a child renderer, we start at its enclosing box
+        and traverse up all the way to the container block.
+        However when the enclosing box is the ancestor of the container block, we
+        should just bail out right away since there's no container to use to adjust the position.
+
+        * fast/multicol/positioned-rtl-column-crash-expected.txt: Added.
+        * fast/multicol/positioned-rtl-column-crash.html: Added.
+
 2016-05-05  Ryan Haddad  <[email protected]>
 
         Unskip 9 compositing tests on ios-simulator, mark 2 as failures on ios-simulator-wk1

Added: trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash-expected.txt (0 => 200492)


--- trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash-expected.txt	2016-05-05 23:25:39 UTC (rev 200492)
@@ -0,0 +1 @@
+PASS if no crash or ASSERT.

Added: trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash.html (0 => 200492)


--- trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/positioned-rtl-column-crash.html	2016-05-05 23:25:39 UTC (rev 200492)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that multi-column positioned RTL content works.</title>
+<style>
+div { 
+    -webkit-column-count: 2; 
+}
+.outer { 
+    position: relative;  
+    direction: rtl; 
+}
+.inner { 
+    position: absolute; 
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<div><span class=outer><span class=inner></span></span></div>
+PASS if no crash or ASSERT.
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (200491 => 200492)


--- trunk/Source/WebCore/ChangeLog	2016-05-05 23:22:47 UTC (rev 200491)
+++ trunk/Source/WebCore/ChangeLog	2016-05-05 23:25:39 UTC (rev 200492)
@@ -1,3 +1,21 @@
+2016-05-05  Zalan Bujtas  <[email protected]>
+
+        Stop traversing at the container block when computing RTL inline static distance.
+        https://bugs.webkit.org/show_bug.cgi?id=157349
+        <rdar://problem/25994087>
+
+        Reviewed by David Hyatt.
+
+        When computing the inline static distance for a child renderer, we start at its enclosing box
+        and traverse up all the way to the container block.
+        However when the enclosing box is the ancestor of the container block, we
+        should just bail out right away since there's no container to use to adjust the position.
+
+        Test: fast/multicol/positioned-rtl-column-crash.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::computeInlineStaticDistance):
+
 2016-05-05  Ada Chan  <[email protected]>
 
         Add WebKitAdditions extension points in media controls related code in RenderThemeMac

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (200491 => 200492)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2016-05-05 23:22:47 UTC (rev 200491)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2016-05-05 23:25:39 UTC (rev 200492)
@@ -3383,29 +3383,34 @@
         }
         logicalLeft.setValue(Fixed, staticPosition);
     } else {
-        const RenderBox& enclosingBox = child->parent()->enclosingBox();
         LayoutUnit staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock.borderLogicalLeft();
+        auto& enclosingBox = child->parent()->enclosingBox();
+        if (&enclosingBox != &containerBlock && containerBlock.isDescendantOf(&enclosingBox)) {
+            logicalRight.setValue(Fixed, staticPosition);
+            return;
+        }
+
+        staticPosition -= enclosingBox.logicalWidth();
         for (const RenderElement* current = &enclosingBox; current; current = current->container()) {
-            if (is<RenderBox>(*current)) {
-                if (current != &containerBlock) {
-                    const auto& renderBox = downcast<RenderBox>(*current);
-                    staticPosition -= renderBox.logicalLeft();
-                    if (renderBox.isInFlowPositioned())
-                        staticPosition -= renderBox.isHorizontalWritingMode() ? renderBox.offsetForInFlowPosition().width() : renderBox.offsetForInFlowPosition().height();
+            if (!is<RenderBox>(*current))
+                continue;
+
+            if (current != &containerBlock) {
+                auto& renderBox = downcast<RenderBox>(*current);
+                staticPosition -= renderBox.logicalLeft();
+                if (renderBox.isInFlowPositioned())
+                    staticPosition -= renderBox.isHorizontalWritingMode() ? renderBox.offsetForInFlowPosition().width() : renderBox.offsetForInFlowPosition().height();
+            }
+            if (region && is<RenderBlock>(*current)) {
+                auto& currentBlock = downcast<RenderBlock>(*current);
+                region = currentBlock.clampToStartAndEndRegions(region);
+                RenderBoxRegionInfo* boxInfo = currentBlock.renderBoxRegionInfo(region);
+                if (boxInfo) {
+                    if (current != &containerBlock)
+                        staticPosition -= currentBlock.logicalWidth() - (boxInfo->logicalLeft() + boxInfo->logicalWidth());
+                    if (current == &enclosingBox)
+                        staticPosition += enclosingBox.logicalWidth() - boxInfo->logicalWidth();
                 }
-                if (current == &enclosingBox)
-                    staticPosition -= enclosingBox.logicalWidth();
-                if (region && is<RenderBlock>(*current)) {
-                    const RenderBlock& currentBlock = downcast<RenderBlock>(*current);
-                    region = currentBlock.clampToStartAndEndRegions(region);
-                    RenderBoxRegionInfo* boxInfo = currentBlock.renderBoxRegionInfo(region);
-                    if (boxInfo) {
-                        if (current != &containerBlock)
-                            staticPosition -= currentBlock.logicalWidth() - (boxInfo->logicalLeft() + boxInfo->logicalWidth());
-                        if (current == &enclosingBox)
-                            staticPosition += enclosingBox.logicalWidth() - boxInfo->logicalWidth();
-                    }
-                }
             }
             if (current == &containerBlock)
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to