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

Side by Side Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 23875044: Web Animations: Correctly handle incomplete keyframes in CSS animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName)); 172 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName));
173 if (existing != cssAnimations->m_animations.end()) { 173 if (existing != cssAnimations->m_animations.end()) {
174 // FIXME: The play-state of this animation might have change d, record the change in the update. 174 // FIXME: The play-state of this animation might have change d, record the change in the update.
175 inactive.remove(animationName); 175 inactive.remove(animationName);
176 continue; 176 continue;
177 } 177 }
178 } 178 }
179 179
180 Timing timing; 180 Timing timing;
181 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa ta(animationData, timing); 181 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa ta(animationData, timing);
182 KeyframeAnimationEffect::KeyframeVector keyframes; 182 Vector<std::pair<KeyframeAnimationEffect::KeyframeVector, RefPtr<Tim ingFunction> > > keyframesAndTimingFunctions;
183 resolver->resolveKeyframes(element, style, animationName, defaultTim ingFunction.get(), keyframes, timing.timingFunction); 183 resolver->resolveKeyframes(element, style, animationName, defaultTim ingFunction.get(), keyframesAndTimingFunctions);
184 if (!keyframes.isEmpty()) { 184 if (!keyframesAndTimingFunctions.isEmpty()) {
185 if (!update) 185 if (!update)
186 update = adoptPtr(new CSSAnimationUpdate()); 186 update = adoptPtr(new CSSAnimationUpdate());
187 HashSet<RefPtr<InertAnimation> > animations; 187 HashSet<RefPtr<InertAnimation> > animations;
188 // FIXME: crbug.com/268791 - Keyframes are already normalized, p erhaps there should be a flag on KeyframeAnimationEffect to skip normalization. 188 for (size_t j = 0; j < keyframesAndTimingFunctions.size(); ++j) {
189 animations.add(InertAnimation::create(KeyframeAnimationEffect::c reate(keyframes), timing)); 189 ASSERT(!keyframesAndTimingFunctions[j].first.isEmpty());
190 timing.timingFunction = keyframesAndTimingFunctions[j].secon d;
191 // FIXME: crbug.com/268791 - Keyframes are already normalize d, perhaps there should be a flag on KeyframeAnimationEffect to skip normalizati on.
192 animations.add(InertAnimation::create(KeyframeAnimationEffec t::create(keyframesAndTimingFunctions[j].first), timing));
193 }
190 update->startAnimation(animationName, animations); 194 update->startAnimation(animationName, animations);
191 } 195 }
192 } 196 }
193 } 197 }
194 198
195 if (!inactive.isEmpty() && !update) 199 if (!inactive.isEmpty() && !update)
196 update = adoptPtr(new CSSAnimationUpdate()); 200 update = adoptPtr(new CSSAnimationUpdate());
197 for (HashSet<AtomicString>::const_iterator iter = inactive.begin(); iter != inactive.end(); ++iter) 201 for (HashSet<AtomicString>::const_iterator iter = inactive.begin(); iter != inactive.end(); ++iter)
198 update->cancelAnimation(*iter, cssAnimations->m_animations.get(*iter)); 202 update->cancelAnimation(*iter, cssAnimations->m_animations.get(*iter));
199 203
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 case CSSPropertyWordSpacing: 390 case CSSPropertyWordSpacing:
387 case CSSPropertyZIndex: 391 case CSSPropertyZIndex:
388 case CSSPropertyZoom: 392 case CSSPropertyZoom:
389 return true; 393 return true;
390 default: 394 default:
391 return false; 395 return false;
392 } 396 }
393 } 397 }
394 398
395 } // namespace WebCore 399 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698