Skip to content

Commit

Permalink
Only allow calc() combinations as per spec.
Browse files Browse the repository at this point in the history
We allowed calc expressions combining numbers and lengths, numbers and
percentages, and even a combination of numbers, percentages, and
lengths. None of those are allowed per the CSS Values and Units spec,
and it made it possible to combine user units, lengths, and percentages
into the same calc() for certain SVG CSS properties and attributes.

See also: w3c/csswg-drafts#4874

This improves SVG interop with Firefox. Firefox does not support calc()
for numbers, though.

Bug: 1061714
Change-Id: I9e5c492122242e51064310a40e28a233530e357c
  • Loading branch information
Rune Lillesveen authored and chromium-wpt-export-bot committed Apr 3, 2020
1 parent c063a8c commit e10f177
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions svg/animations/svglength-additive-by-8.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<!-- an1: Change width from 10 to 50 in 4s -->
<!-- an2: Change width from 10 to 100 in 4s starting at 5s -->
<rect width="10" height="100" fill="green">
<animate id="an1" attributeType="XML" attributeName="width" fill="remove" by="calc(4% + 8)" begin="0s" dur="4s"/>
<animate id="an2" attributeType="XML" attributeName="width" additive="replace" fill="freeze" by="calc(10% + 10)" begin="5s" dur="4s"/>
<animate id="an1" attributeType="XML" attributeName="width" fill="remove" by="calc(4% + 8px)" begin="0s" dur="4s"/>
<animate id="an2" attributeType="XML" attributeName="width" additive="replace" fill="freeze" by="calc(10% + 10px)" begin="5s" dur="4s"/>
</rect>

</svg>
Expand Down Expand Up @@ -73,4 +73,4 @@

window.animationStartsImmediately = true;

</script>
</script>
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-dasharray-invalid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-dasharray-valid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-dashoffset-invalid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-dashoffset-valid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-width-invalid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions svg/painting/parsing/stroke-width-valid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e10f177

Please sign in to comment.