From bbb772a0a698210c840c1e1a9e4de7b070820d39 Mon Sep 17 00:00:00 2001 From: Antoine Quint Date: Tue, 22 Nov 2022 14:31:43 -0800 Subject: [PATCH] [web-animations] implement correct additivity support for the filter property https://bugs.webkit.org/show_bug.cgi?id=248225 Reviewed by Tim Nguyen. When blending with additivity, simply concatenate the two filter lists. * LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt: * Source/WebCore/animation/CSSPropertyAnimation.cpp: (WebCore::blendFilterOperations): Canonical link: https://commits.webkit.org/256955@main --- .../addition-per-property-001-expected.txt | 4 ++-- Source/WebCore/animation/CSSPropertyAnimation.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt index ea15cdc1f810..420acb2beb17 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt @@ -197,8 +197,8 @@ PASS fill-rule (type: discrete) has testAddition function PASS fill-rule: "nonzero" onto "evenodd" PASS fill-rule: "evenodd" onto "nonzero" PASS filter (type: filterList) has testAddition function -FAIL filter: blur on blur assert_equals: The value should be blur(10px) blur(20px) at 0ms expected "blur(10px) blur(20px)" but got "blur(30px)" -FAIL filter: different filter functions assert_equals: The value should be blur(10px) brightness(0.8) at 0ms expected "blur(10px) brightness(0.8)" but got "brightness(0.8)" +PASS filter: blur on blur +PASS filter: different filter functions PASS flex-basis (type: lengthPercentageOrCalc) has testAddition function PASS flex-basis: length PASS flex-basis: length of rem diff --git a/Source/WebCore/animation/CSSPropertyAnimation.cpp b/Source/WebCore/animation/CSSPropertyAnimation.cpp index 5d567c519938..412961961e65 100644 --- a/Source/WebCore/animation/CSSPropertyAnimation.cpp +++ b/Source/WebCore/animation/CSSPropertyAnimation.cpp @@ -330,6 +330,14 @@ static inline RefPtr blendFunc(FilterOperation* from, FilterOpe static inline FilterOperations blendFilterOperations(const FilterOperations& from, const FilterOperations& to, const CSSPropertyBlendingContext& context) { + if (context.compositeOperation == CompositeOperation::Add) { + ASSERT(context.progress == 1.0); + FilterOperations resultOperations; + resultOperations.operations().appendVector(from.operations()); + resultOperations.operations().appendVector(to.operations()); + return resultOperations; + } + FilterOperations result; size_t fromSize = from.operations().size(); size_t toSize = to.operations().size();