Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e809da70b870de6faae16df8bf00c39a27cc2575
https://github.com/WebKit/WebKit/commit/e809da70b870de6faae16df8bf00c39a27cc2575
Author: Ahmad Saleem <[email protected]>
Date: 2026-06-14 (Sun, 14 Jun 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-computed-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/signed-zero-expected.txt
M Source/WebCore/css/calc/CSSCalcExecutor.h
M Source/WebCore/css/calc/CSSCalcTree+Simplification.cpp
M Source/WebCore/css/calc/CSSCalcValue.cpp
Log Message:
-----------
[css-values] Math functions produce incorrect signed zero for subtraction,
min/max/clamp, and mod()
https://bugs.webkit.org/show_bug.cgi?id=317056
rdar://179534440
Reviewed by Sam Weinig.
Several CSS math operations did not follow the IEEE 754 signed-zero rules
required by https://drafts.csswg.org/css-values-4/#calc-ieee, leading to
few test failures:
- Negate folded +0 to +0 via "0 - value", so calc(-0 - 0) (i.e. 0⁻ - 0⁺)
produced 0⁺ instead of 0⁻.
- min()/max()/clamp() used std::min/std::max, which ignore the sign of zero
and return the first argument on ties, so min(0⁺, 0⁻), max(0⁺, 0⁻), and
clamp(0⁺, 0⁻, ...) gave the wrong zero.
- mod() shifted a zero remainder by B, turning ±0 into B instead of a
B-signed zero, so mod(-1, 1) returned 1 and mod(1, -1) returned -1.
Fix each to honor the spec: minimum(0⁺, 0⁻) is 0⁻, maximum(0⁺, 0⁻) is 0⁺,
0⁻ - 0⁺ is 0⁻, and a zero mod() result takes the sign of B. Also censor
signed zero into unsigned zero when a value escapes a top-level calculation.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-mod-rem-computed-expected.txt:
Progressions
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/signed-zero-expected.txt:
Ditto
* Source/WebCore/css/calc/CSSCalcExecutor.h:
(WebCore::CSSCalc::minWithSignedZero):
(WebCore::CSSCalc::maxWithSignedZero):
(WebCore::CSSCalc::OperatorExecutor<Operator::Min>::operator()):
(WebCore::CSSCalc::OperatorExecutor<Operator::Max>::operator()):
(WebCore::CSSCalc::OperatorExecutor<Operator::Clamp>::operator()):
(WebCore::CSSCalc::OperatorExecutor<Operator::Mod>::operator()):
* Source/WebCore/css/calc/CSSCalcTree+Simplification.cpp:
(WebCore::CSSCalc::simplify):
* Source/WebCore/css/calc/CSSCalcValue.cpp:
(WebCore::CSSCalc::Value::clampToPermittedRange const):
Canonical link: https://commits.webkit.org/315188@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications