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

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: .. 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
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..97502d03124b103cd6b7a6aab5ebbfd9736ce014 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,32 @@ 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 {
+ return *this == NGLogicalRect();
Gleb Lanbin 2016/10/21 21:06:59 .nit We will need to change that later as it alloc
ikilpatrick 2016/10/21 21:45:27 added TODO
+}
+
+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 +82,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();
}

Powered by Google App Engine
This is Rietveld 408576698