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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 116 bool operator==(const NGPhysicalOffset& other) const; |
117 | 117 |
118 String ToString() const { | 118 String ToString() const { |
119 return String::format("%dx%d", left.toInt(), top.toInt()); | 119 return String::format("%dx%d", left.toInt(), top.toInt()); |
120 } | 120 } |
121 }; | 121 }; |
122 | 122 |
| 123 CORE_EXPORT inline std::ostream& operator<<(std::ostream& os, |
| 124 const NGPhysicalOffset& value) { |
| 125 return os << value.ToString(); |
| 126 } |
| 127 |
123 struct CORE_EXPORT NGPhysicalSize { | 128 struct CORE_EXPORT NGPhysicalSize { |
124 NGPhysicalSize() {} | 129 NGPhysicalSize() {} |
125 NGPhysicalSize(LayoutUnit width, LayoutUnit height) | 130 NGPhysicalSize(LayoutUnit width, LayoutUnit height) |
126 : width(width), height(height) {} | 131 : width(width), height(height) {} |
127 | 132 |
128 LayoutUnit width; | 133 LayoutUnit width; |
129 LayoutUnit height; | 134 LayoutUnit height; |
130 | 135 |
131 NGLogicalSize ConvertToLogical(NGWritingMode mode) const; | 136 NGLogicalSize ConvertToLogical(NGWritingMode mode) const; |
132 | 137 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (position_matches) | 389 if (position_matches) |
385 return position; | 390 return position; |
386 else | 391 else |
387 return container_size - position - length - margin_start - margin_end; | 392 return container_size - position - length - margin_start - margin_end; |
388 } | 393 } |
389 }; | 394 }; |
390 | 395 |
391 } // namespace blink | 396 } // namespace blink |
392 | 397 |
393 #endif // NGUnits_h | 398 #endif // NGUnits_h |
OLD | NEW |