| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, effectInput, execut
ionContext, exceptionState); |
| 56 if (exceptionState.hadException()) | 56 if (exceptionState.hadException()) |
| 57 return 0; | 57 return 0; |
| 58 return animateInternal(element, effect, TimingInput::convert(duration)); | 58 Timing timing; |
| 59 bool success = TimingInput::convert(duration, timing); |
| 60 DCHECK(success); |
| 61 return animateInternal(element, effect, timing); |
| 59 } | 62 } |
| 60 | 63 |
| 61 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, const Keyfra
meEffectOptions& options, ExceptionState& exceptionState) | 64 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, const Keyfra
meEffectOptions& options, ExceptionState& exceptionState) |
| 62 { | 65 { |
| 63 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); | 66 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); |
| 64 if (exceptionState.hadException()) | 67 Timing timing; |
| 68 bool success = TimingInput::convert(options, timing, &element.document()
, exceptionState); |
| 69 if (!success || exceptionState.hadException()) |
| 65 return 0; | 70 return 0; |
| 66 | 71 |
| 67 Animation* animation = animateInternal(element, effect, TimingInput::con
vert(options, &element.document())); | 72 Animation* animation = animateInternal(element, effect, timing); |
| 68 animation->setId(options.id()); | 73 animation->setId(options.id()); |
| 69 return animation; | 74 return animation; |
| 70 } | 75 } |
| 71 | 76 |
| 72 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, ExceptionSta
te& exceptionState) | 77 static Animation* animate(ExecutionContext* executionContext, Element& eleme
nt, const EffectModelOrDictionarySequenceOrDictionary& effectInput, ExceptionSta
te& exceptionState) |
| 73 { | 78 { |
| 74 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); | 79 EffectModel* effect = EffectInput::convert(&element, effectInput, execut
ionContext, exceptionState); |
| 75 if (exceptionState.hadException()) | 80 if (exceptionState.hadException()) |
| 76 return 0; | 81 return 0; |
| 77 return animateInternal(element, effect, Timing()); | 82 return animateInternal(element, effect, Timing()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 static Animation* animateInternal(Element& element, EffectModel* effect, con
st Timing& timing) | 101 static Animation* animateInternal(Element& element, EffectModel* effect, con
st Timing& timing) |
| 97 { | 102 { |
| 98 KeyframeEffect* keyframeEffect = KeyframeEffect::create(&element, effect
, timing); | 103 KeyframeEffect* keyframeEffect = KeyframeEffect::create(&element, effect
, timing); |
| 99 return element.document().timeline().play(keyframeEffect); | 104 return element.document().timeline().play(keyframeEffect); |
| 100 } | 105 } |
| 101 }; | 106 }; |
| 102 | 107 |
| 103 } // namespace blink | 108 } // namespace blink |
| 104 | 109 |
| 105 #endif // ElementAnimation_h | 110 #endif // ElementAnimation_h |
| OLD | NEW |