| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class Dictionary; | 48 class Dictionary; |
| 49 | 49 |
| 50 class ElementAnimation { | 50 class ElementAnimation { |
| 51 STATIC_ONLY(ElementAnimation); | 51 STATIC_ONLY(ElementAnimation); |
| 52 public: | 52 public: |
| 53 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, double durat
ion, ExceptionState& exceptionState) | 53 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, double durat
ion, ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); | 55 EffectModel* effect = EffectInput::convert(element.document(), effectInp
ut, executionContext, exceptionState); |
| 56 if (exceptionState.hadException()) | 56 if (exceptionState.hadException()) |
| 57 return nullptr; | 57 return nullptr; |
| 58 | 58 |
| 59 Timing timing; | 59 Timing timing; |
| 60 if (!TimingInput::convert(duration, timing, exceptionState)) | 60 if (!TimingInput::convert(duration, timing, exceptionState)) |
| 61 return nullptr; | 61 return nullptr; |
| 62 | 62 |
| 63 return animateInternal(element, effect, timing); | 63 return animateInternal(element, effect, timing); |
| 64 } | 64 } |
| 65 | 65 |
| 66 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, const Keyfra
meEffectOptions& options, ExceptionState& exceptionState) | 66 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, const Keyfra
meEffectOptions& options, ExceptionState& exceptionState) |
| 67 { | 67 { |
| 68 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); | 68 EffectModel* effect = EffectInput::convert(element.document(), effectInp
ut, executionContext, exceptionState); |
| 69 if (exceptionState.hadException()) | 69 if (exceptionState.hadException()) |
| 70 return nullptr; | 70 return nullptr; |
| 71 | 71 |
| 72 Timing timing; | 72 Timing timing; |
| 73 if (!TimingInput::convert(options, timing, &element.document(), exceptio
nState)) | 73 if (!TimingInput::convert(options, timing, element.document(), exception
State)) |
| 74 return nullptr; | 74 return nullptr; |
| 75 | 75 |
| 76 Animation* animation = animateInternal(element, effect, timing); | 76 Animation* animation = animateInternal(element, effect, timing); |
| 77 animation->setId(options.id()); | 77 animation->setId(options.id()); |
| 78 return animation; | 78 return animation; |
| 79 } | 79 } |
| 80 | 80 |
| 81 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, ExceptionSta
te& exceptionState) | 81 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, ExceptionSta
te& exceptionState) |
| 82 { | 82 { |
| 83 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); | 83 EffectModel* effect = EffectInput::convert(element.document(), effectInp
ut, executionContext, exceptionState); |
| 84 if (exceptionState.hadException()) | 84 if (exceptionState.hadException()) |
| 85 return nullptr; | 85 return nullptr; |
| 86 return animateInternal(element, effect, Timing()); | 86 return animateInternal(element, effect, Timing()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static HeapVector<Member<Animation>> getAnimations(Element& element) | 89 static HeapVector<Member<Animation>> getAnimations(Element& element) |
| 90 { | 90 { |
| 91 HeapVector<Member<Animation>> animations; | 91 HeapVector<Member<Animation>> animations; |
| 92 | 92 |
| 93 if (!element.hasAnimations()) | 93 if (!element.hasAnimations()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 static Animation* animateInternal(Element& element, EffectModel* effect, con
st Timing& timing) | 105 static Animation* animateInternal(Element& element, EffectModel* effect, con
st Timing& timing) |
| 106 { | 106 { |
| 107 KeyframeEffect* keyframeEffect = KeyframeEffect::create(&element, effect
, timing); | 107 KeyframeEffect* keyframeEffect = KeyframeEffect::create(&element, effect
, timing); |
| 108 return element.document().timeline().play(keyframeEffect); | 108 return element.document().timeline().play(keyframeEffect); |
| 109 } | 109 } |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace blink | 112 } // namespace blink |
| 113 | 113 |
| 114 #endif // ElementAnimation_h | 114 #endif // ElementAnimation_h |
| OLD | NEW |