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_writing_mode.h" | 9 #include "core/layout/ng/ng_writing_mode.h" |
10 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 String ToString() const; | 93 String ToString() const; |
94 }; | 94 }; |
95 | 95 |
96 CORE_EXPORT inline std::ostream& operator<<(std::ostream& os, | 96 CORE_EXPORT inline std::ostream& operator<<(std::ostream& os, |
97 const NGLogicalOffset& value) { | 97 const NGLogicalOffset& value) { |
98 return os << value.ToString(); | 98 return os << value.ToString(); |
99 } | 99 } |
100 | 100 |
101 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to | 101 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to |
102 // its parent rect in the physical coordinate system. | 102 // its parent rect in the physical coordinate system. |
103 struct NGPhysicalOffset { | 103 struct CORE_EXPORT NGPhysicalOffset { |
104 NGPhysicalOffset() {} | 104 NGPhysicalOffset() {} |
105 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} | 105 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} |
106 | 106 |
107 LayoutUnit left; | 107 LayoutUnit left; |
108 LayoutUnit top; | 108 LayoutUnit top; |
109 | 109 |
110 NGPhysicalOffset operator+(const NGPhysicalOffset& other) const; | 110 NGPhysicalOffset operator+(const NGPhysicalOffset& other) const; |
111 NGPhysicalOffset& operator+=(const NGPhysicalOffset& other); | 111 NGPhysicalOffset& operator+=(const NGPhysicalOffset& other); |
112 | 112 |
113 NGPhysicalOffset operator-(const NGPhysicalOffset& other) const; | 113 NGPhysicalOffset operator-(const NGPhysicalOffset& other) const; |
114 NGPhysicalOffset& operator-=(const NGPhysicalOffset& other); | 114 NGPhysicalOffset& operator-=(const NGPhysicalOffset& other); |
115 | 115 |
| 116 bool operator==(const NGPhysicalOffset& other) const; |
| 117 |
116 String ToString() const { | 118 String ToString() const { |
117 return String::format("%dx%d", left.toInt(), top.toInt()); | 119 return String::format("%dx%d", left.toInt(), top.toInt()); |
118 } | 120 } |
119 }; | 121 }; |
120 | 122 |
121 struct CORE_EXPORT NGPhysicalSize { | 123 struct CORE_EXPORT NGPhysicalSize { |
122 NGPhysicalSize() {} | 124 NGPhysicalSize() {} |
123 NGPhysicalSize(LayoutUnit width, LayoutUnit height) | 125 NGPhysicalSize(LayoutUnit width, LayoutUnit height) |
124 : width(width), height(height) {} | 126 : width(width), height(height) {} |
125 | 127 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (position_matches) | 384 if (position_matches) |
383 return position; | 385 return position; |
384 else | 386 else |
385 return container_size - position - length - margin_start - margin_end; | 387 return container_size - position - length - margin_start - margin_end; |
386 } | 388 } |
387 }; | 389 }; |
388 | 390 |
389 } // namespace blink | 391 } // namespace blink |
390 | 392 |
391 #endif // NGUnits_h | 393 #endif // NGUnits_h |
OLD | NEW |