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

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

Issue 2877703003: Improve LayoutMultiColumnFlowThread::IsPageLogicalHeightKnown(). (Closed)
Patch Set: Created 3 years, 7 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/LayoutMultiColumnFlowThread.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/LayoutMultiColumnFlowThread.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index 7d2e99ab0ff5b13b2dbe3e9e09aa8b7a078d3ccf..be1c667ecd4b7f118de60f1313eccc175fc36256 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -363,9 +363,7 @@ bool LayoutMultiColumnFlowThread::NeedsNewWidth() const {
}
bool LayoutMultiColumnFlowThread::IsPageLogicalHeightKnown() const {
- if (LayoutMultiColumnSet* column_set = LastMultiColumnSet())
- return column_set->IsPageLogicalHeightKnown();
- return false;
+ return all_columns_have_known_height_;
}
bool LayoutMultiColumnFlowThread::MayHaveNonUniformPageLogicalHeight() const {
@@ -543,6 +541,10 @@ void LayoutMultiColumnFlowThread::LayoutColumns(
}
}
+ // We'll start by assuming that all columns have some known height, and flip
+ // it to false if we discover that this isn't the case.
+ all_columns_have_known_height_ = true;
+
for (LayoutBox* column_box = FirstMultiColumnBox(); column_box;
column_box = column_box->NextSiblingMultiColumnBox()) {
if (!column_box->IsLayoutMultiColumnSet()) {
@@ -557,6 +559,13 @@ void LayoutMultiColumnFlowThread::LayoutColumns(
// because contents typically have changed.
column_set->ResetColumnHeight();
}
+ if (all_columns_have_known_height_ &&
+ !column_set->IsPageLogicalHeightKnown()) {
+ // If any of the column sets requires a layout pass before it has any
+ // clue about its height, we cannot fragment in this pass, just measure
+ // the block sizes.
+ all_columns_have_known_height_ = false;
+ }
// Since column sets are regular block flow objects, and their position is
// changed in regular block layout code (with no means for the multicol code
// to notice unless we add hooks there), store the previous position now. If
@@ -945,6 +954,18 @@ void LayoutMultiColumnFlowThread::SkipColumnSpanner(
}
}
+bool LayoutMultiColumnFlowThread::FinishLayout() {
+ all_columns_have_known_height_ = true;
+ for (const auto* column_set = FirstMultiColumnSet(); column_set;
+ column_set = column_set->NextSiblingMultiColumnSet()) {
+ if (!column_set->IsPageLogicalHeightKnown()) {
+ all_columns_have_known_height_ = false;
+ break;
+ }
+ }
+ return !ColumnHeightsChanged();
+}
+
// When processing layout objects to remove or when processing layout objects
// that have just been inserted, certain types of objects should be skipped.
static bool ShouldSkipInsertedOrRemovedChild(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698