Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[web-animations] additive/accumulative color blending fails to yield …
…intermediary out-of-bounds values https://bugs.webkit.org/show_bug.cgi?id=242185 <rdar://96593559> Reviewed by Antoine Quint. Additive (and Accumulative, which is identical for colors) blending in web animations is implemented by calling the blend function two extra times: 1. First to add the 'base' color to the 'from' color, giving us 'additive-from'. e.g. blend(base, from, add-operation) 2. Second to add the 'base' color to the 'to' color, giving us the 'additive-to'. e.g. blend(base, to, add-operation) It then interpolates 'additive-from' to 'additive-to', using the normal, 'replace', blend path. Further, it expects 'additive-from' and 'additive-to' to be unclamped color values. To support this scheme, the blend function for Color was updated to implement support for the add operation, using a new addColorComponents helper (which is just a wrapper around interpolatColorComponents that specifies 100% of each color) which uses ExtendedSRGBA to avoid clamping. The normal, replace, blend path was changed to use the now standard color interpolation function, interpolateColorComponents, which supports all interpolation methods not just SRGB, to make it match convention. To maintain compatability with existing animmation interpolation, the result of the replace blend is clipped to the sRGB gamut. This clipping is suspect, but the tests currently require this. Additional discussion with the WG is needed to deterimine the best path forward. * LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt: * Source/WebCore/platform/graphics/ColorBlending.cpp: (WebCore::blend): * Source/WebCore/platform/graphics/ColorInterpolation.h: (WebCore::interpolateAlphaPremulitplied): Add a clamp, needed for the additive blend, as alpha > 1 doesn't really make sense. (WebCore::addColorComponents): Canonical link: https://commits.webkit.org/254850@main
- Loading branch information
Showing
6 changed files
with
72 additions
and
38 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
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
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
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
Oops, something went wrong.