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

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

Issue 2457013004: Use NGLogicalRect instead of NGExclusion for exclusions. (Closed)
Patch Set: remove builder from NGLogicalRect 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 side-by-side diff with in-line comments
Download patch
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..cabebac81abf718b9de25ec9ecf62dab8478edfd 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 within the provided rectangle.
+ bool IsWithin(const NGLogicalRect& other) const;
atotic 2016/10/31 23:42:40 IsWithin had me confused. Usual Rect APIs use 'c
atotic 2016/10/31 23:42:40 Confusing to me. Does this mean this is fully encl
+
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;
atotic 2016/10/31 23:42:40 Only simple accessors should be inline according t
+ }
+
+ 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;
};

Powered by Google App Engine
This is Rietveld 408576698