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

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

Issue 2259963002: [layoutng] Margin support, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheck 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
Index: third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
index f65529e501601baf1dfbfce8ef21eecb7cb517e3..93ea4e504dcdbcc954206d042dd9b3d8c221dcf1 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
@@ -5,6 +5,7 @@
#include "core/layout/ng/ng_length_utils.h"
#include "core/layout/ng/ng_constraint_space.h"
+#include "core/layout/ng/ng_margin_strut.h"
#include "core/style/ComputedStyle.h"
#include "platform/CalculationValue.h"
#include "platform/LayoutUnit.h"
@@ -158,5 +159,21 @@ TEST_F(NGLengthUtilsTest, testComputeBlockSizeForFragment) {
// TODO(layout-ng): test {min,max}-content on max-height.
}
+TEST_F(NGLengthUtilsTest, testMargins) {
+ style_->setMarginTop(Length(10, Percent));
+ style_->setMarginRight(Length(52, Fixed));
+ style_->setMarginBottom(Length(Auto));
+ style_->setMarginLeft(Length(11, Percent));
+
+ NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300));
+
+ NGBoxMargins margins = computeMargins(constraintSpace, *style_);
+
+ EXPECT_EQ(LayoutUnit(20), margins.blockStart);
+ EXPECT_EQ(LayoutUnit(52), margins.inlineEnd);
+ EXPECT_EQ(LayoutUnit(), margins.blockEnd);
+ EXPECT_EQ(LayoutUnit(22), margins.inlineStart);
+}
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698