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

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

Issue 2398373002: Construct KeyframeEffectReadOnly objects (Closed)
Patch Set: Test tweaks in response to review Created 4 years, 1 month 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/KeyframeEffectReadOnly.h" 5 #include "core/animation/KeyframeEffectReadOnly.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/animation/Animation.h" 9 #include "core/animation/Animation.h"
10 #include "core/animation/CompositorAnimations.h" 10 #include "core/animation/CompositorAnimations.h"
11 #include "core/animation/EffectInput.h" 11 #include "core/animation/EffectInput.h"
12 #include "core/animation/ElementAnimations.h" 12 #include "core/animation/ElementAnimations.h"
13 #include "core/animation/Interpolation.h" 13 #include "core/animation/Interpolation.h"
14 #include "core/animation/KeyframeEffect.h" 14 #include "core/animation/KeyframeEffect.h"
15 #include "core/animation/KeyframeEffectOptions.h" 15 #include "core/animation/KeyframeEffectOptions.h"
16 #include "core/animation/PropertyHandle.h" 16 #include "core/animation/PropertyHandle.h"
17 #include "core/animation/SampledEffect.h" 17 #include "core/animation/SampledEffect.h"
18 #include "core/animation/TimingInput.h" 18 #include "core/animation/TimingInput.h"
19 #include "core/dom/Element.h" 19 #include "core/dom/Element.h"
20 #include "core/dom/NodeComputedStyle.h" 20 #include "core/dom/NodeComputedStyle.h"
21 #include "core/frame/UseCounter.h" 21 #include "core/frame/UseCounter.h"
22 #include "core/paint/PaintLayer.h" 22 #include "core/paint/PaintLayer.h"
23 #include "core/svg/SVGElement.h" 23 #include "core/svg/SVGElement.h"
24 24
25 namespace blink { 25 namespace blink {
26 26
27 // Web Animations API Bindings constructors. We never actually want to create a 27 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
28 // KeyframeEffectReadOnly object, we just want to provide a read-only interface 28 Element* target,
29 // to the KeyframeEffect object, so pass straight through to the subclass 29 EffectModel* model,
30 // factory methods. 30 const Timing& timing,
31 Priority priority,
32 EventDelegate* eventDelegate) {
33 return new KeyframeEffectReadOnly(target, model, timing, priority,
34 eventDelegate);
35 }
36
31 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create( 37 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
32 ExecutionContext* executionContext, 38 ExecutionContext* executionContext,
33 Element* element, 39 Element* element,
34 const DictionarySequenceOrDictionary& effectInput, 40 const DictionarySequenceOrDictionary& effectInput,
35 double duration, 41 double duration,
36 ExceptionState& exceptionState) { 42 ExceptionState& exceptionState) {
37 return KeyframeEffect::create(executionContext, element, effectInput, 43 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
38 duration, exceptionState); 44 if (element) {
45 UseCounter::count(
46 element->document(),
47 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming);
48 }
49 Timing timing;
50 if (!TimingInput::convert(duration, timing, exceptionState))
51 return nullptr;
52 return create(element, EffectInput::convert(element, effectInput,
53 executionContext, exceptionState),
54 timing);
39 } 55 }
40 56
41 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create( 57 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
42 ExecutionContext* executionContext, 58 ExecutionContext* executionContext,
43 Element* element, 59 Element* element,
44 const DictionarySequenceOrDictionary& effectInput, 60 const DictionarySequenceOrDictionary& effectInput,
45 const KeyframeEffectOptions& timingInput, 61 const KeyframeEffectOptions& timingInput,
46 ExceptionState& exceptionState) { 62 ExceptionState& exceptionState) {
47 return KeyframeEffect::create(executionContext, element, effectInput, 63 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
48 timingInput, exceptionState); 64 if (element) {
65 UseCounter::count(
66 element->document(),
67 UseCounter::AnimationConstructorKeyframeListEffectObjectTiming);
68 }
69 Timing timing;
70 Document* document = element ? &element->document() : nullptr;
71 if (!TimingInput::convert(timingInput, timing, document, exceptionState))
72 return nullptr;
73 return create(element, EffectInput::convert(element, effectInput,
74 executionContext, exceptionState),
75 timing);
49 } 76 }
50 77
51 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create( 78 KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
52 ExecutionContext* executionContext, 79 ExecutionContext* executionContext,
53 Element* element, 80 Element* element,
54 const DictionarySequenceOrDictionary& effectInput, 81 const DictionarySequenceOrDictionary& effectInput,
55 ExceptionState& exceptionState) { 82 ExceptionState& exceptionState) {
56 return KeyframeEffect::create(executionContext, element, effectInput, 83 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
57 exceptionState); 84 if (element) {
85 UseCounter::count(
86 element->document(),
87 UseCounter::AnimationConstructorKeyframeListEffectNoTiming);
88 }
89 return create(element, EffectInput::convert(element, effectInput,
90 executionContext, exceptionState),
91 Timing());
58 } 92 }
59 93
60 KeyframeEffectReadOnly::KeyframeEffectReadOnly(Element* target, 94 KeyframeEffectReadOnly::KeyframeEffectReadOnly(Element* target,
61 EffectModel* model, 95 EffectModel* model,
62 const Timing& timing, 96 const Timing& timing,
63 Priority priority, 97 Priority priority,
64 EventDelegate* eventDelegate) 98 EventDelegate* eventDelegate)
65 : AnimationEffectReadOnly(timing, eventDelegate), 99 : AnimationEffectReadOnly(timing, eventDelegate),
66 m_target(target), 100 m_target(target),
67 m_model(model), 101 m_model(model),
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 370 }
337 371
338 DEFINE_TRACE(KeyframeEffectReadOnly) { 372 DEFINE_TRACE(KeyframeEffectReadOnly) {
339 visitor->trace(m_target); 373 visitor->trace(m_target);
340 visitor->trace(m_model); 374 visitor->trace(m_model);
341 visitor->trace(m_sampledEffect); 375 visitor->trace(m_sampledEffect);
342 AnimationEffectReadOnly::trace(visitor); 376 AnimationEffectReadOnly::trace(visitor);
343 } 377 }
344 378
345 } // namespace blink 379 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698