| Index: third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc b/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0bba377cca5ce97d394c3beac018557d0dbd7bf8
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/layout/ng/ng_exclusion.h"
|
| +
|
| +#include "wtf/text/WTFString.h"
|
| +
|
| +namespace blink {
|
| +
|
| +bool NGExclusion::operator==(const NGExclusion& other) const {
|
| + return std::tie(other.rect, other.type) == std::tie(rect, type);
|
| +}
|
| +
|
| +String NGExclusion::ToString() const {
|
| + return String::format("Rect: %s Type: %d", rect.ToString().ascii().data(),
|
| + type);
|
| +}
|
| +
|
| +NGExclusions::NGExclusions()
|
| + : last_left_float(nullptr), last_right_float(nullptr) {}
|
| +
|
| +NGExclusions::NGExclusions(const NGExclusions& other) {
|
| + for (const auto& exclusion : other.storage)
|
| + Add(*exclusion);
|
| +}
|
| +
|
| +void NGExclusions::Add(const NGExclusion& exclusion) {
|
| + storage.push_back(WTF::makeUnique<NGExclusion>(exclusion));
|
| + if (exclusion.type == NGExclusion::kFloatLeft) {
|
| + last_left_float = storage.rbegin()->get();
|
| + } else if (exclusion.type == NGExclusion::kFloatRight) {
|
| + last_right_float = storage.rbegin()->get();
|
| + }
|
| +}
|
| +
|
| +inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) {
|
| + storage.clear();
|
| + last_left_float = nullptr;
|
| + last_right_float = nullptr;
|
| + for (const auto& exclusion : other.storage)
|
| + Add(*exclusion);
|
| + return *this;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|