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( |