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

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

Issue 1631633002: Adjust column rows' height better for their offset in the multicol container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 3a18ce06ac2622a38f08050c5f8bba2f758ffec6..0b26432d2995d70d9bfa3f525084d291e1c7c863 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -170,6 +170,22 @@ MultiColumnFragmentainerGroup& LayoutMultiColumnSet::appendNewFragmentainerGroup
return m_fragmentainerGroups.last();
}
+LayoutUnit LayoutMultiColumnSet::logicalTopFromMulticolContentEdge() const
+{
+ // We subtract the position of the first column set or spanner placeholder, rather than the
+ // "before" border+padding of the multicol container. This distinction doesn't matter after
+ // layout, but during layout it does: The flow thread (i.e. the multicol contents) is laid out
+ // before the column sets and spanner placeholders, which means that compesating for a top
+ // border+padding that hasn't yet been baked into the offset will produce the wrong results in
+ // the first layout pass, and we'd end up performing a wasted layout pass in many cases.
+ const LayoutBox& firstColumnBox = *multiColumnFlowThread()->firstMultiColumnBox();
+ // The top margin edge of the first column set or spanner placeholder is flush with the top
+ // content edge of the multicol container. The margin here never collapses with other margins,
+ // so we can just subtract it. Column sets never have margins, but spanner placeholders may.
+ LayoutUnit firstColumnBoxMarginEdge = firstColumnBox.logicalTop() - multiColumnBlockFlow()->marginBeforeForChild(firstColumnBox);
+ return logicalTop() - firstColumnBoxMarginEdge;
+}
+
LayoutUnit LayoutMultiColumnSet::logicalTopInFlowThread() const
{
return firstFragmentainerGroup().logicalTopInFlowThread();

Powered by Google App Engine
This is Rietveld 408576698