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