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 NGPhysicalFragmentBase_h | 5 #ifndef NGPhysicalFragmentBase_h |
6 #define NGPhysicalFragmentBase_h | 6 #define NGPhysicalFragmentBase_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_break_token.h" | 9 #include "core/layout/ng/ng_break_token.h" |
10 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
11 #include "core/layout/ng/ng_units.h" | 11 #include "core/layout/ng/ng_units.h" |
12 #include "platform/LayoutUnit.h" | 12 #include "platform/LayoutUnit.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
| 18 class NGBlockNode; |
| 19 |
18 // The NGPhysicalFragmentBase contains the output information from layout. The | 20 // The NGPhysicalFragmentBase contains the output information from layout. The |
19 // fragment stores all of its information in the physical coordinate system for | 21 // fragment stores all of its information in the physical coordinate system for |
20 // use by paint, hit-testing etc. | 22 // use by paint, hit-testing etc. |
21 // | 23 // |
22 // Layout code should only access output layout information through the | 24 // Layout code should only access output layout information through the |
23 // NGFragmentBase classes which transforms information into the logical | 25 // NGFragmentBase classes which transforms information into the logical |
24 // coordinate system. | 26 // coordinate system. |
25 class CORE_EXPORT NGPhysicalFragmentBase | 27 class CORE_EXPORT NGPhysicalFragmentBase |
26 : public GarbageCollectedFinalized<NGPhysicalFragmentBase> { | 28 : public GarbageCollectedFinalized<NGPhysicalFragmentBase> { |
27 public: | 29 public: |
(...skipping 25 matching lines...) Expand all Loading... |
53 return offset_.top; | 55 return offset_.top; |
54 } | 56 } |
55 | 57 |
56 // Should only be used by the parent fragement's layout. | 58 // Should only be used by the parent fragement's layout. |
57 void SetOffset(NGPhysicalOffset offset) { | 59 void SetOffset(NGPhysicalOffset offset) { |
58 DCHECK(!has_been_placed_); | 60 DCHECK(!has_been_placed_); |
59 offset_ = offset; | 61 offset_ = offset; |
60 has_been_placed_ = true; | 62 has_been_placed_ = true; |
61 } | 63 } |
62 | 64 |
63 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { visitor->trace(break_token_); } | 65 const HeapLinkedHashSet<WeakMember<NGBlockNode>>& OutOfFlowDescendants() |
| 66 const { |
| 67 return out_of_flow_descendants_; |
| 68 } |
| 69 |
| 70 const Vector<NGStaticPosition>& OutOfFlowPositions() const { |
| 71 return out_of_flow_positions_; |
| 72 } |
| 73 |
| 74 DECLARE_TRACE_AFTER_DISPATCH(); |
64 DECLARE_TRACE(); | 75 DECLARE_TRACE(); |
65 | 76 |
66 void finalizeGarbageCollectedObject(); | 77 void finalizeGarbageCollectedObject(); |
67 | 78 |
68 protected: | 79 protected: |
69 NGPhysicalFragmentBase(NGPhysicalSize size, | 80 NGPhysicalFragmentBase( |
70 NGPhysicalSize overflow, | 81 NGPhysicalSize size, |
71 NGFragmentType type, | 82 NGPhysicalSize overflow, |
72 NGBreakToken* break_token = nullptr) | 83 NGFragmentType type, |
73 : size_(size), | 84 HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants, |
74 overflow_(overflow), | 85 Vector<NGStaticPosition> out_of_flow_positions, |
75 break_token_(break_token), | 86 NGBreakToken* break_token = nullptr); |
76 type_(type), | |
77 has_been_placed_(false) {} | |
78 | 87 |
79 NGPhysicalSize size_; | 88 NGPhysicalSize size_; |
80 NGPhysicalSize overflow_; | 89 NGPhysicalSize overflow_; |
81 NGPhysicalOffset offset_; | 90 NGPhysicalOffset offset_; |
82 Member<NGBreakToken> break_token_; | 91 Member<NGBreakToken> break_token_; |
| 92 HeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_; |
| 93 Vector<NGStaticPosition> out_of_flow_positions_; |
83 | 94 |
84 unsigned type_ : 1; | 95 unsigned type_ : 1; |
85 unsigned has_been_placed_ : 1; | 96 unsigned has_been_placed_ : 1; |
86 }; | 97 }; |
87 | 98 |
88 } // namespace blink | 99 } // namespace blink |
89 | 100 |
90 #endif // NGFragmentBase_h | 101 #endif // NGFragmentBase_h |
OLD | NEW |