Skip to content

Commit

Permalink
Bug 1567349 - Fix various bogus WPTs that test wrong calc serializati…
Browse files Browse the repository at this point in the history
…on. r=heycam

https://drafts.csswg.org/css-values-4/#calc-serialize:

> Sort the terms in the following order:
>  The number, if present
>  The percentage, if present
>  The dimensions, ordered by their units ASCII case-insensitive alphabetically
>  Comparison, trigonometric and exponential functions, in the order they appeared in the original expression.

So em goes before px. I filed w3c/csswg-drafts#4129 on
the second part of that algorithm not matching any browser.

These are tests that are marked as only failing in Firefox because we're the
only following the spec. #funtimes

Differential Revision: https://phabricator.services.mozilla.com/D38593

--HG--
extra : moz-landing-system : lando
  • Loading branch information
emilio committed Jul 19, 2019
1 parent dc7d08d commit 200431f
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
[background-position-x-valid.html]
[e.style['background-position-x'\] = "calc(10px - 0.5em)" should set the property value]
expected: FAIL

[e.style['background-position-x'\] = "calc(10px - 0.5em), left -20%, right 10px" should set the property value]
expected: FAIL

[e.style['background-position-x'\] = "x-end" should set the property value]
expected: FAIL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@
[e.style['background-position-y'\] = "y-end" should set the property value]
expected: FAIL

[e.style['background-position-y'\] = "calc(10px - 0.5em)" should set the property value]
expected: FAIL

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
test_valid_value("background-position-x", "-20%");
test_valid_value("background-position-x", "10px");
test_valid_value("background-position-x", "0.5em");
test_valid_value("background-position-x", "calc(10px - 0.5em)");
test_valid_value("background-position-x", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");
test_valid_value("background-position-x", "left -20%");
test_valid_value("background-position-x", "right 10px");
test_valid_value("background-position-x", "-20%, 10px");
test_valid_value("background-position-x", "center, left, right");
test_valid_value("background-position-x", "0.5em, x-start, x-end");
test_valid_value("background-position-x", "calc(10px - 0.5em), left -20%, right 10px");
test_valid_value("background-position-x", "calc(10px - 0.5em), left -20%, right 10px", "calc(-0.5em + 10px), left -20%, right 10px");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
test_valid_value("background-position-y", "-20%");
test_valid_value("background-position-y", "10px");
test_valid_value("background-position-y", "0.5em");
test_valid_value("background-position-y", "calc(10px - 0.5em)");
test_valid_value("background-position-y", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");
test_valid_value("background-position-y", "top -20%");
test_valid_value("background-position-y", "bottom 10px");
test_valid_value("background-position-y", "-20%, 10px");
test_valid_value("background-position-y", "center, top, bottom");
test_valid_value("background-position-y", "0.5em, y-start, y-end");
test_valid_value("background-position-y", "calc(10px - 0.5em), top -20%, bottom 10px");
test_valid_value("background-position-y", "calc(10px - 0.5em), top -20%, bottom 10px", "calc(-0.5em + 10px), top -20%, top 10px");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
test_valid_value("border-block-start", "green double thin", "thin double green");
test_valid_value("border-block-start", "green", ["green", "medium none green"]);
test_valid_value("border-block-end", "thin", ["thin", "thin none"]);
test_valid_value("border-block-end", "calc(10px - 0.5em) dotted red");
test_valid_value("border-block-end", "calc(10px - 0.5em) dotted red", "calc(-0.5em + 10px) dotted red");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<script>
// <length> | thin | medium | thick
test_valid_value("border-block-start-width", "10px");
test_valid_value("border-block-start-width", "calc(10px + 0.5em)");
test_valid_value("border-block-start-width", "calc(10px + 0.5em)", "calc(0.5em + 10px)");
test_valid_value("border-block-start-width", "thick");
test_valid_value("border-block-start-width", "thin");
test_valid_value("border-block-end-width", "0", "0px");
test_valid_value("border-block-end-width", "calc(10px - 0.5em)");
test_valid_value("border-block-end-width", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");
test_valid_value("border-block-end-width", "medium");
test_valid_value("border-block-width", "10px");
test_valid_value("border-block-width", "medium calc(10px + 0.5em)");
test_valid_value("border-block-width", "medium calc(10px + 0.5em)", "medium calc(0.5em + 10px)");
test_valid_value("border-block-width", "10px 10px", "10px");
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
test_valid_value("border-inline-start", "green double thin", "thin double green");
test_valid_value("border-inline-start", "green", ["green", "medium none green"]);
test_valid_value("border-inline-end", "thin", ["thin", "thin none"]);
test_valid_value("border-inline-end", "calc(10px - 0.5em) dotted red");
test_valid_value("border-inline-end", "calc(10px - 0.5em) dotted red", "calc(-0.5em + 10px) dotted red");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<script>
// <length> | thin | medium | thick
test_valid_value("border-inline-start-width", "10px");
test_valid_value("border-inline-start-width", "calc(10px + 0.5em)");
test_valid_value("border-inline-start-width", "calc(10px + 0.5em)", "calc(0.5em + 10px)");
test_valid_value("border-inline-start-width", "thick");
test_valid_value("border-inline-start-width", "thin");
test_valid_value("border-inline-end-width", "0", "0px");
test_valid_value("border-inline-end-width", "calc(10px - 0.5em)");
test_valid_value("border-inline-end-width", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");
test_valid_value("border-inline-end-width", "medium");
test_valid_value("border-inline-width", "10px");
test_valid_value("border-inline-width", "medium calc(10px + 0.5em)");
test_valid_value("border-inline-width", "medium calc(10px + 0.5em)", "medium calc(0.5em + 10px)");
test_valid_value("border-inline-width", "10px 10px", "10px");
</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
test_valid_value("inset-block-start", "auto");
test_valid_value("inset-block-end", "-10px");
test_valid_value("inset-inline-start", "-20%");
test_valid_value("inset-inline-end", "calc(10px - 0.5em)");
test_valid_value("inset-inline-end", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");

test_valid_value("inset-block", "auto");
test_valid_value("inset-block", "-10px");
test_valid_value("inset-block", "calc(10px - 0.5em) -20%");
test_valid_value("inset-block", "calc(10px - 0.5em) -20%", "calc(-0.5em + 10px) -20%");
test_valid_value("inset-block", "auto auto", "auto");
test_valid_value("inset-inline", "-20%");
test_valid_value("inset-inline", "calc(10px - 0.5em)");
test_valid_value("inset-inline", "calc(10px - 0.5em)", "calc(-0.5em + 10px)");
test_valid_value("inset-inline", "-10px auto");
test_valid_value("inset-inline", "auto calc(10px + 0.5em)");
test_valid_value("inset-inline", "auto calc(10px + 0.5em)", "auto calc(0.5em + 10px)");
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<script>
test_valid_value("border-spacing", "0px");
test_valid_value("border-spacing", "10px 20px");
test_valid_value("border-spacing", "calc(10px + 0.5em) calc(10px - 0.5em)");
test_valid_value("border-spacing", "calc(10px + 0.5em) calc(10px - 0.5em)", "calc(0.5em + 10px) calc(-0.5em + 10px)");
</script>
</body>
</html>

0 comments on commit 200431f

Please sign in to comment.