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

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

Issue 2438313003: [LayoutNG] Remove derived constraint spaces from opportunity iterator. (Closed)
Patch Set: address comments. Created 4 years, 2 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_units.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units.cc b/third_party/WebKit/Source/core/layout/ng/ng_units.cc
index f8ecccdce2b182987feac638972af04a53d03445..f63dd7bec69a42e67eeb916d1ad32135b0ca954c 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.cc
@@ -13,11 +13,33 @@ NGPhysicalSize NGLogicalSize::ConvertToPhysical(NGWritingMode mode) const {
: NGPhysicalSize(block_size, inline_size);
}
+bool NGLogicalSize::operator==(const NGLogicalSize& other) const {
+ return std::tie(other.inline_size, other.block_size) ==
+ std::tie(inline_size, block_size);
+}
+
NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const {
return mode == HorizontalTopBottom ? NGLogicalSize(width, height)
: NGLogicalSize(height, width);
}
+bool NGLogicalRect::IsEmpty() const {
+ // TODO(layout-dev): equality check shouldn't allocate an object each time.
+ return *this == NGLogicalRect();
+}
+
+bool NGLogicalRect::operator==(const NGLogicalRect& other) const {
+ return std::tie(other.offset, other.size) == std::tie(offset, size);
+}
+
+String NGLogicalRect::ToString() const {
+ return String::format("%s,%s %sx%s",
+ offset.inline_offset.toString().ascii().data(),
+ offset.block_offset.toString().ascii().data(),
+ size.inline_size.toString().ascii().data(),
+ size.block_size.toString().ascii().data());
+}
+
NGPhysicalOffset NGLogicalOffset::ConvertToPhysical(
NGWritingMode mode,
NGDirection direction,
@@ -61,6 +83,11 @@ NGPhysicalOffset NGLogicalOffset::ConvertToPhysical(
}
}
+bool NGLogicalOffset::operator==(const NGLogicalOffset& other) const {
+ return std::tie(other.inline_offset, other.block_offset) ==
+ std::tie(inline_offset, block_offset);
+}
+
bool NGBoxStrut::IsEmpty() const {
return *this == NGBoxStrut();
}
« 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