Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_exclusion.cc

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 std::ostream& operator<<(std::ostream& stream, const NGExclusion& value) {
21 return stream << value.ToString();
22 }
23
24 NGExclusions::NGExclusions()
25 : last_left_float(nullptr), last_right_float(nullptr) {}
26
27 NGExclusions::NGExclusions(const NGExclusions& other) {
28 for (const auto& exclusion : other.storage)
29 Add(*exclusion);
30 }
31
32 void NGExclusions::Add(const NGExclusion& exclusion) {
33 storage.push_back(WTF::makeUnique<NGExclusion>(exclusion));
34 if (exclusion.type == NGExclusion::kFloatLeft) {
35 last_left_float = storage.rbegin()->get();
36 } else if (exclusion.type == NGExclusion::kFloatRight) {
37 last_right_float = storage.rbegin()->get();
38 }
39 }
40
41 inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) {
42 storage.clear();
43 last_left_float = nullptr;
44 last_right_float = nullptr;
45 for (const auto& exclusion : other.storage)
46 Add(*exclusion);
47 return *this;
48 }
49
50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698