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