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

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

Issue 26382004: Web Animations CSS: Implement CSS Transitions backed on Web Animations model (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: fix logic for elapsedTime in event Created 7 years, 2 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 100e5da60d52fbcc28869f19a69bec90e4c270de..a9292faaa5abbd153b39b1b649e611d8c7c3e070 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1248,7 +1248,7 @@ bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Doc
const Vector<Animation*>& animations = animationStack->activeAnimations(element);
for (size_t i = 0; i < animations.size(); ++i) {
RefPtr<Animation> animation = animations.at(i);
- if (update && update->isCancelled(animation->player()))
+ if (update && update->isCancelledAnimation(animation->player()))
continue;
const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
@@ -1295,6 +1295,21 @@ bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Doc
return didApply;
}
+void StyleResolver::applyTransitionedProperties(StyleResolverState& state)
+{
+ ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
+ const CSSAnimationUpdate* update = state.animationUpdate();
+ ActiveAnimations* activeAnimations = state.element()->activeAnimations();
+ const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
+
+ const AnimationEffect::CompositableValueMap& compositableValues = CSSAnimations::compositableValuesForTransitions(cssAnimations, update);
+
+ for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues.begin(); iter != compositableValues.end(); ++iter) {
+ CSSPropertyID id = iter->key;
+ AnimatedStyleBuilder::applyProperty(iter->key, state, iter->value->compositeOnto(AnimatableValue::neutralValue()).get());
+ }
+}
+
// http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule
// FIXME: add incremental support for other region styling properties.
static inline bool isValidRegionStyleProperty(CSSPropertyID id)
@@ -1453,23 +1468,6 @@ void StyleResolver::invalidateMatchedPropertiesCache()
m_matchedPropertiesCache.clear();
}
-void StyleResolver::calculateCSSAnimationUpdate(StyleResolverState& state)
-{
- if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
- return;
-
- Element* element = state.element();
- ASSERT(element);
-
- if (!CSSAnimations::needsUpdate(element, state.style()))
- return;
-
- ActiveAnimations* activeAnimations = element->activeAnimations();
- const CSSAnimationDataList* animations = state.style()->animations();
- const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
- state.setAnimationUpdate(CSSAnimations::calculateUpdate(element, state.style(), cssAnimations, animations, this));
-}
-
void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult)
{
const Element* element = state.element();
@@ -1514,6 +1512,12 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
+ // Match transition-property / animation-name length by trimming and
+ // lengthening other transition / animation property lists
+ // FIXME: This is wrong because we shouldn't affect the computed values
+ state.style()->adjustAnimations();
dstockwell 2013/10/08 21:02:59 should be guarded by if enable web-animations-css
Timothy Loh 2013/10/09 01:33:07 same as above; moving this should be fine for the
+ state.style()->adjustTransitions();
+
// Now we have all of the matched rules in the appropriate order. Walk the rules and apply
// high-priority properties first, i.e., those properties that other properties depend on.
// The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
@@ -1553,7 +1557,7 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
if (RuntimeEnabledFeatures::webAnimationsEnabled() && !applyInheritedOnly) {
- calculateCSSAnimationUpdate(state);
+ state.setAnimationUpdate(CSSAnimations::calculateUpdate(state.element(), state.style(), this));
// Apply animated properties, then reapply any rules marked important.
if (applyAnimatedProperties<HighPriorityProperties>(state, element->document().timeline())) {
bool important = true;
@@ -1567,6 +1571,8 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
applyMatchedProperties<LowPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
applyMatchedProperties<LowPriorityProperties>(state, matchResult, important, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
}
+
+ applyTransitionedProperties(state);
}
// Start loading resources referenced by this style.
« Source/core/css/resolver/StyleAdjuster.cpp ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698