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

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

Issue 2289353002: [layoutng] Add methods to compute border and padding (Closed)
Patch Set: better enum name Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc ('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.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 c691ad23eefb67ee4706d541621281da9ff4b1ea..309e0861d4fb5ec062188fba4e89d75b3102270a 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.h
@@ -61,6 +61,22 @@ struct NGBoxStrut {
LayoutUnit InlineSum() const { return inline_start + inline_end; }
LayoutUnit BlockSum() const { return block_start + block_end; }
+
+ // The following two operators exist primarily to have an easy way to access
+ // the sum of border and padding.
+ NGBoxStrut& operator+=(const NGBoxStrut& other) {
+ inline_start += other.inline_start;
+ inline_end += other.inline_end;
+ block_start += other.block_start;
+ block_end += other.block_end;
+ return *this;
+ }
+
+ NGBoxStrut operator+(const NGBoxStrut& other) {
+ NGBoxStrut result(*this);
+ result += other;
+ return result;
+ }
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698