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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc

Issue 2954953002: [LayoutNG] Abort a layout once the BFC offset is resolved. (Closed)
Patch Set: rebase. Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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_builder.h" 5 #include "core/layout/ng/ng_constraint_space_builder.h"
6 6
7 #include "core/layout/ng/ng_length_utils.h" 7 #include "core/layout/ng/ng_length_utils.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsAnonymous( 140 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetIsAnonymous(
141 bool is_anonymous) { 141 bool is_anonymous) {
142 is_anonymous_ = is_anonymous; 142 is_anonymous_ = is_anonymous;
143 return *this; 143 return *this;
144 } 144 }
145 145
146 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetUnpositionedFloats( 146 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::SetUnpositionedFloats(
147 Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats) { 147 Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats) {
148 unpositioned_floats_.swap(unpositioned_floats); 148 unpositioned_floats_ = unpositioned_floats;
149 return *this; 149 return *this;
150 } 150 }
151 151
152 void NGConstraintSpaceBuilder::AddBaselineRequests( 152 void NGConstraintSpaceBuilder::AddBaselineRequests(
153 const Vector<NGBaselineRequest>& requests) { 153 const Vector<NGBaselineRequest>& requests) {
154 baseline_requests_.AppendVector(requests); 154 baseline_requests_.AppendVector(requests);
155 } 155 }
156 156
157 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::AddBaselineRequest( 157 NGConstraintSpaceBuilder& NGConstraintSpaceBuilder::AddBaselineRequest(
158 NGBaselineAlgorithmType algorithm_type, 158 NGBaselineAlgorithmType algorithm_type,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_); 203 is_new_fc_ ? std::make_shared<NGExclusions>() : exclusions_);
204 if (is_new_fc_) 204 if (is_new_fc_)
205 DCHECK(unpositioned_floats_.IsEmpty()); 205 DCHECK(unpositioned_floats_.IsEmpty());
206 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_; 206 NGLogicalOffset bfc_offset = is_new_fc_ ? NGLogicalOffset() : bfc_offset_;
207 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_; 207 NGMarginStrut margin_strut = is_new_fc_ ? NGMarginStrut() : margin_strut_;
208 WTF::Optional<LayoutUnit> clearance_offset = 208 WTF::Optional<LayoutUnit> clearance_offset =
209 is_new_fc_ ? WTF::nullopt : clearance_offset_; 209 is_new_fc_ ? WTF::nullopt : clearance_offset_;
210 WTF::Optional<NGLogicalOffset> floats_bfc_offset = 210 WTF::Optional<NGLogicalOffset> floats_bfc_offset =
211 is_new_fc_ ? WTF::nullopt : floats_bfc_offset_; 211 is_new_fc_ ? WTF::nullopt : floats_bfc_offset_;
212 212
213 // The inline_offsets of the bfc_offset and floats_bfc_offset should match. 213 if (floats_bfc_offset) {
214 if (floats_bfc_offset) 214 floats_bfc_offset = NGLogicalOffset(
215 DCHECK_EQ(bfc_offset.inline_offset, 215 {bfc_offset.inline_offset, floats_bfc_offset.value().block_offset});
216 floats_bfc_offset.value().inline_offset); 216 }
217 217
218 if (is_in_parallel_flow) { 218 if (is_in_parallel_flow) {
219 return AdoptRef(new NGConstraintSpace( 219 return AdoptRef(new NGConstraintSpace(
220 static_cast<NGWritingMode>(out_writing_mode), 220 static_cast<NGWritingMode>(out_writing_mode),
221 static_cast<TextDirection>(text_direction_), available_size, 221 static_cast<TextDirection>(text_direction_), available_size,
222 percentage_resolution_size, initial_containing_block_size_, 222 percentage_resolution_size, initial_containing_block_size_,
223 fragmentainer_space_available_, is_fixed_size_inline_, 223 fragmentainer_space_available_, is_fixed_size_inline_,
224 is_fixed_size_block_, is_shrink_to_fit_, 224 is_fixed_size_block_, is_shrink_to_fit_,
225 is_inline_direction_triggers_scrollbar_, 225 is_inline_direction_triggers_scrollbar_,
226 is_block_direction_triggers_scrollbar_, 226 is_block_direction_triggers_scrollbar_,
227 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 227 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
228 is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions, 228 is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions,
229 unpositioned_floats_, clearance_offset, baseline_requests_)); 229 unpositioned_floats_, clearance_offset, baseline_requests_));
230 } 230 }
231 return AdoptRef(new NGConstraintSpace( 231 return AdoptRef(new NGConstraintSpace(
232 out_writing_mode, static_cast<TextDirection>(text_direction_), 232 out_writing_mode, static_cast<TextDirection>(text_direction_),
233 available_size, percentage_resolution_size, 233 available_size, percentage_resolution_size,
234 initial_containing_block_size_, fragmentainer_space_available_, 234 initial_containing_block_size_, fragmentainer_space_available_,
235 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_, 235 is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_,
236 is_block_direction_triggers_scrollbar_, 236 is_block_direction_triggers_scrollbar_,
237 is_inline_direction_triggers_scrollbar_, 237 is_inline_direction_triggers_scrollbar_,
238 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_, 238 static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
239 is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions, 239 is_anonymous_, margin_strut, bfc_offset, floats_bfc_offset, exclusions,
240 unpositioned_floats_, clearance_offset, baseline_requests_)); 240 unpositioned_floats_, clearance_offset, baseline_requests_));
241 } 241 }
242 242
243 } // namespace blink 243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698