Title: [259455] trunk
Revision
259455
Author
[email protected]
Date
2020-04-03 06:56:32 -0700 (Fri, 03 Apr 2020)

Log Message

[MultiColumn] Infinite loop in RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight
https://bugs.webkit.org/show_bug.cgi?id=209948
<rdar://problem/59331899>

Reviewed by Antti Koivisto.

Source/WebCore:

pushToNextPageWithMinimumLogicalHeight is supposed to find the next page/column with enough space for the content.
However we keep finding the same column because it is not balanced properly yet (while in layout, they have the initial height of LayoutUnit::max).

Test: fast/multicol/infinite-loop-with-unbalanced-column.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight const):

LayoutTests:

* fast/multicol/infinite-loop-with-unbalanced-column-expected.txt: Added.
* fast/multicol/infinite-loop-with-unbalanced-column.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259454 => 259455)


--- trunk/LayoutTests/ChangeLog	2020-04-03 12:09:12 UTC (rev 259454)
+++ trunk/LayoutTests/ChangeLog	2020-04-03 13:56:32 UTC (rev 259455)
@@ -1,3 +1,14 @@
+2020-04-03  Zalan Bujtas  <[email protected]>
+
+        [MultiColumn] Infinite loop in RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=209948
+        <rdar://problem/59331899>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/multicol/infinite-loop-with-unbalanced-column-expected.txt: Added.
+        * fast/multicol/infinite-loop-with-unbalanced-column.html: Added.
+
 2020-04-03  youenn fablet  <[email protected]>
 
         Add initial support for WebRTC HEVC

Added: trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column-expected.txt (0 => 259455)


--- trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column-expected.txt	2020-04-03 13:56:32 UTC (rev 259455)
@@ -0,0 +1,4 @@
+PASS if the test finishes.
+
+
+

Added: trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column.html (0 => 259455)


--- trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/infinite-loop-with-unbalanced-column.html	2020-04-03 13:56:32 UTC (rev 259455)
@@ -0,0 +1,15 @@
+<style>
+.verticalContainer { 
+  writing-mode: vertical-rl;
+  column-count: 2;
+}
+.spanner {
+  column-span: all;
+}
+</style>
+PASS if the test finishes.
+<sup><h1><div class=verticalContainer><meter></meter><div dir='RTL' class=spanner></div></div></h1></sup>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (259454 => 259455)


--- trunk/Source/WebCore/ChangeLog	2020-04-03 12:09:12 UTC (rev 259454)
+++ trunk/Source/WebCore/ChangeLog	2020-04-03 13:56:32 UTC (rev 259455)
@@ -1,3 +1,19 @@
+2020-04-03  Zalan Bujtas  <[email protected]>
+
+        [MultiColumn] Infinite loop in RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=209948
+        <rdar://problem/59331899>
+
+        Reviewed by Antti Koivisto.
+
+        pushToNextPageWithMinimumLogicalHeight is supposed to find the next page/column with enough space for the content.
+        However we keep finding the same column because it is not balanced properly yet (while in layout, they have the initial height of LayoutUnit::max).    
+
+        Test: fast/multicol/infinite-loop-with-unbalanced-column.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight const):
+
 2020-04-03  youenn fablet  <[email protected]>
 
         Add initial support for WebRTC HEVC

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (259454 => 259455)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-04-03 12:09:12 UTC (rev 259454)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-04-03 13:56:32 UTC (rev 259455)
@@ -1939,12 +1939,22 @@
 bool RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUnit logicalOffset, LayoutUnit minimumLogicalHeight) const
 {
     bool checkFragment = false;
-    for (LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset + adjustment); pageLogicalHeight;
-        pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset + adjustment)) {
+    auto* fragmentedFlow = enclosingFragmentedFlow();
+    RenderFragmentContainer* currentFragmentContainer = nullptr;
+    for (auto pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset + adjustment); pageLogicalHeight; pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset + adjustment)) {
         if (minimumLogicalHeight <= pageLogicalHeight)
             return true;
-        if (!hasNextPage(logicalOffset + adjustment))
+        auto adjustedOffset = logicalOffset + adjustment;
+        if (!hasNextPage(adjustedOffset))
             return false;
+        if (fragmentedFlow) {
+            // While in layout and the columnsets are not balanced yet, we keep finding the same (infinite tall) column over and over again.
+            auto* nextFragmentContainer = fragmentedFlow->fragmentAtBlockOffset(this, adjustedOffset, true);
+            ASSERT(nextFragmentContainer);
+            if (nextFragmentContainer == currentFragmentContainer)
+                return false;
+            currentFragmentContainer = nextFragmentContainer;
+        }
         adjustment += pageLogicalHeight;
         checkFragment = true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to