Index: third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc |
index a5b6498e99f3253eccd53ee7332665f7561fbf9b..fc9720fe63a90ea86631def28b28eb7430dc7c32 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc |
@@ -27,7 +27,7 @@ |
for (unsigned i = 0; i < indent; i++) |
indent_builder.append("\t"); |
- if (node->IsLeafNode()) |
+ if (!node->exclusion) |
return; |
string_builder->append(indent_builder.toString()); |
@@ -159,13 +159,6 @@ |
return nullptr; |
} |
-void SplitNGLayoutOpportunityTreeNode(const NGLogicalRect& rect, |
- NGLayoutOpportunityTreeNode* node) { |
- node->left = CreateLeftNGLayoutOpportunityTreeNode(node, rect); |
- node->right = CreateRightNGLayoutOpportunityTreeNode(node, rect); |
- node->bottom = CreateBottomNGLayoutOpportunityTreeNode(node, rect); |
-} |
- |
// Gets/Creates the "TOP" positioned constraint space by splitting |
// the parent node with the exclusion. |
// |
@@ -203,29 +196,24 @@ |
if (!exclusion->rect.IsContained(node->opportunity)) |
return; |
- if (node->exclusions.isEmpty()) { |
- SplitNGLayoutOpportunityTreeNode(exclusion->rect, node); |
- |
- NGLayoutOpportunity top_layout_opp = |
- GetTopSpace(node->opportunity, exclusion->rect); |
- if (!top_layout_opp.IsEmpty()) |
- opportunities.push_back(top_layout_opp); |
- |
- node->exclusions.push_back(exclusion); |
- node->combined_exclusion = WTF::makeUnique<NGExclusion>(*exclusion); |
- return; |
- } |
- |
- DCHECK(!node->exclusions.isEmpty()); |
- |
- if (node->combined_exclusion->MaybeCombineWith(*exclusion)) { |
- SplitNGLayoutOpportunityTreeNode(node->combined_exclusion->rect, node); |
- node->exclusions.push_back(exclusion); |
- } else { |
+ if (node->exclusion) { |
InsertExclusion(node->left, exclusion, opportunities); |
InsertExclusion(node->bottom, exclusion, opportunities); |
InsertExclusion(node->right, exclusion, opportunities); |
- } |
+ return; |
+ } |
+ |
+ // Split the current node. |
+ node->left = CreateLeftNGLayoutOpportunityTreeNode(node, exclusion->rect); |
+ node->right = CreateRightNGLayoutOpportunityTreeNode(node, exclusion->rect); |
+ node->bottom = CreateBottomNGLayoutOpportunityTreeNode(node, exclusion->rect); |
+ |
+ NGLayoutOpportunity top_layout_opp = |
+ GetTopSpace(node->opportunity, exclusion->rect); |
+ if (!top_layout_opp.IsEmpty()) |
+ opportunities.push_back(top_layout_opp); |
+ |
+ node->exclusion = exclusion; |
} |
// Compares exclusions by their top position. |