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