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_fragment.h" | 8 #include "core/layout/ng/ng_fragment.h" |
9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_units.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT NGFragmentBuilder final { | 13 class CORE_EXPORT NGFragmentBuilder final |
| 14 : public GarbageCollected<NGFragmentBuilder> { |
14 public: | 15 public: |
15 NGFragmentBuilder(NGFragmentBase::NGFragmentType); | 16 NGFragmentBuilder(NGFragmentBase::NGFragmentType); |
16 | 17 |
17 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 18 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
18 NGFragmentBuilder& SetDirection(NGDirection); | 19 NGFragmentBuilder& SetDirection(NGDirection); |
19 | 20 |
20 NGFragmentBuilder& SetInlineSize(LayoutUnit); | 21 NGFragmentBuilder& SetInlineSize(LayoutUnit); |
21 NGFragmentBuilder& SetBlockSize(LayoutUnit); | 22 NGFragmentBuilder& SetBlockSize(LayoutUnit); |
22 | 23 |
23 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); | 24 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); |
24 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); | 25 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); |
25 | 26 |
26 NGFragmentBuilder& AddChild(const NGFragment*); | 27 NGFragmentBuilder& AddChild(const NGFragment*); |
27 | 28 |
28 // Offsets are not supposed to be set during fragment construction, so we | 29 // Offsets are not supposed to be set during fragment construction, so we |
29 // do not provide a setter here. | 30 // do not provide a setter here. |
30 | 31 |
31 // Creates the fragment. Can only be called once. | 32 // Creates the fragment. Can only be called once. |
32 NGFragment* ToFragment(); | 33 NGFragment* ToFragment(); |
33 | 34 |
| 35 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(children_); } |
| 36 |
34 private: | 37 private: |
35 NGFragmentBase::NGFragmentType type_; | 38 NGFragmentBase::NGFragmentType type_; |
36 NGWritingMode writing_mode_; | 39 NGWritingMode writing_mode_; |
37 NGDirection direction_; | 40 NGDirection direction_; |
38 | 41 |
39 NGLogicalSize size_; | 42 NGLogicalSize size_; |
40 NGLogicalSize overflow_; | 43 NGLogicalSize overflow_; |
41 | 44 |
42 PersistentHeapVector<Member<const NGFragmentBase>> children_; | 45 HeapVector<Member<const NGFragmentBase>> children_; |
43 }; | 46 }; |
44 | 47 |
45 } // namespace blink | 48 } // namespace blink |
46 | 49 |
47 #endif // NGFragmentBuilder | 50 #endif // NGFragmentBuilder |
OLD | NEW |