From 754d29c8998301b508b80ddf107467113e3421a7 Mon Sep 17 00:00:00 2001 From: Pu Xingyu Date: Thu, 13 Apr 2017 19:19:48 +0800 Subject: [PATCH] Floor to 0 when computing intrinsic sizes for box-sizing:border-box --- components/layout/fragment.rs | 2 +- tests/wpt/mozilla/meta/MANIFEST.json | 25 +++++++++++++++++++ .../tests/css/intrinsic_border_box.html | 19 ++++++++++++++ .../tests/css/intrinsic_border_box_ref.html | 17 +++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/wpt/mozilla/tests/css/intrinsic_border_box.html create mode 100644 tests/wpt/mozilla/tests/css/intrinsic_border_box_ref.html diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index bf42f628f094..b43cf1d23395 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -937,7 +937,7 @@ impl Fragment { } if self.style.get_position().box_sizing == box_sizing::T::border_box { - specified -= border_padding + specified = max(Au(0), specified - border_padding); } } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 4ce2c3ec04f7..02a1f0db4272 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -3131,6 +3131,18 @@ {} ] ], + "css/intrinsic_border_box.html": [ + [ + "/_mozilla/css/intrinsic_border_box.html", + [ + [ + "/_mozilla/css/intrinsic_border_box_ref.html", + "==" + ] + ], + {} + ] + ], "css/issue-1324.html": [ [ "/_mozilla/css/issue-1324.html", @@ -8073,6 +8085,11 @@ {} ] ], + "css/intrinsic_border_box_ref.html": [ + [ + {} + ] + ], "css/issue-1324-ref.html": [ [ {} @@ -22115,6 +22132,14 @@ "c78c6c992e47adb47ba00b621210ae8564d46389", "support" ], + "css/intrinsic_border_box.html": [ + "261487f82f350ab020f49f362993b26711a89b5b", + "reftest" + ], + "css/intrinsic_border_box_ref.html": [ + "9a8f19331c748658b71c85b823b5b3db68e4b7a4", + "support" + ], "css/issue-1324-ref.html": [ "ef2253d5045622f54634dbfa6b6abdef6b6e00a7", "support" diff --git a/tests/wpt/mozilla/tests/css/intrinsic_border_box.html b/tests/wpt/mozilla/tests/css/intrinsic_border_box.html new file mode 100644 index 000000000000..85e000185ad5 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/intrinsic_border_box.html @@ -0,0 +1,19 @@ + + + + + +
+
diff --git a/tests/wpt/mozilla/tests/css/intrinsic_border_box_ref.html b/tests/wpt/mozilla/tests/css/intrinsic_border_box_ref.html new file mode 100644 index 000000000000..e47b8414c32a --- /dev/null +++ b/tests/wpt/mozilla/tests/css/intrinsic_border_box_ref.html @@ -0,0 +1,17 @@ + + + + +
+