Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fad1b146f46c60d3eeaafa8b49f79f4ac77574dc
https://github.com/WebKit/WebKit/commit/fad1b146f46c60d3eeaafa8b49f79f4ac77574dc
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-31 (Mon, 31 Aug 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/svg/animations/additive-color-precision-animation-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/svg/animations/additive-color-precision-animation.html
M Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h
Log Message:
-----------
[SVG] Additive color animations lose precision from per-layer 8-bit rounding
https://bugs.webkit.org/show_bug.cgi?id=322950
rdar://186223510
Reviewed by Simon Fraser.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
SVGAnimationColorFunction interpolated and accumulated color channels as
8-bit sRGB (SRGBA<uint8_t>). Every additive/cumulative animation targeting
the same element/attribute stacks its contribution through a single shared
Color value, so rounding each layer to 8 bits before the next layer reads
it discarded the sub-integer remainder. Stacked additive="sum" color
animations therefore under-counted: ten layers each contributing 0.4 per
channel produced rgb(0, 0, 0) instead of rgb(4, 4, 4), diverging from
other browsers.
Interpolate and accumulate in SRGBA<float> instead, matching the approach
blendWithoutPremultiply() uses for CSS transitions. The result is still
serialized as legacy rgb()/rgba() via serializationForHTML(SRGBA<float>),
so there is no computed-value or rendering-format change for single-layer
animations; only the precision of multi-layer accumulation improves.
Test:
imported/w3c/web-platform-tests/svg/animations/additive-color-precision-animation.html
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/additive-color-precision-animation-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/animations/additive-color-precision-animation.html:
Added.
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationColorFunction::animate):
Canonical link: https://commits.webkit.org/320166@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications