OLD | NEW |
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 for (Vector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update-
>newAnimations().begin(); iter != update->newAnimations().end(); ++iter) { | 469 for (Vector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update-
>newAnimations().begin(); iter != update->newAnimations().end(); ++iter) { |
470 OwnPtr<AnimationEventDelegate> eventDelegate = adoptPtr(new AnimationEve
ntDelegate(element, iter->name)); | 470 OwnPtr<AnimationEventDelegate> eventDelegate = adoptPtr(new AnimationEve
ntDelegate(element, iter->name)); |
471 HashSet<RefPtr<Player> > players; | 471 HashSet<RefPtr<Player> > players; |
472 for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = i
ter->animations.begin(); animationsIter != iter->animations.end(); ++animationsI
ter) { | 472 for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = i
ter->animations.begin(); animationsIter != iter->animations.end(); ++animationsI
ter) { |
473 const InertAnimation* inertAnimation = animationsIter->get(); | 473 const InertAnimation* inertAnimation = animationsIter->get(); |
474 // The event delegate is set on the the first animation only. We | 474 // The event delegate is set on the the first animation only. We |
475 // rely on the behavior of OwnPtr::release() to achieve this. | 475 // rely on the behavior of OwnPtr::release() to achieve this. |
476 RefPtr<Animation> animation = Animation::create(element, inertAnimat
ion->effect(), inertAnimation->specified(), Animation::DefaultPriority, eventDel
egate.release()); | 476 RefPtr<Animation> animation = Animation::create(element, inertAnimat
ion->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPriority, ev
entDelegate.release()); |
477 Player* player = element->document().timeline()->createPlayer(animat
ion.get()); | 477 Player* player = element->document().timeline()->createPlayer(animat
ion.get()); |
478 if (inertAnimation->paused()) | 478 if (inertAnimation->paused()) |
479 player->pause(); | 479 player->pause(); |
480 element->document().cssPendingAnimations().add(player); | 480 element->document().cssPendingAnimations().add(player); |
481 player->update(); | 481 player->update(); |
482 players.add(player); | 482 players.add(player); |
483 } | 483 } |
484 m_animations.set(iter->name, players); | 484 m_animations.set(iter->name, players); |
485 } | 485 } |
486 | 486 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 KeyframeEffectModel::KeyframeVector newFrames; | 524 KeyframeEffectModel::KeyframeVector newFrames; |
525 newFrames.append(frames[0]->clone()); | 525 newFrames.append(frames[0]->clone()); |
526 newFrames[0]->clearPropertyValue(id); | 526 newFrames[0]->clearPropertyValue(id); |
527 ASSERT(oldAnimation->compositableValues()->size() == 1); | 527 ASSERT(oldAnimation->compositableValues()->size() == 1); |
528 const AnimationEffect::CompositableValue* compositableValue = oldAni
mation->compositableValues()->at(0).second.get(); | 528 const AnimationEffect::CompositableValue* compositableValue = oldAni
mation->compositableValues()->at(0).second.get(); |
529 ASSERT(!compositableValue->dependsOnUnderlyingValue()); | 529 ASSERT(!compositableValue->dependsOnUnderlyingValue()); |
530 newFrames[0]->setPropertyValue(id, compositableValue->compositeOnto(
0).get()); | 530 newFrames[0]->setPropertyValue(id, compositableValue->compositeOnto(
0).get()); |
531 newFrames.append(frames[1]->clone()); | 531 newFrames.append(frames[1]->clone()); |
532 effect = KeyframeEffectModel::create(newFrames); | 532 effect = KeyframeEffectModel::create(newFrames); |
533 } | 533 } |
534 RefPtr<Animation> transition = Animation::create(element, effect, inertA
nimation->specified(), Animation::TransitionPriority, eventDelegate.release()); | 534 RefPtr<Animation> transition = Animation::create(element, effect, inertA
nimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.releas
e()); |
535 RefPtr<Player> player = element->document().transitionTimeline()->create
Player(transition.get()); | 535 RefPtr<Player> player = element->document().transitionTimeline()->create
Player(transition.get()); |
536 player->update(); | 536 player->update(); |
537 element->document().cssPendingAnimations().add(player.get()); | 537 element->document().cssPendingAnimations().add(player.get()); |
538 runningTransition.transition = transition.get(); | 538 runningTransition.transition = transition.get(); |
539 m_transitions.set(id, runningTransition); | 539 m_transitions.set(id, runningTransition); |
540 ASSERT(id != CSSPropertyInvalid); | 540 ASSERT(id != CSSPropertyInvalid); |
541 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); | 541 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); |
542 } | 542 } |
543 } | 543 } |
544 | 544 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 const double currentIteration = timedItem->currentIteration(); | 750 const double currentIteration = timedItem->currentIteration(); |
751 | 751 |
752 // Note that the elapsedTime is measured from when the animation starts play
ing. | 752 // Note that the elapsedTime is measured from when the animation starts play
ing. |
753 if (!isFirstSample && previousPhase == TimedItem::PhaseActive && currentPhas
e == TimedItem::PhaseActive && previousIteration != currentIteration) { | 753 if (!isFirstSample && previousPhase == TimedItem::PhaseActive && currentPhas
e == TimedItem::PhaseActive && previousIteration != currentIteration) { |
754 ASSERT(!isNull(previousIteration)); | 754 ASSERT(!isNull(previousIteration)); |
755 ASSERT(!isNull(currentIteration)); | 755 ASSERT(!isNull(currentIteration)); |
756 // We fire only a single event for all iterations thast terminate | 756 // We fire only a single event for all iterations thast terminate |
757 // between a single pair of samples. See http://crbug.com/275263. For | 757 // between a single pair of samples. See http://crbug.com/275263. For |
758 // compatibility with the existing implementation, this event uses | 758 // compatibility with the existing implementation, this event uses |
759 // the elapsedTime for the first iteration in question. | 759 // the elapsedTime for the first iteration in question. |
760 ASSERT(!std::isnan(timedItem->specified().iterationDuration)); | 760 ASSERT(!std::isnan(timedItem->specifiedTiming().iterationDuration)); |
761 const double elapsedTime = timedItem->specified().iterationDuration * (p
reviousIteration + 1); | 761 const double elapsedTime = timedItem->specifiedTiming().iterationDuratio
n * (previousIteration + 1); |
762 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani
mationiteration, elapsedTime); | 762 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani
mationiteration, elapsedTime); |
763 return; | 763 return; |
764 } | 764 } |
765 if ((isFirstSample || previousPhase == TimedItem::PhaseBefore) && isLaterPha
se(currentPhase, TimedItem::PhaseBefore)) { | 765 if ((isFirstSample || previousPhase == TimedItem::PhaseBefore) && isLaterPha
se(currentPhase, TimedItem::PhaseBefore)) { |
766 ASSERT(timedItem->specified().startDelay > 0 || isFirstSample); | 766 ASSERT(timedItem->specifiedTiming().startDelay > 0 || isFirstSample); |
767 // The spec states that the elapsed time should be | 767 // The spec states that the elapsed time should be |
768 // 'delay < 0 ? -delay : 0', but we always use 0 to match the existing | 768 // 'delay < 0 ? -delay : 0', but we always use 0 to match the existing |
769 // implementation. See crbug.com/279611 | 769 // implementation. See crbug.com/279611 |
770 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati
onstart, 0); | 770 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati
onstart, 0); |
771 } | 771 } |
772 if ((isFirstSample || isEarlierPhase(previousPhase, TimedItem::PhaseAfter))
&& currentPhase == TimedItem::PhaseAfter) | 772 if ((isFirstSample || isEarlierPhase(previousPhase, TimedItem::PhaseAfter))
&& currentPhase == TimedItem::PhaseAfter) |
773 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation
end, timedItem->activeDuration()); | 773 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation
end, timedItem->activeDuration()); |
774 } | 774 } |
775 | 775 |
776 void CSSAnimations::TransitionEventDelegate::onEventCondition(const TimedItem* t
imedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIte
ration) | 776 void CSSAnimations::TransitionEventDelegate::onEventCondition(const TimedItem* t
imedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIte
ration) |
777 { | 777 { |
778 // Events for a single document are queued and dispatched as a group at | 778 // Events for a single document are queued and dispatched as a group at |
779 // the end of DocumentTimeline::serviceAnimations. | 779 // the end of DocumentTimeline::serviceAnimations. |
780 // FIXME: Events which are queued outside of serviceAnimations should | 780 // FIXME: Events which are queued outside of serviceAnimations should |
781 // trigger a timer to dispatch when control is released. | 781 // trigger a timer to dispatch when control is released. |
782 const TimedItem::Phase currentPhase = timedItem->phase(); | 782 const TimedItem::Phase currentPhase = timedItem->phase(); |
783 if (currentPhase == TimedItem::PhaseAfter && (isFirstSample || previousPhase
!= currentPhase) && m_target->document().hasListenerType(Document::TRANSITIONEN
D_LISTENER)) { | 783 if (currentPhase == TimedItem::PhaseAfter && (isFirstSample || previousPhase
!= currentPhase) && m_target->document().hasListenerType(Document::TRANSITIONEN
D_LISTENER)) { |
784 String propertyName = getPropertyNameString(m_property); | 784 String propertyName = getPropertyNameString(m_property); |
785 const Timing& timing = timedItem->specified(); | 785 const Timing& timing = timedItem->specifiedTiming(); |
786 double elapsedTime = timing.iterationDuration; | 786 double elapsedTime = timing.iterationDuration; |
787 const AtomicString& eventType = EventTypeNames::transitionend; | 787 const AtomicString& eventType = EventTypeNames::transitionend; |
788 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe
t->pseudoId()); | 788 String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_targe
t->pseudoId()); |
789 m_target->document().transitionTimeline()->addEventToDispatch(m_target,
TransitionEvent::create(eventType, propertyName, elapsedTime, pseudoElement)); | 789 m_target->document().transitionTimeline()->addEventToDispatch(m_target,
TransitionEvent::create(eventType, propertyName, elapsedTime, pseudoElement)); |
790 } | 790 } |
791 } | 791 } |
792 | 792 |
793 | 793 |
794 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) | 794 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
795 { | 795 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 CSSPropertyID id = convertToCSSPropertyID(i); | 918 CSSPropertyID id = convertToCSSPropertyID(i); |
919 if (isAnimatableProperty(id)) | 919 if (isAnimatableProperty(id)) |
920 properties.append(id); | 920 properties.append(id); |
921 } | 921 } |
922 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 922 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
923 } | 923 } |
924 return propertyShorthand; | 924 return propertyShorthand; |
925 } | 925 } |
926 | 926 |
927 } // namespace WebCore | 927 } // namespace WebCore |
OLD | NEW |