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_logical_offset.h" | 5 #include "core/layout/ng/geometry/ng_logical_offset.h" |
6 | 6 |
7 #include "core/layout/ng/geometry/ng_physical_offset.h" | 7 #include "core/layout/ng/geometry/ng_physical_offset.h" |
8 #include "core/layout/ng/geometry/ng_physical_size.h" | 8 #include "core/layout/ng/geometry/ng_physical_size.h" |
9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ASSERT_NOT_REACHED(); | 49 ASSERT_NOT_REACHED(); |
50 return NGPhysicalOffset(); | 50 return NGPhysicalOffset(); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const { | 54 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const { |
55 return std::tie(other.inline_offset, other.block_offset) == | 55 return std::tie(other.inline_offset, other.block_offset) == |
56 std::tie(inline_offset, block_offset); | 56 std::tie(inline_offset, block_offset); |
57 } | 57 } |
58 | 58 |
| 59 bool NGLogicalOffset::operator!=(const NGLogicalOffset& other) const { |
| 60 return !operator==(other); |
| 61 } |
| 62 |
59 NGLogicalOffset NGLogicalOffset::operator+(const NGLogicalOffset& other) const { | 63 NGLogicalOffset NGLogicalOffset::operator+(const NGLogicalOffset& other) const { |
60 NGLogicalOffset result; | 64 NGLogicalOffset result; |
61 result.inline_offset = this->inline_offset + other.inline_offset; | 65 result.inline_offset = this->inline_offset + other.inline_offset; |
62 result.block_offset = this->block_offset + other.block_offset; | 66 result.block_offset = this->block_offset + other.block_offset; |
63 return result; | 67 return result; |
64 } | 68 } |
65 | 69 |
66 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { | 70 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { |
67 *this = *this + other; | 71 *this = *this + other; |
68 return *this; | 72 return *this; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 104 |
101 String NGLogicalOffset::ToString() const { | 105 String NGLogicalOffset::ToString() const { |
102 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt()); | 106 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt()); |
103 } | 107 } |
104 | 108 |
105 std::ostream& operator<<(std::ostream& os, const NGLogicalOffset& value) { | 109 std::ostream& operator<<(std::ostream& os, const NGLogicalOffset& value) { |
106 return os << value.ToString(); | 110 return os << value.ToString(); |
107 } | 111 } |
108 | 112 |
109 } // namespace blink | 113 } // namespace blink |
OLD | NEW |