Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: Source/core/dom/Element.cpp

Issue 19266007: Web Animations: Introduce ActiveAnimations and AnimationStack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 9cd7c2549f1977b741ee35267ed7b3de3b175d67..bb5d623ade31e5e3fbaff26eee5793c5753a21c0 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -33,6 +33,7 @@
#include "SVGNames.h"
#include "XMLNames.h"
#include "core/accessibility/AXObjectCache.h"
+#include "core/animation/DocumentTimeline.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/CSSValuePool.h"
@@ -373,34 +374,31 @@ NamedNodeMap* Element::attributes() const
return rareData->attributeMap();
}
-void Element::addActiveAnimation(Animation* animation)
+ActiveAnimations* Element::activeAnimations() const
{
- ElementRareData* rareData = ensureElementRareData();
- if (!rareData->activeAnimations())
- rareData->setActiveAnimations(adoptPtr(new Vector<Animation*>));
- rareData->activeAnimations()->append(animation);
+ if (hasActiveAnimations())
+ return elementRareData()->activeAnimations();
+ return 0;
}
-void Element::removeActiveAnimation(Animation* animation)
+ActiveAnimations* Element::ensureActiveAnimations()
{
- ElementRareData* rareData = elementRareData();
- ASSERT(rareData);
- size_t position = rareData->activeAnimations()->find(animation);
- ASSERT(position != notFound);
- rareData->activeAnimations()->remove(position);
+ ElementRareData* rareData = ensureElementRareData();
+ if (!elementRareData()->activeAnimations())
+ rareData->setActiveAnimations(adoptPtr(new ActiveAnimations()));
+ return rareData->activeAnimations();
}
bool Element::hasActiveAnimations() const
{
- return hasRareData() && elementRareData()->activeAnimations()
- && elementRareData()->activeAnimations()->size();
-}
+ if (!RuntimeEnabledFeatures::webAnimationsEnabled())
+ return false;
-Vector<Animation*>* Element::activeAnimations() const
-{
- if (!elementRareData())
- return 0;
- return elementRareData()->activeAnimations();
+ if (!hasRareData())
+ return false;
+
+ ActiveAnimations* activeAnimations = elementRareData()->activeAnimations();
+ return activeAnimations && !activeAnimations->isEmpty();
}
Node::NodeType Element::nodeType() const
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698