Changeset 274391 in webkit


Ignore:
Timestamp:
Mar 13, 2021 12:00:21 PM (16 months ago)
Author:
graouts@webkit.org
Message:

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

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Import interpolation tests for clip. These tests pass completely
with 42 PASS results compared to prior to the source changes.

  • web-platform-tests/css/css-masking/animations/clip-interpolation-expected.txt: Added.
  • web-platform-tests/css/css-masking/animations/clip-interpolation.html: Added.

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/css-masking/animations/clip-interpolation.html

While we already had support for interpolating the clip property, we had a couple of small
issues to fix to pass the entire WPT test dedicated to testing that feature:

  1. we must allow negative values
  2. we must serialize the value to "auto" if all four values are "auto"
  • animation/CSSPropertyAnimation.cpp:

(WebCore::blendFunc):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

LayoutTests:

Rebase a test that used the old, incorrect computed value for "clip" with
four "auto" values.

  • fast/css/computed-clip-with-auto-rect-expected.txt:
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r274390 r274391  
     12021-03-13  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of clip CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223126
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Rebase a test that used the old, incorrect computed value for "clip" with
     9        four "auto" values.
     10
     11        * fast/css/computed-clip-with-auto-rect-expected.txt:
     12
    1132021-03-13  Peng Liu  <peng.liu6@apple.com>
    214
  • trunk/LayoutTests/fast/css/computed-clip-with-auto-rect-expected.txt

    r180441 r274391  
    1 rect(auto, auto, auto, auto)
     1auto
    22
    33rect(5px, auto, auto, auto)
     
    55rect(auto, 5px, auto, auto)
    66
    7 rect(auto, auto, 5px, auto)
     7auto
    88
    9 rect(auto, auto, auto, 5px)
     9auto
    1010
    1111rect(5px, auto, 5px, auto)
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r274389 r274391  
     12021-03-13  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of clip CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223126
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Import interpolation tests for clip. These tests pass completely
     9        with 42 PASS results compared to prior to the source changes.
     10
     11        * web-platform-tests/css/css-masking/animations/clip-interpolation-expected.txt: Added.
     12        * web-platform-tests/css/css-masking/animations/clip-interpolation.html: Added.
     13
    1142021-03-13  Rob Buis  <rbuis@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r274390 r274391  
     12021-03-13  Antoine Quint  <graouts@webkit.org>
     2
     3        Fix interpolation of clip CSS property
     4        https://bugs.webkit.org/show_bug.cgi?id=223126
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Test: imported/w3c/web-platform-tests/css/css-masking/animations/clip-interpolation.html
     9
     10        While we already had support for interpolating the clip property, we had a couple of small
     11        issues to fix to pass the entire WPT test dedicated to testing that feature:
     12
     13            1. we must allow negative values
     14            2. we must serialize the value to "auto" if all four values are "auto"
     15
     16        * animation/CSSPropertyAnimation.cpp:
     17        (WebCore::blendFunc):
     18        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     19        * css/CSSComputedStyleDeclaration.cpp:
     20        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
     21
    1222021-03-13  Peng Liu  <peng.liu6@apple.com>
    223
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r274383 r274391  
    387387}
    388388
    389 static inline LengthBox blendFunc(const CSSPropertyBlendingClient* anim, const LengthBox& from, const LengthBox& to, double progress)
    390 {
    391     LengthBox result(blendFunc(anim, from.top(), to.top(), progress, ValueRangeNonNegative),
    392                      blendFunc(anim, from.right(), to.right(), progress, ValueRangeNonNegative),
    393                      blendFunc(anim, from.bottom(), to.bottom(), progress, ValueRangeNonNegative),
    394                      blendFunc(anim, from.left(), to.left(), progress, ValueRangeNonNegative));
     389static inline LengthBox blendFunc(const CSSPropertyBlendingClient* anim, const LengthBox& from, const LengthBox& to, double progress, ValueRange valueRange = ValueRangeNonNegative)
     390{
     391    LengthBox result(blendFunc(anim, from.top(), to.top(), progress, valueRange),
     392                     blendFunc(anim, from.right(), to.right(), progress, valueRange),
     393                     blendFunc(anim, from.bottom(), to.bottom(), progress, valueRange),
     394                     blendFunc(anim, from.left(), to.left(), progress, valueRange));
    395395
    396396    return result;
     
    791791public:
    792792    enum class Flags {
    793         IsLengthPercentage  = 1 << 0,
    794         UsesFillKeyword     = 1 << 1,
     793        IsLengthPercentage      = 1 << 0,
     794        UsesFillKeyword         = 1 << 1,
     795        AllowsNegativeValues    = 1 << 2,
    795796    };
    796797    LengthBoxPropertyWrapper(CSSPropertyID prop, const LengthBox& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(LengthBox&&), OptionSet<Flags> flags = { })
     
    819820        if (m_flags.contains(Flags::UsesFillKeyword))
    820821            dst->setBorderImageSliceFill((!progress || canInterpolate(a, b) ? a : b)->borderImage().fill());
    821         (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
     822        auto valueRange = m_flags.contains(Flags::AllowsNegativeValues) ? ValueRangeAll : ValueRangeNonNegative;
     823        (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress, valueRange));
    822824    }
    823825
     
    19871989        new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue),
    19881990
    1989         new LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip),
     1991        new LengthBoxPropertyWrapper(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip, { LengthBoxPropertyWrapper::Flags::AllowsNegativeValues }),
    19901992
    19911993        new AcceleratedPropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &RenderStyle::setOpacity),
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r273688 r274391  
    35793579            if (!style.hasClip())
    35803580                return cssValuePool.createIdentifierValue(CSSValueAuto);
     3581            if (style.clip().top().isAuto() && style.clip().right().isAuto()
     3582                && style.clip().top().isAuto() && style.clip().right().isAuto())
     3583                return cssValuePool.createIdentifierValue(CSSValueAuto);
     3584
    35813585            auto rect = Rect::create();
    35823586            rect->setTop(autoOrZoomAdjustedValue(style.clip().top(), style));
Note: See TracChangeset for help on using the changeset viewer.