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

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

Issue 1906463002: Web Animations: Throw TypeErrors for invalid timing parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 7 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 /* 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
51 KeyframeEffect* KeyframeEffect::create(Element* target, EffectModel* model, cons t Timing& timing, Priority priority, EventDelegate* eventDelegate) 51 KeyframeEffect* KeyframeEffect::create(Element* target, EffectModel* model, cons t Timing& timing, Priority priority, EventDelegate* eventDelegate)
52 { 52 {
53 return new KeyframeEffect(target, model, timing, priority, eventDelegate); 53 return new KeyframeEffect(target, model, timing, priority, eventDelegate);
54 } 54 }
55 55
56 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, dou ble duration, ExceptionState& exceptionState) 56 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, dou ble duration, ExceptionState& exceptionState)
57 { 57 {
58 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 58 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
59 if (element) 59 if (element)
60 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming); 60 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming);
61 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), TimingInput::convert(duration)); 61 Timing timing;
62 if (!TimingInput::convert(duration, timing, exceptionState))
63 return nullptr;
64 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), timing);
62 } 65 }
63 66
64 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, con st KeyframeEffectOptions& timingInput, ExceptionState& exceptionState) 67 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, con st KeyframeEffectOptions& timingInput, ExceptionState& exceptionState)
65 { 68 {
66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 69 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
67 if (element) 70 if (element)
68 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming); 71 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectObjectTiming);
69 Timing timing; 72 Timing timing;
70 bool success = TimingInput::convert(timingInput, timing, &element->document( ), exceptionState); 73 if (!TimingInput::convert(timingInput, timing, &element->document(), excepti onState))
71 if (!success || exceptionState.hadException())
72 return nullptr; 74 return nullptr;
73
74 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), timing); 75 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), timing);
75 } 76 }
76 77
77 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, Exc eptionState& exceptionState) 78 KeyframeEffect* KeyframeEffect::create(ExecutionContext* executionContext, Eleme nt* element, const EffectModelOrDictionarySequenceOrDictionary& effectInput, Exc eptionState& exceptionState)
78 { 79 {
79 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 80 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
80 if (element) 81 if (element)
81 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectNoTiming); 82 UseCounter::count(element->document(), UseCounter::AnimationConstructorK eyframeListEffectNoTiming);
82 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), Timing()); 83 return create(element, EffectInput::convert(element, effectInput, executionC ontext, exceptionState), Timing());
83 } 84 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 369
369 DEFINE_TRACE(KeyframeEffect) 370 DEFINE_TRACE(KeyframeEffect)
370 { 371 {
371 visitor->trace(m_target); 372 visitor->trace(m_target);
372 visitor->trace(m_model); 373 visitor->trace(m_model);
373 visitor->trace(m_sampledEffect); 374 visitor->trace(m_sampledEffect);
374 AnimationEffect::trace(visitor); 375 AnimationEffect::trace(visitor);
375 } 376 }
376 377
377 } // namespace blink 378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698