Changeset 276465 in webkit


Ignore:
Timestamp:
Apr 22, 2021 3:07:02 PM (15 months ago)
Author:
graouts@webkit.org
Message:

Add discrete animation support for border-image-repeat
https://bugs.webkit.org/show_bug.cgi?id=224923

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Mark 10 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:

Source/WebCore:

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • rendering/style/NinePieceImage.cpp:

(WebCore::operator<<):

  • rendering/style/NinePieceImage.h:
  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::setBorderImageHorizontalRule):
(WebCore::RenderStyle::setBorderImageVerticalRule):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::borderImageHorizontalRule const):
(WebCore::RenderStyle::borderImageVerticalRule const):

Location:
trunk
Files:
10 edited

Legend:

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

    r276450 r276465  
     12021-04-22  Antoine Quint  <graouts@webkit.org>
     2
     3        Add discrete animation support for border-image-repeat
     4        https://bugs.webkit.org/show_bug.cgi?id=224923
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Mark 10 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
    1142021-04-22  Chris Lord  <clord@igalia.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt

    r276376 r276465  
    4545PASS border-collapse: "separate" onto "collapse"
    4646PASS border-collapse: "collapse" onto "separate"
     47PASS border-image-repeat (type: discrete) has testAccumulation function
     48PASS border-image-repeat: "round space" onto "stretch repeat"
     49PASS border-image-repeat: "stretch repeat" onto "round space"
    4750PASS border-image-source (type: discrete) has testAccumulation function
    4851PASS border-image-source: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt

    r276376 r276465  
    4545PASS border-collapse: "separate" onto "collapse"
    4646PASS border-collapse: "collapse" onto "separate"
     47PASS border-image-repeat (type: discrete) has testAddition function
     48PASS border-image-repeat: "round space" onto "stretch repeat"
     49PASS border-image-repeat: "stretch repeat" onto "round space"
    4750PASS border-image-source (type: discrete) has testAddition function
    4851PASS border-image-source: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt

    r276376 r276465  
    5454PASS border-collapse uses discrete animation when animating between "collapse" and "separate" with effect easing
    5555PASS border-collapse uses discrete animation when animating between "collapse" and "separate" with keyframe easing
     56PASS border-image-repeat (type: discrete) has testInterpolation function
     57PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with linear easing
     58PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with effect easing
     59PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with keyframe easing
    5660PASS border-image-source (type: discrete) has testInterpolation function
    5761FAIL border-image-source 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\")"
  • trunk/Source/WebCore/ChangeLog

    r276464 r276465  
     12021-04-22  Antoine Quint  <graouts@webkit.org>
     2
     3        Add discrete animation support for border-image-repeat
     4        https://bugs.webkit.org/show_bug.cgi?id=224923
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * animation/CSSPropertyAnimation.cpp:
     9        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     10        * rendering/style/NinePieceImage.cpp:
     11        (WebCore::operator<<):
     12        * rendering/style/NinePieceImage.h:
     13        * rendering/style/RenderStyle.cpp:
     14        (WebCore::RenderStyle::setBorderImageHorizontalRule):
     15        (WebCore::RenderStyle::setBorderImageVerticalRule):
     16        * rendering/style/RenderStyle.h:
     17        (WebCore::RenderStyle::borderImageHorizontalRule const):
     18        (WebCore::RenderStyle::borderImageVerticalRule const):
     19
    1202021-04-22  Zalan Bujtas  <zalan@apple.com>
    221
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r276376 r276465  
    621621    }
    622622
    623 private:
    624623    bool equals(const RenderStyle& a, const RenderStyle& b) const override
    625624    {
     
    636635#endif
    637636
     637private:
    638638    T (RenderStyle::*m_getter)() const;
    639639};
     
    685685    }
    686686
    687 private:
    688     bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
    689 
    690687    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
    691688    {
     
    694691    }
    695692
     693private:
     694    bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
     695
    696696    void (RenderStyle::*m_setter)(T);
     697};
     698
     699class BorderImageRepeatWrapper final : public AnimationPropertyWrapperBase {
     700    WTF_MAKE_FAST_ALLOCATED;
     701public:
     702    BorderImageRepeatWrapper()
     703        : AnimationPropertyWrapperBase(CSSPropertyBorderImageRepeat)
     704        , m_horizontalWrapper(DiscretePropertyWrapper<NinePieceImageRule>(CSSPropertyBorderImageRepeat, &RenderStyle::borderImageHorizontalRule, &RenderStyle::setBorderImageHorizontalRule))
     705        , m_verticalWrapper(DiscretePropertyWrapper<NinePieceImageRule>(CSSPropertyBorderImageRepeat, &RenderStyle::borderImageVerticalRule, &RenderStyle::setBorderImageVerticalRule))
     706    {
     707    }
     708
     709private:
     710    bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
     711
     712    bool equals(const RenderStyle& a, const RenderStyle& b) const override
     713    {
     714        return m_horizontalWrapper.equals(a, b) && m_verticalWrapper.equals(a, b);
     715    }
     716
     717    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
     718    {
     719        m_horizontalWrapper.blend(destination, from, to, context);
     720        m_verticalWrapper.blend(destination, from, to, context);
     721    }
     722
     723#if !LOG_DISABLED
     724    void logBlend(const RenderStyle& from, const RenderStyle& to, const RenderStyle& destination, double progress) const final
     725    {
     726        m_horizontalWrapper.logBlend(from, to, destination, progress);
     727        m_verticalWrapper.logBlend(from, to, destination, progress);
     728    }
     729#endif
     730
     731    DiscretePropertyWrapper<NinePieceImageRule> m_horizontalWrapper;
     732    DiscretePropertyWrapper<NinePieceImageRule> m_verticalWrapper;
    697733};
    698734
     
    23232359
    23242360        // FIXME: The following properties are currently not animatable but should be:
    2325         // background-blend-mode, border-image-repeat, clip-rule, color-interpolation,
     2361        // background-blend-mode, clip-rule, color-interpolation,
    23262362        // color-interpolation-filters, counter-increment, counter-reset, dominant-baseline,
    23272363        // fill-rule, font-family, font-feature-settings, font-kerning, font-language-override,
     
    23432379        new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderBottomStyle, &RenderStyle::borderBottomStyle, &RenderStyle::setBorderBottomStyle),
    23442380        new DiscretePropertyWrapper<BorderCollapse>(CSSPropertyBorderCollapse, &RenderStyle::borderCollapse, &RenderStyle::setBorderCollapse),
     2381        new BorderImageRepeatWrapper,
    23452382        new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderLeftStyle, &RenderStyle::borderLeftStyle, &RenderStyle::setBorderLeftStyle),
    23462383        new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderRightStyle, &RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle),
  • trunk/Source/WebCore/rendering/style/NinePieceImage.cpp

    r254841 r276465  
    291291}
    292292
    293 }
     293TextStream& operator<<(TextStream& ts, NinePieceImageRule rule)
     294{
     295    switch (rule) {
     296    case NinePieceImageRule::Stretch: ts << "stretch"; break;
     297    case NinePieceImageRule::Round: ts << "round"; break;
     298    case NinePieceImageRule::Space: ts << "space"; break;
     299    case NinePieceImageRule::Repeat: ts << "repeat"; break;
     300    }
     301    return ts;
     302}
     303
     304}
  • trunk/Source/WebCore/rendering/style/NinePieceImage.h

    r273882 r276465  
    216216
    217217WTF::TextStream& operator<<(WTF::TextStream&, const NinePieceImage&);
     218WTF::TextStream& operator<<(WTF::TextStream&, NinePieceImageRule);
    218219
    219220} // namespace WebCore
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r276253 r276465  
    23502350}
    23512351
     2352void RenderStyle::setBorderImageHorizontalRule(NinePieceImageRule rule)
     2353{
     2354    if (m_surroundData->border.m_image.horizontalRule() == rule)
     2355        return;
     2356    m_surroundData.access().border.m_image.setHorizontalRule(rule);
     2357}
     2358
     2359void RenderStyle::setBorderImageVerticalRule(NinePieceImageRule rule)
     2360{
     2361    if (m_surroundData->border.m_image.verticalRule() == rule)
     2362        return;
     2363    m_surroundData.access().border.m_image.setVerticalRule(rule);
     2364}
     2365
    23522366void RenderStyle::setColumnStylesFromPaginationMode(const Pagination::Mode& paginationMode)
    23532367{
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r276376 r276465  
    293293    const LengthBox& borderImageWidth() const { return m_surroundData->border.image().borderSlices(); }
    294294    const LengthBox& borderImageOutset() const { return m_surroundData->border.image().outset(); }
     295    NinePieceImageRule borderImageHorizontalRule() const { return m_surroundData->border.image().horizontalRule(); }
     296    NinePieceImageRule borderImageVerticalRule() const { return m_surroundData->border.image().verticalRule(); }
    295297
    296298    const LengthSize& borderTopLeftRadius() const { return m_surroundData->border.topLeftRadius(); }
     
    903905    void setBorderImageWidth(LengthBox&&);
    904906    void setBorderImageOutset(LengthBox&&);
     907    void setBorderImageHorizontalRule(NinePieceImageRule);
     908    void setBorderImageVerticalRule(NinePieceImageRule);
    905909
    906910    void setBorderTopLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topLeftRadius, WTFMove(size)); }
Note: See TracChangeset for help on using the changeset viewer.