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

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

Issue 2612103004: [ng_layout] Rename NGFragmentBase,NGFragment,NGPhysicalFragment (Closed)
Patch Set: CR: rename ifdef guards 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_inline_layout_algorithm.h" 5 #include "core/layout/ng/ng_inline_layout_algorithm.h"
6 6
7 #include "core/layout/ng/ng_break_token.h" 7 #include "core/layout/ng/ng_break_token.h"
8 #include "core/layout/ng/ng_constraint_space.h" 8 #include "core/layout/ng/ng_constraint_space.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_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
11 #include "core/layout/ng/ng_inline_node.h" 11 #include "core/layout/ng/ng_inline_node.h"
12 #include "core/layout/ng/ng_length_utils.h" 12 #include "core/layout/ng/ng_length_utils.h"
13 #include "core/layout/ng/ng_line_builder.h" 13 #include "core/layout/ng/ng_line_builder.h"
14 #include "core/layout/ng/ng_physical_fragment.h"
15 #include "core/style/ComputedStyle.h" 14 #include "core/style/ComputedStyle.h"
15 #include "core/layout/ng/ng_physical_box_fragment.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm( 19 NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm(
20 PassRefPtr<const ComputedStyle> style, 20 PassRefPtr<const ComputedStyle> style,
21 NGInlineNode* first_child, 21 NGInlineNode* first_child,
22 NGConstraintSpace* constraint_space, 22 NGConstraintSpace* constraint_space,
23 NGBreakToken* break_token) 23 NGBreakToken* break_token)
24 : NGLayoutAlgorithm(kInlineLayoutAlgorithm), 24 : NGLayoutAlgorithm(kInlineLayoutAlgorithm),
25 style_(style), 25 style_(style),
26 first_child_(first_child), 26 first_child_(first_child),
27 constraint_space_(constraint_space), 27 constraint_space_(constraint_space),
28 break_token_(break_token) { 28 break_token_(break_token) {
29 DCHECK(style_); 29 DCHECK(style_);
30 } 30 }
31 31
32 NGLayoutStatus NGInlineLayoutAlgorithm::Layout( 32 NGLayoutStatus NGInlineLayoutAlgorithm::Layout(
33 NGPhysicalFragmentBase*, 33 NGPhysicalFragment*,
34 NGPhysicalFragmentBase** fragment_out, 34 NGPhysicalFragment** fragment_out,
35 NGLayoutAlgorithm**) { 35 NGLayoutAlgorithm**) {
36 // TODO(kojii): Implement sizing and child constraint spaces. Share common 36 // TODO(kojii): Implement sizing and child constraint spaces. Share common
37 // logic with NGBlockLayoutAlgorithm using composition. 37 // logic with NGBlockLayoutAlgorithm using composition.
38 switch (state_) { 38 switch (state_) {
39 case kStateInit: { 39 case kStateInit: {
40 builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::kFragmentBox); 40 builder_ = new NGFragmentBuilder(NGPhysicalFragment::kFragmentBox);
41 builder_->SetWritingMode(constraint_space_->WritingMode()); 41 builder_->SetWritingMode(constraint_space_->WritingMode());
42 builder_->SetDirection(constraint_space_->Direction()); 42 builder_->SetDirection(constraint_space_->Direction());
43 current_child_ = first_child_; 43 current_child_ = first_child_;
44 if (current_child_) { 44 if (current_child_) {
45 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); 45 space_for_current_child_ = CreateConstraintSpaceForCurrentChild();
46 line_builder_ = 46 line_builder_ =
47 new NGLineBuilder(current_child_, space_for_current_child_); 47 new NGLineBuilder(current_child_, space_for_current_child_);
48 } 48 }
49 49
50 state_ = kStateChildLayout; 50 state_ = kStateChildLayout;
(...skipping 10 matching lines...) Expand all
61 ASSERT_NOT_REACHED(); 61 ASSERT_NOT_REACHED();
62 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); 62 space_for_current_child_ = CreateConstraintSpaceForCurrentChild();
63 return kNotFinished; 63 return kNotFinished;
64 } 64 }
65 } 65 }
66 state_ = kStateFinalize; 66 state_ = kStateFinalize;
67 return kNotFinished; 67 return kNotFinished;
68 } 68 }
69 case kStateFinalize: 69 case kStateFinalize:
70 line_builder_->CreateFragments(builder_); 70 line_builder_->CreateFragments(builder_);
71 *fragment_out = builder_->ToFragment(); 71 *fragment_out = builder_->ToBoxFragment();
72 state_ = kStateInit; 72 state_ = kStateInit;
73 return kNewFragment; 73 return kNewFragment;
74 }; 74 };
75 NOTREACHED(); 75 NOTREACHED();
76 *fragment_out = nullptr; 76 *fragment_out = nullptr;
77 return kNewFragment; 77 return kNewFragment;
78 } 78 }
79 79
80 bool NGInlineLayoutAlgorithm::LayoutCurrentChild() { 80 bool NGInlineLayoutAlgorithm::LayoutCurrentChild() {
81 return current_child_->LayoutInline(space_for_current_child_, line_builder_); 81 return current_child_->LayoutInline(space_for_current_child_, line_builder_);
(...skipping 15 matching lines...) Expand all
97 visitor->trace(first_child_); 97 visitor->trace(first_child_);
98 visitor->trace(constraint_space_); 98 visitor->trace(constraint_space_);
99 visitor->trace(break_token_); 99 visitor->trace(break_token_);
100 visitor->trace(builder_); 100 visitor->trace(builder_);
101 visitor->trace(space_for_current_child_); 101 visitor->trace(space_for_current_child_);
102 visitor->trace(current_child_); 102 visitor->trace(current_child_);
103 visitor->trace(line_builder_); 103 visitor->trace(line_builder_);
104 } 104 }
105 105
106 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698