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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 19266007: Web Animations: Introduce ActiveAnimations and AnimationStack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed maps. Store ActiveAnimations in ElementRareData. 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
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 2d5c0a0361230794d8f1b11af235998b020d8962..bca939549c1ea2a9b9f29100e0353c882b319e4d 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -37,6 +37,7 @@
#include "XMLNames.h"
#include "core/animation/AnimatableValue.h"
#include "core/animation/Animation.h"
+#include "core/animation/DocumentTimeline.h"
#include "core/css/CSSCalculationValue.h"
#include "core/css/CSSCursorImageValue.h"
#include "core/css/CSSDefaultStyleSheets.h"
@@ -1056,17 +1057,17 @@ PassRefPtr<CSSRuleList> StyleResolver::pseudoStyleRulesForElement(Element* e, Ps
// this is mostly boring stuff on how to apply a certain rule to the renderstyle...
template <StyleResolver::StyleApplicationPass pass>
-void StyleResolver::applyAnimatedProperties(const Element* target)
+void StyleResolver::applyAnimatedProperties(const Element* target, const DocumentTimeline* timeline)
{
ASSERT(pass != VariableDefinitions);
ASSERT(pass != AnimationProperties);
- if (!target->hasActiveAnimations())
+ AnimationStack* animationStack = timeline->animationStack(target);
+ if (!animationStack)
return;
+ const Vector<Animation*>& animations = animationStack->activeAnimations(target);
- Vector<Animation*>* animations = target->activeAnimations();
-
- for (size_t i = 0; i < animations->size(); ++i) {
- RefPtr<Animation> animation = animations->at(i);
+ for (size_t i = 0; i < animations.size(); ++i) {
+ RefPtr<Animation> animation = animations.at(i);
const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
CSSPropertyID property = iter->key;
@@ -1306,7 +1307,7 @@ void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const
applyMatchedProperties<HighPriorityProperties>(matchResult, false, 0, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
// Animation contributions are processed here because CSS Animations are overridable by user !important rules.
if (RuntimeEnabledFeatures::webAnimationsEnabled())
- applyAnimatedProperties<HighPriorityProperties>(element);
+ applyAnimatedProperties<HighPriorityProperties>(element, element->document()->timeline());
applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<HighPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
@@ -1336,7 +1337,7 @@ void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const
// Now do the author and user normal priority properties and all the !important properties.
applyMatchedProperties<LowPriorityProperties>(matchResult, false, matchResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyInheritedOnly);
if (RuntimeEnabledFeatures::webAnimationsEnabled())
- applyAnimatedProperties<LowPriorityProperties>(element);
+ applyAnimatedProperties<LowPriorityProperties>(element, element->document()->timeline());
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);

Powered by Google App Engine
This is Rietveld 408576698