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

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

Issue 293893003: Web Animations: Rename TimedItem to AnimationSource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update expectations. Created 6 years, 7 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/css/CSSAnimations.h ('k') | Source/core/core.gypi » ('j') | 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime) 595 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime)
596 { 596 {
597 if (m_target->document().hasListenerType(listenerType)) { 597 if (m_target->document().hasListenerType(listenerType)) {
598 RefPtrWillBeRawPtr<WebKitAnimationEvent> event = WebKitAnimationEvent::c reate(eventName, m_name, elapsedTime); 598 RefPtrWillBeRawPtr<WebKitAnimationEvent> event = WebKitAnimationEvent::c reate(eventName, m_name, elapsedTime);
599 event->setTarget(m_target); 599 event->setTarget(m_target);
600 m_target->document().enqueueAnimationFrameEvent(event); 600 m_target->document().enqueueAnimationFrameEvent(event);
601 } 601 }
602 } 602 }
603 603
604 void CSSAnimations::AnimationEventDelegate::onEventCondition(const TimedItem* ti medItem) 604 void CSSAnimations::AnimationEventDelegate::onEventCondition(const AnimationSour ce* animationSource)
605 { 605 {
606 const TimedItem::Phase currentPhase = timedItem->phase(); 606 const AnimationSource::Phase currentPhase = animationSource->phase();
607 const double currentIteration = timedItem->currentIteration(); 607 const double currentIteration = animationSource->currentIteration();
608 608
609 if (m_previousPhase != currentPhase 609 if (m_previousPhase != currentPhase
610 && (currentPhase == TimedItem::PhaseActive || currentPhase == TimedItem: :PhaseAfter) 610 && (currentPhase == AnimationSource::PhaseActive || currentPhase == Anim ationSource::PhaseAfter)
611 && (m_previousPhase == TimedItem::PhaseNone || m_previousPhase == TimedI tem::PhaseBefore)) { 611 && (m_previousPhase == AnimationSource::PhaseNone || m_previousPhase == AnimationSource::PhaseBefore)) {
612 // The spec states that the elapsed time should be 612 // The spec states that the elapsed time should be
613 // 'delay < 0 ? -delay : 0', but we always use 0 to match the existing 613 // 'delay < 0 ? -delay : 0', but we always use 0 to match the existing
614 // implementation. See crbug.com/279611 614 // implementation. See crbug.com/279611
615 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, 0); 615 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, 0);
616 } 616 }
617 617
618 if (currentPhase == TimedItem::PhaseActive && m_previousPhase == currentPhas e && m_previousIteration != currentIteration) { 618 if (currentPhase == AnimationSource::PhaseActive && m_previousPhase == curre ntPhase && m_previousIteration != currentIteration) {
619 // We fire only a single event for all iterations thast terminate 619 // We fire only a single event for all iterations thast terminate
620 // between a single pair of samples. See http://crbug.com/275263. For 620 // between a single pair of samples. See http://crbug.com/275263. For
621 // compatibility with the existing implementation, this event uses 621 // compatibility with the existing implementation, this event uses
622 // the elapsedTime for the first iteration in question. 622 // the elapsedTime for the first iteration in question.
623 ASSERT(!std::isnan(timedItem->specifiedTiming().iterationDuration)); 623 ASSERT(!std::isnan(animationSource->specifiedTiming().iterationDuration) );
624 const double elapsedTime = timedItem->specifiedTiming().iterationDuratio n * (m_previousIteration + 1); 624 const double elapsedTime = animationSource->specifiedTiming().iterationD uration * (m_previousIteration + 1);
625 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime); 625 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime);
626 } 626 }
627 627
628 if (currentPhase == TimedItem::PhaseAfter && m_previousPhase != TimedItem::P haseAfter) 628 if (currentPhase == AnimationSource::PhaseAfter && m_previousPhase != Animat ionSource::PhaseAfter)
629 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, timedItem->activeDurationInternal()); 629 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationSource->activeDurationInternal());
630 630
631 m_previousPhase = currentPhase; 631 m_previousPhase = currentPhase;
632 m_previousIteration = currentIteration; 632 m_previousIteration = currentIteration;
633 } 633 }
634 634
635 void CSSAnimations::TransitionEventDelegate::onEventCondition(const TimedItem* t imedItem) 635 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationSou rce* animationSource)
636 { 636 {
637 const TimedItem::Phase currentPhase = timedItem->phase(); 637 const AnimationSource::Phase currentPhase = animationSource->phase();
638 if (currentPhase == TimedItem::PhaseAfter && currentPhase != m_previousPhase && m_target->document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { 638 if (currentPhase == AnimationSource::PhaseAfter && currentPhase != m_previou sPhase && m_target->document().hasListenerType(Document::TRANSITIONEND_LISTENER) ) {
639 String propertyName = getPropertyNameString(m_property); 639 String propertyName = getPropertyNameString(m_property);
640 const Timing& timing = timedItem->specifiedTiming(); 640 const Timing& timing = animationSource->specifiedTiming();
641 double elapsedTime = timing.iterationDuration; 641 double elapsedTime = timing.iterationDuration;
642 const AtomicString& eventType = EventTypeNames::transitionend; 642 const AtomicString& eventType = EventTypeNames::transitionend;
643 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe t->pseudoId()); 643 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe t->pseudoId());
644 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement); 644 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even tType, propertyName, elapsedTime, pseudoElement);
645 event->setTarget(m_target); 645 event->setTarget(m_target);
646 m_target->document().enqueueAnimationFrameEvent(event); 646 m_target->document().enqueueAnimationFrameEvent(event);
647 } 647 }
648 648
649 m_previousPhase = currentPhase; 649 m_previousPhase = currentPhase;
650 } 650 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 void CSSAnimationUpdate::trace(Visitor* visitor) 836 void CSSAnimationUpdate::trace(Visitor* visitor)
837 { 837 {
838 visitor->trace(m_newTransitions); 838 visitor->trace(m_newTransitions);
839 visitor->trace(m_activeInterpolationsForAnimations); 839 visitor->trace(m_activeInterpolationsForAnimations);
840 visitor->trace(m_activeInterpolationsForTransitions); 840 visitor->trace(m_activeInterpolationsForTransitions);
841 visitor->trace(m_newAnimations); 841 visitor->trace(m_newAnimations);
842 visitor->trace(m_cancelledAnimationPlayers); 842 visitor->trace(m_cancelledAnimationPlayers);
843 } 843 }
844 844
845 } // namespace WebCore 845 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/css/CSSAnimations.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698