| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 player->suspendIfNeeded(); | 55 player->suspendIfNeeded(); |
| 56 return player.release(); | 56 return player.release(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 AnimationPlayer::AnimationPlayer(ExecutionContext* executionContext, AnimationTi
meline& timeline, AnimationNode* content) | 59 AnimationPlayer::AnimationPlayer(ExecutionContext* executionContext, AnimationTi
meline& timeline, AnimationNode* content) |
| 60 : ActiveDOMObject(executionContext) | 60 : ActiveDOMObject(executionContext) |
| 61 , m_playbackRate(1) | 61 , m_playbackRate(1) |
| 62 , m_startTime(nullValue()) | 62 , m_startTime(nullValue()) |
| 63 , m_holdTime(nullValue()) | 63 , m_holdTime(nullValue()) |
| 64 , m_storedTimeLag(0) | 64 , m_storedTimeLag(0) |
| 65 , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime()) | 65 , m_sortInfo(nextSequenceNumber()) |
| 66 , m_content(content) | 66 , m_content(content) |
| 67 , m_timeline(&timeline) | 67 , m_timeline(&timeline) |
| 68 , m_paused(false) | 68 , m_paused(false) |
| 69 , m_held(false) | 69 , m_held(false) |
| 70 , m_isPausedForTesting(false) | 70 , m_isPausedForTesting(false) |
| 71 , m_outdated(true) | 71 , m_outdated(true) |
| 72 , m_finished(false) | 72 , m_finished(false) |
| 73 { | 73 { |
| 74 ScriptWrappable::init(this); | 74 ScriptWrappable::init(this); |
| 75 if (m_content) { | 75 if (m_content) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ASSERT(!isUpdateFromCompositor || !hasStartTime()); | 176 ASSERT(!isUpdateFromCompositor || !hasStartTime()); |
| 177 | 177 |
| 178 if (!std::isfinite(newStartTime)) | 178 if (!std::isfinite(newStartTime)) |
| 179 return; | 179 return; |
| 180 if (newStartTime == m_startTime) | 180 if (newStartTime == m_startTime) |
| 181 return; | 181 return; |
| 182 updateCurrentTimingState(); // Update the value of held | 182 updateCurrentTimingState(); // Update the value of held |
| 183 bool hadStartTime = hasStartTime(); | 183 bool hadStartTime = hasStartTime(); |
| 184 double previousCurrentTime = currentTimeInternal(); | 184 double previousCurrentTime = currentTimeInternal(); |
| 185 m_startTime = newStartTime; | 185 m_startTime = newStartTime; |
| 186 m_sortInfo.m_startTime = newStartTime; | |
| 187 updateCurrentTimingState(); | 186 updateCurrentTimingState(); |
| 188 if (previousCurrentTime != currentTimeInternal()) { | 187 if (previousCurrentTime != currentTimeInternal()) { |
| 189 setOutdated(); | 188 setOutdated(); |
| 190 } else if (!hadStartTime && m_timeline) { | 189 } else if (!hadStartTime && m_timeline) { |
| 191 // Even though this player is not outdated, time to effect change is | 190 // Even though this player is not outdated, time to effect change is |
| 192 // infinity until start time is set. | 191 // infinity until start time is set. |
| 193 m_timeline->wake(); | 192 m_timeline->wake(); |
| 194 } | 193 } |
| 195 if (!isUpdateFromCompositor) { | 194 if (!isUpdateFromCompositor) { |
| 196 cancelAnimationOnCompositor(); | 195 cancelAnimationOnCompositor(); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 if (m_playbackRate > 0) | 407 if (m_playbackRate > 0) |
| 409 return m_content->timeToForwardsEffectChange() / m_playbackRate; | 408 return m_content->timeToForwardsEffectChange() / m_playbackRate; |
| 410 return m_content->timeToReverseEffectChange() / -m_playbackRate; | 409 return m_content->timeToReverseEffectChange() / -m_playbackRate; |
| 411 } | 410 } |
| 412 | 411 |
| 413 void AnimationPlayer::cancel() | 412 void AnimationPlayer::cancel() |
| 414 { | 413 { |
| 415 setSource(0); | 414 setSource(0); |
| 416 } | 415 } |
| 417 | 416 |
| 418 bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const | |
| 419 { | |
| 420 ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime)); | |
| 421 if (m_startTime < other.m_startTime) | |
| 422 return true; | |
| 423 if (m_startTime > other.m_startTime) | |
| 424 return false; | |
| 425 return m_sequenceNumber < other.m_sequenceNumber; | |
| 426 } | |
| 427 | |
| 428 #if !ENABLE(OILPAN) | 417 #if !ENABLE(OILPAN) |
| 429 bool AnimationPlayer::canFree() const | 418 bool AnimationPlayer::canFree() const |
| 430 { | 419 { |
| 431 ASSERT(m_content); | 420 ASSERT(m_content); |
| 432 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); | 421 return hasOneRef() && m_content->isAnimation() && m_content->hasOneRef(); |
| 433 } | 422 } |
| 434 #endif | 423 #endif |
| 435 | 424 |
| 436 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr
<EventListener> listener, bool useCapture) | 425 bool AnimationPlayer::addEventListener(const AtomicString& eventType, PassRefPtr
<EventListener> listener, bool useCapture) |
| 437 { | 426 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 452 | 441 |
| 453 void AnimationPlayer::trace(Visitor* visitor) | 442 void AnimationPlayer::trace(Visitor* visitor) |
| 454 { | 443 { |
| 455 visitor->trace(m_content); | 444 visitor->trace(m_content); |
| 456 visitor->trace(m_timeline); | 445 visitor->trace(m_timeline); |
| 457 visitor->trace(m_pendingFinishedEvent); | 446 visitor->trace(m_pendingFinishedEvent); |
| 458 EventTargetWithInlineData::trace(visitor); | 447 EventTargetWithInlineData::trace(visitor); |
| 459 } | 448 } |
| 460 | 449 |
| 461 } // namespace | 450 } // namespace |
| OLD | NEW |