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

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

Issue 2274593002: [layoutng] Correctly resolve indefinite percentages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error... 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 93ea4e504dcdbcc954206d042dd9b3d8c221dcf1..0cabc047730fed6cc9e40ed68b36a53b7f1e9156 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
@@ -159,6 +159,21 @@ TEST_F(NGLengthUtilsTest, testComputeBlockSizeForFragment) {
// TODO(layout-ng): test {min,max}-content on max-height.
}
+TEST_F(NGLengthUtilsTest, testIndefinitePercentages) {
+ style_->setMinHeight(Length(20, Fixed));
+ style_->setHeight(Length(20, Percent));
+
+ EXPECT_EQ(LayoutUnit(-1),
+ computeBlockSizeForFragment(constructConstraintSpace(200, -1),
+ LayoutUnit(-1)));
+ EXPECT_EQ(LayoutUnit(20),
+ computeBlockSizeForFragment(constructConstraintSpace(200, -1),
+ LayoutUnit(10)));
+ EXPECT_EQ(LayoutUnit(120),
+ computeBlockSizeForFragment(constructConstraintSpace(200, -1),
+ LayoutUnit(120)));
+}
+
TEST_F(NGLengthUtilsTest, testMargins) {
style_->setMarginTop(Length(10, Percent));
style_->setMarginRight(Length(52, Fixed));

Powered by Google App Engine
This is Rietveld 408576698