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

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

Issue 1864493002: Adding tall content may require insertion of more than one additional column row. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/LayoutTests/fast/multicol/nested-with-tall-block-expected.html ('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/LayoutMultiColumnFlowThread.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index a8fc25a54f1b6f7bf9d2c5031510a47b930f451e..4e388740ab2233a0cdc213b5a1432c820d7fc03c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -497,12 +497,25 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit
if (!enclosingFragmentationContext)
return; // Not nested. We'll never need more rows than the one we already have then.
ASSERT(!isLayoutPagedFlowThread());
- // We have run out of columns here, so we add another row to hold more columns. When we add
- // a new row, it implicitly means that we're inserting another column in our enclosing
- // multicol container. That in turn may mean that we've run out of columns there too.
- const MultiColumnFragmentainerGroup& newRow = columnSet->appendNewFragmentainerGroup();
- if (LayoutMultiColumnFlowThread* enclosingFlowThread = enclosingFragmentationContext->associatedFlowThread())
- enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(newRow.blockOffsetInEnclosingFragmentationContext(), AssociateWithLatterPage);
+
+ // We have run out of columns here, so we need to add at least one more row to hold more
+ // columns.
+ do {
+ const MultiColumnFragmentainerGroup& newRow = columnSet->appendNewFragmentainerGroup();
+ // Zero-height rows should really not occur here, but if it does anyway, break, so that
+ // we don't get stuck in an infinite loop.
+ ASSERT(newRow.logicalHeight() > 0);
+ if (newRow.logicalHeight() <= 0)
+ break;
+ } while (!columnSet->hasFragmentainerGroupForColumnAt(offsetInFlowThread, pageBoundaryRule));
+
+ if (LayoutMultiColumnFlowThread* enclosingFlowThread = enclosingFragmentationContext->associatedFlowThread()) {
+ // When we add a new row here, it implicitly means that we're inserting another column
+ // in our enclosing multicol container. That in turn may mean that we've run out of
+ // columns there too.
+ const MultiColumnFragmentainerGroup& lastRow = columnSet->lastFragmentainerGroup();
+ enclosingFlowThread->appendNewFragmentainerGroupIfNeeded(lastRow.blockOffsetInEnclosingFragmentationContext(), AssociateWithLatterPage);
+ }
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/nested-with-tall-block-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698