| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return new KeyframeEffect(target, model, timing, priority, eventDelegate); | 51 return new KeyframeEffect(target, model, timing, priority, eventDelegate); |
| 52 } | 52 } |
| 53 | 53 |
| 54 KeyframeEffect* KeyframeEffect::create( | 54 KeyframeEffect* KeyframeEffect::create( |
| 55 ExecutionContext* executionContext, | 55 ExecutionContext* executionContext, |
| 56 Element* element, | 56 Element* element, |
| 57 const DictionarySequenceOrDictionary& effectInput, | 57 const DictionarySequenceOrDictionary& effectInput, |
| 58 double duration, | 58 double duration, |
| 59 ExceptionState& exceptionState) { | 59 ExceptionState& exceptionState) { |
| 60 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 60 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| 61 if (element) | 61 if (element) { |
| 62 UseCounter::count( | 62 UseCounter::count( |
| 63 element->document(), | 63 element->document(), |
| 64 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming); | 64 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming); |
| 65 } |
| 65 Timing timing; | 66 Timing timing; |
| 66 if (!TimingInput::convert(duration, timing, exceptionState)) | 67 if (!TimingInput::convert(duration, timing, exceptionState)) |
| 67 return nullptr; | 68 return nullptr; |
| 68 return create(element, EffectInput::convert(element, effectInput, | 69 return create(element, EffectInput::convert(element, effectInput, |
| 69 executionContext, exceptionState), | 70 executionContext, exceptionState), |
| 70 timing); | 71 timing); |
| 71 } | 72 } |
| 72 | 73 |
| 73 KeyframeEffect* KeyframeEffect::create( | 74 KeyframeEffect* KeyframeEffect::create( |
| 74 ExecutionContext* executionContext, | 75 ExecutionContext* executionContext, |
| 75 Element* element, | 76 Element* element, |
| 76 const DictionarySequenceOrDictionary& effectInput, | 77 const DictionarySequenceOrDictionary& effectInput, |
| 77 const KeyframeEffectOptions& timingInput, | 78 const KeyframeEffectOptions& timingInput, |
| 78 ExceptionState& exceptionState) { | 79 ExceptionState& exceptionState) { |
| 79 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 80 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| 80 if (element) | 81 if (element) { |
| 81 UseCounter::count( | 82 UseCounter::count( |
| 82 element->document(), | 83 element->document(), |
| 83 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming); | 84 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming); |
| 85 } |
| 84 Timing timing; | 86 Timing timing; |
| 85 Document* document = element ? &element->document() : nullptr; | 87 Document* document = element ? &element->document() : nullptr; |
| 86 if (!TimingInput::convert(timingInput, timing, document, exceptionState)) | 88 if (!TimingInput::convert(timingInput, timing, document, exceptionState)) |
| 87 return nullptr; | 89 return nullptr; |
| 88 return create(element, EffectInput::convert(element, effectInput, | 90 return create(element, EffectInput::convert(element, effectInput, |
| 89 executionContext, exceptionState), | 91 executionContext, exceptionState), |
| 90 timing); | 92 timing); |
| 91 } | 93 } |
| 92 | 94 |
| 93 KeyframeEffect* KeyframeEffect::create( | 95 KeyframeEffect* KeyframeEffect::create( |
| 94 ExecutionContext* executionContext, | 96 ExecutionContext* executionContext, |
| 95 Element* element, | 97 Element* element, |
| 96 const DictionarySequenceOrDictionary& effectInput, | 98 const DictionarySequenceOrDictionary& effectInput, |
| 97 ExceptionState& exceptionState) { | 99 ExceptionState& exceptionState) { |
| 98 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); | 100 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| 99 if (element) | 101 if (element) { |
| 100 UseCounter::count( | 102 UseCounter::count( |
| 101 element->document(), | 103 element->document(), |
| 102 UseCounter::AnimationConstructorKeyframeListEffectNoTiming); | 104 UseCounter::AnimationConstructorKeyframeListEffectNoTiming); |
| 105 } |
| 103 return create(element, EffectInput::convert(element, effectInput, | 106 return create(element, EffectInput::convert(element, effectInput, |
| 104 executionContext, exceptionState), | 107 executionContext, exceptionState), |
| 105 Timing()); | 108 Timing()); |
| 106 } | 109 } |
| 107 | 110 |
| 108 KeyframeEffect::KeyframeEffect(Element* target, | 111 KeyframeEffect::KeyframeEffect(Element* target, |
| 109 EffectModel* model, | 112 EffectModel* model, |
| 110 const Timing& timing, | 113 const Timing& timing, |
| 111 KeyframeEffectReadOnly::Priority priority, | 114 KeyframeEffectReadOnly::Priority priority, |
| 112 EventDelegate* eventDelegate) | 115 EventDelegate* eventDelegate) |
| 113 : KeyframeEffectReadOnly(target, model, timing, priority, eventDelegate) {} | 116 : KeyframeEffectReadOnly(target, model, timing, priority, eventDelegate) {} |
| 114 | 117 |
| 115 KeyframeEffect::~KeyframeEffect() {} | 118 KeyframeEffect::~KeyframeEffect() {} |
| 116 | 119 |
| 117 AnimationEffectTiming* KeyframeEffect::timing() { | 120 AnimationEffectTiming* KeyframeEffect::timing() { |
| 118 return AnimationEffectTiming::create(this); | 121 return AnimationEffectTiming::create(this); |
| 119 } | 122 } |
| 120 | 123 |
| 121 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |