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 // The NGPhysicalFragmentBase contains the output information from layout. The | 18 // The NGPhysicalFragmentBase contains the output information from layout. The |
19 // fragment stores all of its information in the physical coordinate system for | 19 // fragment stores all of its information in the physical coordinate system for |
20 // use by paint, hit-testing etc. | 20 // use by paint, hit-testing etc. |
21 // | 21 // |
22 // Layout code should only access output layout information through the | 22 // Layout code should only access output layout information through the |
23 // NGFragmentBase classes which transforms information into the logical | 23 // NGFragmentBase classes which transforms information into the logical |
24 // coordinate system. | 24 // coordinate system. |
25 class CORE_EXPORT NGPhysicalFragmentBase | 25 class CORE_EXPORT NGPhysicalFragmentBase |
26 : public GarbageCollected<NGPhysicalFragmentBase> { | 26 : public GarbageCollectedFinalized<NGPhysicalFragmentBase> { |
27 public: | 27 public: |
28 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; | 28 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; |
29 | 29 |
30 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } | 30 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } |
31 | 31 |
32 // The accessors in this class shouldn't be used by layout code directly, | 32 // The accessors in this class shouldn't be used by layout code directly, |
33 // instead should be accessed by the NGFragmentBase classes. These accessors | 33 // instead should be accessed by the NGFragmentBase classes. These accessors |
34 // exist for paint, hit-testing, etc. | 34 // exist for paint, hit-testing, etc. |
35 | 35 |
36 // Returns the border-box size. | 36 // Returns the border-box size. |
(...skipping 19 matching lines...) Expand all Loading... |
56 // Should only be used by the parent fragement's layout. | 56 // Should only be used by the parent fragement's layout. |
57 void SetOffset(NGPhysicalOffset offset) { | 57 void SetOffset(NGPhysicalOffset offset) { |
58 DCHECK(!has_been_placed_); | 58 DCHECK(!has_been_placed_); |
59 offset_ = offset; | 59 offset_ = offset; |
60 has_been_placed_ = true; | 60 has_been_placed_ = true; |
61 } | 61 } |
62 | 62 |
63 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { visitor->trace(break_token_); } | 63 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { visitor->trace(break_token_); } |
64 DECLARE_TRACE(); | 64 DECLARE_TRACE(); |
65 | 65 |
| 66 void finalizeGarbageCollectedObject(); |
| 67 |
66 protected: | 68 protected: |
67 NGPhysicalFragmentBase(NGPhysicalSize size, | 69 NGPhysicalFragmentBase(NGPhysicalSize size, |
68 NGPhysicalSize overflow, | 70 NGPhysicalSize overflow, |
69 NGFragmentType type, | 71 NGFragmentType type, |
70 NGBreakToken* break_token = nullptr) | 72 NGBreakToken* break_token = nullptr) |
71 : size_(size), | 73 : size_(size), |
72 overflow_(overflow), | 74 overflow_(overflow), |
73 break_token_(break_token), | 75 break_token_(break_token), |
74 type_(type), | 76 type_(type), |
75 has_been_placed_(false) {} | 77 has_been_placed_(false) {} |
76 | 78 |
77 NGPhysicalSize size_; | 79 NGPhysicalSize size_; |
78 NGPhysicalSize overflow_; | 80 NGPhysicalSize overflow_; |
79 NGPhysicalOffset offset_; | 81 NGPhysicalOffset offset_; |
80 Member<NGBreakToken> break_token_; | 82 Member<NGBreakToken> break_token_; |
81 | 83 |
82 unsigned type_ : 1; | 84 unsigned type_ : 1; |
83 unsigned has_been_placed_ : 1; | 85 unsigned has_been_placed_ : 1; |
84 }; | 86 }; |
85 | 87 |
86 } // namespace blink | 88 } // namespace blink |
87 | 89 |
88 #endif // NGFragmentBase_h | 90 #endif // NGFragmentBase_h |
OLD | NEW |