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

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

Issue 2435803005: Initial implementation of LayoutNG's block layout algorithm for floats. (Closed)
Patch Set: fix PositionFragment's doc, added TODO to fix floats with margins and add more test expectations. Created 4 years, 2 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 76977630c2a784e71e646b72bf7d09017d55fd16..65e8af83fddaef126ecb06402dfd3985b7ddbcb0 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
@@ -148,6 +148,10 @@ NGConstraintSpace* GetTopSpace(const NGConstraintSpace& space,
void InsertExclusion(NGLayoutOpportunityTreeNode* node,
const NGExclusion* exclusion,
NGLayoutOpportunities& opportunities) {
+ // Base case: there is no node.
+ if (!node)
+ return;
+
// Base case: exclusion is not in the node's constraint space.
if (!IsExclusionWithinSpace(*node->space, *exclusion))
return;
@@ -216,9 +220,9 @@ NGLayoutOpportunityIterator::NGLayoutOpportunityIterator(
opportunity_tree_root_ = new NGLayoutOpportunityTreeNode(space);
for (const auto exclusion : exclusions) {
- InsertExclusion(opportunity_tree_root_, exclusion, opportunities_);
+ InsertExclusion(MutableOpportunityTreeRoot(), exclusion, opportunities_);
}
- CollectAllOpportunities(opportunity_tree_root_, opportunities_);
+ CollectAllOpportunities(OpportunityTreeRoot(), opportunities_);
std::sort(opportunities_.begin(), opportunities_.end(),
&CompareNGLayoutOpportunitesByStartPoint);
opportunity_iter_ = opportunities_.begin();

Powered by Google App Engine
This is Rietveld 408576698