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

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: NGSizeIndefinite 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.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_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..e05e419b27faf72d78149448116e77c0cafc99ff 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(NGSizeIndefinite,
+ 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));
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698