- Revision
- 252461
- Author
- [email protected]
- Date
- 2019-11-14 12:16:44 -0800 (Thu, 14 Nov 2019)
Log Message
[Web Animations] Accelerated transitions do not always remove their backing accelerated animation
https://bugs.webkit.org/show_bug.cgi?id=204198
<rdar://problem/45847205>
Reviewed by Dean Jackson.
LayoutTests/imported/w3c:
Mark some WPT progressions.
* web-platform-tests/dom/events/Event-dispatch-on-disabled-elements-expected.txt:
Source/WebCore:
Test: webanimations/accelerated-animation-removal-upon-transition-completion.html
There could be several calls to KeyframeEffect::updateAcceleratedAnimationState() made after an animation had completed but
before any pending accelerated actions would be processed during the next animation frame. In the first call, we would correctly
set add Accelerated::Stop to the list of pending accelerated actions, but on a further call, wrongly assuming that the fact that
we'd already recorded an Accelerated::Stop action meant that it had been committed, we would clear that action and the animation
would never be explicitly removed.
Additionally, we would schedule animation resolution on the DocumentTimeline in the wrong function, we now do that in the function
where animations with an effect pending accelerated actions is added rather than in the function where we track which elements have
accelerated animations.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
(WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updateAcceleratedAnimationState):
LayoutTests:
Add a new test that checks that a CSS Transition targeting the transform property which requires a layer correctly clears the
accelerated animation upon completion.
* webanimations/accelerated-animation-removal-upon-transition-completion-expected.txt: Added.
* webanimations/accelerated-animation-removal-upon-transition-completion.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (252460 => 252461)
--- trunk/LayoutTests/ChangeLog 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/LayoutTests/ChangeLog 2019-11-14 20:16:44 UTC (rev 252461)
@@ -1,5 +1,19 @@
2019-11-14 Antoine Quint <[email protected]>
+ [Web Animations] Accelerated transitions do not always remove their backing accelerated animation
+ https://bugs.webkit.org/show_bug.cgi?id=204198
+ <rdar://problem/45847205>
+
+ Reviewed by Dean Jackson.
+
+ Add a new test that checks that a CSS Transition targeting the transform property which requires a layer correctly clears the
+ accelerated animation upon completion.
+
+ * webanimations/accelerated-animation-removal-upon-transition-completion-expected.txt: Added.
+ * webanimations/accelerated-animation-removal-upon-transition-completion.html: Added.
+
+2019-11-14 Antoine Quint <[email protected]>
+
[Web Animations] Retargeted transitions targeting accelerated properties do not stop the original transition
https://bugs.webkit.org/show_bug.cgi?id=204116
<rdar://problem/57116961>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (252460 => 252461)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-14 20:16:44 UTC (rev 252461)
@@ -1,3 +1,15 @@
+2019-11-14 Antoine Quint <[email protected]>
+
+ [Web Animations] Accelerated transitions do not always remove their backing accelerated animation
+ https://bugs.webkit.org/show_bug.cgi?id=204198
+ <rdar://problem/45847205>
+
+ Reviewed by Dean Jackson.
+
+ Mark some WPT progressions.
+
+ * web-platform-tests/dom/events/Event-dispatch-on-disabled-elements-expected.txt:
+
2019-11-13 Said Abou-Hallawa <[email protected]>
[SVG2] Add the 'orient' property of the interface SVGMarkerElement
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements-expected.txt (252460 => 252461)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements-expected.txt 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-on-disabled-elements-expected.txt 2019-11-14 20:16:44 UTC (rev 252461)
@@ -1,7 +1,4 @@
-
-Harness Error (TIMEOUT), message = null
-
PASS Can dispatch untrusted 'click' Events at disabled HTML elements.
PASS Can dispatch untrusted Events at disabled HTML elements.
PASS Can dispatch CustomEvents at disabled HTML elements.
@@ -8,7 +5,7 @@
PASS Calling click() on disabled elements must not dispatch events.
PASS CSS Transitions transitionrun, transitionstart, transitionend events fire on disabled form elements
PASS CSS Transitions transitioncancel event fires on disabled form elements
-TIMEOUT CSS Animation animationstart, animationiteration, animationend fire on disabled form elements Test timed out
-NOTRUN CSS Animation's animationcancel event fires on disabled form elements
-NOTRUN Real clicks on disabled elements must not dispatch events.
+PASS CSS Animation animationstart, animationiteration, animationend fire on disabled form elements
+PASS CSS Animation's animationcancel event fires on disabled form elements
+PASS Real clicks on disabled elements must not dispatch events.
Added: trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion-expected.txt (0 => 252461)
--- trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion-expected.txt (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion-expected.txt 2019-11-14 20:16:44 UTC (rev 252461)
@@ -0,0 +1,3 @@
+
+PASS An accelerated CSS transition should remove its animation upon completion.
+
Added: trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion.html (0 => 252461)
--- trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion.html (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-removal-upon-transition-completion.html 2019-11-14 20:16:44 UTC (rev 252461)
@@ -0,0 +1,48 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebAnimationsCSSIntegrationEnabled=true ] -->
+<html>
+<head>
+<style>
+
+#target {
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ transition: transform 10ms;
+}
+
+</style>
+</head>
+<body>
+<script src=""
+<script src=""
+<div id="target"></div>
+
+<script>
+
+function waitNFrames(numberOfFrames, continuation)
+{
+ let elapsedFrames = 0;
+ (function rAFCallback() {
+ if (elapsedFrames++ >= numberOfFrames)
+ continuation();
+ else
+ requestAnimationFrame(rAFCallback);
+ })();
+}
+
+async_test(t => {
+ requestAnimationFrame(() => {
+ const target = document.getElementById("target");
+ target.style.transform = "translate3d(100px, 0, 0)";
+ target.getAnimations()[0].finished.then(() => {
+ waitNFrames(3, () => {
+ assert_equals(internals.acceleratedAnimationsForElement(target).length, 0, "There should be no accelerated animation after the animation completed.");
+ t.done();
+ });
+ });
+ });
+}, "An accelerated CSS transition should remove its animation upon completion.");
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (252460 => 252461)
--- trunk/Source/WebCore/ChangeLog 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/Source/WebCore/ChangeLog 2019-11-14 20:16:44 UTC (rev 252461)
@@ -1,3 +1,29 @@
+2019-11-14 Antoine Quint <[email protected]>
+
+ [Web Animations] Accelerated transitions do not always remove their backing accelerated animation
+ https://bugs.webkit.org/show_bug.cgi?id=204198
+ <rdar://problem/45847205>
+
+ Reviewed by Dean Jackson.
+
+ Test: webanimations/accelerated-animation-removal-upon-transition-completion.html
+
+ There could be several calls to KeyframeEffect::updateAcceleratedAnimationState() made after an animation had completed but
+ before any pending accelerated actions would be processed during the next animation frame. In the first call, we would correctly
+ set add Accelerated::Stop to the list of pending accelerated actions, but on a further call, wrongly assuming that the fact that
+ we'd already recorded an Accelerated::Stop action meant that it had been committed, we would clear that action and the animation
+ would never be explicitly removed.
+
+ Additionally, we would schedule animation resolution on the DocumentTimeline in the wrong function, we now do that in the function
+ where animations with an effect pending accelerated actions is added rather than in the function where we track which elements have
+ accelerated animations.
+
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
+ (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::updateAcceleratedAnimationState):
+
2019-11-14 Zalan Bujtas <[email protected]>
[LFC][Invalidation] Use InvalidationState to populate LayoutQueue
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (252460 => 252461)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2019-11-14 20:16:44 UTC (rev 252461)
@@ -640,6 +640,11 @@
if (auto* target = downcast<KeyframeEffect>(animation.effect())->target())
updateListOfElementsWithRunningAcceleratedAnimationsForElement(*target);
}
+
+ if (shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState())
+ scheduleAnimationResolution();
+ else
+ unscheduleAnimationResolution();
}
void DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement(Element& element)
@@ -659,11 +664,6 @@
}
m_elementsWithRunningAcceleratedAnimations.add(&element);
-
- if (shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState())
- scheduleAnimationResolution();
- else
- unscheduleAnimationResolution();
}
void DocumentTimeline::applyPendingAcceleratedAnimations()
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (252460 => 252461)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2019-11-14 19:42:50 UTC (rev 252460)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2019-11-14 20:16:44 UTC (rev 252461)
@@ -1305,13 +1305,7 @@
}
if (playState == WebAnimation::PlayState::Finished) {
- if (isRunningAccelerated())
- addPendingAcceleratedAction(AcceleratedAction::Stop);
- else {
- m_lastRecordedAcceleratedAction = AcceleratedAction::Stop;
- m_pendingAcceleratedActions.clear();
- animation()->acceleratedStateDidChange();
- }
+ addPendingAcceleratedAction(AcceleratedAction::Stop);
return;
}