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

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

Issue 2814523002: Web Animations: Coalesce constructors where possible. (Closed)
Patch Set: Rebase Created 3 years, 8 months 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 "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h"
9 #include "core/animation/Animation.h" 10 #include "core/animation/Animation.h"
10 #include "core/animation/CompositorAnimations.h" 11 #include "core/animation/CompositorAnimations.h"
11 #include "core/animation/EffectInput.h" 12 #include "core/animation/EffectInput.h"
12 #include "core/animation/ElementAnimations.h" 13 #include "core/animation/ElementAnimations.h"
13 #include "core/animation/Interpolation.h" 14 #include "core/animation/Interpolation.h"
14 #include "core/animation/KeyframeEffect.h" 15 #include "core/animation/KeyframeEffect.h"
15 #include "core/animation/KeyframeEffectOptions.h" 16 #include "core/animation/KeyframeEffectOptions.h"
16 #include "core/animation/PropertyHandle.h" 17 #include "core/animation/PropertyHandle.h"
17 #include "core/animation/SampledEffect.h" 18 #include "core/animation/SampledEffect.h"
18 #include "core/animation/TimingInput.h" 19 #include "core/animation/TimingInput.h"
(...skipping 12 matching lines...) Expand all
31 Priority priority, 32 Priority priority,
32 EventDelegate* event_delegate) { 33 EventDelegate* event_delegate) {
33 return new KeyframeEffectReadOnly(target, model, timing, priority, 34 return new KeyframeEffectReadOnly(target, model, timing, priority,
34 event_delegate); 35 event_delegate);
35 } 36 }
36 37
37 KeyframeEffectReadOnly* KeyframeEffectReadOnly::Create( 38 KeyframeEffectReadOnly* KeyframeEffectReadOnly::Create(
38 ExecutionContext* execution_context, 39 ExecutionContext* execution_context,
39 Element* element, 40 Element* element,
40 const DictionarySequenceOrDictionary& effect_input, 41 const DictionarySequenceOrDictionary& effect_input,
41 double duration, 42 const UnrestrictedDoubleOrKeyframeEffectOptions& options,
42 ExceptionState& exception_state) { 43 ExceptionState& exception_state) {
43 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 44 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
44 if (element) { 45 if (element) {
45 UseCounter::Count(
46 element->GetDocument(),
47 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming);
48 }
49 Timing timing;
50 if (!TimingInput::Convert(duration, timing, exception_state))
51 return nullptr;
52 return Create(element,
53 EffectInput::Convert(element, effect_input, execution_context,
54 exception_state),
55 timing);
56 }
57
58 KeyframeEffectReadOnly* KeyframeEffectReadOnly::Create(
59 ExecutionContext* execution_context,
60 Element* element,
61 const DictionarySequenceOrDictionary& effect_input,
62 const KeyframeEffectOptions& timing_input,
63 ExceptionState& exception_state) {
64 DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
65 if (element) {
66 UseCounter::Count( 46 UseCounter::Count(
67 element->GetDocument(), 47 element->GetDocument(),
68 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming); 48 UseCounter::kAnimationConstructorKeyframeListEffectObjectTiming);
69 } 49 }
70 Timing timing; 50 Timing timing;
71 Document* document = element ? &element->GetDocument() : nullptr; 51 Document* document = element ? &element->GetDocument() : nullptr;
72 if (!TimingInput::Convert(timing_input, timing, document, exception_state)) 52 if (!TimingInput::Convert(options, timing, document, exception_state))
73 return nullptr; 53 return nullptr;
74 return Create(element, 54 return Create(element,
75 EffectInput::Convert(element, effect_input, execution_context, 55 EffectInput::Convert(element, effect_input, execution_context,
76 exception_state), 56 exception_state),
77 timing); 57 timing);
78 } 58 }
79 59
80 KeyframeEffectReadOnly* KeyframeEffectReadOnly::Create( 60 KeyframeEffectReadOnly* KeyframeEffectReadOnly::Create(
81 ExecutionContext* execution_context, 61 ExecutionContext* execution_context,
82 Element* element, 62 Element* element,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 356 }
377 357
378 DEFINE_TRACE(KeyframeEffectReadOnly) { 358 DEFINE_TRACE(KeyframeEffectReadOnly) {
379 visitor->Trace(target_); 359 visitor->Trace(target_);
380 visitor->Trace(model_); 360 visitor->Trace(model_);
381 visitor->Trace(sampled_effect_); 361 visitor->Trace(sampled_effect_);
382 AnimationEffectReadOnly::Trace(visitor); 362 AnimationEffectReadOnly::Trace(visitor);
383 } 363 }
384 364
385 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698