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 NGPhysicalFragment_h | 5 #ifndef NGPhysicalFragment_h |
6 #define NGPhysicalFragment_h | 6 #define NGPhysicalFragment_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_physical_fragment_base.h" | 9 #include "core/layout/ng/ng_physical_fragment_base.h" |
10 #include "core/layout/ng/ng_units.h" | 10 #include "core/layout/ng/ng_units.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/Vector.h" | |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 | 14 |
16 class CORE_EXPORT NGPhysicalFragment final : public NGPhysicalFragmentBase { | 15 class CORE_EXPORT NGPhysicalFragment final : public NGPhysicalFragmentBase { |
17 public: | 16 public: |
18 // This modifies the passed-in children vector. | 17 // This modifies the passed-in children vector. |
19 NGPhysicalFragment(NGPhysicalSize size, | 18 NGPhysicalFragment(NGPhysicalSize size, |
20 NGPhysicalSize overflow, | 19 NGPhysicalSize overflow, |
21 HeapVector<Member<const NGPhysicalFragmentBase>>& children, | 20 HeapVector<Member<const NGPhysicalFragmentBase>>& children, |
22 NGMarginStrut margin_strut) | 21 NGMarginStrut margin_strut); |
23 : NGPhysicalFragmentBase(size, overflow, FragmentBox), | |
24 margin_strut_(margin_strut) { | |
25 children_.swap(children); | |
26 } | |
27 | 22 |
28 const HeapVector<Member<const NGPhysicalFragmentBase>>& Children() const { | 23 const HeapVector<Member<const NGPhysicalFragmentBase>>& Children() const { |
29 return children_; | 24 return children_; |
30 } | 25 } |
31 | 26 |
32 NGMarginStrut MarginStrut() const { return margin_strut_; } | 27 NGMarginStrut MarginStrut() const { return margin_strut_; } |
33 | 28 |
34 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 29 DECLARE_TRACE_AFTER_DISPATCH(); |
35 visitor->trace(children_); | |
36 NGPhysicalFragmentBase::traceAfterDispatch(visitor); | |
37 } | |
38 | 30 |
39 private: | 31 private: |
40 HeapVector<Member<const NGPhysicalFragmentBase>> children_; | 32 HeapVector<Member<const NGPhysicalFragmentBase>> children_; |
41 | 33 |
42 NGMarginStrut margin_strut_; | 34 NGMarginStrut margin_strut_; |
43 }; | 35 }; |
44 | 36 |
45 WILL_NOT_BE_EAGERLY_TRACED_CLASS(NGPhysicalFragment); | 37 WILL_NOT_BE_EAGERLY_TRACED_CLASS(NGPhysicalFragment); |
46 | 38 |
47 DEFINE_TYPE_CASTS(NGPhysicalFragment, | 39 DEFINE_TYPE_CASTS(NGPhysicalFragment, |
48 NGPhysicalFragmentBase, | 40 NGPhysicalFragmentBase, |
49 fragment, | 41 fragment, |
50 fragment->Type() == NGPhysicalFragmentBase::FragmentBox, | 42 fragment->Type() == NGPhysicalFragmentBase::FragmentBox, |
51 fragment.Type() == NGPhysicalFragmentBase::FragmentBox); | 43 fragment.Type() == NGPhysicalFragmentBase::FragmentBox); |
52 | 44 |
53 } // namespace blink | 45 } // namespace blink |
54 | 46 |
55 #endif // NGPhysicalFragment_h | 47 #endif // NGPhysicalFragment_h |
OLD | NEW |