| 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&
|
|
|