Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2471623003: Complete layout even if a block needs relayout due to widows or column balancing. (Closed)
Patch Set: Getting the flowthread once makes the code slighty prettier. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index cb24181eb5e898624e4af9336fe065fd549b2118..7e6fdb4f294712cb5e131e1a462442d7a1dc7fd6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -403,9 +403,21 @@ void LayoutBlockFlow::layoutBlock(bool relayoutChildren) {
// Multiple passes might be required for column based layout.
// The number of passes could be as high as the number of columns.
- bool done = false;
- while (!done)
- done = layoutBlockFlow(relayoutChildren, layoutScope);
+ LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread();
+ do {
+ layoutBlockFlow(relayoutChildren, layoutScope);
+
+ if (flowThread && flowThread->columnHeightsChanged()) {
+ setChildNeedsLayout(MarkOnlyThis);
+ continue;
+ }
+
+ if (shouldBreakAtLineToAvoidWidow()) {
+ setEverHadLayout();
+ continue;
+ }
+ break;
+ } while (true);
updateLayerTransformAfterLayout();
@@ -462,7 +474,7 @@ void LayoutBlockFlow::resetLayout() {
}
DISABLE_CFI_PERF
-inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren,
+inline void LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren,
SubtreeLayoutScope& layoutScope) {
LayoutUnit oldLeft = logicalLeft();
bool logicalWidthChanged = updateLogicalWidthAndColumnWidth();
@@ -503,7 +515,8 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren,
// potential infinite loop, run layout again with auto scrollbars frozen in
// their current state.
PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbars;
- return layoutBlockFlow(relayoutChildren, layoutScope);
+ layoutBlockFlow(relayoutChildren, layoutScope);
szager1 2016/12/01 17:43:24 Please add: DCHECK(preferredLogicalWidthsWereDirt
mstensho (USE GERRIT) 2016/12/01 18:11:47 We can be pretty sure that !preferredLogicalWidths
mstensho (USE GERRIT) 2016/12/01 19:15:34 Hmm... scrollbars/overflow-auto-infinite-loop.html
szager1 2016/12/01 20:30:12 There's a reason why I added preferredLogicalWidth
mstensho (USE GERRIT) 2016/12/01 20:36:10 But we only get here if preferredLogicalWidthsBeca
+ return;
}
// Expand our intrinsic height to encompass floats.
@@ -511,18 +524,6 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren,
createsNewFormattingContext())
setLogicalHeight(lowestFloatLogicalBottom() + afterEdge);
- if (LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread()) {
- if (flowThread->columnHeightsChanged()) {
- setChildNeedsLayout(MarkOnlyThis);
- return false;
- }
- }
-
- if (shouldBreakAtLineToAvoidWidow()) {
- setEverHadLayout();
- return false;
- }
-
// Remember the automatic logical height we got from laying out the children.
LayoutUnit unconstrainedHeight = logicalHeight();
LayoutUnit unconstrainedClientAfterEdge = clientLogicalBottom();
@@ -546,7 +547,6 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren,
computeOverflow(unconstrainedClientAfterEdge);
m_descendantsWithFloatsMarkedForLayout = false;
- return true;
}
void LayoutBlockFlow::addOverhangingFloatsFromChildren(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698