Index: third_party/WebKit/Source/core/layout/ng/ng_units.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units.h b/third_party/WebKit/Source/core/layout/ng/ng_units.h |
index d52f17d858c99989caea7fcec888dcfde5443383..a8821b681b375806a0ef20feabbf198bb4e12e36 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.h |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.h |
@@ -92,6 +92,7 @@ struct NGPhysicalRect { |
NGPhysicalSize size; |
}; |
+// TODO(glebl): move to a separate file in layout/ng/units. |
struct CORE_EXPORT NGLogicalRect { |
NGLogicalRect() {} |
NGLogicalRect(LayoutUnit inline_offset, |
@@ -101,9 +102,30 @@ struct CORE_EXPORT NGLogicalRect { |
: offset(inline_offset, block_offset), size(inline_size, block_size) {} |
bool IsEmpty() const; |
+ |
+ // Whether this rectangle is contained by the provided rectangle. |
+ bool IsContained(const NGLogicalRect& other) const; |
+ |
String ToString() const; |
bool operator==(const NGLogicalRect& other) const; |
+ // Getters |
+ LayoutUnit InlineStartOffset() const { return offset.inline_offset; } |
+ |
+ LayoutUnit InlineEndOffset() const { |
+ return offset.inline_offset + size.inline_size; |
+ } |
+ |
+ LayoutUnit BlockStartOffset() const { return offset.block_offset; } |
+ |
+ LayoutUnit BlockEndOffset() const { |
+ return offset.block_offset + size.block_size; |
+ } |
+ |
+ LayoutUnit BlockSize() const { return size.block_size; } |
+ |
+ LayoutUnit InlineSize() const { return size.inline_size; } |
+ |
NGLogicalOffset offset; |
NGLogicalSize size; |
}; |