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

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

Issue 2462413002: Reland of Use NGLogicalRect instead of NGExclusion for exclusions. (Closed)
Patch Set: Created 4 years, 1 month 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 10 matching lines...) Expand all
21 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const { 21 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const {
22 return mode == HorizontalTopBottom ? NGLogicalSize(width, height) 22 return mode == HorizontalTopBottom ? NGLogicalSize(width, height)
23 : NGLogicalSize(height, width); 23 : NGLogicalSize(height, width);
24 } 24 }
25 25
26 bool NGLogicalRect::IsEmpty() const { 26 bool NGLogicalRect::IsEmpty() const {
27 // TODO(layout-dev): equality check shouldn't allocate an object each time. 27 // TODO(layout-dev): equality check shouldn't allocate an object each time.
28 return *this == NGLogicalRect(); 28 return *this == NGLogicalRect();
29 } 29 }
30 30
31 bool NGLogicalRect::IsContained(const NGLogicalRect& other) const {
32 return !(InlineEndOffset() <= other.InlineStartOffset() ||
33 BlockEndOffset() <= other.BlockStartOffset() ||
34 InlineStartOffset() >= other.InlineEndOffset() ||
35 BlockStartOffset() >= other.BlockEndOffset());
36 }
37
31 bool NGLogicalRect::operator==(const NGLogicalRect& other) const { 38 bool NGLogicalRect::operator==(const NGLogicalRect& other) const {
32 return std::tie(other.offset, other.size) == std::tie(offset, size); 39 return std::tie(other.offset, other.size) == std::tie(offset, size);
33 } 40 }
34 41
35 String NGLogicalRect::ToString() const { 42 String NGLogicalRect::ToString() const {
36 return String::format("%s,%s %sx%s", 43 return String::format("%s,%s %sx%s",
37 offset.inline_offset.toString().ascii().data(), 44 offset.inline_offset.toString().ascii().data(),
38 offset.block_offset.toString().ascii().data(), 45 offset.block_offset.toString().ascii().data(),
39 size.inline_size.toString().ascii().data(), 46 size.inline_size.toString().ascii().data(),
40 size.block_size.toString().ascii().data()); 47 size.block_size.toString().ascii().data());
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 168
162 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { 169 bool NGMarginStrut::operator==(const NGMarginStrut& other) const {
163 return std::tie(other.margin_block_start, other.margin_block_end, 170 return std::tie(other.margin_block_start, other.margin_block_end,
164 other.negative_margin_block_start, 171 other.negative_margin_block_start,
165 other.negative_margin_block_end) == 172 other.negative_margin_block_end) ==
166 std::tie(margin_block_start, margin_block_end, 173 std::tie(margin_block_start, margin_block_end,
167 negative_margin_block_start, negative_margin_block_end); 174 negative_margin_block_start, negative_margin_block_end);
168 } 175 }
169 176
170 } // namespace blink 177 } // 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