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

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

Issue 1710843003: Ability to return the height of fragmentainer groups that don't yet exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/LayoutBlockFlow.cpp ('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 14746b86ea35367464c59976618c85a7c317cd31..1850092c23cb32ce75fca07f84af23c9a2b0c7ad 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -72,6 +72,32 @@ const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV
LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInFlowThread) const
{
+ const MultiColumnFragmentainerGroup &lastRow = lastFragmentainerGroup();
+ if (!lastRow.logicalHeight()) {
+ // In the first layout pass of an auto-height multicol container, height isn't set. No need
+ // to perform the series of complicated dance steps below to figure out that we should
+ // simply return 0. Bail now.
+ ASSERT(m_fragmentainerGroups.size() == 1);
+ return LayoutUnit();
+ }
+ if (offsetInFlowThread >= lastRow.logicalTopInFlowThread() + lastRow.logicalHeight() * usedColumnCount()) {
+ // The offset is outside the bounds of the fragmentainer groups that we have established at
+ // this point. If we're nested inside another fragmentation context, we need to calculate
+ // the height on our own.
+ const LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread();
+ if (FragmentationContext* enclosingFragmentationContext = flowThread->enclosingFragmentationContext()) {
+ // We'd ideally like to translate |offsetInFlowThread| to an offset in the coordinate
+ // space of the enclosing fragmentation context here, but that's hard, since the offset
leviw_travelin_and_unemployed 2016/02/23 18:56:17 Ugh.
+ // is out of bounds. So just use the bottom we have found so far.
+ LayoutUnit enclosingContextBottom = lastRow.blockOffsetInEnclosingFragmentationContext() + lastRow.logicalHeight();
+ LayoutUnit enclosingFragmentainerHeight = enclosingFragmentationContext->fragmentainerLogicalHeightAt(enclosingContextBottom);
+ // Constrain against specified height / max-height.
+ LayoutUnit currentMulticolHeight = logicalTopFromMulticolContentEdge() + lastRow.logicalTop() + lastRow.logicalHeight();
+ LayoutUnit multicolHeightWithExtraRow = currentMulticolHeight + enclosingFragmentainerHeight;
+ multicolHeightWithExtraRow = std::min(multicolHeightWithExtraRow, flowThread->maxColumnLogicalHeight());
+ return std::max(LayoutUnit(1), multicolHeightWithExtraRow - currentMulticolHeight);
+ }
+ }
return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeight();
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698