OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/ng/ng_exclusion.h" |
| 6 |
| 7 #include "wtf/text/WTFString.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 bool NGExclusion::operator==(const NGExclusion& other) const { |
| 12 return std::tie(other.rect, other.type) == std::tie(rect, type); |
| 13 } |
| 14 |
| 15 String NGExclusion::ToString() const { |
| 16 return String::format("Rect: %s Type: %d", rect.ToString().ascii().data(), |
| 17 type); |
| 18 } |
| 19 |
| 20 NGExclusions::NGExclusions() |
| 21 : last_left_float(nullptr), last_right_float(nullptr) {} |
| 22 |
| 23 NGExclusions::NGExclusions(const NGExclusions& other) { |
| 24 for (const auto& exclusion : other.storage) |
| 25 Add(*exclusion); |
| 26 } |
| 27 |
| 28 void NGExclusions::Add(const NGExclusion& exclusion) { |
| 29 storage.push_back(WTF::makeUnique<NGExclusion>(exclusion)); |
| 30 if (exclusion.type == NGExclusion::kFloatLeft) { |
| 31 last_left_float = storage.rbegin()->get(); |
| 32 } else if (exclusion.type == NGExclusion::kFloatRight) { |
| 33 last_right_float = storage.rbegin()->get(); |
| 34 } |
| 35 } |
| 36 |
| 37 inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) { |
| 38 storage.clear(); |
| 39 last_left_float = nullptr; |
| 40 last_right_float = nullptr; |
| 41 for (const auto& exclusion : other.storage) |
| 42 Add(*exclusion); |
| 43 return *this; |
| 44 } |
| 45 |
| 46 } // namespace blink |
OLD | NEW |