<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170070] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170070">170070</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-06-17 13:19:11 -0700 (Tue, 17 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use strongly typed enums for AnimationState and AnimationInputState
https://bugs.webkit.org/show_bug.cgi?id=133988
Reviewed by Tim Horton.
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::AnimationBase):
(WebCore::nameForState):
(WebCore::AnimationBase::updateStateMachine):
(WebCore::AnimationBase::fireAnimationEventsIfNeeded):
(WebCore::AnimationBase::updatePlayState):
(WebCore::AnimationBase::timeToNextService):
(WebCore::AnimationBase::goIntoEndingOrLoopingState):
(WebCore::AnimationBase::freezeAtTime):
(WebCore::AnimationBase::beginAnimationUpdateTime):
* page/animation/AnimationBase.h:
(WebCore::AnimationBase::clear):
(WebCore::AnimationBase::onAnimationStartResponse):
(WebCore::AnimationBase::waitingToStart):
(WebCore::AnimationBase::preActive):
(WebCore::AnimationBase::postActive):
(WebCore::AnimationBase::fillingForwards):
(WebCore::AnimationBase::paused):
(WebCore::AnimationBase::inPausedState):
(WebCore::AnimationBase::isNew):
(WebCore::AnimationBase::waitingForStartTime):
(WebCore::AnimationBase::waitingForStyleAvailable):
(WebCore::AnimationBase::isAnimatingProperty):
(WebCore::AnimationBase::styleAvailable):
(WebCore::AnimationBase::compositeAnimation):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::onAnimationEnd):
(WebCore::ImplicitAnimation::sendTransitionEvent):
(WebCore::ImplicitAnimation::reset):
(WebCore::ImplicitAnimation::setOverridden):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::KeyframeAnimation):
(WebCore::KeyframeAnimation::animate):
(WebCore::KeyframeAnimation::sendAnimationEvent):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationBasecpp">trunk/Source/WebCore/page/animation/AnimationBase.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationBaseh">trunk/Source/WebCore/page/animation/AnimationBase.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationImplicitAnimationcpp">trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationKeyframeAnimationcpp">trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170069 => 170070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-17 20:17:44 UTC (rev 170069)
+++ trunk/Source/WebCore/ChangeLog        2014-06-17 20:19:11 UTC (rev 170070)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-06-17 Anders Carlsson <andersca@apple.com>
+
+ Use strongly typed enums for AnimationState and AnimationInputState
+ https://bugs.webkit.org/show_bug.cgi?id=133988
+
+ Reviewed by Tim Horton.
+
+ * page/animation/AnimationBase.cpp:
+ (WebCore::AnimationBase::AnimationBase):
+ (WebCore::nameForState):
+ (WebCore::AnimationBase::updateStateMachine):
+ (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
+ (WebCore::AnimationBase::updatePlayState):
+ (WebCore::AnimationBase::timeToNextService):
+ (WebCore::AnimationBase::goIntoEndingOrLoopingState):
+ (WebCore::AnimationBase::freezeAtTime):
+ (WebCore::AnimationBase::beginAnimationUpdateTime):
+ * page/animation/AnimationBase.h:
+ (WebCore::AnimationBase::clear):
+ (WebCore::AnimationBase::onAnimationStartResponse):
+ (WebCore::AnimationBase::waitingToStart):
+ (WebCore::AnimationBase::preActive):
+ (WebCore::AnimationBase::postActive):
+ (WebCore::AnimationBase::fillingForwards):
+ (WebCore::AnimationBase::paused):
+ (WebCore::AnimationBase::inPausedState):
+ (WebCore::AnimationBase::isNew):
+ (WebCore::AnimationBase::waitingForStartTime):
+ (WebCore::AnimationBase::waitingForStyleAvailable):
+ (WebCore::AnimationBase::isAnimatingProperty):
+ (WebCore::AnimationBase::styleAvailable):
+ (WebCore::AnimationBase::compositeAnimation):
+ * page/animation/ImplicitAnimation.cpp:
+ (WebCore::ImplicitAnimation::onAnimationEnd):
+ (WebCore::ImplicitAnimation::sendTransitionEvent):
+ (WebCore::ImplicitAnimation::reset):
+ (WebCore::ImplicitAnimation::setOverridden):
+ * page/animation/KeyframeAnimation.cpp:
+ (WebCore::KeyframeAnimation::KeyframeAnimation):
+ (WebCore::KeyframeAnimation::animate):
+ (WebCore::KeyframeAnimation::sendAnimationEvent):
+
</ins><span class="cx"> 2014-06-17 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Avoid synchronous layout in window.scrollTo(0,0) when already at (0,0)
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (170069 => 170070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationBase.cpp        2014-06-17 20:17:44 UTC (rev 170069)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp        2014-06-17 20:19:11 UTC (rev 170070)
</span><span class="lines">@@ -68,8 +68,8 @@
</span><span class="cx"> return floor(numSteps * t) / numSteps;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-AnimationBase::AnimationBase(const Animation& transition, RenderElement* renderer, CompositeAnimation* compAnim)
- : m_animState(AnimationStateNew)
</del><ins>+AnimationBase::AnimationBase(const Animation& transition, RenderElement* renderer, CompositeAnimation* compositeAnimation)
+ : m_animationState(AnimationState::New)
</ins><span class="cx"> , m_isAccelerated(false)
</span><span class="cx"> , m_transformFunctionListValid(false)
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> , m_nextIterationDuration(-1)
</span><span class="cx"> , m_object(renderer)
</span><span class="cx"> , m_animation(const_cast<Animation*>(&transition))
</span><del>- , m_compAnim(compAnim)
</del><ins>+ , m_compositeAnimation(compositeAnimation)
</ins><span class="cx"> {
</span><span class="cx"> // Compute the total duration
</span><span class="cx"> if (m_animation->iterationCount() > 0)
</span><span class="lines">@@ -112,38 +112,38 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !LOG_DISABLED
</span><del>-static const char* nameForState(AnimationBase::AnimState state)
</del><ins>+static const char* nameForState(AnimationBase::AnimationState state)
</ins><span class="cx"> {
</span><span class="cx"> switch (state) {
</span><del>- case AnimationBase::AnimationStateNew: return "New";
- case AnimationBase::AnimationStateStartWaitTimer: return "StartWaitTimer";
- case AnimationBase::AnimationStateStartWaitStyleAvailable: return "StartWaitStyleAvailable";
- case AnimationBase::AnimationStateStartWaitResponse: return "StartWaitResponse";
- case AnimationBase::AnimationStateLooping: return "Looping";
- case AnimationBase::AnimationStateEnding: return "Ending";
- case AnimationBase::AnimationStatePausedNew: return "PausedNew";
- case AnimationBase::AnimationStatePausedWaitTimer: return "PausedWaitTimer";
- case AnimationBase::AnimationStatePausedWaitStyleAvailable: return "PausedWaitStyleAvailable";
- case AnimationBase::AnimationStatePausedWaitResponse: return "PausedWaitResponse";
- case AnimationBase::AnimationStatePausedRun: return "PausedRun";
- case AnimationBase::AnimationStateDone: return "Done";
- case AnimationBase::AnimationStateFillingForwards: return "FillingForwards";
</del><ins>+ case AnimationBase::AnimationState::New: return "New";
+ case AnimationBase::AnimationState::StartWaitTimer: return "StartWaitTimer";
+ case AnimationBase::AnimationState::StartWaitStyleAvailable: return "StartWaitStyleAvailable";
+ case AnimationBase::AnimationState::StartWaitResponse: return "StartWaitResponse";
+ case AnimationBase::AnimationState::Looping: return "Looping";
+ case AnimationBase::AnimationState::Ending: return "Ending";
+ case AnimationBase::AnimationState::PausedNew: return "PausedNew";
+ case AnimationBase::AnimationState::PausedWaitTimer: return "PausedWaitTimer";
+ case AnimationBase::AnimationState::PausedWaitStyleAvailable: return "PausedWaitStyleAvailable";
+ case AnimationBase::AnimationState::PausedWaitResponse: return "PausedWaitResponse";
+ case AnimationBase::AnimationState::PausedRun: return "PausedRun";
+ case AnimationBase::AnimationState::Done: return "Done";
+ case AnimationBase::AnimationState::FillingForwards: return "FillingForwards";
</ins><span class="cx"> }
</span><span class="cx"> return "";
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void AnimationBase::updateStateMachine(AnimStateInput input, double param)
</del><ins>+void AnimationBase::updateStateMachine(AnimationStateInput input, double param)
</ins><span class="cx"> {
</span><del>- if (!m_compAnim)
</del><ins>+ if (!m_compositeAnimation)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- // If we get AnimationStateInputRestartAnimation then we force a new animation, regardless of state.
- if (input == AnimationStateInputMakeNew) {
- if (m_animState == AnimationStateStartWaitStyleAvailable)
- m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
- LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
- m_animState = AnimationStateNew;
</del><ins>+ // If we get AnimationStateInput::RestartAnimation then we force a new animation, regardless of state.
+ if (input == AnimationStateInput::MakeNew) {
+ if (m_animationState == AnimationState::StartWaitStyleAvailable)
+ m_compositeAnimation->animationController()->removeFromAnimationsWaitingForStyle(this);
+ LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState));
+ m_animationState = AnimationState::New;
</ins><span class="cx"> m_startTime = 0;
</span><span class="cx"> m_pauseTime = -1;
</span><span class="cx"> m_requestedStartTime = 0;
</span><span class="lines">@@ -152,11 +152,11 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (input == AnimationStateInputRestartAnimation) {
- if (m_animState == AnimationStateStartWaitStyleAvailable)
- m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
- LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
- m_animState = AnimationStateNew;
</del><ins>+ if (input == AnimationStateInput::RestartAnimation) {
+ if (m_animationState == AnimationState::StartWaitStyleAvailable)
+ m_compositeAnimation->animationController()->removeFromAnimationsWaitingForStyle(this);
+ LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState));
+ m_animationState = AnimationState::New;
</ins><span class="cx"> m_startTime = 0;
</span><span class="cx"> m_pauseTime = -1;
</span><span class="cx"> m_requestedStartTime = 0;
</span><span class="lines">@@ -164,31 +164,31 @@
</span><span class="cx"> endAnimation();
</span><span class="cx">
</span><span class="cx"> if (!paused())
</span><del>- updateStateMachine(AnimationStateInputStartAnimation, -1);
</del><ins>+ updateStateMachine(AnimationStateInput::StartAnimation, -1);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (input == AnimationStateInputEndAnimation) {
- if (m_animState == AnimationStateStartWaitStyleAvailable)
- m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
- LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
- m_animState = AnimationStateDone;
</del><ins>+ if (input == AnimationStateInput::EndAnimation) {
+ if (m_animationState == AnimationState::StartWaitStyleAvailable)
+ m_compositeAnimation->animationController()->removeFromAnimationsWaitingForStyle(this);
+ LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animationState));
+ m_animationState = AnimationState::Done;
</ins><span class="cx"> endAnimation();
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (input == AnimationStateInputPauseOverride) {
- if (m_animState == AnimationStateStartWaitResponse) {
- // If we are in AnimationStateStartWaitResponse, the animation will get canceled before
</del><ins>+ if (input == AnimationStateInput::PauseOverride) {
+ if (m_animationState == AnimationState::StartWaitResponse) {
+ // If we are in AnimationState::StartWaitResponse, the animation will get canceled before
</ins><span class="cx"> // we get a response, so move to the next state.
</span><span class="cx"> endAnimation();
</span><del>- updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
</del><ins>+ updateStateMachine(AnimationStateInput::StartTimeSet, beginAnimationUpdateTime());
</ins><span class="cx"> }
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (input == AnimationStateInputResumeOverride) {
- if (m_animState == AnimationStateLooping || m_animState == AnimationStateEnding) {
</del><ins>+ if (input == AnimationStateInput::ResumeOverride) {
+ if (m_animationState == AnimationState::Looping || m_animationState == AnimationState::Ending) {
</ins><span class="cx"> // Start the animation
</span><span class="cx"> startAnimation(beginAnimationUpdateTime() - m_startTime);
</span><span class="cx"> }
</span><span class="lines">@@ -196,47 +196,47 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Execute state machine
</span><del>- switch (m_animState) {
- case AnimationStateNew:
- ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning || input == AnimationStateInputPlayStatePaused);
- if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
</del><ins>+ switch (m_animationState) {
+ case AnimationState::New:
+ ASSERT(input == AnimationStateInput::StartAnimation || input == AnimationStateInput::PlayStateRunning || input == AnimationStateInput::PlayStatePaused);
+ if (input == AnimationStateInput::StartAnimation || input == AnimationStateInput::PlayStateRunning) {
</ins><span class="cx"> m_requestedStartTime = beginAnimationUpdateTime();
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitTimer", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitTimer;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitTimer", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitTimer;
</ins><span class="cx"> } else {
</span><span class="cx"> // We are pausing before we even started.
</span><del>- LOG(Animations, "%p AnimationState %s -> AnimationStatePausedNew", this, nameForState(m_animState));
- m_animState = AnimationStatePausedNew;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> AnimationState::PausedNew", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedNew;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case AnimationStateStartWaitTimer:
- ASSERT(input == AnimationStateInputStartTimerFired || input == AnimationStateInputPlayStatePaused);
</del><ins>+ case AnimationState::StartWaitTimer:
+ ASSERT(input == AnimationStateInput::StartTimerFired || input == AnimationStateInput::PlayStatePaused);
</ins><span class="cx">
</span><del>- if (input == AnimationStateInputStartTimerFired) {
</del><ins>+ if (input == AnimationStateInput::StartTimerFired) {
</ins><span class="cx"> ASSERT(param >= 0);
</span><span class="cx"> // Start timer has fired, tell the animation to start and wait for it to respond with start time
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitStyleAvailable;
- m_compAnim->animationController()->addToAnimationsWaitingForStyle(this);
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitStyleAvailable;
+ m_compositeAnimation->animationController()->addToAnimationsWaitingForStyle(this);
</ins><span class="cx">
</span><span class="cx"> // Trigger a render so we can start the animation
</span><span class="cx"> if (m_object && m_object->element())
</span><del>- m_compAnim->animationController()->addElementChangeToDispatch(*m_object->element());
</del><ins>+ m_compositeAnimation->animationController()->addElementChangeToDispatch(*m_object->element());
</ins><span class="cx"> } else {
</span><span class="cx"> ASSERT(!paused());
</span><span class="cx"> // We're waiting for the start timer to fire and we got a pause. Cancel the timer, pause and wait
</span><span class="cx"> m_pauseTime = beginAnimationUpdateTime();
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedWaitTimer", this, nameForState(m_animState));
- m_animState = AnimationStatePausedWaitTimer;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedWaitTimer", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedWaitTimer;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case AnimationStateStartWaitStyleAvailable:
- ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused);
</del><ins>+ case AnimationState::StartWaitStyleAvailable:
+ ASSERT(input == AnimationStateInput::StyleAvailable || input == AnimationStateInput::PlayStatePaused);
</ins><span class="cx">
</span><del>- if (input == AnimationStateInputStyleAvailable) {
</del><ins>+ if (input == AnimationStateInput::StyleAvailable) {
</ins><span class="cx"> // Start timer has fired, tell the animation to start and wait for it to respond with start time
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitResponse;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitResponse;
</ins><span class="cx">
</span><span class="cx"> overrideAnimations();
</span><span class="cx">
</span><span class="lines">@@ -244,10 +244,10 @@
</span><span class="cx"> if (overridden()) {
</span><span class="cx"> // We won't try to start accelerated animations if we are overridden and
</span><span class="cx"> // just move on to the next state.
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitResponse;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitResponse;
</ins><span class="cx"> m_isAccelerated = false;
</span><del>- updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
</del><ins>+ updateStateMachine(AnimationStateInput::StartTimeSet, beginAnimationUpdateTime());
</ins><span class="cx"> } else {
</span><span class="cx"> double timeOffset = 0;
</span><span class="cx"> // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
</span><span class="lines">@@ -255,20 +255,20 @@
</span><span class="cx"> timeOffset = -m_animation->delay();
</span><span class="cx"> bool started = startAnimation(timeOffset);
</span><span class="cx">
</span><del>- m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
</del><ins>+ m_compositeAnimation->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
</ins><span class="cx"> m_isAccelerated = started;
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> // We're waiting for the style to be available and we got a pause. Pause and wait
</span><span class="cx"> m_pauseTime = beginAnimationUpdateTime();
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedWaitStyleAvailable", this, nameForState(m_animState));
- m_animState = AnimationStatePausedWaitStyleAvailable;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedWaitStyleAvailable", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedWaitStyleAvailable;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case AnimationStateStartWaitResponse:
- ASSERT(input == AnimationStateInputStartTimeSet || input == AnimationStateInputPlayStatePaused);
</del><ins>+ case AnimationState::StartWaitResponse:
+ ASSERT(input == AnimationStateInput::StartTimeSet || input == AnimationStateInput::PlayStatePaused);
</ins><span class="cx">
</span><del>- if (input == AnimationStateInputStartTimeSet) {
</del><ins>+ if (input == AnimationStateInput::StartTimeSet) {
</ins><span class="cx"> ASSERT(param >= 0);
</span><span class="cx"> // We have a start time, set it, unless the startTime is already set
</span><span class="cx"> if (m_startTime <= 0) {
</span><span class="lines">@@ -286,20 +286,20 @@
</span><span class="cx">
</span><span class="cx"> // Dispatch updateStyleIfNeeded so we can start the animation
</span><span class="cx"> if (m_object && m_object->element())
</span><del>- m_compAnim->animationController()->addElementChangeToDispatch(*m_object->element());
</del><ins>+ m_compositeAnimation->animationController()->addElementChangeToDispatch(*m_object->element());
</ins><span class="cx"> } else {
</span><span class="cx"> // We are pausing while waiting for a start response. Cancel the animation and wait. When
</span><span class="cx"> // we unpause, we will act as though the start timer just fired
</span><span class="cx"> m_pauseTime = beginAnimationUpdateTime();
</span><span class="cx"> pauseAnimation(beginAnimationUpdateTime() - m_startTime);
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStatePausedWaitResponse;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedWaitResponse;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case AnimationStateLooping:
- ASSERT(input == AnimationStateInputLoopTimerFired || input == AnimationStateInputPlayStatePaused);
</del><ins>+ case AnimationState::Looping:
+ ASSERT(input == AnimationStateInput::LoopTimerFired || input == AnimationStateInput::PlayStatePaused);
</ins><span class="cx">
</span><del>- if (input == AnimationStateInputLoopTimerFired) {
</del><ins>+ if (input == AnimationStateInput::LoopTimerFired) {
</ins><span class="cx"> ASSERT(param >= 0);
</span><span class="cx"> // Loop timer fired, loop again or end.
</span><span class="cx"> onAnimationIteration(param);
</span><span class="lines">@@ -310,131 +310,131 @@
</span><span class="cx"> // We are pausing while running. Cancel the animation and wait
</span><span class="cx"> m_pauseTime = beginAnimationUpdateTime();
</span><span class="cx"> pauseAnimation(beginAnimationUpdateTime() - m_startTime);
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
- m_animState = AnimationStatePausedRun;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedRun;
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case AnimationStateEnding:
</del><ins>+ case AnimationState::Ending:
</ins><span class="cx"> #if !LOG_DISABLED
</span><del>- if (input != AnimationStateInputEndTimerFired && input != AnimationStateInputPlayStatePaused)
- LOG_ERROR("State is AnimationStateEnding, but input is not AnimationStateInputEndTimerFired or AnimationStateInputPlayStatePaused. It is %d.", input);
</del><ins>+ if (input != AnimationStateInput::EndTimerFired && input != AnimationStateInput::PlayStatePaused)
+ LOG_ERROR("State is AnimationState::Ending, but input is not AnimationStateInput::EndTimerFired or AnimationStateInput::PlayStatePaused. It is %d.", input);
</ins><span class="cx"> #endif
</span><del>- if (input == AnimationStateInputEndTimerFired) {
</del><ins>+ if (input == AnimationStateInput::EndTimerFired) {
</ins><span class="cx">
</span><span class="cx"> ASSERT(param >= 0);
</span><span class="cx"> // End timer fired, finish up
</span><span class="cx"> onAnimationEnd(param);
</span><span class="cx">
</span><del>- LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
- m_animState = AnimationStateDone;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animationState));
+ m_animationState = AnimationState::Done;
</ins><span class="cx">
</span><span class="cx"> if (m_object) {
</span><span class="cx"> if (m_animation->fillsForwards()) {
</span><del>- LOG(Animations, "%p AnimationState %s -> FillingForwards", this, nameForState(m_animState));
- m_animState = AnimationStateFillingForwards;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> FillingForwards", this, nameForState(m_animationState));
+ m_animationState = AnimationState::FillingForwards;
</ins><span class="cx"> } else
</span><span class="cx"> resumeOverriddenAnimations();
</span><span class="cx">
</span><span class="cx"> // Fire off another style change so we can set the final value
</span><span class="cx"> if (m_object->element())
</span><del>- m_compAnim->animationController()->addElementChangeToDispatch(*m_object->element());
</del><ins>+ m_compositeAnimation->animationController()->addElementChangeToDispatch(*m_object->element());
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> // We are pausing while running. Cancel the animation and wait
</span><span class="cx"> m_pauseTime = beginAnimationUpdateTime();
</span><span class="cx"> pauseAnimation(beginAnimationUpdateTime() - m_startTime);
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
- m_animState = AnimationStatePausedRun;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedRun;
</ins><span class="cx"> }
</span><span class="cx"> // |this| may be deleted here
</span><span class="cx"> break;
</span><del>- case AnimationStatePausedWaitTimer:
- ASSERT(input == AnimationStateInputPlayStateRunning);
</del><ins>+ case AnimationState::PausedWaitTimer:
+ ASSERT(input == AnimationStateInput::PlayStateRunning);
</ins><span class="cx"> ASSERT(paused());
</span><span class="cx"> // Update the times
</span><span class="cx"> m_startTime += beginAnimationUpdateTime() - m_pauseTime;
</span><span class="cx"> m_pauseTime = -1;
</span><span class="cx">
</span><span class="cx"> // we were waiting for the start timer to fire, go back and wait again
</span><del>- LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
- m_animState = AnimationStateNew;
- updateStateMachine(AnimationStateInputStartAnimation, 0);
</del><ins>+ LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animationState));
+ m_animationState = AnimationState::New;
+ updateStateMachine(AnimationStateInput::StartAnimation, 0);
</ins><span class="cx"> break;
</span><del>- case AnimationStatePausedNew:
- case AnimationStatePausedWaitResponse:
- case AnimationStatePausedWaitStyleAvailable:
- case AnimationStatePausedRun:
</del><ins>+ case AnimationState::PausedNew:
+ case AnimationState::PausedWaitResponse:
+ case AnimationState::PausedWaitStyleAvailable:
+ case AnimationState::PausedRun:
</ins><span class="cx"> // We treat these two cases the same. The only difference is that, when we are in
</span><del>- // AnimationStatePausedWaitResponse, we don't yet have a valid startTime, so we send 0 to startAnimation.
- // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice
</del><ins>+ // AnimationState::PausedWaitResponse, we don't yet have a valid startTime, so we send 0 to startAnimation.
+ // When the AnimationStateInput::StartTimeSet comes in and we were in AnimationState::PausedRun, we will notice
</ins><span class="cx"> // that we have already set the startTime and will ignore it.
</span><del>- ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet || input == AnimationStateInputStyleAvailable || input == AnimationStateInputStartAnimation);
</del><ins>+ ASSERT(input == AnimationStateInput::PlayStateRunning || input == AnimationStateInput::StartTimeSet || input == AnimationStateInput::StyleAvailable || input == AnimationStateInput::StartAnimation);
</ins><span class="cx"> ASSERT(paused());
</span><span class="cx">
</span><del>- if (input == AnimationStateInputPlayStateRunning) {
- if (m_animState == AnimationStatePausedNew) {
</del><ins>+ if (input == AnimationStateInput::PlayStateRunning) {
+ if (m_animationState == AnimationState::PausedNew) {
</ins><span class="cx"> // We were paused before we even started, and now we're supposed
</span><span class="cx"> // to start, so jump back to the New state and reset.
</span><del>- LOG(Animations, "%p AnimationState %s -> AnimationStateNew", this, nameForState(m_animState));
- m_animState = AnimationStateNew;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> AnimationState::New", this, nameForState(m_animationState));
+ m_animationState = AnimationState::New;
</ins><span class="cx"> updateStateMachine(input, param);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Update the times
</span><del>- if (m_animState == AnimationStatePausedRun)
</del><ins>+ if (m_animationState == AnimationState::PausedRun)
</ins><span class="cx"> m_startTime += beginAnimationUpdateTime() - m_pauseTime;
</span><span class="cx"> else
</span><span class="cx"> m_startTime = 0;
</span><span class="cx"> m_pauseTime = -1;
</span><span class="cx">
</span><del>- if (m_animState == AnimationStatePausedWaitStyleAvailable) {
- LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitStyleAvailable;
</del><ins>+ if (m_animationState == AnimationState::PausedWaitStyleAvailable) {
+ LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitStyleAvailable;
</ins><span class="cx"> } else {
</span><span class="cx"> // We were either running or waiting for a begin time response from the animation.
</span><span class="cx"> // Either way we need to restart the animation (possibly with an offset if we
</span><span class="cx"> // had already been running) and wait for it to start.
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitResponse;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitResponse;
</ins><span class="cx">
</span><span class="cx"> // Start the animation
</span><span class="cx"> if (overridden()) {
</span><span class="cx"> // We won't try to start accelerated animations if we are overridden and
</span><span class="cx"> // just move on to the next state.
</span><del>- updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
</del><ins>+ updateStateMachine(AnimationStateInput::StartTimeSet, beginAnimationUpdateTime());
</ins><span class="cx"> m_isAccelerated = true;
</span><span class="cx"> } else {
</span><span class="cx"> bool started = startAnimation(beginAnimationUpdateTime() - m_startTime);
</span><del>- m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
</del><ins>+ m_compositeAnimation->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
</ins><span class="cx"> m_isAccelerated = started;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (input == AnimationStateInputStartTimeSet) {
- ASSERT(m_animState == AnimationStatePausedWaitResponse);
</del><ins>+ if (input == AnimationStateInput::StartTimeSet) {
+ ASSERT(m_animationState == AnimationState::PausedWaitResponse);
</ins><span class="cx">
</span><span class="cx"> // We are paused but we got the callback that notifies us that an accelerated animation started.
</span><span class="cx"> // We ignore the start time and just move into the paused-run state.
</span><del>- LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
- m_animState = AnimationStatePausedRun;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedRun;
</ins><span class="cx"> ASSERT(m_startTime == 0);
</span><span class="cx"> m_startTime = param;
</span><span class="cx"> m_pauseTime += m_startTime;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable);
</del><ins>+ ASSERT(m_animationState == AnimationState::PausedWaitStyleAvailable);
</ins><span class="cx"> // We are paused but we got the callback that notifies us that style has been updated.
</span><del>- // We move to the AnimationStatePausedWaitResponse state
- LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStatePausedWaitResponse;
</del><ins>+ // We move to the AnimationState::PausedWaitResponse state
+ LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::PausedWaitResponse;
</ins><span class="cx"> overrideAnimations();
</span><span class="cx"> break;
</span><del>- case AnimationStateFillingForwards:
- case AnimationStateDone:
</del><ins>+ case AnimationState::FillingForwards:
+ case AnimationState::Done:
</ins><span class="cx"> // We're done. Stay in this state until we are deleted
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -442,11 +442,11 @@
</span><span class="cx">
</span><span class="cx"> void AnimationBase::fireAnimationEventsIfNeeded()
</span><span class="cx"> {
</span><del>- if (!m_compAnim)
</del><ins>+ if (!m_compositeAnimation)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // If we are waiting for the delay time to expire and it has, go to the next state
</span><del>- if (m_animState != AnimationStateStartWaitTimer && m_animState != AnimationStateLooping && m_animState != AnimationStateEnding)
</del><ins>+ if (m_animationState != AnimationState::StartWaitTimer && m_animationState != AnimationState::Looping && m_animationState != AnimationState::Ending)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // We have to make sure to keep a ref to the this pointer, because it could get destroyed
</span><span class="lines">@@ -454,12 +454,12 @@
</span><span class="cx"> // and it ref counts this object, we will keep a ref to that instead. That way the AnimationBase
</span><span class="cx"> // can still access the resources of its CompositeAnimation as needed.
</span><span class="cx"> Ref<AnimationBase> protect(*this);
</span><del>- Ref<CompositeAnimation> protectCompositeAnimation(*m_compAnim);
</del><ins>+ Ref<CompositeAnimation> protectCompositeAnimation(*m_compositeAnimation);
</ins><span class="cx">
</span><span class="cx"> // Check for start timeout
</span><del>- if (m_animState == AnimationStateStartWaitTimer) {
</del><ins>+ if (m_animationState == AnimationState::StartWaitTimer) {
</ins><span class="cx"> if (beginAnimationUpdateTime() - m_requestedStartTime >= m_animation->delay())
</span><del>- updateStateMachine(AnimationStateInputStartTimerFired, 0);
</del><ins>+ updateStateMachine(AnimationStateInput::StartTimerFired, 0);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -471,13 +471,13 @@
</span><span class="cx">
</span><span class="cx"> // Check for end timeout
</span><span class="cx"> if (m_totalDuration >= 0 && elapsedDuration >= m_totalDuration) {
</span><del>- // We may still be in AnimationStateLooping if we've managed to skip a
</del><ins>+ // We may still be in AnimationState::Looping if we've managed to skip a
</ins><span class="cx"> // whole iteration, in which case we should jump to the end state.
</span><del>- LOG(Animations, "%p AnimationState %s -> Ending", this, nameForState(m_animState));
- m_animState = AnimationStateEnding;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> Ending", this, nameForState(m_animationState));
+ m_animationState = AnimationState::Ending;
</ins><span class="cx">
</span><span class="cx"> // Fire an end event
</span><del>- updateStateMachine(AnimationStateInputEndTimerFired, m_totalDuration);
</del><ins>+ updateStateMachine(AnimationStateInput::EndTimerFired, m_totalDuration);
</ins><span class="cx"> } else {
</span><span class="cx"> // Check for iteration timeout
</span><span class="cx"> if (m_nextIterationDuration < 0) {
</span><span class="lines">@@ -493,35 +493,35 @@
</span><span class="cx"> m_nextIterationDuration = elapsedDuration + durationLeft;
</span><span class="cx">
</span><span class="cx"> // Send the event
</span><del>- updateStateMachine(AnimationStateInputLoopTimerFired, previous);
</del><ins>+ updateStateMachine(AnimationStateInput::LoopTimerFired, previous);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AnimationBase::updatePlayState(EAnimPlayState playState)
</span><span class="cx"> {
</span><del>- if (!m_compAnim)
</del><ins>+ if (!m_compositeAnimation)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // When we get here, we can have one of 4 desired states: running, paused, suspended, paused & suspended.
</span><span class="cx"> // The state machine can be in one of two states: running, paused.
</span><span class="cx"> // Set the state machine to the desired state.
</span><del>- bool pause = playState == AnimPlayStatePaused || m_compAnim->isSuspended();
</del><ins>+ bool pause = playState == AnimPlayStatePaused || m_compositeAnimation->isSuspended();
</ins><span class="cx">
</span><span class="cx"> if (pause == paused() && !isNew())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- updateStateMachine(pause ? AnimationStateInputPlayStatePaused : AnimationStateInputPlayStateRunning, -1);
</del><ins>+ updateStateMachine(pause ? AnimationStateInput::PlayStatePaused : AnimationStateInput::PlayStateRunning, -1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double AnimationBase::timeToNextService()
</span><span class="cx"> {
</span><span class="cx"> // Returns the time at which next service is required. -1 means no service is required. 0 means
</span><span class="cx"> // service is required now, and > 0 means service is required that many seconds in the future.
</span><del>- if (paused() || isNew() || m_animState == AnimationStateFillingForwards)
</del><ins>+ if (paused() || isNew() || m_animationState == AnimationState::FillingForwards)
</ins><span class="cx"> return -1;
</span><span class="cx">
</span><del>- if (m_animState == AnimationStateStartWaitTimer) {
</del><ins>+ if (m_animationState == AnimationState::StartWaitTimer) {
</ins><span class="cx"> double timeFromNow = m_animation->delay() - (beginAnimationUpdateTime() - m_requestedStartTime);
</span><span class="cx"> return std::max(timeFromNow, 0.0);
</span><span class="cx"> }
</span><span class="lines">@@ -637,19 +637,19 @@
</span><span class="cx"> double t;
</span><span class="cx"> bool isLooping;
</span><span class="cx"> getTimeToNextEvent(t, isLooping);
</span><del>- LOG(Animations, "%p AnimationState %s -> %s", this, nameForState(m_animState), isLooping ? "Looping" : "Ending");
- m_animState = isLooping ? AnimationStateLooping : AnimationStateEnding;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> %s", this, nameForState(m_animationState), isLooping ? "Looping" : "Ending");
+ m_animationState = isLooping ? AnimationState::Looping : AnimationState::Ending;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AnimationBase::freezeAtTime(double t)
</span><span class="cx"> {
</span><del>- if (!m_compAnim)
</del><ins>+ if (!m_compositeAnimation)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!m_startTime) {
</span><span class="cx"> // If we haven't started yet, make it as if we started.
</span><del>- LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
- m_animState = AnimationStateStartWaitResponse;
</del><ins>+ LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animationState));
+ m_animationState = AnimationState::StartWaitResponse;
</ins><span class="cx"> onAnimationStartResponse(monotonicallyIncreasingTime());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -665,10 +665,10 @@
</span><span class="cx">
</span><span class="cx"> double AnimationBase::beginAnimationUpdateTime() const
</span><span class="cx"> {
</span><del>- if (!m_compAnim)
</del><ins>+ if (!m_compositeAnimation)
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><del>- return m_compAnim->animationController()->beginAnimationUpdateTime();
</del><ins>+ return m_compositeAnimation->animationController()->beginAnimationUpdateTime();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double AnimationBase::getElapsedTime() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationBase.h (170069 => 170070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationBase.h        2014-06-17 20:17:44 UTC (rev 170069)
+++ trunk/Source/WebCore/page/animation/AnimationBase.h        2014-06-17 20:19:11 UTC (rev 170070)
</span><span class="lines">@@ -39,14 +39,12 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class AnimationBase;
</del><span class="cx"> class AnimationController;
</span><span class="cx"> class CompositeAnimation;
</span><span class="cx"> class Element;
</span><span class="cx"> class RenderElement;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class TimingFunction;
</span><del>-
</del><span class="cx"> class AnimationBase : public RefCounted<AnimationBase> {
</span><span class="cx"> friend class CompositeAnimation;
</span><span class="cx"> friend class CSSPropertyAnimation;
</span><span class="lines">@@ -58,9 +56,9 @@
</span><span class="cx"> RenderElement* renderer() const { return m_object; }
</span><span class="cx"> void clear()
</span><span class="cx"> {
</span><del>- endAnimation();
- m_object = 0;
- m_compAnim = 0;
</del><ins>+ endAnimation();
+ m_object = nullptr;
+ m_compositeAnimation = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double duration() const;
</span><span class="lines">@@ -68,68 +66,68 @@
</span><span class="cx"> // Animations and Transitions go through the states below. When entering the STARTED state
</span><span class="cx"> // the animation is started. This may or may not require deferred response from the animator.
</span><span class="cx"> // If so, we stay in this state until that response is received (and it returns the start time).
</span><del>- // Otherwise, we use the current time as the start time and go immediately to AnimationStateLooping
- // or AnimationStateEnding.
- enum AnimState {
- AnimationStateNew, // animation just created, animation not running yet
- AnimationStateStartWaitTimer, // start timer running, waiting for fire
- AnimationStateStartWaitStyleAvailable, // waiting for style setup so we can start animations
- AnimationStateStartWaitResponse, // animation started, waiting for response
- AnimationStateLooping, // response received, animation running, loop timer running, waiting for fire
- AnimationStateEnding, // received, animation running, end timer running, waiting for fire
- AnimationStatePausedNew, // in pause mode when animation was created
- AnimationStatePausedWaitTimer, // in pause mode when animation started
- AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup
- AnimationStatePausedWaitResponse, // animation paused when in STARTING state
- AnimationStatePausedRun, // animation paused when in LOOPING or ENDING state
- AnimationStateDone, // end timer fired, animation finished and removed
- AnimationStateFillingForwards // animation has ended and is retaining its final value
</del><ins>+ // Otherwise, we use the current time as the start time and go immediately to AnimationState::Looping
+ // or AnimationState::Ending.
+ enum class AnimationState {
+ New, // animation just created, animation not running yet
+ StartWaitTimer, // start timer running, waiting for fire
+ StartWaitStyleAvailable, // waiting for style setup so we can start animations
+ StartWaitResponse, // animation started, waiting for response
+ Looping, // response received, animation running, loop timer running, waiting for fire
+ Ending, // received, animation running, end timer running, waiting for fire
+ PausedNew, // in pause mode when animation was created
+ PausedWaitTimer, // in pause mode when animation started
+ PausedWaitStyleAvailable, // in pause mode when waiting for style setup
+ PausedWaitResponse, // animation paused when in STARTING state
+ PausedRun, // animation paused when in LOOPING or ENDING state
+ Done, // end timer fired, animation finished and removed
+ FillingForwards // animation has ended and is retaining its final value
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- enum AnimStateInput {
- AnimationStateInputMakeNew, // reset back to new from any state
- AnimationStateInputStartAnimation, // animation requests a start
- AnimationStateInputRestartAnimation, // force a restart from any state
- AnimationStateInputStartTimerFired, // start timer fired
- AnimationStateInputStyleAvailable, // style is setup, ready to start animating
- AnimationStateInputStartTimeSet, // m_startTime was set
- AnimationStateInputLoopTimerFired, // loop timer fired
- AnimationStateInputEndTimerFired, // end timer fired
- AnimationStateInputPauseOverride, // pause an animation due to override
- AnimationStateInputResumeOverride, // resume an overridden animation
- AnimationStateInputPlayStateRunning, // play state paused -> running
- AnimationStateInputPlayStatePaused, // play state running -> paused
- AnimationStateInputEndAnimation // force an end from any state
</del><ins>+ enum class AnimationStateInput {
+ MakeNew, // reset back to new from any state
+ StartAnimation, // animation requests a start
+ RestartAnimation, // force a restart from any state
+ StartTimerFired, // start timer fired
+ StyleAvailable, // style is setup, ready to start animating
+ StartTimeSet, // m_startTime was set
+ LoopTimerFired, // loop timer fired
+ EndTimerFired, // end timer fired
+ PauseOverride, // pause an animation due to override
+ ResumeOverride, // resume an overridden animation
+ PlayStateRunning, // play state paused -> running
+ PlayStatePaused, // play state running -> paused
+ EndAnimation // force an end from any state
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- // Called when animation is in AnimationStateNew to start animation
- void updateStateMachine(AnimStateInput, double param);
</del><ins>+ // Called when animation is in AnimationState::New to start animation
+ void updateStateMachine(AnimationStateInput, double param);
</ins><span class="cx">
</span><span class="cx"> // Animation has actually started, at passed time
</span><span class="cx"> void onAnimationStartResponse(double startTime)
</span><span class="cx"> {
</span><del>- updateStateMachine(AnimationBase::AnimationStateInputStartTimeSet, startTime);
</del><ins>+ updateStateMachine(AnimationStateInput::StartTimeSet, startTime);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Called to change to or from paused state
</span><span class="cx"> void updatePlayState(EAnimPlayState);
</span><span class="cx"> bool playStatePlaying() const;
</span><span class="cx">
</span><del>- bool waitingToStart() const { return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer || m_animState == AnimationStatePausedNew; }
</del><ins>+ bool waitingToStart() const { return m_animationState == AnimationState::New || m_animationState == AnimationState::StartWaitTimer || m_animationState == AnimationState::PausedNew; }
</ins><span class="cx"> bool preActive() const
</span><span class="cx"> {
</span><del>- return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer || m_animState == AnimationStateStartWaitStyleAvailable || m_animState == AnimationStateStartWaitResponse;
</del><ins>+ return m_animationState == AnimationState::New || m_animationState == AnimationState::StartWaitTimer || m_animationState == AnimationState::StartWaitStyleAvailable || m_animationState == AnimationState::StartWaitResponse;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- bool postActive() const { return m_animState == AnimationStateDone; }
- bool fillingForwards() const { return m_animState == AnimationStateFillingForwards; }
</del><ins>+ bool postActive() const { return m_animationState == AnimationState::Done; }
+ bool fillingForwards() const { return m_animationState == AnimationState::FillingForwards; }
</ins><span class="cx"> bool active() const { return !postActive() && !preActive(); }
</span><span class="cx"> bool running() const { return !isNew() && !postActive(); }
</span><del>- bool paused() const { return m_pauseTime >= 0 || m_animState == AnimationStatePausedNew; }
- bool inPausedState() const { return m_animState >= AnimationStatePausedNew && m_animState <= AnimationStatePausedRun; }
- bool isNew() const { return m_animState == AnimationStateNew || m_animState == AnimationStatePausedNew; }
- bool waitingForStartTime() const { return m_animState == AnimationStateStartWaitResponse; }
- bool waitingForStyleAvailable() const { return m_animState == AnimationStateStartWaitStyleAvailable; }
</del><ins>+ bool paused() const { return m_pauseTime >= 0 || m_animationState == AnimationState::PausedNew; }
+ bool inPausedState() const { return m_animationState >= AnimationState::PausedNew && m_animationState <= AnimationState::PausedRun; }
+ bool isNew() const { return m_animationState == AnimationState::New || m_animationState == AnimationState::PausedNew; }
+ bool waitingForStartTime() const { return m_animationState == AnimationState::StartWaitResponse; }
+ bool waitingForStyleAvailable() const { return m_animationState == AnimationState::StartWaitStyleAvailable; }
</ins><span class="cx">
</span><span class="cx"> virtual double timeToNextService();
</span><span class="cx">
</span><span class="lines">@@ -149,7 +147,7 @@
</span><span class="cx"> // Return true if this animation is overridden. This will only be the case for
</span><span class="cx"> // ImplicitAnimations and is used to determine whether or not we should force
</span><span class="cx"> // set the start time. If an animation is overridden, it will probably not get
</span><del>- // back the AnimationStateInputStartTimeSet input.
</del><ins>+ // back the AnimationStateInput::StartTimeSet input.
</ins><span class="cx"> virtual bool overridden() const { return false; }
</span><span class="cx">
</span><span class="cx"> // Does this animation/transition involve the given property?
</span><span class="lines">@@ -176,10 +174,10 @@
</span><span class="cx"> if ((runningState & Paused) && inPausedState())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- if ((runningState & Running) && !inPausedState() && (m_animState >= AnimationStateStartWaitStyleAvailable && m_animState <= AnimationStateDone))
</del><ins>+ if ((runningState & Running) && !inPausedState() && (m_animationState >= AnimationState::StartWaitStyleAvailable && m_animationState <= AnimationState::Done))
</ins><span class="cx"> return true;
</span><span class="cx">
</span><del>- if ((runningState & FillingFowards) && m_animState == AnimationStateFillingForwards)
</del><ins>+ if ((runningState & FillingFowards) && m_animationState == AnimationState::FillingForwards)
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> return false;
</span><span class="lines">@@ -207,7 +205,7 @@
</span><span class="cx"> void styleAvailable()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(waitingForStyleAvailable());
</span><del>- updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
</del><ins>+ updateStateMachine(AnimationStateInput::StyleAvailable, -1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const Animation& animation() const { return *m_animation; }
</span><span class="lines">@@ -216,7 +214,7 @@
</span><span class="cx"> virtual void overrideAnimations() { }
</span><span class="cx"> virtual void resumeOverriddenAnimations() { }
</span><span class="cx">
</span><del>- CompositeAnimation* compositeAnimation() { return m_compAnim; }
</del><ins>+ CompositeAnimation* compositeAnimation() { return m_compositeAnimation; }
</ins><span class="cx">
</span><span class="cx"> // These are called when the corresponding timer fires so subclasses can do any extra work
</span><span class="cx"> virtual void onAnimationStart(double /*elapsedTime*/) { }
</span><span class="lines">@@ -240,7 +238,7 @@
</span><span class="cx">
</span><span class="cx"> double fractionalTime(double scale, double elapsedTime, double offset) const;
</span><span class="cx">
</span><del>- AnimState m_animState;
</del><ins>+ AnimationState m_animationState;
</ins><span class="cx">
</span><span class="cx"> bool m_isAccelerated;
</span><span class="cx"> bool m_transformFunctionListValid;
</span><span class="lines">@@ -257,7 +255,7 @@
</span><span class="cx"> RenderElement* m_object;
</span><span class="cx">
</span><span class="cx"> RefPtr<Animation> m_animation;
</span><del>- CompositeAnimation* m_compAnim;
</del><ins>+ CompositeAnimation* m_compositeAnimation;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationImplicitAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp (170069 => 170070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp        2014-06-17 20:17:44 UTC (rev 170069)
+++ trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp        2014-06-17 20:19:11 UTC (rev 170070)
</span><span class="lines">@@ -131,7 +131,7 @@
</span><span class="cx"> // running. But now that the transition has completed, we need to update this style with its new
</span><span class="cx"> // destination. If we didn't, the next time through we would think a transition had started
</span><span class="cx"> // (comparing the old unanimated style with the new final style of the transition).
</span><del>- RefPtr<KeyframeAnimation> keyframeAnim = m_compAnim->getAnimationForProperty(m_animatingProperty);
</del><ins>+ RefPtr<KeyframeAnimation> keyframeAnim = m_compositeAnimation->getAnimationForProperty(m_animatingProperty);
</ins><span class="cx"> if (keyframeAnim)
</span><span class="cx"> keyframeAnim->setUnanimatedStyle(m_toStyle);
</span><span class="cx">
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // Schedule event handling
</span><del>- m_compAnim->animationController()->addEventToDispatch(element, eventType, propertyName, elapsedTime);
</del><ins>+ m_compositeAnimation->animationController()->addEventToDispatch(element, eventType, propertyName, elapsedTime);
</ins><span class="cx">
</span><span class="cx"> // Restore the original (unanimated) style
</span><span class="cx"> if (eventType == eventNames().transitionendEvent && element->renderer())
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx">
</span><span class="cx"> // Restart the transition
</span><span class="cx"> if (m_fromStyle && m_toStyle)
</span><del>- updateStateMachine(AnimationStateInputRestartAnimation, -1);
</del><ins>+ updateStateMachine(AnimationStateInput::RestartAnimation, -1);
</ins><span class="cx">
</span><span class="cx"> // set the transform animation list
</span><span class="cx"> validateTransformFunctionList();
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_overridden = b;
</span><del>- updateStateMachine(m_overridden ? AnimationStateInputPauseOverride : AnimationStateInputResumeOverride, -1);
</del><ins>+ updateStateMachine(m_overridden ? AnimationStateInput::PauseOverride : AnimationStateInput::ResumeOverride, -1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ImplicitAnimation::affectsProperty(CSSPropertyID property) const
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationKeyframeAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp (170069 => 170070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp        2014-06-17 20:17:44 UTC (rev 170069)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp        2014-06-17 20:19:11 UTC (rev 170070)
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-KeyframeAnimation::KeyframeAnimation(const Animation& animation, RenderElement* renderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle)
- : AnimationBase(animation, renderer, compAnim)
</del><ins>+KeyframeAnimation::KeyframeAnimation(const Animation& animation, RenderElement* renderer, int index, CompositeAnimation* compositeAnimation, RenderStyle* unanimatedStyle)
+ : AnimationBase(animation, renderer, compositeAnimation)
</ins><span class="cx"> , m_keyframes(animation.name())
</span><span class="cx"> , m_index(index)
</span><span class="cx"> , m_startEventDispatched(false)
</span><span class="lines">@@ -127,7 +127,7 @@
</span><span class="cx">
</span><span class="cx"> // If we have not yet started, we will not have a valid start time, so just start the animation if needed.
</span><span class="cx"> if (isNew() && m_animation->playState() == AnimPlayStatePlaying && !compositeAnimation->isSuspended())
</span><del>- updateStateMachine(AnimationStateInputStartAnimation, -1);
</del><ins>+ updateStateMachine(AnimationStateInput::StartAnimation, -1);
</ins><span class="cx">
</span><span class="cx"> // If we get this far and the animation is done, it means we are cleaning up a just finished animation.
</span><span class="cx"> // If so, we need to send back the targetStyle.
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">
</span><span class="cx"> // If we have no keyframes, don't animate.
</span><span class="cx"> if (!m_keyframes.size()) {
</span><del>- updateStateMachine(AnimationStateInputEndAnimation, -1);
</del><ins>+ updateStateMachine(AnimationStateInput::EndAnimation, -1);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -287,7 +287,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // Schedule event handling
</span><del>- m_compAnim->animationController()->addEventToDispatch(element, eventType, m_keyframes.animationName(), elapsedTime);
</del><ins>+ m_compositeAnimation->animationController()->addEventToDispatch(element, eventType, m_keyframes.animationName(), elapsedTime);
</ins><span class="cx">
</span><span class="cx"> // Restore the original (unanimated) style
</span><span class="cx"> if (eventType == eventNames().webkitAnimationEndEvent && element->renderer())
</span></span></pre>
</div>
</div>
</body>
</html>