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/geometry/ng_border_edges.h" | 9 #include "core/layout/ng/geometry/ng_border_edges.h" |
10 #include "core/layout/ng/geometry/ng_box_strut.h" | 10 #include "core/layout/ng/geometry/ng_box_strut.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 bool IsText() const { return Type() == NGFragmentType::kFragmentText; } | 47 bool IsText() const { return Type() == NGFragmentType::kFragmentText; } |
48 bool IsLineBox() const { return Type() == NGFragmentType::kFragmentLineBox; } | 48 bool IsLineBox() const { return Type() == NGFragmentType::kFragmentLineBox; } |
49 | 49 |
50 // The accessors in this class shouldn't be used by layout code directly, | 50 // The accessors in this class shouldn't be used by layout code directly, |
51 // instead should be accessed by the NGFragmentBase classes. These accessors | 51 // instead should be accessed by the NGFragmentBase classes. These accessors |
52 // exist for paint, hit-testing, etc. | 52 // exist for paint, hit-testing, etc. |
53 | 53 |
54 // Returns the border-box size. | 54 // Returns the border-box size. |
55 NGPhysicalSize Size() const { return size_; } | 55 NGPhysicalSize Size() const { return size_; } |
56 | 56 |
57 // Bitmask for border edges, see NGPaintBorderEdge. | 57 // Bitmask for border edges, see NGBorderEdges::Physical. |
58 NGBorderEdges::Physical BorderEdges() const { | 58 unsigned BorderEdges() const { return border_edge_; } |
59 return static_cast<NGBorderEdges::Physical>(border_edge_); | |
60 } | |
61 NGPixelSnappedPhysicalBoxStrut BorderWidths() const; | 59 NGPixelSnappedPhysicalBoxStrut BorderWidths() const; |
62 | 60 |
63 // Returns the offset relative to the parent fragment's content-box. | 61 // Returns the offset relative to the parent fragment's content-box. |
64 NGPhysicalOffset Offset() const { | 62 NGPhysicalOffset Offset() const { |
65 DCHECK(is_placed_); | 63 DCHECK(is_placed_); |
66 return offset_; | 64 return offset_; |
67 } | 65 } |
68 | 66 |
69 NGBreakToken* BreakToken() const { return break_token_.Get(); } | 67 NGBreakToken* BreakToken() const { return break_token_.Get(); } |
70 const ComputedStyle& Style() const; | 68 const ComputedStyle& Style() const; |
(...skipping 26 matching lines...) Expand all Loading... |
97 NGFragmentType type, | 95 NGFragmentType type, |
98 RefPtr<NGBreakToken> break_token = nullptr); | 96 RefPtr<NGBreakToken> break_token = nullptr); |
99 | 97 |
100 LayoutObject* layout_object_; | 98 LayoutObject* layout_object_; |
101 NGPhysicalSize size_; | 99 NGPhysicalSize size_; |
102 NGPhysicalOffset offset_; | 100 NGPhysicalOffset offset_; |
103 RefPtr<NGBreakToken> break_token_; | 101 RefPtr<NGBreakToken> break_token_; |
104 | 102 |
105 unsigned type_ : 2; // NGFragmentType | 103 unsigned type_ : 2; // NGFragmentType |
106 unsigned is_placed_ : 1; | 104 unsigned is_placed_ : 1; |
107 unsigned border_edge_ : 4; // NGPhysicalBorderEdges | 105 unsigned border_edge_ : 4; // NGBorderEdges::Physical |
108 | 106 |
109 private: | 107 private: |
110 void Destroy() const; | 108 void Destroy() const; |
111 }; | 109 }; |
112 | 110 |
113 } // namespace blink | 111 } // namespace blink |
114 | 112 |
115 #endif // NGPhysicalFragment_h | 113 #endif // NGPhysicalFragment_h |
OLD | NEW |