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 NGLogicalSize_h | 5 #ifndef NGLogicalSize_h |
6 #define NGLogicalSize_h | 6 #define NGLogicalSize_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" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 struct NGPhysicalSize; | 14 struct NGPhysicalSize; |
| 15 #define NGSizeIndefinite LayoutUnit(-1) |
15 | 16 |
16 // NGLogicalSize is the size of rect (typically a fragment) in the logical | 17 // NGLogicalSize is the size of rect (typically a fragment) in the logical |
17 // coordinate system. | 18 // coordinate system. |
18 struct CORE_EXPORT NGLogicalSize { | 19 struct CORE_EXPORT NGLogicalSize { |
19 NGLogicalSize() {} | 20 NGLogicalSize() {} |
20 NGLogicalSize(LayoutUnit inline_size, LayoutUnit block_size) | 21 NGLogicalSize(LayoutUnit inline_size, LayoutUnit block_size) |
21 : inline_size(inline_size), block_size(block_size) {} | 22 : inline_size(inline_size), block_size(block_size) {} |
22 | 23 |
23 LayoutUnit inline_size; | 24 LayoutUnit inline_size; |
24 LayoutUnit block_size; | 25 LayoutUnit block_size; |
25 | 26 |
26 NGPhysicalSize ConvertToPhysical(NGWritingMode mode) const; | 27 NGPhysicalSize ConvertToPhysical(NGWritingMode mode) const; |
27 bool operator==(const NGLogicalSize& other) const; | 28 bool operator==(const NGLogicalSize& other) const; |
28 | 29 |
29 bool IsEmpty() const { | 30 bool IsEmpty() const { |
30 return inline_size == LayoutUnit() || block_size == LayoutUnit(); | 31 return inline_size == LayoutUnit() || block_size == LayoutUnit(); |
31 } | 32 } |
32 }; | 33 }; |
33 | 34 |
34 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGLogicalSize&); | 35 CORE_EXPORT std::ostream& operator<<(std::ostream&, const NGLogicalSize&); |
35 | 36 |
36 } // namespace blink | 37 } // namespace blink |
37 | 38 |
38 #endif // NGLogicalSize_h | 39 #endif // NGLogicalSize_h |
OLD | NEW |