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

Side by Side Diff: sky/engine/core/animation/css/CSSAnimations.cpp

Issue 772673002: Fix Animations, Remove Compostior Animations. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 6 years 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "sky/engine/config.h" 31 #include "sky/engine/config.h"
32 #include "sky/engine/core/animation/css/CSSAnimations.h" 32 #include "sky/engine/core/animation/css/CSSAnimations.h"
33 33
34 #include "gen/sky/core/StylePropertyShorthand.h" 34 #include "gen/sky/core/StylePropertyShorthand.h"
35 #include "sky/engine/core/animation/ActiveAnimations.h" 35 #include "sky/engine/core/animation/ActiveAnimations.h"
36 #include "sky/engine/core/animation/AnimationTimeline.h" 36 #include "sky/engine/core/animation/AnimationTimeline.h"
37 #include "sky/engine/core/animation/CompositorAnimations.h"
38 #include "sky/engine/core/animation/KeyframeEffectModel.h" 37 #include "sky/engine/core/animation/KeyframeEffectModel.h"
39 #include "sky/engine/core/animation/LegacyStyleInterpolation.h" 38 #include "sky/engine/core/animation/LegacyStyleInterpolation.h"
40 #include "sky/engine/core/animation/css/CSSAnimatableValueFactory.h" 39 #include "sky/engine/core/animation/css/CSSAnimatableValueFactory.h"
41 #include "sky/engine/core/animation/css/CSSPropertyEquality.h" 40 #include "sky/engine/core/animation/css/CSSPropertyEquality.h"
42 #include "sky/engine/core/css/CSSKeyframeRule.h" 41 #include "sky/engine/core/css/CSSKeyframeRule.h"
43 #include "sky/engine/core/css/CSSPropertyMetadata.h" 42 #include "sky/engine/core/css/CSSPropertyMetadata.h"
44 #include "sky/engine/core/css/CSSValueList.h" 43 #include "sky/engine/core/css/CSSValueList.h"
45 #include "sky/engine/core/css/resolver/CSSToStyleMap.h" 44 #include "sky/engine/core/css/resolver/CSSToStyleMap.h"
46 #include "sky/engine/core/css/resolver/StyleResolver.h" 45 #include "sky/engine/core/css/resolver/StyleResolver.h"
47 #include "sky/engine/core/dom/Element.h" 46 #include "sky/engine/core/dom/Element.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // lazily. However, we need the new state to know what the from state shoud 328 // lazily. However, we need the new state to know what the from state shoud
330 // be when transitions are retargeted. Instead of triggering complete style 329 // be when transitions are retargeted. Instead of triggering complete style
331 // recalculation, we find these cases by searching for new transitions that 330 // recalculation, we find these cases by searching for new transitions that
332 // have matching cancelled animation property IDs on the compositor. 331 // have matching cancelled animation property IDs on the compositor.
333 HashMap<CSSPropertyID, std::pair<RefPtr<Animation>, double> > retargetedComp ositorTransitions; 332 HashMap<CSSPropertyID, std::pair<RefPtr<Animation>, double> > retargetedComp ositorTransitions;
334 for (HashSet<CSSPropertyID>::iterator iter = update->cancelledTransitions(). begin(); iter != update->cancelledTransitions().end(); ++iter) { 333 for (HashSet<CSSPropertyID>::iterator iter = update->cancelledTransitions(). begin(); iter != update->cancelledTransitions().end(); ++iter) {
335 CSSPropertyID id = *iter; 334 CSSPropertyID id = *iter;
336 ASSERT(m_transitions.contains(id)); 335 ASSERT(m_transitions.contains(id));
337 336
338 RefPtr<AnimationPlayer> player = m_transitions.take(id).player; 337 RefPtr<AnimationPlayer> player = m_transitions.take(id).player;
339 Animation* animation = toAnimation(player->source()); 338 // Animation* animation = toAnimation(player->source());
340 if (animation->hasActiveAnimationsOnCompositor(id) && update->newTransit ions().find(id) != update->newTransitions().end()) 339 // if (animation->hasActiveAnimationsOnCompositor(id) && update->newTran sitions().find(id) != update->newTransitions().end())
341 retargetedCompositorTransitions.add(id, std::pair<RefPtr<Animation>, double>(animation, player->startTimeInternal())); 340 // retargetedCompositorTransitions.add(id, std::pair<RefPtr<Animatio n>, double>(animation, player->startTimeInternal()));
341
342 // FIXME(rafaelw): Should we still do this?
342 player->cancel(); 343 player->cancel();
343 player->update(TimingUpdateOnDemand); 344 player->update(TimingUpdateOnDemand);
344 } 345 }
345 346
346 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update->new Transitions().begin(); iter != update->newTransitions().end(); ++iter) { 347 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update->new Transitions().begin(); iter != update->newTransitions().end(); ++iter) {
347 const CSSAnimationUpdate::NewTransition& newTransition = iter->value; 348 const CSSAnimationUpdate::NewTransition& newTransition = iter->value;
348 349
349 RunningTransition runningTransition; 350 RunningTransition runningTransition;
350 runningTransition.from = newTransition.from; 351 runningTransition.from = newTransition.from;
351 runningTransition.to = newTransition.to; 352 runningTransition.to = newTransition.to;
352 353
353 CSSPropertyID id = newTransition.id; 354 CSSPropertyID id = newTransition.id;
354 InertAnimation* inertAnimation = newTransition.animation.get(); 355 InertAnimation* inertAnimation = newTransition.animation.get();
355 OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionE ventDelegate(element, newTransition.eventId)); 356 OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionE ventDelegate(element, newTransition.eventId));
356 357
357 RefPtr<AnimationEffect> effect = inertAnimation->effect(); 358 RefPtr<AnimationEffect> effect = inertAnimation->effect();
358 359
359 if (retargetedCompositorTransitions.contains(id)) { 360 // if (retargetedCompositorTransitions.contains(id)) {
360 const std::pair<RefPtr<Animation>, double>& oldTransition = retarget edCompositorTransitions.get(id); 361 // const std::pair<RefPtr<Animation>, double>& oldTransition = retar getedCompositorTransitions.get(id);
361 RefPtr<Animation> oldAnimation = oldTransition.first; 362 // RefPtr<Animation> oldAnimation = oldTransition.first;
362 double oldStartTime = oldTransition.second; 363 // double oldStartTime = oldTransition.second;
363 double inheritedTime = isNull(oldStartTime) ? 0 : element->document( ).timeline().currentTimeInternal() - oldStartTime; 364 // double inheritedTime = isNull(oldStartTime) ? 0 : element->docume nt().timeline().currentTimeInternal() - oldStartTime;
364 365
365 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey frameEffectModel(inertAnimation->effect()); 366 // AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValue KeyframeEffectModel(inertAnimation->effect());
366 const KeyframeVector& frames = oldEffect->getFrames(); 367 // const KeyframeVector& frames = oldEffect->getFrames();
367 368
368 AnimatableValueKeyframeVector newFrames; 369 // AnimatableValueKeyframeVector newFrames;
369 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get()) ); 370 // newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get ()));
370 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get()) ); 371 // newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get ()));
371 372
372 newFrames[0]->clearPropertyValue(id); 373 // newFrames[0]->clearPropertyValue(id);
373 RefPtr<InertAnimation> inertAnimationForSampling = InertAnimation::c reate(oldAnimation->effect(), oldAnimation->specifiedTiming(), false); 374 // RefPtr<InertAnimation> inertAnimationForSampling = InertAnimation ::create(oldAnimation->effect(), oldAnimation->specifiedTiming(), false);
374 OwnPtr<Vector<RefPtr<Interpolation> > > sample = inertAnimationForSa mpling->sample(inheritedTime); 375 // OwnPtr<Vector<RefPtr<Interpolation> > > sample = inertAnimationFo rSampling->sample(inheritedTime);
375 ASSERT(sample->size() == 1); 376 // ASSERT(sample->size() == 1);
376 newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sample ->at(0).get())->currentValue()); 377 // newFrames[0]->setPropertyValue(id, toLegacyStyleInterpolation(sam ple->at(0).get())->currentValue());
377 378
378 effect = AnimatableValueKeyframeEffectModel::create(newFrames); 379 // effect = AnimatableValueKeyframeEffectModel::create(newFrames);
379 } 380 // }
380 381
381 RefPtr<Animation> transition = Animation::create(element, effect, inertA nimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.releas e()); 382 RefPtr<Animation> transition = Animation::create(element, effect, inertA nimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.releas e());
382 RefPtr<AnimationPlayer> player = element->document().timeline().createAn imationPlayer(transition.get()); 383 RefPtr<AnimationPlayer> player = element->document().timeline().createAn imationPlayer(transition.get());
383 player->update(TimingUpdateOnDemand); 384 player->update(TimingUpdateOnDemand);
384 runningTransition.player = player; 385 runningTransition.player = player;
385 m_transitions.set(id, runningTransition); 386 m_transitions.set(id, runningTransition);
386 ASSERT(id != CSSPropertyInvalid); 387 ASSERT(id != CSSPropertyInvalid);
387 } 388 }
388 } 389 }
389 390
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 case CSSPropertyWebkitTransitionDuration: 683 case CSSPropertyWebkitTransitionDuration:
683 case CSSPropertyWebkitTransitionProperty: 684 case CSSPropertyWebkitTransitionProperty:
684 case CSSPropertyWebkitTransitionTimingFunction: 685 case CSSPropertyWebkitTransitionTimingFunction:
685 return false; 686 return false;
686 default: 687 default:
687 return true; 688 return true;
688 } 689 }
689 } 690 }
690 691
691 } // namespace blink 692 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698