Chromium Code Reviews| 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(); |
| } |