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

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

Issue 2656693007: [LayoutNG] Return MinAndMaxContentSizes by value, step 1 (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_block_layout_algorithm.h" 5 #include "core/layout/ng/ng_block_layout_algorithm.h"
6 6
7 #include "core/layout/ng/ng_absolute_utils.h" 7 #include "core/layout/ng/ng_absolute_utils.h"
8 #include "core/layout/ng/ng_block_break_token.h" 8 #include "core/layout/ng/ng_block_break_token.h"
9 #include "core/layout/ng/ng_box_fragment.h" 9 #include "core/layout/ng/ng_box_fragment.h"
10 #include "core/layout/ng/ng_column_mapper.h" 10 #include "core/layout/ng/ng_column_mapper.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 sizes->max_content = LayoutUnit(); 201 sizes->max_content = LayoutUnit();
202 202
203 // Size-contained elements don't consider their contents for intrinsic sizing. 203 // Size-contained elements don't consider their contents for intrinsic sizing.
204 if (Style().containsSize()) 204 if (Style().containsSize())
205 return true; 205 return true;
206 206
207 // TODO: handle floats & orthogonal children. 207 // TODO: handle floats & orthogonal children.
208 for (NGBlockNode* node = first_child_; node; node = node->NextSibling()) { 208 for (NGBlockNode* node = first_child_; node; node = node->NextSibling()) {
209 Optional<MinAndMaxContentSizes> child_minmax; 209 Optional<MinAndMaxContentSizes> child_minmax;
210 if (NeedMinAndMaxContentSizesForContentContribution(*node->Style())) { 210 if (NeedMinAndMaxContentSizesForContentContribution(*node->Style())) {
211 child_minmax = node->ComputeMinAndMaxContentSizesSync(); 211 child_minmax = node->ComputeMinAndMaxContentSizes();
212 } 212 }
213 213
214 MinAndMaxContentSizes child_sizes = 214 MinAndMaxContentSizes child_sizes =
215 ComputeMinAndMaxContentContribution(*node->Style(), child_minmax); 215 ComputeMinAndMaxContentContribution(*node->Style(), child_minmax);
216 216
217 sizes->min_content = std::max(sizes->min_content, child_sizes.min_content); 217 sizes->min_content = std::max(sizes->min_content, child_sizes.min_content);
218 sizes->max_content = std::max(sizes->max_content, child_sizes.max_content); 218 sizes->max_content = std::max(sizes->max_content, child_sizes.max_content);
219 } 219 }
220 220
221 sizes->max_content = std::max(sizes->min_content, sizes->max_content); 221 sizes->max_content = std::max(sizes->min_content, sizes->max_content);
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 builder_->SetMarginStrutBlockEnd(from); 607 builder_->SetMarginStrutBlockEnd(from);
608 } 608 }
609 609
610 NGBoxStrut NGBlockLayoutAlgorithm::CalculateMargins( 610 NGBoxStrut NGBlockLayoutAlgorithm::CalculateMargins(
611 const NGConstraintSpace& space, 611 const NGConstraintSpace& space,
612 const ComputedStyle& style) { 612 const ComputedStyle& style) {
613 WTF::Optional<MinAndMaxContentSizes> sizes; 613 WTF::Optional<MinAndMaxContentSizes> sizes;
614 if (NeedMinAndMaxContentSizes(space, style)) { 614 if (NeedMinAndMaxContentSizes(space, style)) {
615 // TODO(ikilpatrick): Change ComputeMinAndMaxContentSizes to return 615 // TODO(ikilpatrick): Change ComputeMinAndMaxContentSizes to return
616 // MinAndMaxContentSizes. 616 // MinAndMaxContentSizes.
617 sizes = current_child_->ComputeMinAndMaxContentSizesSync(); 617 sizes = current_child_->ComputeMinAndMaxContentSizes();
618 } 618 }
619 LayoutUnit child_inline_size = 619 LayoutUnit child_inline_size =
620 ComputeInlineSizeForFragment(space, style, sizes); 620 ComputeInlineSizeForFragment(space, style, sizes);
621 NGBoxStrut margins = 621 NGBoxStrut margins =
622 ComputeMargins(space, style, space.WritingMode(), space.Direction()); 622 ComputeMargins(space, style, space.WritingMode(), space.Direction());
623 if (!style.isFloating()) { 623 if (!style.isFloating()) {
624 ApplyAutoMargins(space, style, child_inline_size, &margins); 624 ApplyAutoMargins(space, style, child_inline_size, &margins);
625 } 625 }
626 return margins; 626 return margins;
627 } 627 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 visitor->trace(constraint_space_); 662 visitor->trace(constraint_space_);
663 visitor->trace(break_token_); 663 visitor->trace(break_token_);
664 visitor->trace(builder_); 664 visitor->trace(builder_);
665 visitor->trace(space_builder_); 665 visitor->trace(space_builder_);
666 visitor->trace(space_for_current_child_); 666 visitor->trace(space_for_current_child_);
667 visitor->trace(current_child_); 667 visitor->trace(current_child_);
668 visitor->trace(fragmentainer_mapper_); 668 visitor->trace(fragmentainer_mapper_);
669 } 669 }
670 670
671 } // namespace blink 671 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698