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

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

Issue 2540653003: Implement collection of out-of-flow descendants (Closed)
Patch Set: Merge conflicts resolved Created 4 years 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 b11d1ecc8057723a6c5e5b50260db6971ddb1735..35bf7b1678929c92c79f391e87a9d41b0764d76e 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.cc
@@ -134,6 +134,16 @@ String NGLogicalOffset::ToString() const {
return String::format("%dx%d", inline_offset.toInt(), block_offset.toInt());
}
+NGPhysicalOffset NGPhysicalOffset::operator+(
+ const NGPhysicalOffset& other) const {
+ return NGPhysicalOffset{this->left + other.left, this->top + other.top};
+}
+
+NGPhysicalOffset& NGPhysicalOffset::operator+=(const NGPhysicalOffset& other) {
+ *this = *this + other;
+ return *this;
+}
+
bool NGBoxStrut::IsEmpty() const {
return *this == NGBoxStrut();
}
@@ -252,4 +262,27 @@ inline NGExclusions& NGExclusions::operator=(const NGExclusions& other) {
return *this;
}
+NGStaticPosition NGStaticPosition::Create(NGWritingMode writing_mode,
+ TextDirection direction,
+ NGPhysicalOffset offset) {
+ NGStaticPosition position;
+ position.offset = offset;
+ switch (writing_mode) {
+ case kHorizontalTopBottom:
+ position.type = (direction == LTR) ? kTopLeft : kTopRight;
+ break;
+ case kVerticalRightLeft:
+ case kSidewaysRightLeft:
+ position.type = (direction == LTR) ? kTopRight : kBottomRight;
+ break;
+ case kVerticalLeftRight:
+ position.type = (direction == LTR) ? kTopLeft : kBottomLeft;
+ break;
+ case kSidewaysLeftRight:
+ position.type = (direction == LTR) ? kBottomLeft : kTopLeft;
+ break;
+ }
+ return position;
+}
+
} // namespace blink
« 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