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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 bool AnimationPlayer::limited(double currentTime) const | 118 bool AnimationPlayer::limited(double currentTime) const |
119 { | 119 { |
120 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu
rrentTime >= sourceEnd()); | 120 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu
rrentTime >= sourceEnd()); |
121 } | 121 } |
122 | 122 |
123 void AnimationPlayer::setCurrentTime(double newCurrentTime) | 123 void AnimationPlayer::setCurrentTime(double newCurrentTime) |
124 { | 124 { |
125 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetCurrentT
ime); | 125 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetCurrentT
ime); |
126 if (!std::isfinite(newCurrentTime)) | |
127 return; | |
128 | 126 |
129 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); | 127 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); |
130 | 128 |
131 m_currentTimePending = false; | 129 m_currentTimePending = false; |
132 setCurrentTimeInternal(newCurrentTime / 1000, TimingUpdateOnDemand); | 130 setCurrentTimeInternal(newCurrentTime / 1000, TimingUpdateOnDemand); |
133 | 131 |
134 if (calculatePlayState() == Finished) | 132 if (calculatePlayState() == Finished) |
135 m_startTime = calculateStartTime(newCurrentTime); | 133 m_startTime = calculateStartTime(newCurrentTime); |
136 } | 134 } |
137 | 135 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 return (m_timeline->effectiveTime() - m_startTime) * m_playbackRate; | 363 return (m_timeline->effectiveTime() - m_startTime) * m_playbackRate; |
366 } | 364 } |
367 | 365 |
368 void AnimationPlayer::setStartTime(double startTime) | 366 void AnimationPlayer::setStartTime(double startTime) |
369 { | 367 { |
370 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); | 368 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); |
371 | 369 |
372 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetStartTim
e); | 370 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetStartTim
e); |
373 if (m_paused || playStateInternal() == Idle) | 371 if (m_paused || playStateInternal() == Idle) |
374 return; | 372 return; |
375 if (!std::isfinite(startTime)) | |
376 return; | |
377 if (startTime == m_startTime) | 373 if (startTime == m_startTime) |
378 return; | 374 return; |
379 | 375 |
380 m_currentTimePending = false; | 376 m_currentTimePending = false; |
381 setStartTimeInternal(startTime / 1000); | 377 setStartTimeInternal(startTime / 1000); |
382 } | 378 } |
383 | 379 |
384 void AnimationPlayer::setStartTimeInternal(double newStartTime) | 380 void AnimationPlayer::setStartTimeInternal(double newStartTime) |
385 { | 381 { |
386 ASSERT(!m_paused); | 382 ASSERT(!m_paused); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 615 |
620 double AnimationPlayer::playbackRate() const | 616 double AnimationPlayer::playbackRate() const |
621 { | 617 { |
622 UseCounter::count(executionContext(), UseCounter::AnimationPlayerGetPlayback
Rate); | 618 UseCounter::count(executionContext(), UseCounter::AnimationPlayerGetPlayback
Rate); |
623 return m_playbackRate; | 619 return m_playbackRate; |
624 } | 620 } |
625 | 621 |
626 void AnimationPlayer::setPlaybackRate(double playbackRate) | 622 void AnimationPlayer::setPlaybackRate(double playbackRate) |
627 { | 623 { |
628 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetPlayback
Rate); | 624 UseCounter::count(executionContext(), UseCounter::AnimationPlayerSetPlayback
Rate); |
629 if (!std::isfinite(playbackRate)) | |
630 return; | |
631 if (playbackRate == m_playbackRate) | 625 if (playbackRate == m_playbackRate) |
632 return; | 626 return; |
633 | 627 |
634 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); | 628 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); |
635 | 629 |
636 setPlaybackRateInternal(playbackRate); | 630 setPlaybackRateInternal(playbackRate); |
637 } | 631 } |
638 | 632 |
639 void AnimationPlayer::setPlaybackRateInternal(double playbackRate) | 633 void AnimationPlayer::setPlaybackRateInternal(double playbackRate) |
640 { | 634 { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 visitor->trace(m_content); | 930 visitor->trace(m_content); |
937 visitor->trace(m_timeline); | 931 visitor->trace(m_timeline); |
938 visitor->trace(m_pendingFinishedEvent); | 932 visitor->trace(m_pendingFinishedEvent); |
939 visitor->trace(m_finishedPromise); | 933 visitor->trace(m_finishedPromise); |
940 visitor->trace(m_readyPromise); | 934 visitor->trace(m_readyPromise); |
941 EventTargetWithInlineData::trace(visitor); | 935 EventTargetWithInlineData::trace(visitor); |
942 ActiveDOMObject::trace(visitor); | 936 ActiveDOMObject::trace(visitor); |
943 } | 937 } |
944 | 938 |
945 } // namespace | 939 } // namespace |
OLD | NEW |