summaryrefslogtreecommitdiffstats
path: root/WebCore/page/animation
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/animation')
-rw-r--r--WebCore/page/animation/AnimationBase.cpp48
-rw-r--r--WebCore/page/animation/AnimationBase.h3
-rw-r--r--WebCore/page/animation/AnimationController.cpp45
-rw-r--r--WebCore/page/animation/AnimationControllerPrivate.h15
-rw-r--r--WebCore/page/animation/CompositeAnimation.cpp16
5 files changed, 94 insertions, 33 deletions
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index 66172f7..1ba39d9 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -357,15 +357,19 @@ public:
ShadowData defaultShadowData(0, 0, 0, 0, Normal, Color::transparent);
ShadowData* newShadowData = 0;
+ ShadowData* lastShadow = 0;
while (shadowA || shadowB) {
const ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData;
const ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData;
- if (!newShadowData)
- newShadowData = blendFunc(anim, srcShadow, dstShadow, progress);
+ ShadowData* blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
+ if (!lastShadow)
+ newShadowData = blendedShadow;
else
- newShadowData->setNext(blendFunc(anim, srcShadow, dstShadow, progress));
+ lastShadow->setNext(blendedShadow);
+
+ lastShadow = blendedShadow;
shadowA = shadowA ? shadowA->next() : 0;
shadowB = shadowB ? shadowB->next() : 0;
@@ -574,6 +578,8 @@ public:
(*it)->blend(anim, dst, a, b, progress);
}
+ const Vector<PropertyWrapperBase*> propertyWrappers() const { return m_propertyWrappers; }
+
private:
Vector<PropertyWrapperBase*> m_propertyWrappers;
};
@@ -731,7 +737,8 @@ static void addShorthandProperties()
CSSPropertyWebkitMask, // for mask-position
CSSPropertyWebkitMaskPosition,
CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft,
- CSSPropertyBorderColor,
+ CSSPropertyBorderColor,
+ CSSPropertyBorderRadius,
CSSPropertyBorderWidth,
CSSPropertyBorder,
CSSPropertyBorderSpacing,
@@ -862,6 +869,39 @@ bool AnimationBase::animationOfPropertyIsAccelerated(int prop)
}
#endif
+static bool gatherEnclosingShorthandProperties(int property, PropertyWrapperBase* wrapper, HashSet<int>& propertySet)
+{
+ if (!wrapper->isShorthandWrapper())
+ return false;
+
+ ShorthandPropertyWrapper* shorthandWrapper = static_cast<ShorthandPropertyWrapper*>(wrapper);
+
+ bool contained = false;
+ for (size_t i = 0; i < shorthandWrapper->propertyWrappers().size(); ++i) {
+ PropertyWrapperBase* currWrapper = shorthandWrapper->propertyWrappers()[i];
+
+ if (gatherEnclosingShorthandProperties(property, currWrapper, propertySet) || currWrapper->property() == property)
+ contained = true;
+ }
+
+ if (contained)
+ propertySet.add(wrapper->property());
+
+ return contained;
+}
+
+// Note: this is inefficient. It's only called from pauseTransitionAtTime().
+HashSet<int> AnimationBase::animatableShorthandsAffectingProperty(int property)
+{
+ ensurePropertyMap();
+
+ HashSet<int> foundProperties;
+ for (int i = 0; i < getNumProperties(); ++i)
+ gatherEnclosingShorthandProperties(property, (*gPropertyWrappers)[i], foundProperties);
+
+ return foundProperties;
+}
+
void AnimationBase::setNeedsStyleRecalc(Node* node)
{
ASSERT(!node || (node->document() && !node->document()->inPageCache()));
diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h
index eb9bd12..877d649 100644
--- a/WebCore/page/animation/AnimationBase.h
+++ b/WebCore/page/animation/AnimationBase.h
@@ -31,6 +31,7 @@
#include "RenderStyleConstants.h"
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -180,6 +181,8 @@ public:
static bool animationOfPropertyIsAccelerated(int prop);
#endif
+ static HashSet<int> animatableShorthandsAffectingProperty(int property);
+
protected:
virtual void overrideAnimations() { }
virtual void resumeOverriddenAnimations() { }
diff --git a/WebCore/page/animation/AnimationController.cpp b/WebCore/page/animation/AnimationController.cpp
index 613aee6..e1281dd 100644
--- a/WebCore/page/animation/AnimationController.cpp
+++ b/WebCore/page/animation/AnimationController.cpp
@@ -53,9 +53,9 @@ AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
, m_beginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet)
, m_styleAvailableWaiters(0)
, m_lastStyleAvailableWaiter(0)
- , m_responseWaiters(0)
- , m_lastResponseWaiter(0)
- , m_waitingForResponse(false)
+ , m_startTimeResponseWaiters(0)
+ , m_lastStartTimeResponseWaiter(0)
+ , m_waitingForStartTimeResponse(false)
{
}
@@ -145,16 +145,16 @@ void AnimationControllerPrivate::fireEventsAndUpdateStyle()
bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
// fire all the events
- Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch;
- m_eventsToDispatch.clear();
- Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = eventsToDispatch.end();
- for (Vector<EventToDispatch>::const_iterator it = eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
+ Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end();
+ for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
if (it->eventType == eventNames().webkitTransitionEndEvent)
it->element->dispatchEvent(WebKitTransitionEvent::create(it->eventType, it->name, it->elapsedTime));
else
it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
}
+ m_eventsToDispatch.clear();
+
// call setChanged on all the elements
Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)
@@ -323,13 +323,13 @@ double AnimationControllerPrivate::beginAnimationUpdateTime()
void AnimationControllerPrivate::endAnimationUpdate()
{
styleAvailable();
- if (!m_waitingForResponse)
+ if (!m_waitingForStartTimeResponse)
startTimeResponse(beginAnimationUpdateTime());
}
void AnimationControllerPrivate::receivedStartTimeResponse(double time)
{
- m_waitingForResponse = false;
+ m_waitingForStartTimeResponse = false;
startTimeResponse(time);
}
@@ -432,48 +432,51 @@ void AnimationControllerPrivate::addToStartTimeResponseWaitList(AnimationBase* a
ASSERT(!animation->next());
if (willGetResponse)
- m_waitingForResponse = true;
+ m_waitingForStartTimeResponse = true;
- if (m_responseWaiters)
- m_lastResponseWaiter->setNext(animation);
+ if (m_startTimeResponseWaiters)
+ m_lastStartTimeResponseWaiter->setNext(animation);
else
- m_responseWaiters = animation;
+ m_startTimeResponseWaiters = animation;
- m_lastResponseWaiter = animation;
+ m_lastStartTimeResponseWaiter = animation;
animation->setNext(0);
}
void AnimationControllerPrivate::removeFromStartTimeResponseWaitList(AnimationBase* animationToRemove)
{
AnimationBase* prevAnimation = 0;
- for (AnimationBase* animation = m_responseWaiters; animation; animation = animation->next()) {
+ for (AnimationBase* animation = m_startTimeResponseWaiters; animation; animation = animation->next()) {
if (animation == animationToRemove) {
if (prevAnimation)
prevAnimation->setNext(animation->next());
else
- m_responseWaiters = animation->next();
+ m_startTimeResponseWaiters = animation->next();
- if (m_lastResponseWaiter == animation)
- m_lastResponseWaiter = prevAnimation;
+ if (m_lastStartTimeResponseWaiter == animation)
+ m_lastStartTimeResponseWaiter = prevAnimation;
animationToRemove->setNext(0);
}
prevAnimation = animation;
}
+
+ if (!m_startTimeResponseWaiters)
+ m_waitingForStartTimeResponse = false;
}
void AnimationControllerPrivate::startTimeResponse(double time)
{
// Go through list of waiters and send them on their way
- for (AnimationBase* animation = m_responseWaiters; animation; ) {
+ for (AnimationBase* animation = m_startTimeResponseWaiters; animation; ) {
AnimationBase* nextAnimation = animation->next();
animation->setNext(0);
animation->onAnimationStartResponse(time);
animation = nextAnimation;
}
- m_responseWaiters = 0;
- m_lastResponseWaiter = 0;
+ m_startTimeResponseWaiters = 0;
+ m_lastStartTimeResponseWaiter = 0;
}
AnimationController::AnimationController(Frame* frame)
diff --git a/WebCore/page/animation/AnimationControllerPrivate.h b/WebCore/page/animation/AnimationControllerPrivate.h
index 893c717..6812e09 100644
--- a/WebCore/page/animation/AnimationControllerPrivate.h
+++ b/WebCore/page/animation/AnimationControllerPrivate.h
@@ -54,12 +54,11 @@ public:
AnimationControllerPrivate(Frame*);
~AnimationControllerPrivate();
+ void updateAnimationTimer(bool callSetChanged = false);
+
PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*);
bool clear(RenderObject*);
- void animationTimerFired(Timer<AnimationControllerPrivate>*);
- void updateAnimationTimer(bool callSetChanged = false);
-
void updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*);
void startUpdateStyleIfNeededDispatcher();
void addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime);
@@ -92,11 +91,13 @@ public:
void addToStartTimeResponseWaitList(AnimationBase*, bool willGetResponse);
void removeFromStartTimeResponseWaitList(AnimationBase*);
- void startTimeResponse(double t);
private:
+ void animationTimerFired(Timer<AnimationControllerPrivate>*);
+
void styleAvailable();
void fireEventsAndUpdateStyle();
+ void startTimeResponse(double t);
typedef HashMap<RenderObject*, RefPtr<CompositeAnimation> > RenderObjectAnimationMap;
@@ -120,9 +121,9 @@ private:
AnimationBase* m_styleAvailableWaiters;
AnimationBase* m_lastStyleAvailableWaiter;
- AnimationBase* m_responseWaiters;
- AnimationBase* m_lastResponseWaiter;
- bool m_waitingForResponse;
+ AnimationBase* m_startTimeResponseWaiters;
+ AnimationBase* m_lastStartTimeResponseWaiter;
+ bool m_waitingForStartTimeResponse;
};
} // namespace WebCore
diff --git a/WebCore/page/animation/CompositeAnimation.cpp b/WebCore/page/animation/CompositeAnimation.cpp
index 9d021b4..602491e 100644
--- a/WebCore/page/animation/CompositeAnimation.cpp
+++ b/WebCore/page/animation/CompositeAnimation.cpp
@@ -30,6 +30,7 @@
#include "CompositeAnimation.h"
#include "AnimationControllerPrivate.h"
+#include "CSSPropertyLonghand.h"
#include "CSSPropertyNames.h"
#include "ImplicitAnimation.h"
#include "KeyframeAnimation.h"
@@ -509,7 +510,20 @@ bool CompositeAnimation::pauseTransitionAtTime(int property, double t)
return false;
ImplicitAnimation* implAnim = m_transitions.get(property).get();
- if (!implAnim || !implAnim->running())
+ if (!implAnim) {
+ // Check to see if this property is being animated via a shorthand.
+ // This code is only used for testing, so performance is not critical here.
+ HashSet<int> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property);
+ bool anyPaused = false;
+ HashSet<int>::const_iterator end = shorthandProperties.end();
+ for (HashSet<int>::const_iterator it = shorthandProperties.begin(); it != end; ++it) {
+ if (pauseTransitionAtTime(*it, t))
+ anyPaused = true;
+ }
+ return anyPaused;
+ }
+
+ if (!implAnim->running())
return false;
if ((t >= 0.0) && (t <= implAnim->duration())) {