summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/page/animation
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/page/animation
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/page/animation')
-rw-r--r--Source/WebCore/page/animation/AnimationBase.cpp25
-rw-r--r--Source/WebCore/page/animation/AnimationBase.h2
-rw-r--r--Source/WebCore/page/animation/CompositeAnimation.cpp11
3 files changed, 30 insertions, 8 deletions
diff --git a/Source/WebCore/page/animation/AnimationBase.cpp b/Source/WebCore/page/animation/AnimationBase.cpp
index 0fe98be..e232b03 100644
--- a/Source/WebCore/page/animation/AnimationBase.cpp
+++ b/Source/WebCore/page/animation/AnimationBase.cpp
@@ -142,6 +142,9 @@ static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from,
static inline ShadowData* blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress)
{
ASSERT(from && to);
+ if (from->style() != to->style())
+ return new ShadowData(*to);
+
return new ShadowData(blendFunc(anim, from->x(), to->x(), progress),
blendFunc(anim, from->y(), to->y(), progress),
blendFunc(anim, from->blur(), to->blur(), progress),
@@ -360,14 +363,15 @@ public:
const ShadowData* shadowA = (a->*m_getter)();
const ShadowData* shadowB = (b->*m_getter)();
ShadowData defaultShadowData(0, 0, 0, 0, Normal, property() == CSSPropertyWebkitBoxShadow, Color::transparent);
+ ShadowData defaultInsetShadowData(0, 0, 0, 0, Inset, property() == CSSPropertyWebkitBoxShadow, Color::transparent);
ShadowData* newShadowData = 0;
ShadowData* lastShadow = 0;
while (shadowA || shadowB) {
- const ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData;
- const ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData;
-
+ const ShadowData* srcShadow = shadowA ? shadowA : (shadowB->style() == Inset ? &defaultInsetShadowData : &defaultShadowData);
+ const ShadowData* dstShadow = shadowB ? shadowB : (shadowA->style() == Inset ? &defaultInsetShadowData : &defaultShadowData);
+
ShadowData* blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
if (!lastShadow)
newShadowData = blendedShadow;
@@ -926,6 +930,9 @@ bool AnimationBase::animationsMatch(const Animation* anim) const
void AnimationBase::updateStateMachine(AnimStateInput input, double param)
{
+ if (!m_compAnim)
+ return;
+
// If we get AnimationStateInputRestartAnimation then we force a new animation, regardless of state.
if (input == AnimationStateInputMakeNew) {
if (m_animState == AnimationStateStartWaitStyleAvailable)
@@ -1194,6 +1201,9 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param)
void AnimationBase::fireAnimationEventsIfNeeded()
{
+ if (!m_compAnim)
+ return;
+
// If we are waiting for the delay time to expire and it has, go to the next state
if (m_animState != AnimationStateStartWaitTimer && m_animState != AnimationStateLooping && m_animState != AnimationStateEnding)
return;
@@ -1248,6 +1258,9 @@ void AnimationBase::fireAnimationEventsIfNeeded()
void AnimationBase::updatePlayState(EAnimPlayState playState)
{
+ if (!m_compAnim)
+ return;
+
// When we get here, we can have one of 4 desired states: running, paused, suspended, paused & suspended.
// The state machine can be in one of two states: running, paused.
// Set the state machine to the desired state.
@@ -1357,6 +1370,9 @@ void AnimationBase::goIntoEndingOrLoopingState()
void AnimationBase::freezeAtTime(double t)
{
+ if (!m_compAnim)
+ return;
+
if (!m_startTime) {
// If we haven't started yet, just generate the start event now
m_compAnim->animationController()->receivedStartTimeResponse(currentTime());
@@ -1376,6 +1392,9 @@ void AnimationBase::freezeAtTime(double t)
double AnimationBase::beginAnimationUpdateTime() const
{
+ if (!m_compAnim)
+ return 0;
+
return m_compAnim->animationController()->beginAnimationUpdateTime();
}
diff --git a/Source/WebCore/page/animation/AnimationBase.h b/Source/WebCore/page/animation/AnimationBase.h
index 1ab14e3..c07f66e 100644
--- a/Source/WebCore/page/animation/AnimationBase.h
+++ b/Source/WebCore/page/animation/AnimationBase.h
@@ -54,7 +54,7 @@ public:
virtual ~AnimationBase() { }
RenderObject* renderer() const { return m_object; }
- void clearRenderer() { m_object = 0; }
+ void clear() { m_object = 0; m_compAnim = 0; }
double duration() const;
diff --git a/Source/WebCore/page/animation/CompositeAnimation.cpp b/Source/WebCore/page/animation/CompositeAnimation.cpp
index 27409d9..29b32eb 100644
--- a/Source/WebCore/page/animation/CompositeAnimation.cpp
+++ b/Source/WebCore/page/animation/CompositeAnimation.cpp
@@ -43,7 +43,10 @@ namespace WebCore {
CompositeAnimation::~CompositeAnimation()
{
- // Toss the refs to all animations
+ // Toss the refs to all animations, but make sure we remove them from
+ // any waiting lists first.
+
+ clearRenderer();
m_transitions.clear();
m_keyframeAnimations.clear();
}
@@ -57,7 +60,7 @@ void CompositeAnimation::clearRenderer()
for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
ImplicitAnimation* transition = it->second.get();
animationController()->animationWillBeRemoved(transition);
- transition->clearRenderer();
+ transition->clear();
}
}
if (!m_keyframeAnimations.isEmpty()) {
@@ -66,7 +69,7 @@ void CompositeAnimation::clearRenderer()
for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
KeyframeAnimation* anim = it->second.get();
animationController()->animationWillBeRemoved(anim);
- anim->clearRenderer();
+ anim->clear();
}
}
}
@@ -261,7 +264,7 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render
if (keyframeAnim->index() < 0) {
animsToBeRemoved.append(keyframeAnim->name().impl());
animationController()->animationWillBeRemoved(keyframeAnim);
- keyframeAnim->clearRenderer();
+ keyframeAnim->clear();
}
}