Changeset 276552 in webkit


Ignore:
Timestamp:
Apr 24, 2021, 12:33:21 PM (4 years ago)
Author:
graouts@webkit.org
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):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r276551 r276552  
     12021-04-24  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of the clip CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=225017
     5
     6        Reviewed by Dean Jackson.
     7
     8        Mark 13 WPT progressions.
     9
     10        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
     11        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
     12        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
     13        * web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt:
     14
    1152021-04-24  Antoine Quint  <graouts@webkit.org>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt

    r276465 r276552  
    115115PASS clip (type: discrete) has testAccumulation function
    116116PASS clip: "auto" onto "rect(10px, 10px, 10px, 10px)"
    117 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"
    118 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"
    119 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"
     117PASS clip: "rect(10px, 10px, 10px, 10px)" onto "auto"
     118PASS clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)"
     119PASS clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)"
    120120PASS color (type: color) has testAccumulation function
    121121FAIL 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)"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt

    r276465 r276552  
    115115PASS clip (type: discrete) has testAddition function
    116116PASS clip: "auto" onto "rect(10px, 10px, 10px, 10px)"
    117 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"
    118 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"
    119 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"
     117PASS clip: "rect(10px, 10px, 10px, 10px)" onto "auto"
     118PASS clip: "rect(10px, 10px, 10px, auto)" onto "rect(10px, 10px, 10px, 10px)"
     119PASS clip: "rect(10px, 10px, 10px, 10px)" onto "rect(10px, 10px, 10px, auto)"
    120120PASS color (type: color) has testAddition function
    121121FAIL 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)"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt

    r276465 r276552  
    135135PASS clear uses discrete animation when animating between "left" and "right" with keyframe easing
    136136PASS clip (type: rect) has testInterpolation function
    137 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"
     137PASS clip supports animating as a rect
    138138PASS clip (type: discrete) has testInterpolation function
    139 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"
    140 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"
    141 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"
    142 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"
    143 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"
    144 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"
     139PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with linear easing
     140PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with effect easing
     141PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "auto" with keyframe easing
     142PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with linear easing
     143PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with effect easing
     144PASS clip uses discrete animation when animating between "rect(10px, 10px, 10px, 10px)" and "rect(10px, 10px, 10px, auto)" with keyframe easing
    145145PASS color (type: color) has testInterpolation function
    146146PASS color supports animating as color of rgb()
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt

    r270801 r276552  
    66FAIL 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)"
    77FAIL iteration composition of <number> type animation assert_equals: Animated flex-grow style at 0s of the third iteration expected "20" but got "0"
    8 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"
     8FAIL 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)"
    99FAIL iteration composition of <calc()> value animation assert_equals: Animated calc width style at 0s of the third iteration expected "20px" but got "0px"
    1010FAIL 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"
  • trunk/Source/WebCore/ChangeLog

    r276551 r276552  
     12021-04-24  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of the clip CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=225017
     5
     6        Reviewed by Dean Jackson.
     7
     8        While we interpolated the clip value correctly, we wouldn't set the RenderStyle bit that
     9        indicates that there is a non-auto value in the first place. With a new dedicated wrapper,
     10        we can ensure we set the bit correctly as we blend, and that we use discrete interpolation
     11        if both the from and to values aren't auto.
     12
     13        * animation/CSSPropertyAnimation.cpp:
     14        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     15
    1162021-04-24  Antoine Quint  <graouts@webkit.org>
    217
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r276550 r276552  
    858858};
    859859
    860 class LengthBoxPropertyWrapper final : public PropertyWrapperGetter<const LengthBox&> {
     860class LengthBoxPropertyWrapper : public PropertyWrapperGetter<const LengthBox&> {
    861861    WTF_MAKE_FAST_ALLOCATED;
    862862public:
     
    873873    }
    874874
    875 private:
    876     bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const final
     875    bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const override
    877876    {
    878877        if (m_flags.contains(Flags::UsesFillKeyword) && from.borderImage().fill() != to.borderImage().fill())
     
    888887    }
    889888
    890     void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
     889    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const override
    891890    {
    892891        if (m_flags.contains(Flags::UsesFillKeyword))
     
    905904    void (RenderStyle::*m_setter)(LengthBox&&);
    906905    OptionSet<Flags> m_flags;
     906};
     907
     908class ClipWrapper final : public LengthBoxPropertyWrapper {
     909    WTF_MAKE_FAST_ALLOCATED;
     910public:
     911    ClipWrapper()
     912        : LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip, { LengthBoxPropertyWrapper::Flags::AllowsNegativeValues })
     913    {
     914    }
     915
     916private:
     917    bool canInterpolate(const RenderStyle& from, const RenderStyle& to) const final
     918    {
     919        return from.hasClip() && to.hasClip() && LengthBoxPropertyWrapper::canInterpolate(from, to);
     920    }
     921
     922    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
     923    {
     924        LengthBoxPropertyWrapper::blend(destination, from, to, context);
     925        destination.setHasClip(true);
     926    }
    907927};
    908928
     
    22792299        new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue),
    22802300
    2281         new LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip, { LengthBoxPropertyWrapper::Flags::AllowsNegativeValues }),
     2301        new ClipWrapper,
    22822302
    22832303        new AcceleratedPropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &RenderStyle::setOpacity),
Note: See TracChangeset for help on using the changeset viewer.