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

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

Issue 2709013007: Allow flow thread portion logical bottom to be above its logical top. (Closed)
Patch Set: Add clarifying comment in logicalHeightInFlowThread() 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/MultiColumnFragmentainerGroup.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/MultiColumnFragmentainerGroup.cpp
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index ceba040700e23c28d2256d79b7bb1c2f2fc751b9..8b5ca39b317454ff827c39aaa4468221ee3271a3 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -37,6 +37,19 @@ MultiColumnFragmentainerGroup::blockOffsetInEnclosingFragmentationContext()
->blockOffsetInEnclosingFragmentationContext();
}
+LayoutUnit MultiColumnFragmentainerGroup::logicalHeightInFlowThreadAt(
+ unsigned columnIndex) const {
+ if (!m_columnHeight)
+ return LayoutUnit();
+ LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex);
+ LayoutUnit logicalBottom = logicalTop + m_columnHeight;
+ if (logicalBottom > logicalBottomInFlowThread()) {
+ DCHECK_EQ(columnIndex + 1, actualColumnCount());
+ logicalBottom = logicalBottomInFlowThread();
+ }
+ return (logicalBottom - logicalTop).clampNegativeToZero();
+}
+
void MultiColumnFragmentainerGroup::resetColumnHeight() {
m_maxColumnHeight = calculateMaxColumnHeight();
@@ -369,19 +382,10 @@ LayoutUnit MultiColumnFragmentainerGroup::rebalanceColumnHeightIfNeeded()
LayoutRect MultiColumnFragmentainerGroup::columnRectAt(
unsigned columnIndex) const {
LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth();
- LayoutUnit columnLogicalHeight = m_columnHeight;
+ LayoutUnit columnLogicalHeight = logicalHeightInFlowThreadAt(columnIndex);
LayoutUnit columnLogicalTop;
LayoutUnit columnLogicalLeft;
LayoutUnit columnGap = m_columnSet.columnGap();
- LayoutUnit portionOutsideFlowThread =
- logicalTopInFlowThread() + (columnIndex + 1) * columnLogicalHeight -
- logicalBottomInFlowThread();
- if (portionOutsideFlowThread > 0) {
- // The last column may not be using all available space.
- ASSERT(columnIndex + 1 == actualColumnCount());
- columnLogicalHeight -= portionOutsideFlowThread;
- ASSERT(columnLogicalHeight >= 0);
- }
if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) {
if (m_columnSet.style()->isLeftToRightDirection())
@@ -404,14 +408,7 @@ LayoutRect MultiColumnFragmentainerGroup::columnRectAt(
LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionRectAt(
unsigned columnIndex) const {
LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex);
- LayoutUnit logicalBottom = logicalTop + m_columnHeight;
- if (logicalBottom > logicalBottomInFlowThread()) {
- // The last column may not be using all available space.
- ASSERT(columnIndex + 1 == actualColumnCount());
- logicalBottom = logicalBottomInFlowThread();
- ASSERT(logicalBottom >= logicalTop);
- }
- LayoutUnit portionLogicalHeight = logicalBottom - logicalTop;
+ LayoutUnit portionLogicalHeight = logicalHeightInFlowThreadAt(columnIndex);
if (m_columnSet.isHorizontalWritingMode())
return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth(),
portionLogicalHeight);
@@ -529,10 +526,9 @@ void MultiColumnFragmentainerGroup::columnIntervalForBlockRangeInFlowThread(
std::max(logicalTopInFlowThread, this->logicalTopInFlowThread());
logicalBottomInFlowThread =
std::min(logicalBottomInFlowThread, this->logicalBottomInFlowThread());
- ASSERT(logicalTopInFlowThread <= logicalBottomInFlowThread);
firstColumn = columnIndexAtOffset(logicalTopInFlowThread,
LayoutBox::AssociateWithLatterPage);
- if (logicalBottomInFlowThread == logicalTopInFlowThread) {
+ if (logicalBottomInFlowThread <= logicalTopInFlowThread) {
// Zero-height block range. There'll be one column in the interval. Set it
// right away. This is important if we're at a column boundary, since
// calling columnIndexAtOffset() with the end-exclusive bottom offset would
« no previous file with comments | « third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698