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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc

Issue 2732223007: Revert of Combine 2 exclusions in Layout Opportunity Tree if they shadow each other (Closed)
Patch Set: Created 3 years, 9 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/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.

Powered by Google App Engine
This is Rietveld 408576698