| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/ng/ng_constraint_space.h" | 5 #include "core/layout/ng/ng_constraint_space.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" | 10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void NGConstraintSpace::AddExclusion(const NGExclusion& exclusion) { | 128 void NGConstraintSpace::AddExclusion(const NGExclusion& exclusion) { |
| 129 exclusions_->Add(exclusion); | 129 exclusions_->Add(exclusion); |
| 130 // Invalidate the Layout Opportunity Iterator. | 130 // Invalidate the Layout Opportunity Iterator. |
| 131 layout_opp_iter_.reset(); | 131 layout_opp_iter_.reset(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 NGFragmentationType NGConstraintSpace::BlockFragmentationType() const { | 134 NGFragmentationType NGConstraintSpace::BlockFragmentationType() const { |
| 135 return static_cast<NGFragmentationType>(block_direction_fragmentation_type_); | 135 return static_cast<NGFragmentationType>(block_direction_fragmentation_type_); |
| 136 } | 136 } |
| 137 | 137 |
| 138 NGLayoutOpportunityIterator* NGConstraintSpace::LayoutOpportunityIterator() { | 138 NGLayoutOpportunityIterator* NGConstraintSpace::LayoutOpportunityIterator( |
| 139 const NGLogicalOffset& iter_offset) { |
| 140 if (layout_opp_iter_ && layout_opp_iter_->Offset() != iter_offset) |
| 141 layout_opp_iter_.reset(); |
| 142 |
| 139 if (!layout_opp_iter_) { | 143 if (!layout_opp_iter_) { |
| 140 layout_opp_iter_ = | 144 layout_opp_iter_ = |
| 141 WTF::makeUnique<NGLayoutOpportunityIterator>(this, this->bfc_offset_); | 145 WTF::makeUnique<NGLayoutOpportunityIterator>(this, iter_offset); |
| 142 } | 146 } |
| 143 return layout_opp_iter_.get(); | 147 return layout_opp_iter_.get(); |
| 144 } | 148 } |
| 145 | 149 |
| 146 String NGConstraintSpace::ToString() const { | 150 String NGConstraintSpace::ToString() const { |
| 147 return String::format( | 151 return String::format( |
| 148 "Offset: %s,%s Size: %sx%s MarginStrut: %s" | 152 "Offset: %s,%s Size: %sx%s MarginStrut: %s" |
| 149 " Clearance: %s", | 153 " Clearance: %s", |
| 150 bfc_offset_.inline_offset.toString().ascii().data(), | 154 bfc_offset_.inline_offset.toString().ascii().data(), |
| 151 bfc_offset_.block_offset.toString().ascii().data(), | 155 bfc_offset_.block_offset.toString().ascii().data(), |
| 152 AvailableSize().inline_size.toString().ascii().data(), | 156 AvailableSize().inline_size.toString().ascii().data(), |
| 153 AvailableSize().block_size.toString().ascii().data(), | 157 AvailableSize().block_size.toString().ascii().data(), |
| 154 margin_strut_.ToString().ascii().data(), | 158 margin_strut_.ToString().ascii().data(), |
| 155 clearance_offset_.has_value() | 159 clearance_offset_.has_value() |
| 156 ? clearance_offset_.value().toString().ascii().data() | 160 ? clearance_offset_.value().toString().ascii().data() |
| 157 : "none"); | 161 : "none"); |
| 158 } | 162 } |
| 159 | 163 |
| 160 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |