Skip to content
Permalink
Browse files
[web-animations] correctly accumulate and clamp filter values when bl…
…ending with "none"

https://bugs.webkit.org/show_bug.cgi?id=248272

Reviewed by Simon Fraser.

Blending a valid operation with a "none" operation is done using a passthrough value in the
WebCore filter blending code. However, when we added support for accumulation and clamping in
bug 248235, we only did so for the case when blending between two valid operations. We now use
the blendAmounts() method in the passthrough cases as well.

* LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/animation/filter-interpolation-003-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt:
* Source/WebCore/platform/graphics/filters/FilterOperation.cpp:
(WebCore::BasicColorMatrixFilterOperation::blend):
(WebCore::BasicComponentTransferFilterOperation::blend):

Canonical link: https://commits.webkit.org/256976@main
  • Loading branch information
graouts committed Nov 23, 2022
1 parent e77c6ec commit 85de8f728bd846fc046de0128994e6949dea9b40
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
@@ -19,42 +19,42 @@ PASS Web Animations: property <filter> from [none] to [blur(10px)] at (0) should
PASS Web Animations: property <filter> from [none] to [blur(10px)] at (0.5) should be [blur(5px)]
PASS Web Animations: property <filter> from [none] to [blur(10px)] at (1) should be [blur(10px)]
PASS Web Animations: property <filter> from [none] to [blur(10px)] at (1.5) should be [blur(15px)]
FAIL CSS Transitions: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] assert_equals: expected "brightness ( 0 ) " but got "brightness ( - 1 ) "
PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)]
PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)]
PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)]
PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)]
PASS CSS Transitions: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)]
FAIL CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] assert_equals: expected "brightness ( 0 ) " but got "brightness ( - 1 ) "
PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)]
PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)]
PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)]
PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)]
PASS CSS Transitions with transition: all: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)]
FAIL CSS Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] assert_equals: expected "brightness ( 0 ) " but got "brightness ( - 1 ) "
PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)]
PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)]
PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)]
PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)]
PASS CSS Animations: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)]
FAIL Web Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)] assert_equals: expected "brightness ( 0 ) " but got "brightness ( - 1 ) "
PASS Web Animations: property <filter> from [brightness(0)] to [none] at (-1) should be [brightness(0)]
PASS Web Animations: property <filter> from [brightness(0)] to [none] at (0) should be [brightness(0)]
PASS Web Animations: property <filter> from [brightness(0)] to [none] at (0.5) should be [brightness(0.5)]
PASS Web Animations: property <filter> from [brightness(0)] to [none] at (1) should be [brightness(1)]
PASS Web Animations: property <filter> from [brightness(0)] to [none] at (1.5) should be [brightness(1.5)]
FAIL CSS Transitions: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] assert_equals: expected "contrast ( 0 ) " but got "contrast ( - 1 ) "
PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)]
PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)]
PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)]
PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)]
PASS CSS Transitions: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)]
FAIL CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] assert_equals: expected "contrast ( 0 ) " but got "contrast ( - 1 ) "
PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)]
PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)]
PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)]
PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)]
PASS CSS Transitions with transition: all: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)]
FAIL CSS Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] assert_equals: expected "contrast ( 0 ) " but got "contrast ( - 1 ) "
PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)]
PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)]
PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)]
PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)]
PASS CSS Animations: property <filter> from [contrast(0)] to [none] at (1.5) should be [contrast(1.5)]
FAIL Web Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)] assert_equals: expected "contrast ( 0 ) " but got "contrast ( - 1 ) "
PASS Web Animations: property <filter> from [contrast(0)] to [none] at (-1) should be [contrast(0)]
PASS Web Animations: property <filter> from [contrast(0)] to [none] at (0) should be [contrast(0)]
PASS Web Animations: property <filter> from [contrast(0)] to [none] at (0.5) should be [contrast(0.5)]
PASS Web Animations: property <filter> from [contrast(0)] to [none] at (1) should be [contrast(1)]
@@ -139,42 +139,42 @@ PASS Web Animations: property <filter> from [none] to [invert(1)] at (0) should
PASS Web Animations: property <filter> from [none] to [invert(1)] at (0.5) should be [invert(0.5)]
PASS Web Animations: property <filter> from [none] to [invert(1)] at (1) should be [invert(1)]
PASS Web Animations: property <filter> from [none] to [invert(1)] at (1.5) should be [invert(1)]
FAIL CSS Transitions: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] assert_equals: expected "opacity ( 0 ) " but got "opacity ( - 1 ) "
PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)]
PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)]
PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)]
PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)]
FAIL CSS Transitions: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "opacity ( 1.5 ) "
FAIL CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] assert_equals: expected "opacity ( 0 ) " but got "opacity ( - 1 ) "
PASS CSS Transitions: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)]
PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)]
PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)]
PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)]
PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)]
FAIL CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "opacity ( 1.5 ) "
FAIL CSS Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] assert_equals: expected "opacity ( 0 ) " but got "opacity ( - 1 ) "
PASS CSS Transitions with transition: all: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)]
PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)]
PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)]
PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)]
PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)]
FAIL CSS Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "opacity ( 1.5 ) "
FAIL Web Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)] assert_equals: expected "opacity ( 0 ) " but got "opacity ( - 1 ) "
PASS CSS Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)]
PASS Web Animations: property <filter> from [opacity(0)] to [none] at (-1) should be [opacity(0)]
PASS Web Animations: property <filter> from [opacity(0)] to [none] at (0) should be [opacity(0)]
PASS Web Animations: property <filter> from [opacity(0)] to [none] at (0.5) should be [opacity(0.5)]
PASS Web Animations: property <filter> from [opacity(0)] to [none] at (1) should be [opacity(1)]
FAIL Web Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)] assert_equals: expected "opacity ( 1 ) " but got "opacity ( 1.5 ) "
FAIL CSS Transitions: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] assert_equals: expected "saturate ( 0 ) " but got "saturate ( - 1 ) "
PASS Web Animations: property <filter> from [opacity(0)] to [none] at (1.5) should be [opacity(1)]
PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)]
PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)]
PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)]
PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)]
PASS CSS Transitions: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)]
FAIL CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] assert_equals: expected "saturate ( 0 ) " but got "saturate ( - 1 ) "
PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)]
PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)]
PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)]
PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)]
PASS CSS Transitions with transition: all: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)]
FAIL CSS Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] assert_equals: expected "saturate ( 0 ) " but got "saturate ( - 1 ) "
PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)]
PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)]
PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)]
PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)]
PASS CSS Animations: property <filter> from [saturate(0)] to [none] at (1.5) should be [saturate(1.5)]
FAIL Web Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)] assert_equals: expected "saturate ( 0 ) " but got "saturate ( - 1 ) "
PASS Web Animations: property <filter> from [saturate(0)] to [none] at (-1) should be [saturate(0)]
PASS Web Animations: property <filter> from [saturate(0)] to [none] at (0) should be [saturate(0)]
PASS Web Animations: property <filter> from [saturate(0)] to [none] at (0.5) should be [saturate(0.5)]
PASS Web Animations: property <filter> from [saturate(0)] to [none] at (1) should be [saturate(1)]
@@ -16,7 +16,7 @@ PASS iteration composition of filter brightness animation
PASS iteration composition of filter drop-shadow animation
PASS iteration composition of same filter list animation
PASS iteration composition of discrete filter list because of mismatch of the order
FAIL iteration composition of different length filter list animation assert_equals: Animated filter list at 0s of the third iteration expected "sepia(1) contrast(3)" but got "sepia(1) contrast(4)"
PASS iteration composition of different length filter list animation
PASS iteration composition of transform(rotate) animation
PASS iteration composition of transform: [ scale(0), scale(1) ] animation
PASS iteration composition of transform: [ scale(1), scale(2) ] animation
@@ -134,7 +134,7 @@ RefPtr<FilterOperation> BasicColorMatrixFilterOperation::blend(const FilterOpera
return this;

if (blendToPassthrough)
return BasicColorMatrixFilterOperation::create(WebCore::blend(m_amount, passthroughAmount(), context), m_type);
return BasicColorMatrixFilterOperation::create(blendAmounts(m_amount, passthroughAmount(), context), m_type);

const BasicColorMatrixFilterOperation* fromOperation = downcast<BasicColorMatrixFilterOperation>(from);
double fromAmount = fromOperation ? fromOperation->amount() : passthroughAmount();
@@ -203,7 +203,7 @@ RefPtr<FilterOperation> BasicComponentTransferFilterOperation::blend(const Filte
return this;

if (blendToPassthrough)
return BasicComponentTransferFilterOperation::create(WebCore::blend(m_amount, passthroughAmount(), context), m_type);
return BasicComponentTransferFilterOperation::create(blendAmounts(m_amount, passthroughAmount(), context), m_type);

const BasicComponentTransferFilterOperation* fromOperation = downcast<BasicComponentTransferFilterOperation>(from);
double fromAmount = fromOperation ? fromOperation->amount() : passthroughAmount();

0 comments on commit 85de8f7

Please sign in to comment.