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

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

Issue 2345583004: Add PageBoundaryRule parameter to fragmentainerGroupAtFlowThreadOffset(). (Closed)
Patch Set: Created 4 years, 3 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 ff138a75425ef30927cf662321e434e7097bdf63..ce7bfc18c1bb34d5cd26f584a344f0c1e41afef1 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -50,7 +50,7 @@ LayoutMultiColumnSet* LayoutMultiColumnSet::createAnonymous(LayoutFlowThread& fl
return layoutObject;
}
-unsigned LayoutMultiColumnSet::fragmentainerGroupIndexAtFlowThreadOffset(LayoutUnit flowThreadOffset) const
+unsigned LayoutMultiColumnSet::fragmentainerGroupIndexAtFlowThreadOffset(LayoutUnit flowThreadOffset, PageBoundaryRule rule) const
{
ASSERT(m_fragmentainerGroups.size() > 0);
if (flowThreadOffset <= 0)
@@ -58,8 +58,12 @@ unsigned LayoutMultiColumnSet::fragmentainerGroupIndexAtFlowThreadOffset(LayoutU
// TODO(mstensho): Introduce an interval tree or similar to speed up this.
for (unsigned index = 0; index < m_fragmentainerGroups.size(); index++) {
const auto& row = m_fragmentainerGroups[index];
- if (row.logicalTopInFlowThread() <= flowThreadOffset && row.logicalBottomInFlowThread() > flowThreadOffset)
+ if (rule == AssociateWithLatterPage) {
+ if (row.logicalTopInFlowThread() <= flowThreadOffset && row.logicalBottomInFlowThread() > flowThreadOffset)
+ return index;
+ } else if (row.logicalTopInFlowThread() < flowThreadOffset && row.logicalBottomInFlowThread() >= flowThreadOffset) {
return index;
+ }
}
return m_fragmentainerGroups.size() - 1;
}
@@ -104,12 +108,12 @@ LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF
return std::max(LayoutUnit(1), multicolHeightWithExtraRow - currentMulticolHeight);
}
}
- return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeight();
+ return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread, AssociateWithLatterPage).logicalHeight();
}
LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const
{
- const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread);
+ const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread, pageBoundaryRule);
LayoutUnit pageLogicalHeight = row.logicalHeight();
ASSERT(pageLogicalHeight); // It's not allowed to call this method if the height is unknown.
LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThread) + pageLogicalHeight;
@@ -291,7 +295,7 @@ bool LayoutMultiColumnSet::heightIsAuto() const
LayoutSize LayoutMultiColumnSet::flowThreadTranslationAtOffset(LayoutUnit blockOffset, PageBoundaryRule rule, CoordinateSpaceConversion mode) const
{
- return fragmentainerGroupAtFlowThreadOffset(blockOffset).flowThreadTranslationAtOffset(blockOffset, rule, mode);
+ return fragmentainerGroupAtFlowThreadOffset(blockOffset, rule).flowThreadTranslationAtOffset(blockOffset, rule, mode);
}
LayoutPoint LayoutMultiColumnSet::visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const
@@ -302,7 +306,7 @@ LayoutPoint LayoutMultiColumnSet::visualPointToFlowThreadPoint(const LayoutPoint
LayoutUnit LayoutMultiColumnSet::pageLogicalTopForOffset(LayoutUnit offset) const
{
- return fragmentainerGroupAtFlowThreadOffset(offset).columnLogicalTopForOffset(offset);
+ return fragmentainerGroupAtFlowThreadOffset(offset, AssociateWithLatterPage).columnLogicalTopForOffset(offset);
}
bool LayoutMultiColumnSet::recalculateColumnHeight()
« 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