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_units.h" | 9 #include "core/layout/ng/ng_units.h" |
10 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.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 ComputedStyle; |
16 class LayoutObject; | 17 class LayoutObject; |
17 class NGBreakToken; | 18 class NGBreakToken; |
18 | 19 |
19 // The NGPhysicalFragment contains the output geometry from layout. The | 20 // The NGPhysicalFragment contains the output geometry from layout. The |
20 // 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 |
21 // use by paint, hit-testing etc. | 22 // use by paint, hit-testing etc. |
22 // | 23 // |
23 // The fragment keeps a pointer back to the LayoutObject which generated it. | 24 // The fragment keeps a pointer back to the LayoutObject which generated it. |
24 // Once we have transitioned fully to LayoutNG it should be a const pointer | 25 // Once we have transitioned fully to LayoutNG it should be a const pointer |
25 // such that paint/hit-testing/etc don't modify it. | 26 // such that paint/hit-testing/etc don't modify it. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 72 |
72 // Should only be used by the parent fragement's layout. | 73 // Should only be used by the parent fragement's layout. |
73 void SetOffset(NGPhysicalOffset offset) { | 74 void SetOffset(NGPhysicalOffset offset) { |
74 DCHECK(!is_placed_); | 75 DCHECK(!is_placed_); |
75 offset_ = offset; | 76 offset_ = offset; |
76 is_placed_ = true; | 77 is_placed_ = true; |
77 } | 78 } |
78 | 79 |
79 NGBreakToken* BreakToken() const { return break_token_; } | 80 NGBreakToken* BreakToken() const { return break_token_; } |
80 | 81 |
| 82 const ComputedStyle& Style() const; |
| 83 |
| 84 // GetLayoutObject should only be used when necessary for compatibility |
| 85 // with LegacyLayout. |
81 LayoutObject* GetLayoutObject() const { return layout_object_; } | 86 LayoutObject* GetLayoutObject() const { return layout_object_; } |
82 | 87 |
83 bool IsPlaced() const { return is_placed_; } | 88 bool IsPlaced() const { return is_placed_; } |
84 | 89 |
85 protected: | 90 protected: |
86 NGPhysicalFragment(LayoutObject* layout_object, | 91 NGPhysicalFragment(LayoutObject* layout_object, |
87 NGPhysicalSize size, | 92 NGPhysicalSize size, |
88 NGPhysicalSize overflow, | 93 NGPhysicalSize overflow, |
89 NGFragmentType type, | 94 NGFragmentType type, |
90 NGBreakToken* break_token = nullptr); | 95 NGBreakToken* break_token = nullptr); |
91 | 96 |
92 LayoutObject* layout_object_; | 97 LayoutObject* layout_object_; |
93 NGPhysicalSize size_; | 98 NGPhysicalSize size_; |
94 NGPhysicalSize overflow_; | 99 NGPhysicalSize overflow_; |
95 NGPhysicalOffset offset_; | 100 NGPhysicalOffset offset_; |
96 Persistent<NGBreakToken> break_token_; | 101 Persistent<NGBreakToken> break_token_; |
97 | 102 |
98 unsigned type_ : 1; | 103 unsigned type_ : 1; |
99 unsigned is_placed_ : 1; | 104 unsigned is_placed_ : 1; |
100 | 105 |
101 private: | 106 private: |
102 void destroy() const; | 107 void destroy() const; |
103 }; | 108 }; |
104 | 109 |
105 } // namespace blink | 110 } // namespace blink |
106 | 111 |
107 #endif // NGPhysicalFragment_h | 112 #endif // NGPhysicalFragment_h |
OLD | NEW |