Title: [276552] trunk
Revision
276552
Author
grao...@webkit.org
Date
2021-04-24 12:33:21 -0700 (Sat, 24 Apr 2021)

Log Message

Fix interpolation of the clip CSS property
https://bugs.webkit.org/show_bug.cgi?id=225017

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark 13 WPT progressions.

* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
* web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt:

Source/WebCore:

While we interpolated the clip value correctly, we wouldn't set the RenderStyle bit that
indicates that there is a non-auto value in the first place. With a new dedicated wrapper,
we can ensure we set the bit correctly as we blend, and that we use discrete interpolation
if both the from and to values aren't auto.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276551 => 276552)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-24 19:33:21 UTC (rev 276552)
@@ -1,5 +1,19 @@
 2021-04-24  Antoine Quint  <grao...@webkit.org>
 
+        Fix interpolation of the clip CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=225017
+
+        Reviewed by Dean Jackson.
+
+        Mark 13 WPT progressions.
+
+        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt:
+
+2021-04-24  Antoine Quint  <grao...@webkit.org>
+
         Computed style for the translate CSS property should use px for the z value
         https://bugs.webkit.org/show_bug.cgi?id=225018
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2021-04-24 19:33:21 UTC (rev 276552)
@@ -114,9 +114,9 @@
 FAIL clip: rect assert_equals: The value should be rect(110px, 110px, 110px, 110px) at 0ms expected "rect(110px, 110px, 110px, 110px)" but got "rect(10px, 10px, 10px, 10px)"
 PASS clip (type: discrete) has testAccumulation function
 PASS clip: "auto" onto "rect(10px, 10px, 10px, 10px)"
-FAIL clip: "rect(10px, 10px, 10px, 10px)" onto "auto" assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)" assert_equals: The value should be rect(10px, 10px, 10px, auto) at 0ms expected "rect(10px, 10px, 10px, auto)" but got "auto"
-FAIL clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)" assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
+PASS clip: "rect(10px, 10px, 10px, 10px)" onto "auto"
+PASS clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)"
+PASS clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)"
 PASS color (type: color) has testAccumulation function
 FAIL color supports animating as color of rgb() with overflowed  from and to values assert_equals: The value should be rgb(255, 128, 128) at 0ms expected "rgb(255, 128, 128)" but got "rgb(255, 0, 0)"
 FAIL color supports animating as color of #RGB assert_equals: The value should be rgb(255, 128, 128) at 0ms expected "rgb(255, 128, 128)" but got "rgb(255, 0, 0)"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt (276551 => 276552)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2021-04-24 19:33:21 UTC (rev 276552)
@@ -114,9 +114,9 @@
 FAIL clip: rect assert_equals: The value should be rect(110px, 110px, 110px, 110px) at 0ms expected "rect(110px, 110px, 110px, 110px)" but got "rect(10px, 10px, 10px, 10px)"
 PASS clip (type: discrete) has testAddition function
 PASS clip: "auto" onto "rect(10px, 10px, 10px, 10px)"
-FAIL clip: "rect(10px, 10px, 10px, 10px)" onto "auto" assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)" assert_equals: The value should be rect(10px, 10px, 10px, auto) at 0ms expected "rect(10px, 10px, 10px, auto)" but got "auto"
-FAIL clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)" assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
+PASS clip: "rect(10px, 10px, 10px, 10px)" onto "auto"
+PASS clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)"
+PASS clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)"
 PASS color (type: color) has testAddition function
 FAIL color supports animating as color of rgb() with overflowed  from and to values assert_equals: The value should be rgb(255, 128, 128) at 0ms expected "rgb(255, 128, 128)" but got "rgb(255, 0, 0)"
 FAIL color supports animating as color of #RGB assert_equals: The value should be rgb(255, 128, 128) at 0ms expected "rgb(255, 128, 128)" but got "rgb(255, 0, 0)"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt (276551 => 276552)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2021-04-24 19:33:21 UTC (rev 276552)
@@ -134,14 +134,14 @@
 PASS clear uses discrete animation when animating between "left" and "right" with effect easing
 PASS clear uses discrete animation when animating between "left" and "right" with keyframe easing
 PASS clip (type: rect) has testInterpolation function
-FAIL clip supports animating as a rect assert_equals: The value should be rect(30px, 30px, 30px, 30px) at 500ms expected "rect(30px, 30px, 30px, 30px)" but got "auto"
+PASS clip supports animating as a rect
 PASS clip (type: discrete) has testInterpolation function
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with linear easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with effect easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with keyframe easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with linear easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with effect easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
-FAIL clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with keyframe easing assert_equals: The value should be rect(10px, 10px, 10px, 10px) at 0ms expected "rect(10px, 10px, 10px, 10px)" but got "auto"
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with linear easing
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with effect easing
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with keyframe easing
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with linear easing
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with effect easing
+PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with keyframe easing
 PASS color (type: color) has testInterpolation function
 PASS color supports animating as color of rgb()
 PASS color supports animating as color of #RGB

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt (276551 => 276552)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt	2021-04-24 19:33:21 UTC (rev 276552)
@@ -5,7 +5,7 @@
 FAIL iteration composition of <color> type animation assert_equals: Animated color style at 0s of the third iteration expected "rgb(240, 240, 240)" but got "rgb(0, 0, 0)"
 FAIL iteration composition of <color> type animation that green component is decreasing assert_equals: Animated color style at 0s of the third iteration expected "rgb(120, 240, 120)" but got "rgb(0, 120, 0)"
 FAIL iteration composition of <number> type animation assert_equals: Animated flex-grow style at 0s of the third iteration expected "20" but got "0"
-FAIL iteration composition of <shape> type animation assert_equals: Animated clip style at 50s of the first iteration expected "rect(5px, 5px, 5px, 5px)" but got "auto"
+FAIL iteration composition of <shape> type animation assert_equals: Animated clip style at 0s of the third iteration expected "rect(20px, 20px, 20px, 20px)" but got "rect(0px, 0px, 0px, 0px)"
 FAIL iteration composition of <calc()> value animation assert_equals: Animated calc width style at 0s of the third iteration expected "20px" but got "0px"
 FAIL iteration composition of <calc()> value animation that the values can'tbe reduced assert_equals: Animated calc width style at 0s of the third iteration expected "40px" but got "0px"
 FAIL iteration composition of opacity animation assert_equals: Animated opacity style at 50s of the first iteration expected "0.2" but got "0.20000000298023224"

Modified: trunk/Source/WebCore/ChangeLog (276551 => 276552)


--- trunk/Source/WebCore/ChangeLog	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/Source/WebCore/ChangeLog	2021-04-24 19:33:21 UTC (rev 276552)
@@ -1,5 +1,20 @@
 2021-04-24  Antoine Quint  <grao...@webkit.org>
 
+        Fix interpolation of the clip CSS property
+        https://bugs.webkit.org/show_bug.cgi?id=225017
+
+        Reviewed by Dean Jackson.
+
+        While we interpolated the clip value correctly, we wouldn't set the RenderStyle bit that
+        indicates that there is a non-auto value in the first place. With a new dedicated wrapper,
+        we can ensure we set the bit correctly as we blend, and that we use discrete interpolation
+        if both the from and to values aren't auto. 
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
+2021-04-24  Antoine Quint  <grao...@webkit.org>
+
         Computed style for the translate CSS property should use px for the z value
         https://bugs.webkit.org/show_bug.cgi?id=225018
 

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (276551 => 276552)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-04-24 19:32:35 UTC (rev 276551)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-04-24 19:33:21 UTC (rev 276552)
@@ -857,7 +857,7 @@
     void (RenderStyle::*m_setter)(T&&);
 };
 
-class LengthBoxPropertyWrapper final : public PropertyWrapperGetter<const LengthBox&> {
+class LengthBoxPropertyWrapper : public PropertyWrapperGetter<const LengthBox&> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     enum class Flags {
@@ -872,8 +872,7 @@
     {
     }
 
-private:
-    bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const final
+    bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const override
     {
         if (m_flags.contains(Flags::UsesFillKeyword) && from.borderImage().fill() != to.borderImage().fill())
             return false;
@@ -887,7 +886,7 @@
             && canInterpolateLengths(fromLengthBox.left(), toLengthBox.left(), isLengthPercentage);
     }
 
-    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
+    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const override
     {
         if (m_flags.contains(Flags::UsesFillKeyword))
             destination.setBorderImageSliceFill((!context.progress || !context.isDiscrete ? from : to).borderImage().fill());
@@ -906,6 +905,27 @@
     OptionSet<Flags> m_flags;
 };
 
+class ClipWrapper final : public LengthBoxPropertyWrapper {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ClipWrapper()
+        : LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip, { LengthBoxPropertyWrapper::Flags::AllowsNegativeValues })
+    {
+    }
+
+private:
+    bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const final
+    {
+        return from.hasClip() && to.hasClip() && LengthBoxPropertyWrapper::canInterpolate(from, to);
+    }
+
+    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
+    {
+        LengthBoxPropertyWrapper::blend(destination, from, to, context);
+        destination.setHasClip(true);
+    }
+};
+
 class PropertyWrapperClipPath final : public RefCountedPropertyWrapper<ClipPathOperation> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -2278,7 +2298,7 @@
         new PropertyWrapper<Visibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility),
         new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue),
 
-        new LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip, { LengthBoxPropertyWrapper::Flags::AllowsNegativeValues }),
+        new ClipWrapper,
 
         new AcceleratedPropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &RenderStyle::setOpacity),
         new AcceleratedPropertyWrapper<const TransformOperations&>(CSSPropertyTransform, &RenderStyle::transform, &RenderStyle::setTransform),
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to