Title: [291130] trunk
Revision
291130
Author
grao...@webkit.org
Date
2022-03-10 13:50:02 -0800 (Thu, 10 Mar 2022)

Log Message

[web-animations] mask-clip should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237725

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* 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:

Source/WebCore:

* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291129 => 291130)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-10 21:50:02 UTC (rev 291130)
@@ -1,5 +1,16 @@
 2022-03-10  Antoine Quint  <grao...@webkit.org>
 
+        [web-animations] mask-clip should support discrete animation
+        https://bugs.webkit.org/show_bug.cgi?id=237725
+
+        Reviewed by Simon Fraser.
+
+        * 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-10  Antoine Quint  <grao...@webkit.org>
+
         [web-animations] scroll-behavior should support discrete animation
         https://bugs.webkit.org/show_bug.cgi?id=237723
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt (291129 => 291130)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt	2022-03-10 21:50:02 UTC (rev 291130)
@@ -34,6 +34,9 @@
 PASS mask (type: discrete) has testAccumulation function
 FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "url(\"http://localhost/test-2\") 0% 0% / auto repeat border-box border-box add match-source"
 FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-1\") 0% 0% / auto repeat border-box border-box add match-source"
+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-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 (291129 => 291130)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt	2022-03-10 21:50:02 UTC (rev 291130)
@@ -34,6 +34,9 @@
 PASS mask (type: discrete) has testAddition function
 FAIL mask: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")" assert_equals: The value should be url("http://localhost/test-2") at 0ms expected "url(\"http://localhost/test-2\")" but got "url(\"http://localhost/test-2\") 0% 0% / auto repeat border-box border-box add match-source"
 FAIL mask: "url("http://localhost/test-1")" onto "url("http://localhost/test-2")" assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-1\") 0% 0% / auto repeat border-box border-box add match-source"
+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-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 (291129 => 291130)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt	2022-03-10 21:50:02 UTC (rev 291130)
@@ -42,6 +42,10 @@
 FAIL mask 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 0ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-1\") 0% 0% / auto repeat border-box border-box add match-source"
 FAIL mask 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 0ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-1\") 0% 0% / auto repeat border-box border-box add match-source"
 FAIL mask uses discrete animation when animating between "url("http://localhost/test-1")" and "url("http://localhost/test-2")" with keyframe easing assert_equals: The value should be url("http://localhost/test-1") at 0ms expected "url(\"http://localhost/test-1\")" but got "url(\"http://localhost/test-1\") 0% 0% / auto repeat border-box border-box add match-source"
+PASS mask-clip (type: discrete) has testInterpolation function
+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-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 (291129 => 291130)


--- trunk/Source/WebCore/ChangeLog	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/Source/WebCore/ChangeLog	2022-03-10 21:50:02 UTC (rev 291130)
@@ -1,5 +1,15 @@
 2022-03-10  Antoine Quint  <grao...@webkit.org>
 
+        [web-animations] mask-clip should support discrete animation
+        https://bugs.webkit.org/show_bug.cgi?id=237725
+
+        Reviewed by Simon Fraser.
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
+2022-03-10  Antoine Quint  <grao...@webkit.org>
+
         [web-animations] scroll-behavior should support discrete animation
         https://bugs.webkit.org/show_bug.cgi?id=237723
 

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (291129 => 291130)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-10 21:47:34 UTC (rev 291129)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-10 21:50:02 UTC (rev 291130)
@@ -1902,6 +1902,41 @@
 #endif
 };
 
+class FillLayerFillBoxPropertyWrapper final : public FillLayerAnimationPropertyWrapperBase {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    FillLayerFillBoxPropertyWrapper(CSSPropertyID property, FillBox (FillLayer::*getter)() const, void (FillLayer::*setter)(FillBox))
+        : FillLayerAnimationPropertyWrapperBase(property)
+        , m_getter(getter)
+        , m_setter(setter)
+    {
+    }
+
+private:
+    bool equals(const FillLayer* a, const FillLayer* b) const final
+    {
+        return (a->*m_getter)() == (b->*m_getter)();
+    }
+
+    bool canInterpolate(const FillLayer*, const FillLayer*) const final { return false; }
+
+#if !LOG_DISABLED
+    void logBlend(const FillLayer* destination, const FillLayer* from, const FillLayer* to, double progress) const final
+    {
+        LOG_WITH_STREAM(Animations, stream << "  blending " << getPropertyName(this->property()) << " from " << (from->*m_getter)() << " to " << (to->*m_getter)() << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << (destination->*m_getter)());
+    }
+#endif
+
+    void blend(FillLayer* destination, const FillLayer* from, const FillLayer* to, const CSSPropertyBlendingContext& context) const final
+    {
+        ASSERT(!context.progress || context.progress == 1.0);
+        (destination->*m_setter)(((context.progress ? to : from)->*m_getter)());
+    }
+
+    FillBox (FillLayer::*m_getter)() const;
+    void (FillLayer::*m_setter)(FillBox);
+};
+
 class FillLayersPropertyWrapper final : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -1931,6 +1966,9 @@
         case CSSPropertyMaskImage:
             m_fillLayerPropertyWrapper = makeUnique<FillLayerStyleImagePropertyWrapper>(property, &FillLayer::image, &FillLayer::setImage);
             break;
+        case CSSPropertyMaskClip:
+            m_fillLayerPropertyWrapper = makeUnique<FillLayerFillBoxPropertyWrapper>(property, &FillLayer::clip, &FillLayer::setClip);
+            break;
         default:
             break;
         }
@@ -2853,6 +2891,7 @@
         new FillLayersPropertyWrapper(CSSPropertyBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::ensureBackgroundLayers),
         new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::ensureBackgroundLayers),
 
+        new FillLayersPropertyWrapper(CSSPropertyMaskClip, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
         new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
         new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
         new FillLayersPropertyWrapper(CSSPropertyMaskSize, &RenderStyle::maskLayers, &RenderStyle::ensureMaskLayers),
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to