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 NGUnits_h | 5 #ifndef NGUnits_h |
6 #define NGUnits_h | 6 #define NGUnits_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_direction.h" | 9 #include "core/layout/ng/ng_direction.h" |
10 #include "core/layout/ng/ng_writing_mode.h" | 10 #include "core/layout/ng/ng_writing_mode.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Converts a logical offset to a physical offset. See: | 42 // Converts a logical offset to a physical offset. See: |
43 // https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical | 43 // https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical |
44 // @param container_size the size of the rect (typically a fragment). | 44 // @param container_size the size of the rect (typically a fragment). |
45 // @param inner_size the size of the inner rect (typically a child fragment). | 45 // @param inner_size the size of the inner rect (typically a child fragment). |
46 CORE_EXPORT NGPhysicalOffset | 46 CORE_EXPORT NGPhysicalOffset |
47 ConvertToPhysical(NGWritingMode mode, | 47 ConvertToPhysical(NGWritingMode mode, |
48 NGDirection direction, | 48 NGDirection direction, |
49 NGPhysicalSize container_size, | 49 NGPhysicalSize container_size, |
50 NGPhysicalSize inner_size) const; | 50 NGPhysicalSize inner_size) const; |
51 bool operator==(const NGLogicalOffset& other) const; | 51 bool operator==(const NGLogicalOffset& other) const; |
52 }; | |
53 | 52 |
54 // Origin (in logical coordinates) for a fragment or inline content. | 53 NGLogicalOffset operator+(const NGLogicalOffset& other) const; |
55 struct NGLogicalOrigin { | |
56 LayoutUnit inline_offset; | |
57 LayoutUnit block_offset; | |
58 }; | |
59 | 54 |
60 // Leader point (in logical coordinates) for a text fragment. | 55 NGLogicalOffset& operator+=(const NGLogicalOffset& other); |
61 struct NGLogicalLeader { | |
62 LayoutUnit inline_offset; | |
63 LayoutUnit block_offset; | |
64 }; | 56 }; |
65 | 57 |
66 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to | 58 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to |
67 // its parent rect in the physical coordinate system. | 59 // its parent rect in the physical coordinate system. |
68 struct NGPhysicalOffset { | 60 struct NGPhysicalOffset { |
69 NGPhysicalOffset() {} | 61 NGPhysicalOffset() {} |
70 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} | 62 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} |
71 | 63 |
72 LayoutUnit left; | 64 LayoutUnit left; |
73 LayoutUnit top; | 65 LayoutUnit top; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 191 |
200 // Struct to represent a simple edge that has start and end. | 192 // Struct to represent a simple edge that has start and end. |
201 struct NGEdge { | 193 struct NGEdge { |
202 LayoutUnit start; | 194 LayoutUnit start; |
203 LayoutUnit end; | 195 LayoutUnit end; |
204 }; | 196 }; |
205 | 197 |
206 } // namespace blink | 198 } // namespace blink |
207 | 199 |
208 #endif // NGUnits_h | 200 #endif // NGUnits_h |
OLD | NEW |