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 | |
134 bool NGBoxStrut::IsEmpty() const { | 110 bool NGBoxStrut::IsEmpty() const { |
135 return *this == NGBoxStrut(); | 111 return *this == NGBoxStrut(); |
136 } | 112 } |
137 | 113 |
138 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { | 114 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
139 return std::tie(other.inline_start, other.inline_end, other.block_start, | 115 return std::tie(other.inline_start, other.inline_end, other.block_start, |
140 other.block_end) == | 116 other.block_end) == |
141 std::tie(inline_start, inline_end, block_start, block_end); | 117 std::tie(inline_start, inline_end, block_start, block_end); |
142 } | 118 } |
143 | 119 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 168 |
193 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 169 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
194 return std::tie(other.margin_block_start, other.margin_block_end, | 170 return std::tie(other.margin_block_start, other.margin_block_end, |
195 other.negative_margin_block_start, | 171 other.negative_margin_block_start, |
196 other.negative_margin_block_end) == | 172 other.negative_margin_block_end) == |
197 std::tie(margin_block_start, margin_block_end, | 173 std::tie(margin_block_start, margin_block_end, |
198 negative_margin_block_start, negative_margin_block_end); | 174 negative_margin_block_start, negative_margin_block_end); |
199 } | 175 } |
200 | 176 |
201 } // namespace blink | 177 } // namespace blink |
OLD | NEW |