Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2236583003: Rename AnimationEffect to AnimationEffectReadOnly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deprecated-assert
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 namespace { 53 namespace {
54 54
55 static unsigned nextSequenceNumber() 55 static unsigned nextSequenceNumber()
56 { 56 {
57 static unsigned next = 0; 57 static unsigned next = 0;
58 return ++next; 58 return ++next;
59 } 59 }
60 60
61 } 61 }
62 62
63 Animation* Animation::create(AnimationEffect* effect, AnimationTimeline* timelin e) 63 Animation* Animation::create(AnimationEffectReadOnly* effect, AnimationTimeline* timeline)
64 { 64 {
65 if (!timeline) { 65 if (!timeline) {
66 // FIXME: Support creating animations without a timeline. 66 // FIXME: Support creating animations without a timeline.
67 return nullptr; 67 return nullptr;
68 } 68 }
69 69
70 Animation* animation = new Animation(timeline->document()->contextDocument() , *timeline, effect); 70 Animation* animation = new Animation(timeline->document()->contextDocument() , *timeline, effect);
71 animation->suspendIfNeeded(); 71 animation->suspendIfNeeded();
72 72
73 if (timeline) { 73 if (timeline) {
74 timeline->animationAttached(*animation); 74 timeline->animationAttached(*animation);
75 animation->attachCompositorTimeline(); 75 animation->attachCompositorTimeline();
76 } 76 }
77 77
78 return animation; 78 return animation;
79 } 79 }
80 80
81 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time line, AnimationEffect* content) 81 Animation::Animation(ExecutionContext* executionContext, AnimationTimeline& time line, AnimationEffectReadOnly* content)
82 : ActiveScriptWrappable(this) 82 : ActiveScriptWrappable(this)
83 , ActiveDOMObject(executionContext) 83 , ActiveDOMObject(executionContext)
84 , m_playState(Idle) 84 , m_playState(Idle)
85 , m_playbackRate(1) 85 , m_playbackRate(1)
86 , m_startTime(nullValue()) 86 , m_startTime(nullValue())
87 , m_holdTime(0) 87 , m_holdTime(0)
88 , m_sequenceNumber(nextSequenceNumber()) 88 , m_sequenceNumber(nextSequenceNumber())
89 , m_content(content) 89 , m_content(content)
90 , m_timeline(&timeline) 90 , m_timeline(&timeline)
91 , m_paused(false) 91 , m_paused(false)
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 if (previousCurrentTime != newCurrentTime) { 444 if (previousCurrentTime != newCurrentTime) {
445 setOutdated(); 445 setOutdated();
446 } else if (!hadStartTime && m_timeline) { 446 } else if (!hadStartTime && m_timeline) {
447 // Even though this animation is not outdated, time to effect change is 447 // Even though this animation is not outdated, time to effect change is
448 // infinity until start time is set. 448 // infinity until start time is set.
449 m_timeline->wake(); 449 m_timeline->wake();
450 } 450 }
451 } 451 }
452 452
453 void Animation::setEffect(AnimationEffect* newEffect) 453 void Animation::setEffect(AnimationEffectReadOnly* newEffect)
454 { 454 {
455 if (m_content == newEffect) 455 if (m_content == newEffect)
456 return; 456 return;
457 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand, SetCompositorP endingWithEffectChanged); 457 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand, SetCompositorP endingWithEffectChanged);
458 458
459 double storedCurrentTime = currentTimeInternal(); 459 double storedCurrentTime = currentTimeInternal();
460 if (m_content) 460 if (m_content)
461 m_content->detach(); 461 m_content->detach();
462 m_content = newEffect; 462 m_content = newEffect;
463 if (newEffect) { 463 if (newEffect) {
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 DCHECK(!m_outdated); 862 DCHECK(!m_outdated);
863 if (!hasStartTime() || m_held) 863 if (!hasStartTime() || m_held)
864 return std::numeric_limits<double>::infinity(); 864 return std::numeric_limits<double>::infinity();
865 865
866 if (!m_content) 866 if (!m_content)
867 return -currentTimeInternal() / m_playbackRate; 867 return -currentTimeInternal() / m_playbackRate;
868 double result = m_playbackRate > 0 868 double result = m_playbackRate > 0
869 ? m_content->timeToForwardsEffectChange() / m_playbackRate 869 ? m_content->timeToForwardsEffectChange() / m_playbackRate
870 : m_content->timeToReverseEffectChange() / -m_playbackRate; 870 : m_content->timeToReverseEffectChange() / -m_playbackRate;
871 871
872 return !hasActiveAnimationsOnCompositor() && m_content->getPhase() == Animat ionEffect::PhaseActive 872 return !hasActiveAnimationsOnCompositor() && m_content->getPhase() == Animat ionEffectReadOnly::PhaseActive
873 ? 0 873 ? 0
874 : result; 874 : result;
875 } 875 }
876 876
877 void Animation::cancel() 877 void Animation::cancel()
878 { 878 {
879 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); 879 PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand);
880 880
881 if (playStateInternal() == Idle) 881 if (playStateInternal() == Idle)
882 return; 882 return;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 visitor->trace(m_timeline); 1100 visitor->trace(m_timeline);
1101 visitor->trace(m_pendingFinishedEvent); 1101 visitor->trace(m_pendingFinishedEvent);
1102 visitor->trace(m_pendingCancelledEvent); 1102 visitor->trace(m_pendingCancelledEvent);
1103 visitor->trace(m_finishedPromise); 1103 visitor->trace(m_finishedPromise);
1104 visitor->trace(m_readyPromise); 1104 visitor->trace(m_readyPromise);
1105 EventTargetWithInlineData::trace(visitor); 1105 EventTargetWithInlineData::trace(visitor);
1106 ActiveDOMObject::trace(visitor); 1106 ActiveDOMObject::trace(visitor);
1107 } 1107 }
1108 1108
1109 } // namespace blink 1109 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/Animation.h ('k') | third_party/WebKit/Source/core/animation/AnimationEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698