-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #18131 - emilio:calc-serialization, r=canaltinova
style: Multiple calc serialization fixes. This puts us in line with the spec as written, except for caveat in w3c/csswg-drafts#1731. Need to fix computed calc() too, I'm less confident that we won't need to change test expectations. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18131) <!-- Reviewable:end -->
- Loading branch information
Showing
5 changed files
with
93 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>CSS Values and Units: calc() serialization.</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@mozilla.com"> | ||
<link rel="help" href="https://drafts.csswg.org/css-values/#calc-serialize"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<!-- FIXME(emilio): Upstream when spec stops being under discussion --> | ||
<div id="content"></div> | ||
<script> | ||
|
||
// NOTE(emilio): This intentionally doesn't test for order of percentages | ||
// because of: | ||
// | ||
// https://github.com/w3c/csswg-drafts/issues/1731 | ||
|
||
test(function() { | ||
// specified -> expected | ||
var values = { | ||
"calc(10px + 1vmin)": "calc(10px + 1vmin)", | ||
"calc(10px + 1em)": "calc(1em + 10px)", | ||
"calc(1vmin - 10px)": "calc(-10px + 1vmin)", | ||
"calc(-10px + 1em)": "calc(1em - 10px)", | ||
"calc(-10px)": "calc(-10px)", | ||
}; | ||
|
||
var content = document.getElementById("content"); | ||
|
||
for (var prop in values) { | ||
content.style.width = prop; | ||
assert_equals(content.style.width, values[prop], "Serialization of " + prop); | ||
} | ||
}, "calc() serialization") | ||
</script> |