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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp
index c7b469e6f7050ebbf58e418fcb431880c41c6df2..71fc64720d0a702419ab5bca0e516b5557a823be 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffectReadOnly.cpp
@@ -24,18 +24,34 @@
namespace blink {
-// Web Animations API Bindings constructors. We never actually want to create a
-// KeyframeEffectReadOnly object, we just want to provide a read-only interface
-// to the KeyframeEffect object, so pass straight through to the subclass
-// factory methods.
+KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
+ Element* target,
+ EffectModel* model,
+ const Timing& timing,
+ Priority priority,
+ EventDelegate* eventDelegate) {
+ return new KeyframeEffectReadOnly(target, model, timing, priority,
+ eventDelegate);
+}
+
KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
ExecutionContext* executionContext,
Element* element,
const DictionarySequenceOrDictionary& effectInput,
double duration,
ExceptionState& exceptionState) {
- return KeyframeEffect::create(executionContext, element, effectInput,
- duration, exceptionState);
+ DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
+ if (element) {
+ UseCounter::count(
+ element->document(),
+ UseCounter::AnimationConstructorKeyframeListEffectObjectTiming);
+ }
+ Timing timing;
+ if (!TimingInput::convert(duration, timing, exceptionState))
+ return nullptr;
+ return create(element, EffectInput::convert(element, effectInput,
+ executionContext, exceptionState),
+ timing);
}
KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
@@ -44,8 +60,19 @@ KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
const DictionarySequenceOrDictionary& effectInput,
const KeyframeEffectOptions& timingInput,
ExceptionState& exceptionState) {
- return KeyframeEffect::create(executionContext, element, effectInput,
- timingInput, exceptionState);
+ DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
+ if (element) {
+ UseCounter::count(
+ element->document(),
+ UseCounter::AnimationConstructorKeyframeListEffectObjectTiming);
+ }
+ Timing timing;
+ Document* document = element ? &element->document() : nullptr;
+ if (!TimingInput::convert(timingInput, timing, document, exceptionState))
+ return nullptr;
+ return create(element, EffectInput::convert(element, effectInput,
+ executionContext, exceptionState),
+ timing);
}
KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
@@ -53,8 +80,15 @@ KeyframeEffectReadOnly* KeyframeEffectReadOnly::create(
Element* element,
const DictionarySequenceOrDictionary& effectInput,
ExceptionState& exceptionState) {
- return KeyframeEffect::create(executionContext, element, effectInput,
- exceptionState);
+ DCHECK(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
+ if (element) {
+ UseCounter::count(
+ element->document(),
+ UseCounter::AnimationConstructorKeyframeListEffectNoTiming);
+ }
+ return create(element, EffectInput::convert(element, effectInput,
+ executionContext, exceptionState),
+ Timing());
}
KeyframeEffectReadOnly::KeyframeEffectReadOnly(Element* target,

Powered by Google App Engine
This is Rietveld 408576698