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

Unified Diff: third_party/WebKit/Source/core/layout/ColumnBalancer.h

Issue 1420713003: Deduct pagination struts when calculating initial column height. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 1 month 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/ColumnBalancer.h
diff --git a/third_party/WebKit/Source/core/layout/ColumnBalancer.h b/third_party/WebKit/Source/core/layout/ColumnBalancer.h
index 938f3a8d207e7c991a956204ad34cab91d862c18..daab0d98ec96bf2fa2d591bd0191efcfb0430c54 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.h
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.h
@@ -76,6 +76,14 @@ private:
void examineBoxBeforeLeaving(const LayoutBox&);
void examineLine(const RootInlineBox&);
+ // Record that there's a pagination strut that ends at the specified |offsetInFlowThread|, which
+ // is an offset exactly at the top of some column.
+ void recordStrutBeforeOffset(LayoutUnit offsetInFlowThread, LayoutUnit strut);
+
+ // Return the accumulated space used by struts at all column boundaries preceding the specified
+ // flowthread offset.
+ LayoutUnit spaceUsedByStrutsAt(LayoutUnit offsetInFlowThread) const;
+
// Add a content run, specified by its end position. A content run is appended at every
// forced/explicit break and at the end of the column set. The content runs are used to
// determine where implicit/soft breaks will occur, in order to calculate an initial column
@@ -117,6 +125,19 @@ private:
unsigned m_assumedImplicitBreaks; // Number of implicit breaks in this run assumed so far.
};
Vector<ContentRun, 32> m_contentRuns;
+
+ // Shortest strut found at each column boundary (index 0 being the boundary between the first
+ // and the second column, index 1 being the one between the second and the third boundary, and
+ // so on). There may be several objects that cross the same column boundary, and we're only
+ // interested in the shortest one. For example, when having a float beside regular in-flow
+ // content, we end up with two parallel fragmentation flows [1]. The shortest strut found at a
+ // column boundary is the amount of space that we wasted at said column boundary, and it needs
+ // to be deducted when estimating the initial balanced column height, or we risk making the
+ // column row too tall. An entry set to LayoutUnit::max() means that we didn't detect any object
+ // crossing that boundary.
+ //
+ // [1] http://www.w3.org/TR/css3-break/#parallel-flows
+ Vector<LayoutUnit, 32> m_shortestStruts;
};
// If we have previously used InitialColumnHeightFinder to estimate an initial column height, and

Powered by Google App Engine
This is Rietveld 408576698