OLD | NEW |
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 NGPhysicalBoxFragment; | 16 class NGLayoutResult; |
17 class NGPhysicalTextFragment; | 17 class NGPhysicalTextFragment; |
18 | 18 |
19 class CORE_EXPORT NGFragmentBuilder final { | 19 class CORE_EXPORT NGFragmentBuilder final { |
20 public: | 20 public: |
21 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*); | 21 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*); |
22 | 22 |
23 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; | 23 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; |
24 | 24 |
25 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 25 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
26 NGFragmentBuilder& SetDirection(TextDirection); | 26 NGFragmentBuilder& SetDirection(TextDirection); |
27 | 27 |
28 NGFragmentBuilder& SetInlineSize(LayoutUnit); | 28 NGFragmentBuilder& SetInlineSize(LayoutUnit); |
29 NGFragmentBuilder& SetBlockSize(LayoutUnit); | 29 NGFragmentBuilder& SetBlockSize(LayoutUnit); |
30 NGLogicalSize Size() const { return size_; } | 30 NGLogicalSize Size() const { return size_; } |
31 | 31 |
32 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); | 32 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); |
33 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); | 33 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); |
34 | 34 |
| 35 NGFragmentBuilder& AddChild(RefPtr<NGLayoutResult>, const NGLogicalOffset&); |
35 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, | 36 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
36 const NGLogicalOffset&); | 37 const NGLogicalOffset&); |
37 NGFragmentBuilder& AddFloatingObject(NGFloatingObject*, | 38 NGFragmentBuilder& AddFloatingObject(NGFloatingObject*, |
38 const NGLogicalOffset&); | 39 const NGLogicalOffset&); |
39 | 40 |
40 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); | 41 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); |
41 | 42 |
42 NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object); | 43 NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object); |
43 | 44 |
44 // Builder has non-trivial out-of-flow descendant methods. | 45 // Builder has non-trivial out-of-flow descendant methods. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 83 |
83 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) { | 84 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) { |
84 end_margin_strut_ = from; | 85 end_margin_strut_ = from; |
85 return *this; | 86 return *this; |
86 } | 87 } |
87 | 88 |
88 // Offsets are not supposed to be set during fragment construction, so we | 89 // Offsets are not supposed to be set during fragment construction, so we |
89 // do not provide a setter here. | 90 // do not provide a setter here. |
90 | 91 |
91 // Creates the fragment. Can only be called once. | 92 // Creates the fragment. Can only be called once. |
92 RefPtr<NGPhysicalBoxFragment> ToBoxFragment(); | 93 RefPtr<NGLayoutResult> ToBoxFragment(); |
93 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, | 94 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, |
94 unsigned start_offset, | 95 unsigned start_offset, |
95 unsigned end_offset); | 96 unsigned end_offset); |
96 | 97 |
97 // Mutable list of floats that need to be positioned. | 98 // Mutable list of floats that need to be positioned. |
98 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { | 99 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { |
99 return unpositioned_floats_; | 100 return unpositioned_floats_; |
100 } | 101 } |
101 | 102 |
102 // List of floats that need to be positioned. | 103 // List of floats that need to be positioned. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 155 |
155 Persistent<NGBreakToken> break_token_; | 156 Persistent<NGBreakToken> break_token_; |
156 | 157 |
157 WTF::Optional<NGLogicalOffset> bfc_offset_; | 158 WTF::Optional<NGLogicalOffset> bfc_offset_; |
158 NGMarginStrut end_margin_strut_; | 159 NGMarginStrut end_margin_strut_; |
159 }; | 160 }; |
160 | 161 |
161 } // namespace blink | 162 } // namespace blink |
162 | 163 |
163 #endif // NGFragmentBuilder | 164 #endif // NGFragmentBuilder |
OLD | NEW |