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

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

Issue 2636353002: [LayoutNG] Remove the state machine from ng_out_of_flow_layout_part. (Closed)
Patch Set: rebase. Created 3 years, 11 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_block_node.h" 5 #include "core/layout/ng/ng_block_node.h"
6 6
7 #include "core/layout/LayoutBlockFlow.h" 7 #include "core/layout/LayoutBlockFlow.h"
8 #include "core/layout/api/LineLayoutAPIShim.h" 8 #include "core/layout/api/LineLayoutAPIShim.h"
9 #include "core/layout/line/InlineIterator.h" 9 #include "core/layout/line/InlineIterator.h"
10 #include "core/layout/ng/layout_ng_block_flow.h" 10 #include "core/layout/ng/layout_ng_block_flow.h"
(...skipping 21 matching lines...) Expand all
32 layout_box_(nullptr), 32 layout_box_(nullptr),
33 style_(style) { 33 style_(style) {
34 DCHECK(style_); 34 DCHECK(style_);
35 } 35 }
36 36
37 // Need an explicit destructor in the .cc file, or the MSWIN compiler will 37 // Need an explicit destructor in the .cc file, or the MSWIN compiler will
38 // produce an error when attempting to generate a default one, if the .h file is 38 // produce an error when attempting to generate a default one, if the .h file is
39 // included from a compilation unit that lacks the ComputedStyle definition. 39 // included from a compilation unit that lacks the ComputedStyle definition.
40 NGBlockNode::~NGBlockNode() {} 40 NGBlockNode::~NGBlockNode() {}
41 41
42 void NGBlockNode::LayoutSync(NGConstraintSpace* constraint_space,
43 NGFragment** out) {
44 while (!Layout(constraint_space, out))
45 continue;
46 }
47
42 bool NGBlockNode::Layout(NGConstraintSpace* constraint_space, 48 bool NGBlockNode::Layout(NGConstraintSpace* constraint_space,
43 NGFragment** out) { 49 NGFragment** out) {
44 DCHECK(!minmax_algorithm_) 50 DCHECK(!minmax_algorithm_)
45 << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; 51 << "Can't interleave Layout and ComputeMinAndMaxContentSizes";
46 // We can either use the new layout code to do the layout and then copy the 52 // We can either use the new layout code to do the layout and then copy the
47 // resulting size to the LayoutObject, or use the old layout code and 53 // resulting size to the LayoutObject, or use the old layout code and
48 // synthesize a fragment. 54 // synthesize a fragment.
49 if (CanUseNewLayout()) { 55 if (CanUseNewLayout()) {
50 NGPhysicalFragment* fragment; 56 NGPhysicalFragment* fragment;
51 57
(...skipping 20 matching lines...) Expand all
72 } 78 }
73 79
74 void NGBlockNode::UpdateLayoutBox(NGPhysicalBoxFragment* fragment, 80 void NGBlockNode::UpdateLayoutBox(NGPhysicalBoxFragment* fragment,
75 const NGConstraintSpace* constraint_space) { 81 const NGConstraintSpace* constraint_space) {
76 fragment_ = fragment; 82 fragment_ = fragment;
77 if (layout_box_) { 83 if (layout_box_) {
78 CopyFragmentDataToLayoutBox(*constraint_space); 84 CopyFragmentDataToLayoutBox(*constraint_space);
79 } 85 }
80 } 86 }
81 87
88 MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizesSync() {
89 MinAndMaxContentSizes sizes;
90 while (!ComputeMinAndMaxContentSizes(&sizes))
91 continue;
92 return sizes;
93 }
94
82 bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) { 95 bool NGBlockNode::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
83 if (!CanUseNewLayout()) { 96 if (!CanUseNewLayout()) {
84 DCHECK(layout_box_); 97 DCHECK(layout_box_);
85 // TODO(layout-ng): This could be somewhat optimized by directly calling 98 // TODO(layout-ng): This could be somewhat optimized by directly calling
86 // computeIntrinsicLogicalWidths, but that function is currently private. 99 // computeIntrinsicLogicalWidths, but that function is currently private.
87 // Consider doing that if this becomes a performance issue. 100 // Consider doing that if this becomes a performance issue.
88 LayoutUnit borderAndPadding = layout_box_->borderAndPaddingLogicalWidth(); 101 LayoutUnit borderAndPadding = layout_box_->borderAndPaddingLogicalWidth();
89 sizes->min_content = layout_box_->computeLogicalWidthUsing( 102 sizes->min_content = layout_box_->computeLogicalWidthUsing(
90 MainOrPreferredSize, Length(MinContent), 103 MainOrPreferredSize, Length(MinContent),
91 LayoutUnit(), layout_box_->containingBlock()) - 104 LayoutUnit(), layout_box_->containingBlock()) -
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return builder.ToBoxFragment(); 353 return builder.ToBoxFragment();
341 } 354 }
342 355
343 void NGBlockNode::UseOldOutOfFlowPositioning() { 356 void NGBlockNode::UseOldOutOfFlowPositioning() {
344 DCHECK(layout_box_); 357 DCHECK(layout_box_);
345 DCHECK(layout_box_->isOutOfFlowPositioned()); 358 DCHECK(layout_box_->isOutOfFlowPositioned());
346 layout_box_->containingBlock()->insertPositionedObject(layout_box_); 359 layout_box_->containingBlock()->insertPositionedObject(layout_box_);
347 } 360 }
348 361
349 } // namespace blink 362 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698