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

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

Issue 2313873002: Initial implementation of Collapsing Margins computational logic for LayoutNG (Closed)
Patch Set: synced to the head Created 4 years, 3 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_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 44f760022bc010bdfed88877ce118e97db567795..79918a4d661516a8830e0b2bee5388e44a108edd 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.cc
@@ -61,4 +61,29 @@ NGPhysicalOffset NGLogicalOffset::ConvertToPhysical(
}
}
+void NGMarginStrut::AppendMarginBlockStart(const LayoutUnit& value) {
+ if (value < 0) {
+ negative_margin_block_start =
+ -std::max(value.abs(), negative_margin_block_start.abs());
+ } else {
+ margin_block_start = std::max(value, margin_block_start);
+ }
+}
+
+void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) {
+ if (value < 0) {
+ negative_margin_block_end =
+ -std::max(value.abs(), negative_margin_block_end.abs());
+ } else {
+ margin_block_end = std::max(value, margin_block_end);
+ }
+}
+
+String NGMarginStrut::ToString() const {
+ return String::format(
+ "Start: (%d %d) End: (%d %d)", negative_margin_block_start.toInt(),
+ margin_block_start.toInt(), negative_margin_block_end.toInt(),
+ margin_block_end.toInt());
+}
+
} // 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