[webkit-changes] [WebKit/WebKit] 440d1b: [CSS Math Functions] Correct mod() evaluation

Tim Nguyen noreply at github.com
Tue Aug 1 10:52:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 440d1baa8043b2ab0ffa1d187dfd4cb93086f289
      https://github.com/WebKit/WebKit/commit/440d1baa8043b2ab0ffa1d187dfd4cb93086f289
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-computed-expected.txt
    M Source/WebCore/platform/calc/CalcOperator.h

  Log Message:
  -----------
  [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




More information about the webkit-changes mailing list