Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291158 => 291159)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-11 14:05:02 UTC (rev 291159)
@@ -1,5 +1,16 @@
2022-03-11 Antoine Quint <[email protected]>
+ [web-animations] mask-composite should support discrete animation
+ https://bugs.webkit.org/show_bug.cgi?id=237769
+
+ Reviewed by Antti Koivisto.
+
+ * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
+ * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
+ * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:
+
+2022-03-11 Antoine Quint <[email protected]>
+
[web-animations] mask-type should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237768
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt (291158 => 291159)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt 2022-03-11 14:05:02 UTC (rev 291159)
@@ -37,6 +37,9 @@
PASS mask-clip (type: discrete) has testAccumulation function
PASS mask-clip: "border-box" onto "content-box"
PASS mask-clip: "content-box" onto "border-box"
+PASS mask-composite (type: discrete) has testAccumulation function
+PASS mask-composite: "subtract" onto "add"
+PASS mask-composite: "add" onto "subtract"
PASS mask-image (type: discrete) has testAccumulation function
PASS mask-image: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
PASS mask-image: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt (291158 => 291159)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt 2022-03-11 14:05:02 UTC (rev 291159)
@@ -37,6 +37,9 @@
PASS mask-clip (type: discrete) has testAddition function
PASS mask-clip: "border-box" onto "content-box"
PASS mask-clip: "content-box" onto "border-box"
+PASS mask-composite (type: discrete) has testAddition function
+PASS mask-composite: "subtract" onto "add"
+PASS mask-composite: "add" onto "subtract"
PASS mask-image (type: discrete) has testAddition function
PASS mask-image: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
PASS mask-image: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt (291158 => 291159)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt 2022-03-11 14:05:02 UTC (rev 291159)
@@ -46,6 +46,10 @@
PASS mask-clip uses discrete animation when animating between "content-box" and "border-box" with linear easing
PASS mask-clip uses discrete animation when animating between "content-box" and "border-box" with effect easing
PASS mask-clip uses discrete animation when animating between "content-box" and "border-box" with keyframe easing
+PASS mask-composite (type: discrete) has testInterpolation function
+PASS mask-composite uses discrete animation when animating between "add" and "subtract" with linear easing
+PASS mask-composite uses discrete animation when animating between "add" and "subtract" with effect easing
+PASS mask-composite uses discrete animation when animating between "add" and "subtract" with keyframe easing
PASS mask-image (type: discrete) has testInterpolation function
FAIL mask-image uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with linear easing assert_equals: The value should be url("http://localhost/test-1") at 499ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-2\")"
FAIL mask-image uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with effect easing assert_equals: The value should be url("http://localhost/test-1") at 940ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-2\")"
Modified: trunk/Source/WebCore/ChangeLog (291158 => 291159)
--- trunk/Source/WebCore/ChangeLog 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/Source/WebCore/ChangeLog 2022-03-11 14:05:02 UTC (rev 291159)
@@ -1,5 +1,18 @@
2022-03-11 Antoine Quint <[email protected]>
+ [web-animations] mask-composite should support discrete animation
+ https://bugs.webkit.org/show_bug.cgi?id=237769
+
+ Reviewed by Antti Koivisto.
+
+ Refactor FillLayerFillBoxPropertyWrapper to a templatized DiscreteFillLayerPropertyWrapper
+ which allows us to support other enum types like CompositeOperator.
+
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
+2022-03-11 Antoine Quint <[email protected]>
+
[web-animations] mask-type should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237768
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (291158 => 291159)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-11 14:01:39 UTC (rev 291158)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-11 14:05:02 UTC (rev 291159)
@@ -1902,10 +1902,11 @@
#endif
};
-class FillLayerFillBoxPropertyWrapper final : public FillLayerAnimationPropertyWrapperBase {
+template <typename T>
+class DiscreteFillLayerPropertyWrapper final : public FillLayerAnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- FillLayerFillBoxPropertyWrapper(CSSPropertyID property, FillBox (FillLayer::*getter)() const, void (FillLayer::*setter)(FillBox))
+ DiscreteFillLayerPropertyWrapper(CSSPropertyID property, T (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
: FillLayerAnimationPropertyWrapperBase(property)
, m_getter(getter)
, m_setter(setter)
@@ -1933,8 +1934,8 @@
(destination->*m_setter)(((context.progress ? to : from)->*m_getter)());
}
- FillBox (FillLayer::*m_getter)() const;
- void (FillLayer::*m_setter)(FillBox);
+ T (FillLayer::*m_getter)() const;
+ void (FillLayer::*m_setter)(T);
};
class FillLayersPropertyWrapper final : public AnimationPropertyWrapperBase {
@@ -1967,11 +1968,14 @@
m_fillLayerPropertyWrapper = makeUnique<FillLayerStyleImagePropertyWrapper>(property, &FillLayer::image, &FillLayer::setImage);
break;
case CSSPropertyMaskClip:
- m_fillLayerPropertyWrapper = makeUnique<FillLayerFillBoxPropertyWrapper>(property, &FillLayer::clip, &FillLayer::setClip);
+ m_fillLayerPropertyWrapper = makeUnique<DiscreteFillLayerPropertyWrapper<FillBox>>(property, &FillLayer::clip, &FillLayer::setClip);
break;
case CSSPropertyMaskOrigin:
- m_fillLayerPropertyWrapper = makeUnique<FillLayerFillBoxPropertyWrapper>(property, &FillLayer::origin, &FillLayer::setOrigin);
+ m_fillLayerPropertyWrapper = makeUnique<DiscreteFillLayerPropertyWrapper<FillBox>>(property, &FillLayer::origin, &FillLayer::setOrigin);
break;
+ case CSSPropertyMaskComposite:
+ m_fillLayerPropertyWrapper = makeUnique<DiscreteFillLayerPropertyWrapper<CompositeOperator>>(property, &FillLayer::composite, &FillLayer::setComposite);
+ break;
default:
break;
}
@@ -3009,6 +3013,7 @@
new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::ensureBackgroundLayers),
new FillLayersPropertyWrapper(CSSPropertyMaskClip, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
+ new FillLayersPropertyWrapper(CSSPropertyMaskComposite, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
new FillLayersPropertyWrapper(CSSPropertyMaskOrigin, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),