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

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

Issue 2540653003: Implement collection of out-of-flow descendants (Closed)
Patch Set: Merge conflicts resolved Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 bool NGLogicalOffset::operator<=(const NGLogicalOffset& other) const { 128 bool NGLogicalOffset::operator<=(const NGLogicalOffset& other) const {
129 return inline_offset <= other.inline_offset && 129 return inline_offset <= other.inline_offset &&
130 block_offset <= other.block_offset; 130 block_offset <= other.block_offset;
131 } 131 }
132 132
133 String NGLogicalOffset::ToString() const { 133 String NGLogicalOffset::ToString() const {
134 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt()); 134 return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt());
135 } 135 }
136 136
137 NGPhysicalOffset NGPhysicalOffset::operator+(
138 const NGPhysicalOffset& other) const {
139 return NGPhysicalOffset{this->left + other.left, this->top + other.top};
140 }
141
142 NGPhysicalOffset& NGPhysicalOffset::operator+=(const NGPhysicalOffset& other) {
143 *this = *this + other;
144 return *this;
145 }
146
137 bool NGBoxStrut::IsEmpty() const { 147 bool NGBoxStrut::IsEmpty() const {
138 return *this == NGBoxStrut(); 148 return *this == NGBoxStrut();
139 } 149 }
140 150
141 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { 151 bool NGBoxStrut::operator==(const NGBoxStrut& other) const {
142 return std::tie(other.inline_start, other.inline_end, other.block_start, 152 return std::tie(other.inline_start, other.inline_end, other.block_start,
143 other.block_end) == 153 other.block_end) ==
144 std::tie(inline_start, inline_end, block_start, block_end); 154 std::tie(inline_start, inline_end, block_start, block_end);
145 } 155 }
146 156
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 255
246 inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) { 256 inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) {
247 storage.clear(); 257 storage.clear();
248 last_left_float = nullptr; 258 last_left_float = nullptr;
249 last_right_float = nullptr; 259 last_right_float = nullptr;
250 for (const auto& exclusion : other.storage) 260 for (const auto& exclusion : other.storage)
251 Add(*exclusion); 261 Add(*exclusion);
252 return *this; 262 return *this;
253 } 263 }
254 264
265 NGStaticPosition NGStaticPosition::Create(NGWritingMode writing_mode,
266 TextDirection direction,
267 NGPhysicalOffset offset) {
268 NGStaticPosition position;
269 position.offset = offset;
270 switch (writing_mode) {
271 case kHorizontalTopBottom:
272 position.type = (direction == LTR) ? kTopLeft : kTopRight;
273 break;
274 case kVerticalRightLeft:
275 case kSidewaysRightLeft:
276 position.type = (direction == LTR) ? kTopRight : kBottomRight;
277 break;
278 case kVerticalLeftRight:
279 position.type = (direction == LTR) ? kTopLeft : kBottomLeft;
280 break;
281 case kSidewaysLeftRight:
282 position.type = (direction == LTR) ? kBottomLeft : kTopLeft;
283 break;
284 }
285 return position;
286 }
287
255 } // namespace blink 288 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_units.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698