Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[CSS Math Functions] Correct mod() evaluation
https://bugs.webkit.org/show_bug.cgi?id=259690 rdar://113213059 Reviewed by Simon Fraser. According to https://drafts.csswg.org/css-values/#round-func : Their behavior diverges if the A value and the B step are on opposite sides of zero: mod() (short for “modulus”) continues to choose the integer multiple of B that puts the value between zero and B, as above (guaranteeing that the result will either be zero or share the sign of B, not A), while rem() (short for "remainder") chooses the integer multiple of B that puts the value between zero and -B, avoiding changing the sign of the value. * LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-computed-expected.txt: * Source/WebCore/platform/calc/CalcOperator.h: (WebCore::evaluateCalcExpression): Canonical link: https://commits.webkit.org/266485@main
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ PASS calc(mod(18,5) * 2 + mod(17,5)) should be used-value-equivalent to 8 | |
PASS calc(rem(mod(18,5),5)) should be used-value-equivalent to 3 | ||
PASS calc(rem(mod(18,5),mod(17,5))) should be used-value-equivalent to 1 | ||
PASS calc(mod(-140,-90)) should be used-value-equivalent to -50 | ||
FAIL calc(mod(rem(1,18)* -1,5)) should be used-value-equivalent to 4 assert_equals: calc(mod(rem(1,18)* -1,5)) and 4 serialize to the same thing in used values. expected "matrix(4, 0, 0, 4, 0, 0)" but got "matrix(-1, 0, 0, -1, 0, 0)" | ||
PASS calc(mod(rem(1,18)* -1,5)) should be used-value-equivalent to 4 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nt1m
Author
Member
|
||
PASS round(10px,6px) should be used-value-equivalent to 12px | ||
PASS round(10cm,6cm) should be used-value-equivalent to 12cm | ||
PASS round(10mm,6mm) should be used-value-equivalent to 12mm | ||
|
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
I’m a bit surprised that there are two code changes, but only one test case affected.