Title: [274421] trunk
- Revision
- 274421
- Author
- [email protected]
- Date
- 2021-03-15 08:20:36 -0700 (Mon, 15 Mar 2021)
Log Message
Fit-border-to-line may change the layout constraints between 2 paginated line layouts
https://bugs.webkit.org/show_bug.cgi?id=223169
<rdar://73147358>
Reviewed by Antti Koivisto.
Source/WebCore:
In paginated context, we keep triggering layout until all the widows/orphans are cleared.
This happens within the same layout frame (in practice this is a recursive call in
RenderBlockFlow::layoutBlock -see relayoutToAvoidWidows).
The constraints for these subsequent/recursive layouts should stay the same in order
to be able to clear any potential widows/orphans
(e.g first layout produces 5 lines but we can only have 3 on this page due to the widow/orphan values.
Now the subsequent/recursive layout is going to break the content at the 3rd line,
but if the constraints change in between and this layout only produces 2 lines, we'll keep trying
until we manage to produce at least 3 lines. Fit-border-to-line implemented in such an intrusive way that
it overrides previously computed logical width (mutates the constraint) -see RenderBlockFlow::fitBorderToLinesIfNeeded)
This patch ensures that we bail out of the recursive re-layout if we fail to produce the same set of lines.
Test: fast/multicol/widow-relayout-with-border-fit.html
* rendering/ComplexLineLayout.cpp:
(WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):
LayoutTests:
* fast/multicol/widow-relayout-with-border-fit-expected.txt: Added.
* fast/multicol/widow-relayout-with-border-fit.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (274420 => 274421)
--- trunk/LayoutTests/ChangeLog 2021-03-15 13:36:50 UTC (rev 274420)
+++ trunk/LayoutTests/ChangeLog 2021-03-15 15:20:36 UTC (rev 274421)
@@ -1,3 +1,14 @@
+2021-03-15 Zalan Bujtas <[email protected]>
+
+ Fit-border-to-line may change the layout constraints between 2 paginated line layouts
+ https://bugs.webkit.org/show_bug.cgi?id=223169
+ <rdar://73147358>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/multicol/widow-relayout-with-border-fit-expected.txt: Added.
+ * fast/multicol/widow-relayout-with-border-fit.html: Added.
+
2021-03-15 Wenson Hsieh <[email protected]>
[macOS] Selecting text via mouse drag in image documents shouldn't trigger click events
Modified: trunk/LayoutTests/TestExpectations (274420 => 274421)
--- trunk/LayoutTests/TestExpectations 2021-03-15 13:36:50 UTC (rev 274420)
+++ trunk/LayoutTests/TestExpectations 2021-03-15 15:20:36 UTC (rev 274421)
@@ -4818,3 +4818,5 @@
imported/w3c/web-platform-tests/css/css-counter-styles/upper-roman/css3-counter-styles-023.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-counter-styles/upper-roman/css3-counter-styles-024.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-counter-styles/upper-roman/css3-counter-styles-024a.html [ ImageOnlyFailure ]
+
+webkit.org/b/223170 [ Debug ] fast/multicol/widow-relayout-with-border-fit.html [ Skip ]
Added: trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit-expected.txt (0 => 274421)
--- trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit-expected.txt 2021-03-15 15:20:36 UTC (rev 274421)
@@ -0,0 +1 @@
+
Added: trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit.html (0 => 274421)
--- trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/widow-relayout-with-border-fit.html 2021-03-15 15:20:36 UTC (rev 274421)
@@ -0,0 +1,20 @@
+<style>
+ * {
+ -webkit-border-fit: lines;
+ -webkit-column-axis: vertical;
+ columns: 1px 5;
+ float: left;
+ height: 0;
+ max-block-size: 100px;
+ min-height: -webkit-fill-available;
+ shape-outside: ellipse(50% 25% at 50% 25%);
+ widows: 100;
+ }
+ *::after {
+ content: 'PASSi fnoc rasho rasse rt';
+ }
+</style>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (274420 => 274421)
--- trunk/Source/WebCore/ChangeLog 2021-03-15 13:36:50 UTC (rev 274420)
+++ trunk/Source/WebCore/ChangeLog 2021-03-15 15:20:36 UTC (rev 274421)
@@ -1,3 +1,29 @@
+2021-03-15 Zalan Bujtas <[email protected]>
+
+ Fit-border-to-line may change the layout constraints between 2 paginated line layouts
+ https://bugs.webkit.org/show_bug.cgi?id=223169
+ <rdar://73147358>
+
+ Reviewed by Antti Koivisto.
+
+ In paginated context, we keep triggering layout until all the widows/orphans are cleared.
+ This happens within the same layout frame (in practice this is a recursive call in
+ RenderBlockFlow::layoutBlock -see relayoutToAvoidWidows).
+ The constraints for these subsequent/recursive layouts should stay the same in order
+ to be able to clear any potential widows/orphans
+ (e.g first layout produces 5 lines but we can only have 3 on this page due to the widow/orphan values.
+ Now the subsequent/recursive layout is going to break the content at the 3rd line,
+ but if the constraints change in between and this layout only produces 2 lines, we'll keep trying
+ until we manage to produce at least 3 lines. Fit-border-to-line implemented in such an intrusive way that
+ it overrides previously computed logical width (mutates the constraint) -see RenderBlockFlow::fitBorderToLinesIfNeeded)
+
+ This patch ensures that we bail out of the recursive re-layout if we fail to produce the same set of lines.
+
+ Test: fast/multicol/widow-relayout-with-border-fit.html
+
+ * rendering/ComplexLineLayout.cpp:
+ (WebCore::ComplexLineLayout::layoutRunsAndFloatsInRange):
+
2021-03-15 Wenson Hsieh <[email protected]>
[macOS] Selecting text via mouse drag in image documents shouldn't trigger click events
Modified: trunk/Source/WebCore/rendering/ComplexLineLayout.cpp (274420 => 274421)
--- trunk/Source/WebCore/rendering/ComplexLineLayout.cpp 2021-03-15 13:36:50 UTC (rev 274420)
+++ trunk/Source/WebCore/rendering/ComplexLineLayout.cpp 2021-03-15 15:20:36 UTC (rev 274421)
@@ -1552,8 +1552,17 @@
}
// If there were no breaks in the block, we didn't create any widows.
- if (!lineBox || !lineBox->isFirstAfterPageBreak() || lineBox == firstLineInBlock)
+ if (!lineBox || !lineBox->isFirstAfterPageBreak() || lineBox == firstLineInBlock) {
+ if (m_flow.shouldBreakAtLineToAvoidWidow()) {
+ // This is the case when the previous line layout marks a line to break at to avoid widows
+ // but the current layout does not produce that line. It happens when layout constraints unexpectedly
+ // change in between layouts (note that these paginated line layouts run within the same layout frame
+ // as opposed to two subsequent full layouts).
+ ASSERT_NOT_REACHED();
+ m_flow.clearShouldBreakAtLineToAvoidWidow();
+ }
return;
+ }
if (numLinesHanging < style().widows()) {
// We have detected a widow. Now we need to work out how many
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes