Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 35a0ba08385cfdc1e374a1622a229ccbe618f0ed
      
https://github.com/WebKit/WebKit/commit/35a0ba08385cfdc1e374a1622a229ccbe618f0ed
  Author: Sam Weinig <wei...@apple.com>
  Date:   2022-09-26 (Mon, 26 Sep 2022)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt
    M Source/WebCore/platform/graphics/ColorBlending.cpp
    M Source/WebCore/platform/graphics/ColorInterpolation.h

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to