summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/android/LayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-03-09 13:52:11 -0800
committerNicolas Roard <nicolasroard@google.com>2011-03-10 15:14:54 -0800
commitac8d9f13717dd67de94dc7ab18690d6da10b0c99 (patch)
tree0387c02be91f0e9b652a83f4c8502672ec2dfabb /WebCore/platform/graphics/android/LayerAndroid.cpp
parent95cb21b0cde2a64281360f9e45f31f049e583273 (diff)
downloadexternal_webkit-ac8d9f13717dd67de94dc7ab18690d6da10b0c99.zip
external_webkit-ac8d9f13717dd67de94dc7ab18690d6da10b0c99.tar.gz
external_webkit-ac8d9f13717dd67de94dc7ab18690d6da10b0c99.tar.bz2
Fix CSS animations
- we were overriding existing animations. - implement correctly the removeAnimations functions - refactor AndroidAnimation (share common code) - fix how we use the timing functions for the animations - implements timing functions per keyframes bug:2453890 Change-Id: I367d708338c270171eeaacc7e2fb3729eb78c444
Diffstat (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 7d68f03..76fb2f2 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -132,8 +132,10 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer),
addChild(layer.getChild(i)->copy())->unref();
KeyframesMap::const_iterator end = layer.m_animations.end();
- for (KeyframesMap::const_iterator it = layer.m_animations.begin(); it != end; ++it)
- m_animations.add((it->second)->name(), (it->second)->copy());
+ for (KeyframesMap::const_iterator it = layer.m_animations.begin(); it != end; ++it) {
+ pair<String, int> key((it->second)->name(), (it->second)->type());
+ m_animations.add(key, (it->second)->copy());
+ }
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("LayerAndroid");
@@ -243,15 +245,35 @@ bool LayerAndroid::evaluateAnimations(double time) const
void LayerAndroid::addAnimation(PassRefPtr<AndroidAnimation> prpAnim)
{
RefPtr<AndroidAnimation> anim = prpAnim;
- RefPtr<AndroidAnimation> currentAnim = m_animations.get(anim->name());
- if (currentAnim && currentAnim->type() == anim->type())
- removeAnimation(anim->name());
- m_animations.add(anim->name(), anim);
+ pair<String, int> key(anim->name(), anim->type());
+ removeAnimationsForProperty(anim->type());
+ m_animations.add(key, anim);
+}
+
+void LayerAndroid::removeAnimationsForProperty(AnimatedPropertyID property)
+{
+ KeyframesMap::const_iterator end = m_animations.end();
+ Vector<pair<String, int> > toDelete;
+ for (KeyframesMap::const_iterator it = m_animations.begin(); it != end; ++it) {
+ if ((it->second)->type() == property)
+ toDelete.append(it->first);
+ }
+
+ for (unsigned int i = 0; i < toDelete.size(); i++)
+ m_animations.remove(toDelete[i]);
}
-void LayerAndroid::removeAnimation(const String& name)
+void LayerAndroid::removeAnimationsForKeyframes(const String& name)
{
- m_animations.remove(name);
+ KeyframesMap::const_iterator end = m_animations.end();
+ Vector<pair<String, int> > toDelete;
+ for (KeyframesMap::const_iterator it = m_animations.begin(); it != end; ++it) {
+ if ((it->second)->name() == name)
+ toDelete.append(it->first);
+ }
+
+ for (unsigned int i = 0; i < toDelete.size(); i++)
+ m_animations.remove(toDelete[i]);
}
// We only use the bounding rect of the layer as mask...