| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/AnimationEffectTiming.h" | 5 #include "core/animation/AnimationEffectTiming.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/UnrestrictedDoubleOrString.h" | 8 #include "bindings/core/v8/UnrestrictedDoubleOrString.h" |
| 9 #include "core/animation/AnimationEffectReadOnly.h" | 9 #include "core/animation/AnimationEffectReadOnly.h" |
| 10 #include "core/animation/AnimationEffectTimingReadOnly.h" |
| 10 #include "core/animation/KeyframeEffect.h" | 11 #include "core/animation/KeyframeEffect.h" |
| 11 #include "platform/animation/TimingFunction.h" | 12 #include "platform/animation/TimingFunction.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 AnimationEffectTiming* AnimationEffectTiming::create( | 16 AnimationEffectTiming* AnimationEffectTiming::create( |
| 16 AnimationEffectReadOnly* parent) { | 17 AnimationEffectReadOnly* parent) { |
| 17 return new AnimationEffectTiming(parent); | 18 return new AnimationEffectTiming(parent); |
| 18 } | 19 } |
| 19 | 20 |
| 20 AnimationEffectTiming::AnimationEffectTiming(AnimationEffectReadOnly* parent) | 21 AnimationEffectTiming::AnimationEffectTiming(AnimationEffectReadOnly* parent) |
| 21 : m_parent(parent) {} | 22 : AnimationEffectTimingReadOnly(parent) {} |
| 22 | |
| 23 double AnimationEffectTiming::delay() { | |
| 24 return m_parent->specifiedTiming().startDelay * 1000; | |
| 25 } | |
| 26 | |
| 27 double AnimationEffectTiming::endDelay() { | |
| 28 return m_parent->specifiedTiming().endDelay * 1000; | |
| 29 } | |
| 30 | |
| 31 String AnimationEffectTiming::fill() { | |
| 32 return Timing::fillModeString(m_parent->specifiedTiming().fillMode); | |
| 33 } | |
| 34 | |
| 35 double AnimationEffectTiming::iterationStart() { | |
| 36 return m_parent->specifiedTiming().iterationStart; | |
| 37 } | |
| 38 | |
| 39 double AnimationEffectTiming::iterations() { | |
| 40 return m_parent->specifiedTiming().iterationCount; | |
| 41 } | |
| 42 | |
| 43 void AnimationEffectTiming::duration(UnrestrictedDoubleOrString& returnValue) { | |
| 44 if (std::isnan(m_parent->specifiedTiming().iterationDuration)) | |
| 45 returnValue.setString("auto"); | |
| 46 else | |
| 47 returnValue.setUnrestrictedDouble( | |
| 48 m_parent->specifiedTiming().iterationDuration * 1000); | |
| 49 } | |
| 50 | |
| 51 double AnimationEffectTiming::playbackRate() { | |
| 52 return m_parent->specifiedTiming().playbackRate; | |
| 53 } | |
| 54 | |
| 55 String AnimationEffectTiming::direction() { | |
| 56 return Timing::playbackDirectionString(m_parent->specifiedTiming().direction); | |
| 57 } | |
| 58 | |
| 59 String AnimationEffectTiming::easing() { | |
| 60 return m_parent->specifiedTiming().timingFunction->toString(); | |
| 61 } | |
| 62 | 23 |
| 63 void AnimationEffectTiming::setDelay(double delay) { | 24 void AnimationEffectTiming::setDelay(double delay) { |
| 64 Timing timing = m_parent->specifiedTiming(); | 25 Timing timing = m_parent->specifiedTiming(); |
| 65 TimingInput::setStartDelay(timing, delay); | 26 TimingInput::setStartDelay(timing, delay); |
| 66 m_parent->updateSpecifiedTiming(timing); | 27 m_parent->updateSpecifiedTiming(timing); |
| 67 } | 28 } |
| 68 | 29 |
| 69 void AnimationEffectTiming::setEndDelay(double endDelay) { | 30 void AnimationEffectTiming::setEndDelay(double endDelay) { |
| 70 Timing timing = m_parent->specifiedTiming(); | 31 Timing timing = m_parent->specifiedTiming(); |
| 71 TimingInput::setEndDelay(timing, endDelay); | 32 TimingInput::setEndDelay(timing, endDelay); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // The AnimationEffectTiming might not be attached to a document at this | 79 // The AnimationEffectTiming might not be attached to a document at this |
| 119 // point, so we pass nullptr in to setTimingFunction. This means that these | 80 // point, so we pass nullptr in to setTimingFunction. This means that these |
| 120 // calls are not considered in the WebAnimationsEasingAsFunction* | 81 // calls are not considered in the WebAnimationsEasingAsFunction* |
| 121 // UseCounters, but the bug we are tracking there does not come through | 82 // UseCounters, but the bug we are tracking there does not come through |
| 122 // this interface. | 83 // this interface. |
| 123 if (TimingInput::setTimingFunction(timing, easing, nullptr, exceptionState)) | 84 if (TimingInput::setTimingFunction(timing, easing, nullptr, exceptionState)) |
| 124 m_parent->updateSpecifiedTiming(timing); | 85 m_parent->updateSpecifiedTiming(timing); |
| 125 } | 86 } |
| 126 | 87 |
| 127 DEFINE_TRACE(AnimationEffectTiming) { | 88 DEFINE_TRACE(AnimationEffectTiming) { |
| 128 visitor->trace(m_parent); | 89 AnimationEffectTimingReadOnly::trace(visitor); |
| 129 } | 90 } |
| 130 | 91 |
| 131 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |