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 #include "core/layout/ng/ng_physical_fragment.h" | 5 #include "core/layout/ng/ng_physical_fragment.h" |
6 | 6 |
| 7 #include "core/layout/ng/ng_break_token.h" |
| 8 #include "core/layout/ng/ng_physical_text_fragment.h" |
| 9 #include "core/layout/ng/ng_physical_box_fragment.h" |
| 10 |
7 namespace blink { | 11 namespace blink { |
8 | 12 |
9 NGPhysicalFragment::NGPhysicalFragment( | 13 NGPhysicalFragment::NGPhysicalFragment( |
10 NGPhysicalSize size, | 14 NGPhysicalSize size, |
11 NGPhysicalSize overflow, | 15 NGPhysicalSize overflow, |
12 HeapVector<Member<const NGPhysicalFragmentBase>>& children, | 16 NGFragmentType type, |
13 HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants, | 17 HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants, |
14 Vector<NGStaticPosition>& out_of_flow_positions, | 18 Vector<NGStaticPosition> out_of_flow_positions, |
15 NGMarginStrut margin_strut) | 19 NGBreakToken* break_token) |
16 : NGPhysicalFragmentBase(size, | 20 : size_(size), |
17 overflow, | 21 overflow_(overflow), |
18 kFragmentBox, | 22 break_token_(break_token), |
19 out_of_flow_descendants, | 23 type_(type), |
20 out_of_flow_positions), | 24 has_been_placed_(false) { |
21 margin_strut_(margin_strut) { | 25 out_of_flow_descendants_.swap(out_of_flow_descendants); |
22 children_.swap(children); | 26 out_of_flow_positions_.swap(out_of_flow_positions); |
| 27 } |
| 28 |
| 29 DEFINE_TRACE(NGPhysicalFragment) { |
| 30 if (Type() == kFragmentText) |
| 31 static_cast<NGPhysicalTextFragment*>(this)->traceAfterDispatch(visitor); |
| 32 else |
| 33 static_cast<NGPhysicalBoxFragment*>(this)->traceAfterDispatch(visitor); |
| 34 } |
| 35 |
| 36 void NGPhysicalFragment::finalizeGarbageCollectedObject() { |
| 37 if (Type() == kFragmentText) |
| 38 static_cast<NGPhysicalTextFragment*>(this)->~NGPhysicalTextFragment(); |
| 39 else |
| 40 static_cast<NGPhysicalBoxFragment*>(this)->~NGPhysicalBoxFragment(); |
23 } | 41 } |
24 | 42 |
25 DEFINE_TRACE_AFTER_DISPATCH(NGPhysicalFragment) { | 43 DEFINE_TRACE_AFTER_DISPATCH(NGPhysicalFragment) { |
26 visitor->trace(children_); | 44 visitor->trace(out_of_flow_descendants_); |
27 NGPhysicalFragmentBase::traceAfterDispatch(visitor); | 45 visitor->trace(break_token_); |
28 } | 46 } |
29 | 47 |
30 } // namespace blink | 48 } // namespace blink |
OLD | NEW |