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

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

Issue 2631013002: Try to avoid working on zero-height column sets, when possible. (Closed)
Patch Set: Created 3 years, 11 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/LayoutTests/fast/multicol/span/empty-block-with-bottom-margin-between-spanners.html ('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/LayoutMultiColumnFlowThread.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index eaa90b37f9f76e728c58a85932efb257f69139f4..846637693e0a764d86073d4852f70f65918418f8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -463,17 +463,19 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(
DCHECK(!m_columnSetsInvalidated);
if (m_multiColumnSetList.isEmpty())
return nullptr;
- if (offset < LayoutUnit())
- return m_multiColumnSetList.first();
-
- MultiColumnSetSearchAdapter adapter(offset);
- m_multiColumnSetIntervalTree
- .allOverlapsWithAdapter<MultiColumnSetSearchAdapter>(adapter);
-
- // If no set was found, the offset is in the flow thread overflow.
- if (!adapter.result() && !m_multiColumnSetList.isEmpty())
- return m_multiColumnSetList.last();
- columnSet = adapter.result();
+ if (offset < LayoutUnit()) {
+ columnSet = m_multiColumnSetList.first();
+ } else {
+ MultiColumnSetSearchAdapter adapter(offset);
+ m_multiColumnSetIntervalTree
+ .allOverlapsWithAdapter<MultiColumnSetSearchAdapter>(adapter);
+
+ // If no set was found, the offset is in the flow thread overflow.
+ if (!adapter.result() && !m_multiColumnSetList.isEmpty())
+ columnSet = m_multiColumnSetList.last();
+ else
+ columnSet = adapter.result();
+ }
}
if (pageBoundaryRule == AssociateWithFormerPage && columnSet &&
offset == columnSet->logicalTopInFlowThread()) {
@@ -483,7 +485,19 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(
// previous column set.
if (LayoutMultiColumnSet* previousSet =
columnSet->previousSiblingMultiColumnSet())
- return previousSet;
+ columnSet = previousSet;
+ }
+ // Avoid returning zero-height column sets, if possible. We found a column set
+ // based on a flow thread coordinate. If multiple column sets share that
+ // coordinate (because we have zero-height column sets between column
+ // spanners, for instance), look for one that has a height.
+ for (LayoutMultiColumnSet* walker = columnSet; walker;
+ walker = walker->nextSiblingMultiColumnSet()) {
+ if (!walker->isPageLogicalHeightKnown())
+ continue;
+ if (walker->logicalTopInFlowThread() == offset)
+ return walker;
+ break;
}
return columnSet;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/span/empty-block-with-bottom-margin-between-spanners.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698