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