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

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

Issue 2725943003: Respect constrained height on nested multicol containers. (Closed)
Patch Set: Created 3 years, 10 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/Source/core/layout/LayoutMultiColumnSet.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/LayoutMultiColumnSet.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
index 1539e3fb17c15115155bea3bd9635d8078785f4f..8cfe38d6d8800e6bba06d823eea2aae82ca76975 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -240,15 +240,46 @@ LayoutMultiColumnSet* LayoutMultiColumnSet::previousSiblingMultiColumnSet()
return nullptr;
}
-bool LayoutMultiColumnSet::hasFragmentainerGroupForColumnAt(
+bool LayoutMultiColumnSet::needsNewFragmentainerGroupAt(
LayoutUnit offsetInFlowThread,
PageBoundaryRule pageBoundaryRule) const {
+ // First the cheap check: Perhaps the last fragmentainer group has sufficient
+ // capacity?
const MultiColumnFragmentainerGroup& lastRow = lastFragmentainerGroup();
LayoutUnit maxLogicalBottomInFlowThread =
lastRow.logicalTopInFlowThread() + fragmentainerGroupCapacity(lastRow);
- if (pageBoundaryRule == AssociateWithFormerPage)
- return offsetInFlowThread <= maxLogicalBottomInFlowThread;
- return offsetInFlowThread < maxLogicalBottomInFlowThread;
+ if (pageBoundaryRule == AssociateWithFormerPage) {
+ if (offsetInFlowThread <= maxLogicalBottomInFlowThread)
+ return false;
+ } else if (offsetInFlowThread < maxLogicalBottomInFlowThread) {
+ return false;
+ }
+
+ // So, there's not enough room in the last fragmentainer group. However,
+ // there can only ever be one fragmentainer group per column set if we're not
+ // nested inside another fragmentation context. We'll just create overflowing
+ // columns if the fragmentainer group cannot hold all the content.
+ if (!multiColumnFlowThread()->enclosingFragmentationContext())
+ return false;
+
+ // We're in a nested fragmentation context, and the last fragmentainer group
+ // cannot hold content at the specified offset without overflowing. This
+ // usually warrants a new fragmentainer group; however, this will not be the
+ // case if we have already allocated all available block space in this
+ // multicol container. When setting up a new fragmentainer group, we always
+ // constrain against the remaining portion of any specified
+ // height/max-height. This means that we shouldn't allow creation of
+ // fragmentainer groups below the bottom of the multicol container, or we'd
+ // end up with zero-height fragmentainer groups (or actually 1px; see
+ // heightAdjustedForRowOffset() in MultiColumnFragmentainerGroup, which
+ // guards against zero-height groups), i.e. potentially a lot of pretty
+ // useless fragmentainer groups, and possibly broken layout too. Instead,
+ // we'll just allow additional (overflowing) columns to be created in the
+ // last fragmentainer group, similar to what we do when we're not nested.
+ LayoutUnit logicalBottom = lastRow.logicalTop() + lastRow.logicalHeight();
+ LayoutUnit spaceUsed = logicalBottom + logicalTopFromMulticolContentEdge();
+ LayoutUnit maxColumnHeight = multiColumnFlowThread()->maxColumnLogicalHeight();
+ return maxColumnHeight - spaceUsed > LayoutUnit();
}
MultiColumnFragmentainerGroup&
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698