Title: [269258] branches/safari-610-branch

Diff

Added: branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend-expected.txt (0 => 269258)


--- branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend-expected.txt	                        (rev 0)
+++ branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend-expected.txt	2020-11-02 19:20:21 UTC (rev 269258)
@@ -0,0 +1,3 @@
+
+PASS Forcing a style update in a transitionend event for an accelerated animation should not prevent another transition for the same property from running later.
+

Added: branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend.html (0 => 269258)


--- branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend.html	                        (rev 0)
+++ branches/safari-610-branch/LayoutTests/webanimations/transition-restart-after-style-recalc-during-transitionend.html	2020-11-02 19:20:21 UTC (rev 269258)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Forcing a style update in a transitionend event for an accelerated animation should not prevent another transition for the same property from running later</title>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+promise_test(async t => {
+    const target = document.body.appendChild(document.createElement("div"));
+    const animatedStyle = "transition: transform 1ms linear; transform: translateX(100px)";
+
+    // Start a transform transition.
+    getComputedStyle(target).transform;
+    target.setAttribute("style", animatedStyle);
+
+    // Wait until it completes, and in the "transitionend" event handler, force a style recalc
+    // before removing the transition style.
+    await new Promise(resolve => {
+        target.addEventListener("transitionend", event => {
+            target.getAnimations();
+            target.removeAttribute("style");
+            resolve();
+        }, { once: true });
+    });
+
+    // Wait until the accelerated animation has completed.
+    await UIHelper.ensurePresentationUpdate();
+
+    // Start another transform transition.
+    getComputedStyle(target).transform;
+    target.setAttribute("style", animatedStyle);
+
+    // Check that it starts and ends.
+    await new Promise(resolve => target.addEventListener("transitionend", resolve, { once: true }));
+}, "Forcing a style update in a transitionend event for an accelerated animation should not prevent another transition for the same property from running later.");
+
+</script>
+</body>
\ No newline at end of file

Modified: branches/safari-610-branch/Source/WebCore/animation/DocumentTimeline.cpp (269257 => 269258)


--- branches/safari-610-branch/Source/WebCore/animation/DocumentTimeline.cpp	2020-11-02 19:13:11 UTC (rev 269257)
+++ branches/safari-610-branch/Source/WebCore/animation/DocumentTimeline.cpp	2020-11-02 19:20:21 UTC (rev 269258)
@@ -289,8 +289,11 @@
     ASSERT(transition);
     removeAnimation(*transition);
     if (is<KeyframeEffect>(transition->effect())) {
-        if (auto* target = downcast<KeyframeEffect>(transition->effect())->targetElementOrPseudoElement())
-            target->ensureCompletedTransitionsByProperty().set(transition->property(), transition);
+        if (auto* target = downcast<KeyframeEffect>(transition->effect())->targetElementOrPseudoElement()) {
+            auto property = transition->property();
+            if (target->hasRunningTransitionsForProperty(property))
+                target->ensureCompletedTransitionsByProperty().set(property, transition);
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to