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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ASSERT_NOT_REACHED(); | 81 ASSERT_NOT_REACHED(); |
82 return NGPhysicalOffset(); | 82 return NGPhysicalOffset(); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const { | 86 bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const { |
87 return std::tie(other.inline_offset, other.block_offset) == | 87 return std::tie(other.inline_offset, other.block_offset) == |
88 std::tie(inline_offset, block_offset); | 88 std::tie(inline_offset, block_offset); |
89 } | 89 } |
90 | 90 |
| 91 NGLogicalOffset NGLogicalOffset::operator+(const NGLogicalOffset& other) const { |
| 92 NGLogicalOffset result; |
| 93 result.inline_offset = this->inline_offset + other.inline_offset; |
| 94 result.block_offset = this->block_offset + other.block_offset; |
| 95 return result; |
| 96 } |
| 97 |
| 98 NGLogicalOffset& NGLogicalOffset::operator+=(const NGLogicalOffset& other) { |
| 99 *this = *this + other; |
| 100 return *this; |
| 101 } |
| 102 |
91 bool NGBoxStrut::IsEmpty() const { | 103 bool NGBoxStrut::IsEmpty() const { |
92 return *this == NGBoxStrut(); | 104 return *this == NGBoxStrut(); |
93 } | 105 } |
94 | 106 |
95 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { | 107 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
96 return std::tie(other.inline_start, other.inline_end, other.block_start, | 108 return std::tie(other.inline_start, other.inline_end, other.block_start, |
97 other.block_end) == | 109 other.block_end) == |
98 std::tie(inline_start, inline_end, block_start, block_end); | 110 std::tie(inline_start, inline_end, block_start, block_end); |
99 } | 111 } |
100 | 112 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 161 |
150 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 162 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
151 return std::tie(other.margin_block_start, other.margin_block_end, | 163 return std::tie(other.margin_block_start, other.margin_block_end, |
152 other.negative_margin_block_start, | 164 other.negative_margin_block_start, |
153 other.negative_margin_block_end) == | 165 other.negative_margin_block_end) == |
154 std::tie(margin_block_start, margin_block_end, | 166 std::tie(margin_block_start, margin_block_end, |
155 negative_margin_block_start, negative_margin_block_end); | 167 negative_margin_block_start, negative_margin_block_end); |
156 } | 168 } |
157 | 169 |
158 } // namespace blink | 170 } // namespace blink |
OLD | NEW |