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/ng_units.h" | 5 #include "core/layout/ng/ng_units.h" |
6 | 6 |
7 #include "core/layout/ng/ng_writing_mode.h" | 7 #include "core/layout/ng/ng_writing_mode.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 result.inline_offset = this->inline_offset + other.inline_offset; | 100 result.inline_offset = this->inline_offset + other.inline_offset; |
101 result.block_offset = this->block_offset + other.block_offset; | 101 result.block_offset = this->block_offset + other.block_offset; |
102 return result; | 102 return result; |
103 } | 103 } |
104 | 104 |
105 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { | 105 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { |
106 *this = *this + other; | 106 *this = *this + other; |
107 return *this; | 107 return *this; |
108 } | 108 } |
109 | 109 |
| 110 bool NGLogicalOffset::operator>(const NGLogicalOffset& other) const { |
| 111 return inline_offset > other.inline_offset && |
| 112 block_offset > other.block_offset; |
| 113 } |
| 114 |
| 115 bool NGLogicalOffset::operator>=(const NGLogicalOffset& other) const { |
| 116 return inline_offset >= other.inline_offset && |
| 117 block_offset >= other.block_offset; |
| 118 } |
| 119 |
| 120 bool NGLogicalOffset::operator<(const NGLogicalOffset& other) const { |
| 121 return inline_offset < other.inline_offset && |
| 122 block_offset < other.block_offset; |
| 123 } |
| 124 |
| 125 bool NGLogicalOffset::operator<=(const NGLogicalOffset& other) const { |
| 126 return inline_offset <= other.inline_offset && |
| 127 block_offset <= other.block_offset; |
| 128 } |
| 129 |
| 130 String NGLogicalOffset::ToString() const { |
| 131 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt()); |
| 132 } |
| 133 |
110 bool NGBoxStrut::IsEmpty() const { | 134 bool NGBoxStrut::IsEmpty() const { |
111 return *this == NGBoxStrut(); | 135 return *this == NGBoxStrut(); |
112 } | 136 } |
113 | 137 |
114 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { | 138 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
115 return std::tie(other.inline_start, other.inline_end, other.block_start, | 139 return std::tie(other.inline_start, other.inline_end, other.block_start, |
116 other.block_end) == | 140 other.block_end) == |
117 std::tie(inline_start, inline_end, block_start, block_end); | 141 std::tie(inline_start, inline_end, block_start, block_end); |
118 } | 142 } |
119 | 143 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 192 |
169 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 193 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
170 return std::tie(other.margin_block_start, other.margin_block_end, | 194 return std::tie(other.margin_block_start, other.margin_block_end, |
171 other.negative_margin_block_start, | 195 other.negative_margin_block_start, |
172 other.negative_margin_block_end) == | 196 other.negative_margin_block_end) == |
173 std::tie(margin_block_start, margin_block_end, | 197 std::tie(margin_block_start, margin_block_end, |
174 negative_margin_block_start, negative_margin_block_end); | 198 negative_margin_block_start, negative_margin_block_end); |
175 } | 199 } |
176 | 200 |
177 } // namespace blink | 201 } // namespace blink |
OLD | NEW |