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 #include "core/layout/ng/geometry/ng_physical_size.h" | 5 #include "core/layout/ng/geometry/ng_physical_size.h" |
6 | 6 |
7 #include "core/layout/ng/geometry/ng_logical_size.h" | 7 #include "core/layout/ng/geometry/ng_logical_size.h" |
8 #include "wtf/text/WTFString.h" | 8 #include "platform/wtf/text/WTFString.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 bool NGPhysicalSize::operator==(const NGPhysicalSize& other) const { | 12 bool NGPhysicalSize::operator==(const NGPhysicalSize& other) const { |
13 return std::tie(other.width, other.height) == std::tie(width, height); | 13 return std::tie(other.width, other.height) == std::tie(width, height); |
14 } | 14 } |
15 | 15 |
16 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const { | 16 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const { |
17 return mode == kHorizontalTopBottom ? NGLogicalSize(width, height) | 17 return mode == kHorizontalTopBottom ? NGLogicalSize(width, height) |
18 : NGLogicalSize(height, width); | 18 : NGLogicalSize(height, width); |
19 } | 19 } |
20 | 20 |
21 String NGPhysicalSize::ToString() const { | 21 String NGPhysicalSize::ToString() const { |
22 return String::Format("%dx%d", width.ToInt(), height.ToInt()); | 22 return String::Format("%dx%d", width.ToInt(), height.ToInt()); |
23 } | 23 } |
24 | 24 |
25 std::ostream& operator<<(std::ostream& os, const NGPhysicalSize& value) { | 25 std::ostream& operator<<(std::ostream& os, const NGPhysicalSize& value) { |
26 return os << value.ToString(); | 26 return os << value.ToString(); |
27 } | 27 } |
28 | 28 |
29 } // namespace blink | 29 } // namespace blink |
OLD | NEW |