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

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

Issue 1030103002: Transitions: Downgrade transition to animation after it has finished (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/AnimationPlayer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // have matching cancelled animation property IDs on the compositor. 391 // have matching cancelled animation property IDs on the compositor.
392 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<Animation>, do uble>> retargetedCompositorTransitions; 392 WillBeHeapHashMap<CSSPropertyID, std::pair<RefPtrWillBeMember<Animation>, do uble>> retargetedCompositorTransitions;
393 for (CSSPropertyID id : update->cancelledTransitions()) { 393 for (CSSPropertyID id : update->cancelledTransitions()) {
394 ASSERT(m_transitions.contains(id)); 394 ASSERT(m_transitions.contains(id));
395 395
396 RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id).play er; 396 RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id).play er;
397 Animation* animation = toAnimation(player->source()); 397 Animation* animation = toAnimation(player->source());
398 if (animation->hasActiveAnimationsOnCompositor(id) && update->newTransit ions().find(id) != update->newTransitions().end() && !player->limited()) 398 if (animation->hasActiveAnimationsOnCompositor(id) && update->newTransit ions().find(id) != update->newTransitions().end() && !player->limited())
399 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember <Animation>, double>(animation, player->startTimeInternal())); 399 retargetedCompositorTransitions.add(id, std::pair<RefPtrWillBeMember <Animation>, double>(animation, player->startTimeInternal()));
400 player->cancel(); 400 player->cancel();
401 // after cancelation, transitions must be downgraded or they'll fail
402 // to be considered when retriggering themselves. This can happen if
403 // the transition is captured through getAnimationPlayers then played.
404 if (player->source() && player->source()->isAnimation())
405 toAnimation(player->source())->downgradeToNormalAnimation();
401 player->update(TimingUpdateOnDemand); 406 player->update(TimingUpdateOnDemand);
402 } 407 }
403 408
404 for (CSSPropertyID id : update->finishedTransitions()) { 409 for (CSSPropertyID id : update->finishedTransitions()) {
405 // This transition can also be cancelled and finished at the same time 410 // This transition can also be cancelled and finished at the same time
406 if (m_transitions.contains(id)) 411 if (m_transitions.contains(id)) {
407 m_transitions.take(id); 412 RefPtrWillBeRawPtr<AnimationPlayer> player = m_transitions.take(id). player;
413 // Transition must be downgraded
414 if (player->source() && player->source()->isAnimation())
415 toAnimation(player->source())->downgradeToNormalAnimation();
416 }
408 } 417 }
409 418
410 for (const auto& entry : update->newTransitions()) { 419 for (const auto& entry : update->newTransitions()) {
411 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; 420 const CSSAnimationUpdate::NewTransition& newTransition = entry.value;
412 421
413 RunningTransition runningTransition; 422 RunningTransition runningTransition;
414 runningTransition.from = newTransition.from; 423 runningTransition.from = newTransition.from;
415 runningTransition.to = newTransition.to; 424 runningTransition.to = newTransition.to;
416 425
417 CSSPropertyID id = newTransition.id; 426 CSSPropertyID id = newTransition.id;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 visitor->trace(m_activeInterpolationsForAnimations); 833 visitor->trace(m_activeInterpolationsForAnimations);
825 visitor->trace(m_activeInterpolationsForTransitions); 834 visitor->trace(m_activeInterpolationsForTransitions);
826 visitor->trace(m_newAnimations); 835 visitor->trace(m_newAnimations);
827 visitor->trace(m_suppressedAnimationPlayers); 836 visitor->trace(m_suppressedAnimationPlayers);
828 visitor->trace(m_animationsWithUpdates); 837 visitor->trace(m_animationsWithUpdates);
829 visitor->trace(m_animationsWithStyleUpdates); 838 visitor->trace(m_animationsWithStyleUpdates);
830 #endif 839 #endif
831 } 840 }
832 841
833 } // namespace blink 842 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationPlayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698