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

Side by Side Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 851693007: Prepare for responsive CSS animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address comments Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 case CSSPropertyWebkitTransformOriginZ: 79 case CSSPropertyWebkitTransformOriginZ:
80 case CSSPropertyWebkitTransformOrigin: 80 case CSSPropertyWebkitTransformOrigin:
81 return CSSPropertyTransformOrigin; 81 return CSSPropertyTransformOrigin;
82 default: 82 default:
83 break; 83 break;
84 } 84 }
85 return property; 85 return property;
86 } 86 }
87 87
88 static void resolveKeyframes(StyleResolver* resolver, const Element* animatingEl ement, Element& element, const RenderStyle& style, RenderStyle* parentStyle, con st AtomicString& name, TimingFunction* defaultTimingFunction, 88 static void resolveKeyframes(StyleResolver* resolver, const Element* animatingEl ement, Element& element, const RenderStyle& style, RenderStyle* parentStyle, con st AtomicString& name, TimingFunction* defaultTimingFunction,
89 AnimatableValueKeyframeVector& keyframes) 89 StringKeyframeVector& keyframes)
90 { 90 {
91 // When the animating element is null, use its parent for scoping purposes. 91 // When the animating element is null, use its parent for scoping purposes.
92 const Element* elementForScoping = animatingElement ? animatingElement : &el ement; 92 const Element* elementForScoping = animatingElement ? animatingElement : &el ement;
93 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name); 93 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name);
94 if (!keyframesRule) 94 if (!keyframesRule)
95 return; 95 return;
96 96
97 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes(); 97 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes();
98 98
99 // Construct and populate the style for each keyframe 99 // Construct and populate the style for each keyframe
100 PropertySet specifiedPropertiesForUseCounter; 100 PropertySet specifiedPropertiesForUseCounter;
101 for (size_t i = 0; i < styleKeyframes.size(); ++i) { 101 for (size_t i = 0; i < styleKeyframes.size(); ++i) {
102 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); 102 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get();
103 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element, style, parentStyle, styleKeyframe, name); 103 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element, style, parentStyle, styleKeyframe, name);
104 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe yframe::create(); 104 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create();
105 const Vector<double>& offsets = styleKeyframe->keys(); 105 const Vector<double>& offsets = styleKeyframe->keys();
106 ASSERT(!offsets.isEmpty()); 106 ASSERT(!offsets.isEmpty());
107 keyframe->setOffset(offsets[0]); 107 keyframe->setOffset(offsets[0]);
108 keyframe->setEasing(defaultTimingFunction); 108 keyframe->setEasing(defaultTimingFunction);
109 const StylePropertySet& properties = styleKeyframe->properties(); 109 const StylePropertySet& properties = styleKeyframe->properties();
110 for (unsigned j = 0; j < properties.propertyCount(); j++) { 110 for (unsigned j = 0; j < properties.propertyCount(); j++) {
111 specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id()); 111 specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id());
112 CSSPropertyID property = propertyForAnimation(properties.propertyAt( j).id()); 112 CSSPropertyID property = propertyForAnimation(properties.propertyAt( j).id());
113 if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) { 113 if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) {
114 CSSValue* value = properties.propertyAt(j).value(); 114 CSSValue* value = properties.propertyAt(j).value();
115 RefPtr<TimingFunction> timingFunction; 115 RefPtr<TimingFunction> timingFunction;
116 if (value->isInheritedValue() && parentStyle->animations()) { 116 if (value->isInheritedValue() && parentStyle->animations()) {
117 timingFunction = parentStyle->animations()->timingFunctionLi st()[0]; 117 timingFunction = parentStyle->animations()->timingFunctionLi st()[0];
118 } else if (value->isValueList()) { 118 } else if (value->isValueList()) {
119 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t oCSSValueList(value)->item(0)); 119 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t oCSSValueList(value)->item(0));
120 } else { 120 } else {
121 ASSERT(value->isInheritedValue() || value->isInitialValue() || value->isUnsetValue()); 121 ASSERT(value->isInheritedValue() || value->isInitialValue() || value->isUnsetValue());
122 timingFunction = CSSTimingData::initialTimingFunction(); 122 timingFunction = CSSTimingData::initialTimingFunction();
123 } 123 }
124 keyframe->setEasing(timingFunction.release()); 124 keyframe->setEasing(timingFunction.release());
125 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { 125 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) {
126 keyframe->setPropertyValue(property, CSSAnimatableValueFactory:: create(property, *keyframeStyle).get()); 126 keyframe->setPropertyValue(property, properties.propertyAt(j).va lue());
127 } 127 }
128 } 128 }
129 keyframes.append(keyframe); 129 keyframes.append(keyframe);
130 // The last keyframe specified at a given offset is used. 130 // The last keyframe specified at a given offset is used.
131 for (size_t j = 1; j < offsets.size(); ++j) { 131 for (size_t j = 1; j < offsets.size(); ++j) {
132 keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset (offsets[j]).get())); 132 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[ j]).get()));
133 } 133 }
134 } 134 }
135 135
136 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { 136 for (CSSPropertyID property : specifiedPropertiesForUseCounter) {
137 ASSERT(property != CSSPropertyInvalid); 137 ASSERT(property != CSSPropertyInvalid);
138 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); 138 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property));
139 } 139 }
140 140
141 // Merge duplicate keyframes. 141 // Merge duplicate keyframes.
142 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset s); 142 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset s);
143 size_t targetIndex = 0; 143 size_t targetIndex = 0;
144 for (size_t i = 1; i < keyframes.size(); i++) { 144 for (size_t i = 1; i < keyframes.size(); i++) {
145 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { 145 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) {
146 for (CSSPropertyID property : keyframes[i]->properties()) 146 for (CSSPropertyID property : keyframes[i]->properties())
147 keyframes[targetIndex]->setPropertyValue(property, keyframes[i]- >propertyValue(property)); 147 keyframes[targetIndex]->setPropertyValue(property, keyframes[i]- >propertyValue(property));
148 } else { 148 } else {
149 targetIndex++; 149 targetIndex++;
150 keyframes[targetIndex] = keyframes[i]; 150 keyframes[targetIndex] = keyframes[i];
151 } 151 }
152 } 152 }
153 if (!keyframes.isEmpty()) 153 if (!keyframes.isEmpty())
154 keyframes.shrink(targetIndex + 1); 154 keyframes.shrink(targetIndex + 1);
155 155
156 // Add 0% and 100% keyframes if absent. 156 // Add 0% and 100% keyframes if absent.
157 RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = keyframes.isEmpt y() ? nullptr : keyframes[0]; 157 RefPtrWillBeRawPtr<StringKeyframe> startKeyframe = keyframes.isEmpty() ? nul lptr : keyframes[0];
158 if (!startKeyframe || keyframes[0]->offset() != 0) { 158 if (!startKeyframe || keyframes[0]->offset() != 0) {
159 startKeyframe = AnimatableValueKeyframe::create(); 159 startKeyframe = StringKeyframe::create();
160 startKeyframe->setOffset(0); 160 startKeyframe->setOffset(0);
161 startKeyframe->setEasing(defaultTimingFunction); 161 startKeyframe->setEasing(defaultTimingFunction);
162 keyframes.prepend(startKeyframe); 162 keyframes.prepend(startKeyframe);
163 } 163 }
164 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = keyframes[keyframe s.size() - 1]; 164 RefPtrWillBeRawPtr<StringKeyframe> endKeyframe = keyframes[keyframes.size() - 1];
165 if (endKeyframe->offset() != 1) { 165 if (endKeyframe->offset() != 1) {
166 endKeyframe = AnimatableValueKeyframe::create(); 166 endKeyframe = StringKeyframe::create();
167 endKeyframe->setOffset(1); 167 endKeyframe->setOffset(1);
168 endKeyframe->setEasing(defaultTimingFunction); 168 endKeyframe->setEasing(defaultTimingFunction);
169 keyframes.append(endKeyframe); 169 keyframes.append(endKeyframe);
170 } 170 }
171 ASSERT(keyframes.size() >= 2); 171 ASSERT(keyframes.size() >= 2);
172 ASSERT(!keyframes.first()->offset()); 172 ASSERT(!keyframes.first()->offset());
173 ASSERT(keyframes.last()->offset() == 1); 173 ASSERT(keyframes.last()->offset() == 1);
174 174
175 // Snapshot current property values for 0% and 100% if missing. 175 // FIXME: This is only used for use counting neutral keyframes running on th e compositor.
176 PropertySet allProperties; 176 PropertySet allProperties;
177 for (const auto& keyframe : keyframes) { 177 for (const auto& keyframe : keyframes) {
178 for (CSSPropertyID property : keyframe->properties()) 178 for (CSSPropertyID property : keyframe->properties())
179 allProperties.add(property); 179 allProperties.add(property);
180 } 180 }
181 const PropertySet& startKeyframeProperties = startKeyframe->properties(); 181 const PropertySet& startKeyframeProperties = startKeyframe->properties();
182 const PropertySet& endKeyframeProperties = endKeyframe->properties(); 182 const PropertySet& endKeyframeProperties = endKeyframe->properties();
183 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz e(); 183 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz e();
184 bool missingEndValues = endKeyframeProperties.size() < allProperties.size(); 184 bool missingEndValues = endKeyframeProperties.size() < allProperties.size();
185 if (missingStartValues || missingEndValues) { 185 if (missingStartValues || missingEndValues) {
186 for (CSSPropertyID property : allProperties) { 186 for (CSSPropertyID property : allProperties) {
187 bool startNeedsValue = missingStartValues && !startKeyframePropertie s.contains(property); 187 bool startNeedsValue = missingStartValues && !startKeyframePropertie s.contains(property);
188 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(property); 188 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(property);
189 if (!startNeedsValue && !endNeedsValue) 189 if (!startNeedsValue && !endNeedsValue)
190 continue; 190 continue;
191 RefPtrWillBeRawPtr<AnimatableValue> snapshotValue = CSSAnimatableVal ueFactory::create(property, style); 191 if (CompositorAnimations::isCompositableProperty(property))
192 if (startNeedsValue)
193 startKeyframe->setPropertyValue(property, snapshotValue.get());
194 if (endNeedsValue)
195 endKeyframe->setPropertyValue(property, snapshotValue.get());
196 if (property == CSSPropertyOpacity || property == CSSPropertyTransfo rm)
197 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation); 192 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation);
198 } 193 }
199 } 194 }
200 ASSERT(startKeyframe->properties().size() == allProperties.size());
201 ASSERT(endKeyframe->properties().size() == allProperties.size());
202 } 195 }
203 196
197 CSSAnimationUpdate::UpdatedAnimationStyle::CompositableStyleSnapshot snapshotCom positableProperties(RenderObject *renderer, const RenderStyle &newStyle, const A nimationEffect *effect)
198 {
199 CSSAnimationUpdate::UpdatedAnimationStyle::CompositableStyleSnapshot snapsho t;
200 if (!renderer)
201 return snapshot;
202
203 const RenderStyle& oldStyle = *renderer->style();
204 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyOpacity, oldStyle, newS tyle) && effect->affects(CSSPropertyOpacity))
205 snapshot.opacity = CSSAnimatableValueFactory::create(CSSPropertyOpacity, newStyle);
206 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyTransform, oldStyle, ne wStyle) && effect->affects(CSSPropertyTransform))
207 snapshot.transform = CSSAnimatableValueFactory::create(CSSPropertyTransf orm, newStyle);
208 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitFilter, oldStyle, newStyle) && effect->affects(CSSPropertyWebkitFilter))
209 snapshot.webkitFilter = CSSAnimatableValueFactory::create(CSSPropertyWeb kitFilter, newStyle);
210
211 return snapshot;
212 }
204 } // namespace 213 } // namespace
205 214
206 CSSAnimations::CSSAnimations() 215 CSSAnimations::CSSAnimations()
207 { 216 {
208 } 217 }
209 218
210 const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPl ayer& player) 219 const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPl ayer& player)
211 { 220 {
212 for (const auto& it : m_animations) { 221 for (const auto& it : m_animations) {
213 if (it.value->player->sequenceNumber() == player.sequenceNumber()) 222 if (it.value->player->sequenceNumber() == player.sequenceNumber())
(...skipping 18 matching lines...) Expand all
232 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme nt.document().timeline().currentTimeInternal()); 241 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme nt.document().timeline().currentTimeInternal());
233 calculateTransitionUpdate(update.get(), animatingElement, style); 242 calculateTransitionUpdate(update.get(), animatingElement, style);
234 calculateTransitionActiveInterpolations(update.get(), animatingElement, elem ent.document().timeline().currentTimeInternal()); 243 calculateTransitionActiveInterpolations(update.get(), animatingElement, elem ent.document().timeline().currentTimeInternal());
235 return update->isEmpty() ? nullptr : update.release(); 244 return update->isEmpty() ? nullptr : update.release();
236 } 245 }
237 246
238 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const E lement* animatingElement, Element& element, const RenderStyle& style, RenderStyl e* parentStyle, StyleResolver* resolver) 247 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const E lement* animatingElement, Element& element, const RenderStyle& style, RenderStyl e* parentStyle, StyleResolver* resolver)
239 { 248 {
240 const ActiveAnimations* activeAnimations = animatingElement ? animatingEleme nt->activeAnimations() : nullptr; 249 const ActiveAnimations* activeAnimations = animatingElement ? animatingEleme nt->activeAnimations() : nullptr;
241 250
251 bool isAnimationStyleChange = activeAnimations && activeAnimations->isAnimat ionStyleChange();
252
242 #if !ENABLE(ASSERT) 253 #if !ENABLE(ASSERT)
243 // If we're in an animation style change, no animations can have started, be en cancelled or changed play state. 254 // If we're in an animation style change, no animations can have started, be en cancelled or changed play state.
244 // When ASSERT is enabled, we verify this optimization. 255 // When ASSERT is enabled, we verify this optimization.
245 if (activeAnimations && activeAnimations->isAnimationStyleChange()) 256 if (isAnimationStyleChange)
246 return; 257 return;
247 #endif 258 #endif
248 259
249 const CSSAnimationData* animationData = style.animations(); 260 const CSSAnimationData* animationData = style.animations();
250 const CSSAnimations* cssAnimations = activeAnimations ? &activeAnimations->c ssAnimations() : nullptr; 261 const CSSAnimations* cssAnimations = activeAnimations ? &activeAnimations->c ssAnimations() : nullptr;
251 const Element* elementForScoping = animatingElement ? animatingElement : &el ement; 262 const Element* elementForScoping = animatingElement ? animatingElement : &el ement;
252 263
253 HashSet<AtomicString> inactive; 264 HashSet<AtomicString> inactive;
254 if (cssAnimations) { 265 if (cssAnimations) {
255 for (const auto& entry : cssAnimations->m_animations) 266 for (const auto& entry : cssAnimations->m_animations)
(...skipping 18 matching lines...) Expand all
274 continue; // Cancel the animation if there's no style rule for i t. 285 continue; // Cancel the animation if there's no style rule for i t.
275 286
276 if (cssAnimations) { 287 if (cssAnimations) {
277 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName)); 288 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName));
278 if (existing != cssAnimations->m_animations.end()) { 289 if (existing != cssAnimations->m_animations.end()) {
279 inactive.remove(animationName); 290 inactive.remove(animationName);
280 291
281 const RunningAnimation* runningAnimation = existing->value.g et(); 292 const RunningAnimation* runningAnimation = existing->value.g et();
282 AnimationPlayer* player = runningAnimation->player.get(); 293 AnimationPlayer* player = runningAnimation->player.get();
283 294
284 ASSERT(keyframesRule);
285 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) { 295 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) {
286 AnimatableValueKeyframeVector resolvedKeyframes; 296 ASSERT(!isAnimationStyleChange);
297
298 StringKeyframeVector resolvedKeyframes;
287 resolveKeyframes(resolver, animatingElement, element, st yle, parentStyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes ); 299 resolveKeyframes(resolver, animatingElement, element, st yle, parentStyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes );
288 300
289 update->updateAnimation(animationName, player, InertAnim ation::create(AnimatableValueKeyframeEffectModel::create(resolvedKeyframes), 301 RefPtrWillBeRawPtr<StringKeyframeEffectModel> effect = S tringKeyframeEffectModel::create(resolvedKeyframes);
290 timing, isPaused, player->currentTimeInternal()), sp ecifiedTiming, keyframesRule); 302 effect->setNeutralKeyframeEasings(keyframeTimingFunction );
dstockwell 2015/02/05 23:04:52 Can this (302-304) be part of resolveKeyframes? It
shend 2015/02/06 03:16:25 Done.
303 effect->snapshotCompositableProperties(animatingElement, style); // FIXME: Remove this once CompositorAnimations no longer depends on An imatableValues
304 effect->forceConversionsToAnimatableValues(&element); // FIXME: Remove this once LegacyStyleInterpolation is removed from StringKeyframe
305 update->updateAnimation(animationName, player, InertAnim ation::create(effect, timing, isPaused, player->currentTimeInternal()), specifie dTiming, keyframesRule);
306 } else if (!isAnimationStyleChange && player->source()->isAn imation()) {
dstockwell 2015/02/05 23:04:52 && player->source() &&
shend 2015/02/06 03:16:25 Done.
307 AnimationEffect* effect = toAnimation(player->source())- >effect();
308 if (effect && effect->isKeyframeEffectModel()) {
309 KeyframeEffectModelBase* keyframeEffect = toKeyframe EffectModelBase(effect);
310 if (keyframeEffect->hasSyntheticKeyframes())
311 update->updateAnimationStyle(player, keyframeEff ect, snapshotCompositableProperties(animatingElement->renderer(), style, effect) );
312 }
291 } 313 }
292 314
293 if (isPaused != player->paused()) { 315 if (isPaused != player->paused()) {
294 ASSERT(!activeAnimations || !activeAnimations->isAnimati onStyleChange()); 316 ASSERT(!isAnimationStyleChange);
295 update->toggleAnimationPaused(animationName); 317 update->toggleAnimationPaused(animationName);
296 } 318 }
297 319
298 continue; 320 continue;
299 } 321 }
300 } 322 }
301 323
302 AnimatableValueKeyframeVector resolvedKeyframes; 324 StringKeyframeVector resolvedKeyframes;
303 resolveKeyframes(resolver, animatingElement, element, style, parentS tyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes); 325 resolveKeyframes(resolver, animatingElement, element, style, parentS tyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes);
304 if (!resolvedKeyframes.isEmpty()) { 326
305 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC hange()); 327 ASSERT(!resolvedKeyframes.isEmpty());
306 update->startAnimation(animationName, InertAnimation::create(Ani matableValueKeyframeEffectModel::create(resolvedKeyframes), timing, isPaused, 0) , specifiedTiming, keyframesRule); 328 ASSERT(!isAnimationStyleChange);
307 } 329 RefPtrWillBeRawPtr<StringKeyframeEffectModel> effect = StringKeyfram eEffectModel::create(resolvedKeyframes);
330 effect->setNeutralKeyframeEasings(keyframeTimingFunction);
331 effect->snapshotCompositableProperties(animatingElement, style); // FIXME: Remove this once CompositorAnimations no longer depends on AnimatableValu es
332 effect->forceConversionsToAnimatableValues(&element); // FIXME: Remo ve this once LegacyStyleInterpolation is removed from StringKeyframe
333 update->startAnimation(animationName, InertAnimation::create(effect, timing, isPaused, 0), specifiedTiming, keyframesRule);
308 } 334 }
309 } 335 }
310 336
311 ASSERT(inactive.isEmpty() || cssAnimations); 337 ASSERT(inactive.isEmpty() || cssAnimations);
312 for (const AtomicString& animationName : inactive) { 338 for (const AtomicString& animationName : inactive) {
313 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleChange()) ; 339 ASSERT(!isAnimationStyleChange);
314 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->player); 340 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->player);
315 } 341 }
316 } 342 }
317 343
318 void CSSAnimations::maybeApplyPendingUpdate(Element* element) 344 void CSSAnimations::maybeApplyPendingUpdate(Element* element)
319 { 345 {
320 if (!m_pendingUpdate) { 346 if (!m_pendingUpdate) {
321 m_previousActiveInterpolationsForAnimations.clear(); 347 m_previousActiveInterpolationsForAnimations.clear();
322 return; 348 return;
323 } 349 }
(...skipping 25 matching lines...) Expand all
349 375
350 for (const auto& entry : update->animationsWithUpdates()) { 376 for (const auto& entry : update->animationsWithUpdates()) {
351 Animation* animation = toAnimation(entry.player->source()); 377 Animation* animation = toAnimation(entry.player->source());
352 378
353 animation->setEffect(entry.animation->effect()); 379 animation->setEffect(entry.animation->effect());
354 animation->updateSpecifiedTiming(entry.animation->specifiedTiming()); 380 animation->updateSpecifiedTiming(entry.animation->specifiedTiming());
355 381
356 m_animations.find(entry.name)->value->update(entry); 382 m_animations.find(entry.name)->value->update(entry);
357 } 383 }
358 384
385 for (const auto& styleUpdate : update->animationsWithStyleUpdates()) {
386 styleUpdate.effect->setDeferredInterpolationsOutdated();
387 if (styleUpdate.snapshot.opacity || styleUpdate.snapshot.transform || st yleUpdate.snapshot.webkitFilter) {
388 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert yOpacity, styleUpdate.snapshot.opacity);
389 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert yTransform, styleUpdate.snapshot.transform);
390 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert yWebkitFilter, styleUpdate.snapshot.webkitFilter);
391 styleUpdate.player->setOutdated();
392 styleUpdate.player->setCompositorPending(true);
393 }
394 }
395
359 for (const auto& entry : update->newAnimations()) { 396 for (const auto& entry : update->newAnimations()) {
360 const InertAnimation* inertAnimation = entry.animation.get(); 397 const InertAnimation* inertAnimation = entry.animation.get();
361 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, entry.name)); 398 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB eNoop(new AnimationEventDelegate(element, entry.name));
362 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio rity, eventDelegate.release()); 399 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio rity, eventDelegate.release());
363 animation->setName(inertAnimation->name()); 400 animation->setName(inertAnimation->name());
364 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().play(animation.get()); 401 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin e().play(animation.get());
365 if (inertAnimation->paused()) 402 if (inertAnimation->paused())
366 player->pause(); 403 player->pause();
367 player->update(TimingUpdateOnDemand); 404 player->update(TimingUpdateOnDemand);
368 405
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 visitor->trace(m_newTransitions); 824 visitor->trace(m_newTransitions);
788 visitor->trace(m_activeInterpolationsForAnimations); 825 visitor->trace(m_activeInterpolationsForAnimations);
789 visitor->trace(m_activeInterpolationsForTransitions); 826 visitor->trace(m_activeInterpolationsForTransitions);
790 visitor->trace(m_newAnimations); 827 visitor->trace(m_newAnimations);
791 visitor->trace(m_suppressedAnimationPlayers); 828 visitor->trace(m_suppressedAnimationPlayers);
792 visitor->trace(m_animationsWithUpdates); 829 visitor->trace(m_animationsWithUpdates);
793 #endif 830 #endif
794 } 831 }
795 832
796 } // namespace blink 833 } // namespace blink
OLDNEW
« Source/core/animation/StringKeyframe.cpp ('K') | « Source/core/animation/css/CSSAnimationUpdate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698