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

Side by Side Diff: third_party/WebKit/Source/core/animation/ElementAnimation.h

Issue 2757543002: Ensure baseComputedStyle optimisation is cleared during registered custom property animations (Closed)
Patch Set: Rebased Created 3 years, 9 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 EffectModel* effect = EffectInput::convert( 59 EffectModel* effect = EffectInput::convert(
60 &element, effectInput, scriptState->getExecutionContext(), 60 &element, effectInput, scriptState->getExecutionContext(),
61 exceptionState); 61 exceptionState);
62 if (exceptionState.hadException()) 62 if (exceptionState.hadException())
63 return nullptr; 63 return nullptr;
64 64
65 Timing timing; 65 Timing timing;
66 if (!TimingInput::convert(duration, timing, exceptionState)) 66 if (!TimingInput::convert(duration, timing, exceptionState))
67 return nullptr; 67 return nullptr;
68 68
69 return animateInternal(element, effect, timing); 69 return animate(element, effect, timing);
70 } 70 }
71 71
72 static Animation* animate(ScriptState* scriptState, 72 static Animation* animate(ScriptState* scriptState,
73 Element& element, 73 Element& element,
74 const DictionarySequenceOrDictionary& effectInput, 74 const DictionarySequenceOrDictionary& effectInput,
75 const KeyframeEffectOptions& options, 75 const KeyframeEffectOptions& options,
76 ExceptionState& exceptionState) { 76 ExceptionState& exceptionState) {
77 EffectModel* effect = EffectInput::convert( 77 EffectModel* effect = EffectInput::convert(
78 &element, effectInput, scriptState->getExecutionContext(), 78 &element, effectInput, scriptState->getExecutionContext(),
79 exceptionState); 79 exceptionState);
80 if (exceptionState.hadException()) 80 if (exceptionState.hadException())
81 return nullptr; 81 return nullptr;
82 82
83 Timing timing; 83 Timing timing;
84 if (!TimingInput::convert(options, timing, &element.document(), 84 if (!TimingInput::convert(options, timing, &element.document(),
85 exceptionState)) 85 exceptionState))
86 return nullptr; 86 return nullptr;
87 87
88 Animation* animation = animateInternal(element, effect, timing); 88 Animation* animation = animate(element, effect, timing);
89 animation->setId(options.id()); 89 animation->setId(options.id());
90 return animation; 90 return animation;
91 } 91 }
92 92
93 static Animation* animate(ScriptState* scriptState, 93 static Animation* animate(ScriptState* scriptState,
94 Element& element, 94 Element& element,
95 const DictionarySequenceOrDictionary& effectInput, 95 const DictionarySequenceOrDictionary& effectInput,
96 ExceptionState& exceptionState) { 96 ExceptionState& exceptionState) {
97 EffectModel* effect = EffectInput::convert( 97 EffectModel* effect = EffectInput::convert(
98 &element, effectInput, scriptState->getExecutionContext(), 98 &element, effectInput, scriptState->getExecutionContext(),
99 exceptionState); 99 exceptionState);
100 if (exceptionState.hadException()) 100 if (exceptionState.hadException())
101 return nullptr; 101 return nullptr;
102 return animateInternal(element, effect, Timing()); 102 return animate(element, effect, Timing());
103 }
104
105 static Animation* animate(Element& element,
106 EffectModel* effect,
107 const Timing& timing) {
108 KeyframeEffect* keyframeEffect =
109 KeyframeEffect::create(&element, effect, timing);
110 return element.document().timeline().play(keyframeEffect);
103 } 111 }
104 112
105 static HeapVector<Member<Animation>> getAnimations(Element& element) { 113 static HeapVector<Member<Animation>> getAnimations(Element& element) {
106 HeapVector<Member<Animation>> animations; 114 HeapVector<Member<Animation>> animations;
107 115
108 if (!element.hasAnimations()) 116 if (!element.hasAnimations())
109 return animations; 117 return animations;
110 118
111 for (const auto& animation : 119 for (const auto& animation :
112 element.document().timeline().getAnimations()) { 120 element.document().timeline().getAnimations()) {
113 DCHECK(animation->effect()); 121 DCHECK(animation->effect());
114 if (toKeyframeEffectReadOnly(animation->effect())->target() == element && 122 if (toKeyframeEffectReadOnly(animation->effect())->target() == element &&
115 (animation->effect()->isCurrent() || 123 (animation->effect()->isCurrent() ||
116 animation->effect()->isInEffect())) 124 animation->effect()->isInEffect()))
117 animations.push_back(animation); 125 animations.push_back(animation);
118 } 126 }
119 return animations; 127 return animations;
120 } 128 }
121
122 private:
123 static Animation* animateInternal(Element& element,
124 EffectModel* effect,
125 const Timing& timing) {
126 KeyframeEffect* keyframeEffect =
127 KeyframeEffect::create(&element, effect, timing);
128 return element.document().timeline().play(keyframeEffect);
129 }
130 }; 129 };
131 130
132 } // namespace blink 131 } // namespace blink
133 132
134 #endif // ElementAnimation_h 133 #endif // ElementAnimation_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/AnimationClock.cpp ('k') | third_party/WebKit/Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698