- Revision
- 187950
- Author
- carlo...@webkit.org
- Date
- 2015-08-05 01:51:55 -0700 (Wed, 05 Aug 2015)
Log Message
Merge r187535 - Animations sometimes fail to start
https://bugs.webkit.org/show_bug.cgi?id=147394
rdar://problem/21852603
Reviewed by Dean Jackson.
Source/WebCore:
When an accelerated animation or transition was started at the same time as
a non-accelerated one, and then the node for the former was removed, we could
never kick off the non-accelerated animation.
AnimationControllerPrivate has logic to synchronize the two types of animation
when they start in the same animation update, which involves setting the
m_waitingForAsyncStartNotification flag, and waiting for a notifyAnimationStarted()
to come in from the graphics system.
However, it failed to handle the case where the accelerated animation was removed
before the callback was received, which left the m_waitingForAsyncStartNotification flag
set to true, preventing the non-accelerated animation from running.
Test: animations/remove-syncing-animation.html
* page/animation/AnimationBase.h:
(WebCore::AnimationBase::isAccelerated): Make this public.
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::clear): Add logging.
(WebCore::AnimationControllerPrivate::receivedStartTimeResponse): Add logging.
(WebCore::AnimationControllerPrivate::animationWillBeRemoved): Add logging.
After removing animations from the maps, check to see if we expect any of the
remaining animations are waiting for a notifyAnimationStarted(). If not, clear
the m_waitingForAsyncStartNotification flag.
(WebCore::AnimationController::notifyAnimationStarted): Log the renderer.
(WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Remove unneeded
initializations of HashMaps.
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::updateTransitions): Log renderers.
(WebCore::CompositeAnimation::updateKeyframeAnimations): Ditto.
LayoutTests:
Test that starts an accelerated and non-accelerated animation, then removes
the node for the accelerated one.
* animations/remove-syncing-animation-expected.txt: Added.
* animations/remove-syncing-animation.html: Added.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (187949 => 187950)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog 2015-08-05 08:34:02 UTC (rev 187949)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog 2015-08-05 08:51:55 UTC (rev 187950)
@@ -1,3 +1,17 @@
+2015-07-28 Simon Fraser <simon.fra...@apple.com>
+
+ Animations sometimes fail to start
+ https://bugs.webkit.org/show_bug.cgi?id=147394
+ rdar://problem/21852603
+
+ Reviewed by Dean Jackson.
+
+ Test that starts an accelerated and non-accelerated animation, then removes
+ the node for the accelerated one.
+
+ * animations/remove-syncing-animation-expected.txt: Added.
+ * animations/remove-syncing-animation.html: Added.
+
2015-07-28 Michael Catanzaro <mcatanz...@igalia.com>
[Freetype] Always allow font matching for strong aliases
Added: releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation-expected.txt (0 => 187950)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation-expected.txt 2015-08-05 08:51:55 UTC (rev 187950)
@@ -0,0 +1,5 @@
+The remaining square should show a color animation from orange to green.
+
+Color keyframes.
+PASS - colors animation ran.
+
Added: releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation.html (0 => 187950)
--- releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation.html (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/animations/remove-syncing-animation.html 2015-08-05 08:51:55 UTC (rev 187950)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ #container {
+
+ }
+
+ .box {
+ height: 100px;
+ width: 100px;
+ margin: 10px;
+ background-color: blue;
+ }
+
+ #container.changed #first {
+ -webkit-animation: fade 0.1s linear;
+ }
+
+ #container.changed #second {
+ -webkit-animation: colors 0.1s linear;
+ }
+
+ @-webkit-keyframes fade {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }
+
+ @-webkit-keyframes colors {
+ from { background-color: orange; }
+ to { background-color: green; }
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ function log(message)
+ {
+ var results = document.getElementById("results");
+ results.innerHTML = results.innerHTML + message + "<br>";
+ }
+
+ var watchdogTimeoutID;
+
+ function testComplete()
+ {
+ window.clearTimeout(watchdogTimeoutID);
+ watchdogTimeoutID = 0;
+ log('PASS - colors animation ran.');
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ function doTest()
+ {
+ window.setTimeout(function() {
+ document.getElementById('second').addEventListener('animationend', testComplete);
+ document.getElementById('container').classList.add('changed');
+
+ window.setTimeout(function() {
+ document.getElementById('first').remove();
+ }, 0);
+ }, 0);
+
+ watchdogTimeoutID = window.setTimeout(function() {
+ log('FAIL - colors animation did not run.');
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 500);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<p>The remaining square should show a color animation from orange to green.</p>
+<div id="container">
+ <div id="first" class="box">
+ Opacity keyframes.
+ </div>
+ <div id="second" class="box">
+ Color keyframes.
+ </div>
+</div>
+
+<div id="results"></div>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (187949 => 187950)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-08-05 08:34:02 UTC (rev 187949)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-08-05 08:51:55 UTC (rev 187950)
@@ -1,3 +1,42 @@
+2015-07-28 Simon Fraser <simon.fra...@apple.com>
+
+ Animations sometimes fail to start
+ https://bugs.webkit.org/show_bug.cgi?id=147394
+ rdar://problem/21852603
+
+ Reviewed by Dean Jackson.
+
+ When an accelerated animation or transition was started at the same time as
+ a non-accelerated one, and then the node for the former was removed, we could
+ never kick off the non-accelerated animation.
+
+ AnimationControllerPrivate has logic to synchronize the two types of animation
+ when they start in the same animation update, which involves setting the
+ m_waitingForAsyncStartNotification flag, and waiting for a notifyAnimationStarted()
+ to come in from the graphics system.
+
+ However, it failed to handle the case where the accelerated animation was removed
+ before the callback was received, which left the m_waitingForAsyncStartNotification flag
+ set to true, preventing the non-accelerated animation from running.
+
+ Test: animations/remove-syncing-animation.html
+
+ * page/animation/AnimationBase.h:
+ (WebCore::AnimationBase::isAccelerated): Make this public.
+ * page/animation/AnimationController.cpp:
+ (WebCore::AnimationControllerPrivate::clear): Add logging.
+ (WebCore::AnimationControllerPrivate::receivedStartTimeResponse): Add logging.
+ (WebCore::AnimationControllerPrivate::animationWillBeRemoved): Add logging.
+ After removing animations from the maps, check to see if we expect any of the
+ remaining animations are waiting for a notifyAnimationStarted(). If not, clear
+ the m_waitingForAsyncStartNotification flag.
+ (WebCore::AnimationController::notifyAnimationStarted): Log the renderer.
+ (WebCore::AnimationControllerPrivate::AnimationControllerPrivate): Remove unneeded
+ initializations of HashMaps.
+ * page/animation/CompositeAnimation.cpp:
+ (WebCore::CompositeAnimation::updateTransitions): Log renderers.
+ (WebCore::CompositeAnimation::updateKeyframeAnimations): Ditto.
+
2015-07-28 Michael Catanzaro <mcatanz...@igalia.com>
[Freetype] Always allow font matching for strong aliases
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationBase.h (187949 => 187950)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationBase.h 2015-08-05 08:34:02 UTC (rev 187949)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationBase.h 2015-08-05 08:51:55 UTC (rev 187950)
@@ -129,6 +129,8 @@
bool waitingForStartTime() const { return m_animationState == AnimationState::StartWaitResponse; }
bool waitingForStyleAvailable() const { return m_animationState == AnimationState::StartWaitStyleAvailable; }
+ bool isAccelerated() const { return m_isAccelerated; }
+
virtual double timeToNextService();
double progress(double scale, double offset, const TimingFunction*) const;
@@ -228,8 +230,6 @@
void goIntoEndingOrLoopingState();
- bool isAccelerated() const { return m_isAccelerated; }
-
static void setNeedsStyleRecalc(Element*);
void getTimeToNextEvent(double& time, bool& isLooping) const;
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationController.cpp (187949 => 187950)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationController.cpp 2015-08-05 08:34:02 UTC (rev 187949)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/AnimationController.cpp 2015-08-05 08:51:55 UTC (rev 187950)
@@ -72,8 +72,6 @@
, m_updateStyleIfNeededDispatcher(*this, &AnimationControllerPrivate::updateStyleIfNeededDispatcherFired)
, m_frame(frame)
, m_beginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet)
- , m_animationsWaitingForStyle()
- , m_animationsWaitingForStartTimeResponse()
, m_beginAnimationUpdateCount(0)
, m_waitingForAsyncStartNotification(false)
, m_isSuspended(false)
@@ -97,6 +95,8 @@
bool AnimationControllerPrivate::clear(RenderElement& renderer)
{
+ LOG(Animations, "AnimationControllerPrivate %p clear: %p", this, &renderer);
+
ASSERT(renderer.isCSSAnimating());
ASSERT(m_compositeAnimations.contains(&renderer));
@@ -410,6 +410,8 @@
void AnimationControllerPrivate::receivedStartTimeResponse(double time)
{
+ LOG(Animations, "AnimationControllerPrivate %p receivedStartTimeResponse %f", this, time);
+
m_waitingForAsyncStartNotification = false;
startTimeResponse(time);
}
@@ -509,8 +511,21 @@
void AnimationControllerPrivate::animationWillBeRemoved(AnimationBase* animation)
{
+ LOG(Animations, "AnimationControllerPrivate %p animationWillBeRemoved: %p", this, animation);
+
removeFromAnimationsWaitingForStyle(animation);
removeFromAnimationsWaitingForStartTimeResponse(animation);
+
+ bool anyAnimationsWaitingForAsyncStart = false;
+ for (auto& animation : m_animationsWaitingForStartTimeResponse) {
+ if (animation->waitingForStartTime() && animation->isAccelerated()) {
+ anyAnimationsWaitingForAsyncStart = true;
+ break;
+ }
+ }
+
+ if (!anyAnimationsWaitingForAsyncStart)
+ m_waitingForAsyncStartNotification = false;
}
AnimationController::AnimationController(Frame& frame)
@@ -588,8 +603,11 @@
return m_data->getAnimatedStyleForRenderer(renderer);
}
-void AnimationController::notifyAnimationStarted(RenderElement&, double startTime)
+void AnimationController::notifyAnimationStarted(RenderElement& renderer, double startTime)
{
+ LOG(Animations, "AnimationController %p notifyAnimationStarted on renderer %p, time=%f", this, &renderer, startTime);
+ UNUSED_PARAM(renderer);
+
AnimationUpdateBlock animationUpdateBlock(this);
m_data->receivedStartTimeResponse(startTime);
}
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/CompositeAnimation.cpp (187949 => 187950)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/CompositeAnimation.cpp 2015-08-05 08:34:02 UTC (rev 187949)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/animation/CompositeAnimation.cpp 2015-08-05 08:51:55 UTC (rev 187950)
@@ -173,7 +173,7 @@
if (!equal && isActiveTransition) {
// Add the new transition
RefPtr<ImplicitAnimation> implicitAnimation = ImplicitAnimation::create(animation, prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle);
- LOG(Animations, "Created ImplicitAnimation %p for property %s duration %.2f delay %.2f", implicitAnimation.get(), getPropertyName(prop), animation.duration(), animation.delay());
+ LOG(Animations, "Created ImplicitAnimation %p on renderer %p for property %s duration %.2f delay %.2f", implicitAnimation.get(), renderer, getPropertyName(prop), animation.duration(), animation.delay());
m_transitions.set(prop, implicitAnimation.release());
}
@@ -186,13 +186,11 @@
// Make a list of transitions to be removed
Vector<int> toBeRemoved;
- end = m_transitions.end();
- for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
- ImplicitAnimation* anim = it->value.get();
- if (!anim->active()) {
- animationController()->animationWillBeRemoved(anim);
- toBeRemoved.append(anim->animatingProperty());
- LOG(Animations, "Removing ImplicitAnimation %p for property %s", anim, getPropertyName(anim->animatingProperty()));
+ for (auto& transition : m_transitions.values()) {
+ if (!transition->active()) {
+ animationController()->animationWillBeRemoved(transition.get());
+ toBeRemoved.append(transition->animatingProperty());
+ LOG(Animations, "Removing ImplicitAnimation %p from renderer %p for property %s", transition.get(), renderer, getPropertyName(transition->animatingProperty()));
}
}
@@ -256,7 +254,7 @@
keyframeAnim->setIndex(i);
} else if ((animation.duration() || animation.delay()) && animation.iterationCount() && animationName != none) {
keyframeAnim = KeyframeAnimation::create(animation, renderer, i, this, targetStyle);
- LOG(Animations, "Creating KeyframeAnimation %p with keyframes %s, duration %.2f, delay %.2f, iterations %.2f", keyframeAnim.get(), animation.name().utf8().data(), animation.duration(), animation.delay(), animation.iterationCount());
+ LOG(Animations, "Creating KeyframeAnimation %p on renderer %p with keyframes %s, duration %.2f, delay %.2f, iterations %.2f", keyframeAnim.get(), renderer, animation.name().utf8().data(), animation.duration(), animation.delay(), animation.iterationCount());
if (m_suspended) {
keyframeAnim->updatePlayState(AnimPlayStatePaused);
LOG(Animations, " (created in suspended/paused state)");
@@ -277,14 +275,12 @@
// Make a list of animations to be removed.
Vector<AtomicStringImpl*> animsToBeRemoved;
- kfend = m_keyframeAnimations.end();
- for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
- KeyframeAnimation* keyframeAnim = it->value.get();
- if (keyframeAnim->index() < 0) {
- animsToBeRemoved.append(keyframeAnim->name().impl());
- animationController()->animationWillBeRemoved(keyframeAnim);
- keyframeAnim->clear();
- LOG(Animations, "Removing KeyframeAnimation %p", keyframeAnim);
+ for (auto& animation : m_keyframeAnimations.values()) {
+ if (animation->index() < 0) {
+ animsToBeRemoved.append(animation->name().impl());
+ animationController()->animationWillBeRemoved(animation.get());
+ animation->clear();
+ LOG(Animations, "Removing KeyframeAnimation %p from renderer %p", animation.get(), renderer);
}
}