Title: [205434] releases/WebKitGTK/webkit-2.12
Revision
205434
Author
[email protected]
Date
2016-09-05 01:55:23 -0700 (Mon, 05 Sep 2016)

Log Message

Merge r204980 - Infinite recursion crash in WebCore::RenderBlockFlow::layoutBlock
https://bugs.webkit.org/show_bug.cgi?id=139474
<rdar://problem/27705190>

Reviewed by David Hyatt.

Source/WebCore:

We should just give up trying to avoid widow when the page is too small to break line.

Test: fast/multicol/assert-on-small-page-height-with-widow.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::clearShouldBreakAtLineToAvoidWidowIfNeeded):
(WebCore::RenderBlockFlow::adjustLinePositionForPagination):
* rendering/RenderBlockFlow.h:

LayoutTests:

* fast/multicol/assert-on-small-page-height-with-widow-expected.txt: Added.
* fast/multicol/assert-on-small-page-height-with-widow.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (205433 => 205434)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-09-05 08:49:07 UTC (rev 205433)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-09-05 08:55:23 UTC (rev 205434)
@@ -1,3 +1,14 @@
+2016-08-25  Zalan Bujtas  <[email protected]>
+
+        Infinite recursion crash in WebCore::RenderBlockFlow::layoutBlock
+        https://bugs.webkit.org/show_bug.cgi?id=139474
+        <rdar://problem/27705190>
+
+        Reviewed by David Hyatt.
+
+        * fast/multicol/assert-on-small-page-height-with-widow-expected.txt: Added.
+        * fast/multicol/assert-on-small-page-height-with-widow.html: Added.
+
 2016-05-03  Chris Dumez  <[email protected]>
 
         Unreviewed, drop outdated layout test after r200375.

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow-expected.txt (0 => 205434)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow-expected.txt	2016-09-05 08:55:23 UTC (rev 205434)
@@ -0,0 +1,3 @@
+PASS if no assert in debug.
+
+

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow.html (0 => 205434)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/multicol/assert-on-small-page-height-with-widow.html	2016-09-05 08:55:23 UTC (rev 205434)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that.</title>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+html {
+    -webkit-column-count: 3;
+}
+
+body {
+    max-height: 0px;
+    -webkit-column-count: 3;
+    widows: 2;   
+}
+span {
+    margin-right: -1px;
+}
+</style>
+</head>
+<body>
+PASS if no assert in debug.<input><br><br>
+<span></span>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (205433 => 205434)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-09-05 08:49:07 UTC (rev 205433)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-09-05 08:55:23 UTC (rev 205434)
@@ -1,3 +1,20 @@
+2016-08-25  Zalan Bujtas  <[email protected]>
+
+        Infinite recursion crash in WebCore::RenderBlockFlow::layoutBlock
+        https://bugs.webkit.org/show_bug.cgi?id=139474
+        <rdar://problem/27705190>
+
+        Reviewed by David Hyatt.
+
+        We should just give up trying to avoid widow when the page is too small to break line.
+
+        Test: fast/multicol/assert-on-small-page-height-with-widow.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::clearShouldBreakAtLineToAvoidWidowIfNeeded):
+        (WebCore::RenderBlockFlow::adjustLinePositionForPagination):
+        * rendering/RenderBlockFlow.h:
+
 2016-05-03  Pranjal Jumde  <[email protected]>
 
         WorkerGlobalScope's self, location and navigator attributes should not be replaceable

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlockFlow.cpp (205433 => 205434)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlockFlow.cpp	2016-09-05 08:49:07 UTC (rev 205433)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlockFlow.cpp	2016-09-05 08:55:23 UTC (rev 205434)
@@ -1648,7 +1648,15 @@
 
     return false;
 }
-    
+
+static void clearShouldBreakAtLineToAvoidWidowIfNeeded(RenderBlockFlow& blockFlow)
+{
+    if (!blockFlow.shouldBreakAtLineToAvoidWidow())
+        return;
+    blockFlow.clearShouldBreakAtLineToAvoidWidow();
+    blockFlow.setDidBreakAtLineToAvoidWidow();
+}
+
 void RenderBlockFlow::adjustLinePositionForPagination(RootInlineBox* lineBox, LayoutUnit& delta, bool& overflowsRegion, RenderFlowThread* flowThread)
 {
     // FIXME: Ignore anonymous inline blocks. Handle the delta already having been set because of
@@ -1702,8 +1710,11 @@
         logicalBottom = intMinForLayoutUnit;
         lineBox->computeReplacedAndTextLineTopAndBottom(logicalOffset, logicalBottom);
         lineHeight = logicalBottom - logicalOffset;
-        if (logicalOffset == intMaxForLayoutUnit || lineHeight > pageLogicalHeight)
-            return; // Give up. We're genuinely too big even after excluding blank space and overflow.
+        if (logicalOffset == intMaxForLayoutUnit || lineHeight > pageLogicalHeight) {
+            // Give up. We're genuinely too big even after excluding blank space and overflow.
+            clearShouldBreakAtLineToAvoidWidowIfNeeded(*this);
+            return;
+        }
         pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
     }
     
@@ -1712,10 +1723,8 @@
 
     int lineIndex = lineCount(lineBox);
     if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) {
-        if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex) {
-            clearShouldBreakAtLineToAvoidWidow();
-            setDidBreakAtLineToAvoidWidow();
-        }
+        if (lineBreakToAvoidWidow() == lineIndex)
+            clearShouldBreakAtLineToAvoidWidowIfNeeded(*this);
         // If we have a non-uniform page height, then we have to shift further possibly.
         if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to