Title: [219190] trunk
Revision
219190
Author
za...@apple.com
Date
2017-07-05 22:49:50 -0700 (Wed, 05 Jul 2017)

Log Message

REGRESSION: Stack overflow in RenderBlockFlow::layoutBlock after increasing the font size to max in some RTL vertical books.
https://bugs.webkit.org/show_bug.cgi?id=174144
<rdar://problem/32781038>

Reviewed by Simon Fraser.

Source/WebCore:

We set the start/end margin on the ruby renderer to support overhanging content. The margins ensure that
adjacent boxes on the line are placed properly respecting the overhanging content.
The line breaking algorithm also takes this value into account as it affects the line's available width.
We need to reset this value before laying out the lines, otherwise we might end up using this value on the line twice;
first as the renderer's margins (as the result of the previous layout) and second as the renderer's overhanging value.
Since this is not strictly part of the renderer's layout context (i.e. we set them during the line layout and not at
RenderRubyRun::layout) we can't rely on the ruby's layout logic to reset them.

Test: fast/ruby/ruby-overhang-margin-crash.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutLineBoxes):

LayoutTests:

* fast/ruby/ruby-overhang-margin-crash-expected.txt: Added.
* fast/ruby/ruby-overhang-margin-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219189 => 219190)


--- trunk/LayoutTests/ChangeLog	2017-07-06 05:33:22 UTC (rev 219189)
+++ trunk/LayoutTests/ChangeLog	2017-07-06 05:49:50 UTC (rev 219190)
@@ -1,3 +1,14 @@
+2017-07-05  Zalan Bujtas  <za...@apple.com>
+
+        REGRESSION: Stack overflow in RenderBlockFlow::layoutBlock after increasing the font size to max in some RTL vertical books.
+        https://bugs.webkit.org/show_bug.cgi?id=174144
+        <rdar://problem/32781038>
+
+        Reviewed by Simon Fraser.
+
+        * fast/ruby/ruby-overhang-margin-crash-expected.txt: Added.
+        * fast/ruby/ruby-overhang-margin-crash.html: Added.
+
 2017-07-05  Jonathan Bedard  <jbed...@apple.com>
 
         Move internal iOS 11 TestExpectations to OpenSource

Added: trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash-expected.txt (0 => 219190)


--- trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash-expected.txt	2017-07-06 05:49:50 UTC (rev 219190)
@@ -0,0 +1,2 @@
+PASS if no crash.
+i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i凝ぎよう i i i i i i i

Added: trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash.html (0 => 219190)


--- trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/ruby-overhang-margin-crash.html	2017-07-06 05:49:50 UTC (rev 219190)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>This tests ruby's overhanging margin.</title>
+<style>
+.col {
+    column-count: 2;
+    widows: 2;
+    orphans: 1;
+    width: 200px;
+    font-size: 10px;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+PASS if no crash.
+<div class=col><div>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i<ruby><rb>凝</rb><rt>ぎよう</rt></ruby>
+i i i i i i i</div></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (219189 => 219190)


--- trunk/Source/WebCore/ChangeLog	2017-07-06 05:33:22 UTC (rev 219189)
+++ trunk/Source/WebCore/ChangeLog	2017-07-06 05:49:50 UTC (rev 219190)
@@ -1,3 +1,24 @@
+2017-07-05  Zalan Bujtas  <za...@apple.com>
+
+        REGRESSION: Stack overflow in RenderBlockFlow::layoutBlock after increasing the font size to max in some RTL vertical books.
+        https://bugs.webkit.org/show_bug.cgi?id=174144
+        <rdar://problem/32781038>
+
+        Reviewed by Simon Fraser.
+
+        We set the start/end margin on the ruby renderer to support overhanging content. The margins ensure that
+        adjacent boxes on the line are placed properly respecting the overhanging content.
+        The line breaking algorithm also takes this value into account as it affects the line's available width.
+        We need to reset this value before laying out the lines, otherwise we might end up using this value on the line twice;
+        first as the renderer's margins (as the result of the previous layout) and second as the renderer's overhanging value.
+        Since this is not strictly part of the renderer's layout context (i.e. we set them during the line layout and not at
+        RenderRubyRun::layout) we can't rely on the ruby's layout logic to reset them.
+
+        Test: fast/ruby/ruby-overhang-margin-crash.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::layoutLineBoxes):
+
 2017-07-05  Yusuke Suzuki  <utatane....@gmail.com>
 
         Upgrade GCC baseline

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (219189 => 219190)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2017-07-06 05:33:22 UTC (rev 219189)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2017-07-06 05:49:50 UTC (rev 219190)
@@ -1728,6 +1728,12 @@
                     layoutState.floatList().append(FloatWithRect::create(box));
                 else if (isFullLayout || box.needsLayout()) {
                     // Replaced element.
+                    if (isFullLayout && is<RenderRubyRun>(box)) {
+                        // FIXME: This resets the overhanging margins that we set during line layout (see computeInlineDirectionPositionsForSegment)
+                        // Find a more suitable place for this.
+                        setMarginStartForChild(box, 0);
+                        setMarginEndForChild(box, 0);
+                    }
                     box.dirtyLineBoxes(isFullLayout);
                     if (!o.isAnonymousInlineBlock()) {
                         if (isFullLayout)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to