Title: [281683] trunk
Revision
281683
Author
[email protected]
Date
2021-08-26 20:52:54 -0700 (Thu, 26 Aug 2021)

Log Message

CSS keyframed animations don't respect edges in 4 value background-position
https://bugs.webkit.org/show_bug.cgi?id=228995

Reviewed by Darin Adler.

For some background-position animations we'd fail to set backgroundOriginX/Y in the
destination style's FillLayer, because this is not set in the destination style initially.

So have FillLayerPositionPropertyWrapper::blend() always set it.

Source/WebCore:

Test: animations/background-position.html

* animation/CSSPropertyAnimation.cpp:

LayoutTests:

* animations/background-position-expected.html: Added.
* animations/background-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281682 => 281683)


--- trunk/LayoutTests/ChangeLog	2021-08-27 03:48:31 UTC (rev 281682)
+++ trunk/LayoutTests/ChangeLog	2021-08-27 03:52:54 UTC (rev 281683)
@@ -1,5 +1,20 @@
 2021-08-26  Simon Fraser  <[email protected]>
 
+        CSS keyframed animations don't respect edges in 4 value background-position
+        https://bugs.webkit.org/show_bug.cgi?id=228995
+
+        Reviewed by Darin Adler.
+
+        For some background-position animations we'd fail to set backgroundOriginX/Y in the
+        destination style's FillLayer, because this is not set in the destination style initially.
+        
+        So have FillLayerPositionPropertyWrapper::blend() always set it.
+
+        * animations/background-position-expected.html: Added.
+        * animations/background-position.html: Added.
+
+2021-08-26  Simon Fraser  <[email protected]>
+
         Remove some historical iOS CGContext flipping
         https://bugs.webkit.org/show_bug.cgi?id=229589
 

Added: trunk/LayoutTests/animations/background-position-expected.html (0 => 281683)


--- trunk/LayoutTests/animations/background-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/animations/background-position-expected.html	2021-08-27 03:52:54 UTC (rev 281683)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+    @keyframes play {
+        from {
+            background-position: left 250px top 250px;
+        }
+        to {
+            background-position: top 0px top 0px;
+        }
+    }
+
+    div {
+        background-image: linear-gradient(blue, blue);
+        background-size: 50px 50px;
+        background-repeat: no-repeat;
+        height: 300px;
+        width: 300px;
+        border: 1px solid black;
+        animation: play 1000000s -10000s linear;
+    }        
+    </style>
+</head>
+<body>
+    <div></div>
+</body>
+</html>

Added: trunk/LayoutTests/animations/background-position.html (0 => 281683)


--- trunk/LayoutTests/animations/background-position.html	                        (rev 0)
+++ trunk/LayoutTests/animations/background-position.html	2021-08-27 03:52:54 UTC (rev 281683)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+    @keyframes play {
+        from {
+            background-position: right 0px bottom 0px;
+        }
+        to {
+            background-position: right 250px bottom 250px;
+        }
+    }
+
+    div {
+        background-image: linear-gradient(blue, blue);
+        background-size: 50px 50px;
+        background-repeat: no-repeat;
+        height: 300px;
+        width: 300px;
+        border: 1px solid black;
+        animation: play 1000000s -10000s linear;
+    }        
+    </style>
+</head>
+<body>
+    <div></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (281682 => 281683)


--- trunk/Source/WebCore/ChangeLog	2021-08-27 03:48:31 UTC (rev 281682)
+++ trunk/Source/WebCore/ChangeLog	2021-08-27 03:52:54 UTC (rev 281683)
@@ -1,5 +1,21 @@
 2021-08-26  Simon Fraser  <[email protected]>
 
+        CSS keyframed animations don't respect edges in 4 value background-position
+        https://bugs.webkit.org/show_bug.cgi?id=228995
+
+        Reviewed by Darin Adler.
+
+        For some background-position animations we'd fail to set backgroundOriginX/Y in the
+        destination style's FillLayer, because this is not set in the destination style initially.
+        
+        So have FillLayerPositionPropertyWrapper::blend() always set it.
+
+        Test: animations/background-position.html
+
+        * animation/CSSPropertyAnimation.cpp:
+
+2021-08-26  Simon Fraser  <[email protected]>
+
         Remove some historical iOS CGContext flipping
         https://bugs.webkit.org/show_bug.cgi?id=229589
 

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (281682 => 281683)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-08-27 03:48:31 UTC (rev 281682)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2021-08-27 03:52:54 UTC (rev 281683)
@@ -1643,6 +1643,7 @@
         Edge fromEdge = (from->*m_originGetter)();
         Edge toEdge = (to->*m_originGetter)();
         
+        Edge destinationEdge = toEdge;
         if (fromEdge != toEdge) {
             // Convert the right/bottom into a calc _expression_,
             if (fromEdge == m_farEdge)
@@ -1649,10 +1650,11 @@
                 fromLength = convertTo100PercentMinusLength(fromLength);
             else if (toEdge == m_farEdge) {
                 toLength = convertTo100PercentMinusLength(toLength);
-                (destination->*m_originSetter)(fromEdge); // Now we have a calc(100% - l), it's relative to the left/top edge.
+                destinationEdge = fromEdge; // Now we have a calc(100% - l), it's relative to the left/top edge.
             }
         }
 
+        (destination->*m_originSetter)(destinationEdge);
         (destination->*m_lengthSetter)(blendFunc(fromLength, toLength, context));
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to