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

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

Issue 2734923002: Add LayoutOpportunityIterator method to NGConstraintSpace (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_constraint_space.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
index cf99563b25553911c110a83b8f17ce39cc5e38e8..95a0349a1a5ed1763920ffad5805b716bcb2192d 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -49,7 +49,8 @@ NGConstraintSpace::NGConstraintSpace(
margin_strut_(margin_strut),
bfc_offset_(bfc_offset),
exclusions_(exclusions),
- clearance_offset_(clearance_offset) {}
+ clearance_offset_(clearance_offset),
+ layout_opp_iter_(nullptr) {}
RefPtr<NGConstraintSpace> NGConstraintSpace::CreateFromLayoutObject(
const LayoutBox& box) {
@@ -126,14 +127,20 @@ RefPtr<NGConstraintSpace> NGConstraintSpace::CreateFromLayoutObject(
void NGConstraintSpace::AddExclusion(const NGExclusion& exclusion) {
exclusions_->Add(exclusion);
+ // Invalidate the Layout Opportunity Iterator.
+ layout_opp_iter_.reset();
}
NGFragmentationType NGConstraintSpace::BlockFragmentationType() const {
return static_cast<NGFragmentationType>(block_direction_fragmentation_type_);
}
-void NGConstraintSpace::Subtract(const NGBoxFragment*) {
- // TODO(layout-ng): Implement.
+NGLayoutOpportunityIterator* NGConstraintSpace::LayoutOpportunityIterator() {
+ if (!layout_opp_iter_) {
+ layout_opp_iter_ =
+ WTF::makeUnique<NGLayoutOpportunityIterator>(this, this->bfc_offset_);
+ }
+ return layout_opp_iter_.get();
}
String NGConstraintSpace::ToString() const {

Powered by Google App Engine
This is Rietveld 408576698