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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 221 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
222 return std::tie(other.margin_block_start, other.margin_block_end, | 222 return std::tie(other.margin_block_start, other.margin_block_end, |
223 other.negative_margin_block_start, | 223 other.negative_margin_block_start, |
224 other.negative_margin_block_end) == | 224 other.negative_margin_block_end) == |
225 std::tie(margin_block_start, margin_block_end, | 225 std::tie(margin_block_start, margin_block_end, |
226 negative_margin_block_start, negative_margin_block_end); | 226 negative_margin_block_start, negative_margin_block_end); |
227 } | 227 } |
228 | 228 |
| 229 NGExclusions::NGExclusions() |
| 230 : last_left_float(nullptr), last_right_float(nullptr) {} |
| 231 |
| 232 NGExclusions::NGExclusions(const NGExclusions& other) { |
| 233 for (const auto& exclusion : other.storage) |
| 234 Add(*exclusion); |
| 235 } |
| 236 |
| 237 void NGExclusions::Add(const NGExclusion& exclusion) { |
| 238 storage.append(makeUnique<NGExclusion>(exclusion)); |
| 239 if (exclusion.type == NGExclusion::kFloatLeft) { |
| 240 last_left_float = storage.rbegin()->get(); |
| 241 } else if (exclusion.type == NGExclusion::kFloatRight) { |
| 242 last_right_float = storage.rbegin()->get(); |
| 243 } |
| 244 } |
| 245 |
| 246 inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) { |
| 247 storage.clear(); |
| 248 last_left_float = nullptr; |
| 249 last_right_float = nullptr; |
| 250 for (const auto& exclusion : other.storage) |
| 251 Add(*exclusion); |
| 252 return *this; |
| 253 } |
| 254 |
229 } // namespace blink | 255 } // namespace blink |
OLD | NEW |