Title: [276465] trunk
Revision
276465
Author
[email protected]
Date
2021-04-22 15:07:02 -0700 (Thu, 22 Apr 2021)

Log 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):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276464 => 276465)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-22 22:07:02 UTC (rev 276465)
@@ -1,3 +1,16 @@
+2021-04-22  Antoine Quint  <[email protected]>
+
+        Add discrete animation support for border-image-repeat
+        https://bugs.webkit.org/show_bug.cgi?id=224923
+
+        Reviewed by Antti Koivisto.
+
+        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:
+
 2021-04-22  Chris Lord  <[email protected]>
 
         Implement FontFace in Workers for OffscreenCanvas

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2021-04-22 22:07:02 UTC (rev 276465)
@@ -44,6 +44,9 @@
 PASS border-collapse (type: discrete) has testAccumulation function
 PASS border-collapse: "separate" onto "collapse"
 PASS border-collapse: "collapse" onto "separate"
+PASS border-image-repeat (type: discrete) has testAccumulation function
+PASS border-image-repeat: "round space" onto "stretch repeat"
+PASS border-image-repeat: "stretch repeat" onto "round space"
 PASS border-image-source (type: discrete) has testAccumulation function
 PASS border-image-source: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
 PASS border-image-source: "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-001-expected.txt (276464 => 276465)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2021-04-22 22:07:02 UTC (rev 276465)
@@ -44,6 +44,9 @@
 PASS border-collapse (type: discrete) has testAddition function
 PASS border-collapse: "separate" onto "collapse"
 PASS border-collapse: "collapse" onto "separate"
+PASS border-image-repeat (type: discrete) has testAddition function
+PASS border-image-repeat: "round space" onto "stretch repeat"
+PASS border-image-repeat: "stretch repeat" onto "round space"
 PASS border-image-source (type: discrete) has testAddition function
 PASS border-image-source: "url("http://localhost/test-2")" onto "url("http://localhost/test-1")"
 PASS border-image-source: "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-001-expected.txt (276464 => 276465)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2021-04-22 22:07:02 UTC (rev 276465)
@@ -53,6 +53,10 @@
 PASS border-collapse uses discrete animation when animating between "collapse" and "separate" with linear easing
 PASS border-collapse uses discrete animation when animating between "collapse" and "separate" with effect easing
 PASS border-collapse uses discrete animation when animating between "collapse" and "separate" with keyframe easing
+PASS border-image-repeat (type: discrete) has testInterpolation function
+PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with linear easing
+PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with effect easing
+PASS border-image-repeat uses discrete animation when animating between "stretch repeat" and "round space" with keyframe easing
 PASS border-image-source (type: discrete) has testInterpolation function
 FAIL 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\")"
 FAIL border-image-source 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 (276464 => 276465)


--- trunk/Source/WebCore/ChangeLog	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/ChangeLog	2021-04-22 22:07:02 UTC (rev 276465)
@@ -1,3 +1,22 @@
+2021-04-22  Antoine Quint  <[email protected]>
+
+        Add discrete animation support for border-image-repeat
+        https://bugs.webkit.org/show_bug.cgi?id=224923
+
+        Reviewed by Antti Koivisto.
+
+        * 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):
+
 2021-04-22  Zalan Bujtas  <[email protected]>
 
         [RenderTreeBuilder] Multi-column spanners are not part of the enclosing multi-column renderer's subtree

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (276464 => 276465)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-04-22 22:07:02 UTC (rev 276465)
@@ -620,7 +620,6 @@
         return (style.*m_getter)();
     }
 
-private:
     bool equals(const RenderStyle& a, const RenderStyle& b) const override
     {
         if (&a == &b)
@@ -635,6 +634,7 @@
     }
 #endif
 
+private:
     T (RenderStyle::*m_getter)() const;
 };
 
@@ -684,9 +684,6 @@
     {
     }
 
-private:
-    bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
-
     void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
     {
         ASSERT(!context.progress || context.progress == 1.0);
@@ -693,9 +690,48 @@
         (destination.*this->m_setter)(this->value(context.progress ? to : from));
     }
 
+private:
+    bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
+
     void (RenderStyle::*m_setter)(T);
 };
 
+class BorderImageRepeatWrapper final : public AnimationPropertyWrapperBase {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    BorderImageRepeatWrapper()
+        : AnimationPropertyWrapperBase(CSSPropertyBorderImageRepeat)
+        , m_horizontalWrapper(DiscretePropertyWrapper<NinePieceImageRule>(CSSPropertyBorderImageRepeat, &RenderStyle::borderImageHorizontalRule, &RenderStyle::setBorderImageHorizontalRule))
+        , m_verticalWrapper(DiscretePropertyWrapper<NinePieceImageRule>(CSSPropertyBorderImageRepeat, &RenderStyle::borderImageVerticalRule, &RenderStyle::setBorderImageVerticalRule))
+    {
+    }
+
+private:
+    bool canInterpolate(const RenderStyle&, const RenderStyle&) const final { return false; }
+
+    bool equals(const RenderStyle& a, const RenderStyle& b) const override
+    {
+        return m_horizontalWrapper.equals(a, b) && m_verticalWrapper.equals(a, b);
+    }
+
+    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
+    {
+        m_horizontalWrapper.blend(destination, from, to, context);
+        m_verticalWrapper.blend(destination, from, to, context);
+    }
+
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle& from, const RenderStyle& to, const RenderStyle& destination, double progress) const final
+    {
+        m_horizontalWrapper.logBlend(from, to, destination, progress);
+        m_verticalWrapper.logBlend(from, to, destination, progress);
+    }
+#endif
+
+    DiscretePropertyWrapper<NinePieceImageRule> m_horizontalWrapper;
+    DiscretePropertyWrapper<NinePieceImageRule> m_verticalWrapper;
+};
+
 template <typename T>
 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
     WTF_MAKE_FAST_ALLOCATED;
@@ -2322,7 +2358,7 @@
         new TabSizePropertyWrapper,
 
         // FIXME: The following properties are currently not animatable but should be:
-        // background-blend-mode, border-image-repeat, clip-rule, color-interpolation,
+        // background-blend-mode, clip-rule, color-interpolation,
         // color-interpolation-filters, counter-increment, counter-reset, dominant-baseline,
         // fill-rule, font-family, font-feature-settings, font-kerning, font-language-override,
         // font-synthesis, font-variant-alternates, font-variant-caps, font-variant-east-asian,
@@ -2342,6 +2378,7 @@
         new DiscretePropertyWrapper<FillRepeat>(CSSPropertyBackgroundRepeatY, &RenderStyle::backgroundRepeatY, &RenderStyle::setBackgroundRepeatY),
         new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderBottomStyle, &RenderStyle::borderBottomStyle, &RenderStyle::setBorderBottomStyle),
         new DiscretePropertyWrapper<BorderCollapse>(CSSPropertyBorderCollapse, &RenderStyle::borderCollapse, &RenderStyle::setBorderCollapse),
+        new BorderImageRepeatWrapper,
         new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderLeftStyle, &RenderStyle::borderLeftStyle, &RenderStyle::setBorderLeftStyle),
         new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderRightStyle, &RenderStyle::borderRightStyle, &RenderStyle::setBorderRightStyle),
         new DiscretePropertyWrapper<BorderStyle>(CSSPropertyBorderTopStyle, &RenderStyle::borderTopStyle, &RenderStyle::setBorderTopStyle),

Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.cpp (276464 => 276465)


--- trunk/Source/WebCore/rendering/style/NinePieceImage.cpp	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.cpp	2021-04-22 22:07:02 UTC (rev 276465)
@@ -290,4 +290,15 @@
     return ts;
 }
 
+TextStream& operator<<(TextStream& ts, NinePieceImageRule rule)
+{
+    switch (rule) {
+    case NinePieceImageRule::Stretch: ts << "stretch"; break;
+    case NinePieceImageRule::Round: ts << "round"; break;
+    case NinePieceImageRule::Space: ts << "space"; break;
+    case NinePieceImageRule::Repeat: ts << "repeat"; break;
+    }
+    return ts;
 }
+
+}

Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.h (276464 => 276465)


--- trunk/Source/WebCore/rendering/style/NinePieceImage.h	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.h	2021-04-22 22:07:02 UTC (rev 276465)
@@ -215,5 +215,6 @@
 };
 
 WTF::TextStream& operator<<(WTF::TextStream&, const NinePieceImage&);
+WTF::TextStream& operator<<(WTF::TextStream&, NinePieceImageRule);
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (276464 => 276465)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2021-04-22 22:07:02 UTC (rev 276465)
@@ -2349,6 +2349,20 @@
     m_surroundData.access().border.m_image.setOutset(WTFMove(outset));
 }
 
+void RenderStyle::setBorderImageHorizontalRule(NinePieceImageRule rule)
+{
+    if (m_surroundData->border.m_image.horizontalRule() == rule)
+        return;
+    m_surroundData.access().border.m_image.setHorizontalRule(rule);
+}
+
+void RenderStyle::setBorderImageVerticalRule(NinePieceImageRule rule)
+{
+    if (m_surroundData->border.m_image.verticalRule() == rule)
+        return;
+    m_surroundData.access().border.m_image.setVerticalRule(rule);
+}
+
 void RenderStyle::setColumnStylesFromPaginationMode(const Pagination::Mode& paginationMode)
 {
     if (paginationMode == Pagination::Unpaginated)

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (276464 => 276465)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-04-22 22:02:14 UTC (rev 276464)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2021-04-22 22:07:02 UTC (rev 276465)
@@ -292,6 +292,8 @@
     const LengthBox& borderImageSlices() const { return m_surroundData->border.image().imageSlices(); }
     const LengthBox& borderImageWidth() const { return m_surroundData->border.image().borderSlices(); }
     const LengthBox& borderImageOutset() const { return m_surroundData->border.image().outset(); }
+    NinePieceImageRule borderImageHorizontalRule() const { return m_surroundData->border.image().horizontalRule(); }
+    NinePieceImageRule borderImageVerticalRule() const { return m_surroundData->border.image().verticalRule(); }
 
     const LengthSize& borderTopLeftRadius() const { return m_surroundData->border.topLeftRadius(); }
     const LengthSize& borderTopRightRadius() const { return m_surroundData->border.topRightRadius(); }
@@ -902,6 +904,8 @@
     void setBorderImageSlices(LengthBox&&);
     void setBorderImageWidth(LengthBox&&);
     void setBorderImageOutset(LengthBox&&);
+    void setBorderImageHorizontalRule(NinePieceImageRule);
+    void setBorderImageVerticalRule(NinePieceImageRule);
 
     void setBorderTopLeftRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topLeftRadius, WTFMove(size)); }
     void setBorderTopRightRadius(LengthSize&& size) { SET_VAR(m_surroundData, border.m_topRightRadius, WTFMove(size)); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to