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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h

Issue 2692403003: [LayoutNG] Make NGBlockLayoutAlgorithm accept a NGBlockNode. (Closed)
Patch Set: comments! 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
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 #ifndef NGFragmentBuilder_h 5 #ifndef NGFragmentBuilder_h
6 #define NGFragmentBuilder_h 6 #define NGFragmentBuilder_h
7 7
8 #include "core/layout/ng/ng_break_token.h" 8 #include "core/layout/ng/ng_break_token.h"
9 #include "core/layout/ng/ng_constraint_space.h" 9 #include "core/layout/ng/ng_constraint_space.h"
10 #include "core/layout/ng/ng_floating_object.h" 10 #include "core/layout/ng/ng_floating_object.h"
11 #include "core/layout/ng/ng_physical_fragment.h" 11 #include "core/layout/ng/ng_physical_fragment.h"
12 #include "core/layout/ng/ng_units.h" 12 #include "core/layout/ng/ng_units.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class NGInlineNode;
17 class NGPhysicalBoxFragment; 16 class NGPhysicalBoxFragment;
18 class NGPhysicalTextFragment; 17 class NGPhysicalTextFragment;
19 18
20 class CORE_EXPORT NGFragmentBuilder final { 19 class CORE_EXPORT NGFragmentBuilder final {
21 public: 20 public:
22 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, LayoutObject*); 21 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*);
23 22
24 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; 23 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>;
25 24
26 NGFragmentBuilder& SetWritingMode(NGWritingMode); 25 NGFragmentBuilder& SetWritingMode(NGWritingMode);
27 NGFragmentBuilder& SetDirection(TextDirection); 26 NGFragmentBuilder& SetDirection(TextDirection);
28 27
29 NGFragmentBuilder& SetInlineSize(LayoutUnit); 28 NGFragmentBuilder& SetInlineSize(LayoutUnit);
30 NGFragmentBuilder& SetBlockSize(LayoutUnit); 29 NGFragmentBuilder& SetBlockSize(LayoutUnit);
31 NGLogicalSize Size() const { return size_; } 30 NGLogicalSize Size() const { return size_; }
32 31
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) { 83 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) {
85 end_margin_strut_ = from; 84 end_margin_strut_ = from;
86 return *this; 85 return *this;
87 } 86 }
88 87
89 // Offsets are not supposed to be set during fragment construction, so we 88 // Offsets are not supposed to be set during fragment construction, so we
90 // do not provide a setter here. 89 // do not provide a setter here.
91 90
92 // Creates the fragment. Can only be called once. 91 // Creates the fragment. Can only be called once.
93 RefPtr<NGPhysicalBoxFragment> ToBoxFragment(); 92 RefPtr<NGPhysicalBoxFragment> ToBoxFragment();
94 RefPtr<NGPhysicalTextFragment> ToTextFragment(NGInlineNode*, 93 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index,
95 unsigned index,
96 unsigned start_offset, 94 unsigned start_offset,
97 unsigned end_offset); 95 unsigned end_offset);
98 96
99 // Mutable list of floats that need to be positioned. 97 // Mutable list of floats that need to be positioned.
100 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { 98 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() {
101 return unpositioned_floats_; 99 return unpositioned_floats_;
102 } 100 }
103 101
104 // List of floats that need to be positioned. 102 // List of floats that need to be positioned.
105 const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const { 103 const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const {
(...skipping 20 matching lines...) Expand all
126 // be computed until we know fragment's size. 124 // be computed until we know fragment's size.
127 struct OutOfFlowPlacement { 125 struct OutOfFlowPlacement {
128 NGLogicalOffset child_offset; 126 NGLogicalOffset child_offset;
129 NGStaticPosition descendant_position; 127 NGStaticPosition descendant_position;
130 }; 128 };
131 129
132 NGPhysicalFragment::NGFragmentType type_; 130 NGPhysicalFragment::NGFragmentType type_;
133 NGWritingMode writing_mode_; 131 NGWritingMode writing_mode_;
134 TextDirection direction_; 132 TextDirection direction_;
135 133
136 LayoutObject* layout_object_; 134 Persistent<NGLayoutInputNode> node_;
137 135
138 NGLogicalSize size_; 136 NGLogicalSize size_;
139 NGLogicalSize overflow_; 137 NGLogicalSize overflow_;
140 138
141 Vector<RefPtr<NGPhysicalFragment>> children_; 139 Vector<RefPtr<NGPhysicalFragment>> children_;
142 Vector<NGLogicalOffset> offsets_; 140 Vector<NGLogicalOffset> offsets_;
143 141
144 WeakBoxList out_of_flow_descendant_candidates_; 142 WeakBoxList out_of_flow_descendant_candidates_;
145 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_; 143 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_;
146 144
147 WeakBoxList out_of_flow_descendants_; 145 WeakBoxList out_of_flow_descendants_;
148 Vector<NGStaticPosition> out_of_flow_positions_; 146 Vector<NGStaticPosition> out_of_flow_positions_;
149 147
150 // Floats that need to be positioned by the next in-flow fragment that can 148 // Floats that need to be positioned by the next in-flow fragment that can
151 // determine its block position in space. 149 // determine its block position in space.
152 Vector<Persistent<NGFloatingObject>> unpositioned_floats_; 150 Vector<Persistent<NGFloatingObject>> unpositioned_floats_;
153 151
154 Vector<NGLogicalOffset> floating_object_offsets_; 152 Vector<NGLogicalOffset> floating_object_offsets_;
155 Vector<Persistent<NGFloatingObject>> positioned_floats_; 153 Vector<Persistent<NGFloatingObject>> positioned_floats_;
156 154
157 Persistent<NGBreakToken> break_token_; 155 Persistent<NGBreakToken> break_token_;
158 156
159 WTF::Optional<NGLogicalOffset> bfc_offset_; 157 WTF::Optional<NGLogicalOffset> bfc_offset_;
160 NGMarginStrut end_margin_strut_; 158 NGMarginStrut end_margin_strut_;
161 }; 159 };
162 160
163 } // namespace blink 161 } // namespace blink
164 162
165 #endif // NGFragmentBuilder 163 #endif // NGFragmentBuilder
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698