Skip to content

Commit

Permalink
Fix validity checking in calc() divide operations
Browse files Browse the repository at this point in the history
https://crrev.com/c/5909795 relaxed a restriction in type checking on
divide operations in calc() expressions but went too far in doing so -
per css-values-4, we still need to validate that the right side is a
number. This CL introduces the needed check and adds a WPT to validate.

Fixed: 381913623
Change-Id: I08f23d832f9647beb6e067a24226496cb75bb971
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6071943
Reviewed-by: Rune Lillesveen <[email protected]>
Commit-Queue: Kevin Babbitt <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1392351}
  • Loading branch information
kbabbitt authored and chromium-wpt-export-bot committed Dec 5, 2024
1 parent 6d5e092 commit e0333cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion css/css-values/calc-unit-analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"multiplication of number and length");
assert_invalid_value("margin-left", "calc(2px * 1px)", // invalid calc expression
"multiplication of length and length");

assert_invalid_value("margin-left", "calc(20 / 0.75rem)", // invalid calc expression
"division by non-number");
}

run();
Expand Down

0 comments on commit e0333cd

Please sign in to comment.