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

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

Issue 1248483005: Add use counter for stacked neutral keyframe in CSS Animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 4 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
59 #include "wtf/BitArray.h" 59 #include "wtf/BitArray.h"
60 #include "wtf/HashSet.h" 60 #include "wtf/HashSet.h"
61 61
62 namespace blink { 62 namespace blink {
63 63
64 using PropertySet = HashSet<CSSPropertyID>; 64 using PropertySet = HashSet<CSSPropertyID>;
65 65
66 namespace { 66 namespace {
67 67
68 static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffectMod el(StyleResolver* resolver, const Element* animatingElement, Element& element, c onst ComputedStyle* style, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction) 68 static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffectMod el(StyleResolver* resolver, const Element* animatingElement, Element& element, c onst ComputedStyle* style, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, size_t animationIndex)
69 { 69 {
70 // When the animating element is null, use its parent for scoping purposes. 70 // When the animating element is null, use its parent for scoping purposes.
71 const Element* elementForScoping = animatingElement ? animatingElement : &el ement; 71 const Element* elementForScoping = animatingElement ? animatingElement : &el ement;
72 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name); 72 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen tForScoping, name);
73 ASSERT(keyframesRule); 73 ASSERT(keyframesRule);
74 74
75 StringKeyframeVector keyframes; 75 StringKeyframeVector keyframes;
76 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes(); 76 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe s = keyframesRule->keyframes();
77 77
78 // Construct and populate the style for each keyframe 78 // Construct and populate the style for each keyframe
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(PropertyHandle(property)); 166 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont ains(PropertyHandle(property));
167 if (!startNeedsValue && !endNeedsValue) 167 if (!startNeedsValue && !endNeedsValue)
168 continue; 168 continue;
169 if (CompositorAnimations::isCompositableProperty(property)) 169 if (CompositorAnimations::isCompositableProperty(property))
170 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation); 170 UseCounter::count(elementForScoping->document(), UseCounter::Syn theticKeyframesInCompositedCSSAnimation);
171 } 171 }
172 } 172 }
173 173
174 RefPtrWillBeRawPtr<StringKeyframeEffectModel> model = StringKeyframeEffectMo del::create(keyframes, &keyframes[0]->easing()); 174 RefPtrWillBeRawPtr<StringKeyframeEffectModel> model = StringKeyframeEffectMo del::create(keyframes, &keyframes[0]->easing());
175 model->forceConversionsToAnimatableValues(element, style); 175 model->forceConversionsToAnimatableValues(element, style);
176 if (animationIndex > 0 && model->hasSyntheticKeyframes())
177 UseCounter::count(elementForScoping->document(), UseCounter::CSSAnimatio nsStackedNeutralKeyframe);
176 return model; 178 return model;
177 } 179 }
178 180
179 } // namespace 181 } // namespace
180 182
181 CSSAnimations::CSSAnimations() 183 CSSAnimations::CSSAnimations()
182 { 184 {
183 } 185 }
184 186
185 bool CSSAnimations::isAnimationForInspector(const Animation& animation) 187 bool CSSAnimations::isAnimationForInspector(const Animation& animation)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName)); 256 AnimationMap::const_iterator existing(cssAnimations->m_animation s.find(animationName));
255 if (existing != cssAnimations->m_animations.end()) { 257 if (existing != cssAnimations->m_animations.end()) {
256 inactive.remove(animationName); 258 inactive.remove(animationName);
257 259
258 const RunningAnimation* runningAnimation = existing->value.g et(); 260 const RunningAnimation* runningAnimation = existing->value.g et();
259 Animation* animation = runningAnimation->animation.get(); 261 Animation* animation = runningAnimation->animation.get();
260 262
261 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) { 263 if (keyframesRule != runningAnimation->styleRule || keyframe sRule->version() != runningAnimation->styleRuleVersion || runningAnimation->spec ifiedTiming != specifiedTiming) {
262 ASSERT(!isAnimationStyleChange); 264 ASSERT(!isAnimationStyleChange);
263 update->updateAnimation(animationName, animation, InertE ffect::create( 265 update->updateAnimation(animationName, animation, InertE ffect::create(
264 createKeyframeEffectModel(resolver, animatingElement , element, &style, parentStyle, animationName, keyframeTimingFunction.get()), 266 createKeyframeEffectModel(resolver, animatingElement , element, &style, parentStyle, animationName, keyframeTimingFunction.get(), i),
265 timing, isPaused, animation->unlimitedCurrentTimeInt ernal()), specifiedTiming, keyframesRule); 267 timing, isPaused, animation->unlimitedCurrentTimeInt ernal()), specifiedTiming, keyframesRule);
266 } else if (!isAnimationStyleChange && animation->effect() && animation->effect()->isAnimation()) { 268 } else if (!isAnimationStyleChange && animation->effect() && animation->effect()->isAnimation()) {
267 EffectModel* model = toKeyframeEffect(animation->effect( ))->model(); 269 EffectModel* model = toKeyframeEffect(animation->effect( ))->model();
268 if (model && model->isKeyframeEffectModel()) { 270 if (model && model->isKeyframeEffectModel()) {
269 KeyframeEffectModelBase* keyframeEffect = toKeyframe EffectModelBase(model); 271 KeyframeEffectModelBase* keyframeEffect = toKeyframe EffectModelBase(model);
270 if (keyframeEffect->hasSyntheticKeyframes()) 272 if (keyframeEffect->hasSyntheticKeyframes())
271 update->updateAnimationStyle(animation, keyframe Effect, animatingElement->layoutObject(), style); 273 update->updateAnimationStyle(animation, keyframe Effect, animatingElement->layoutObject(), style);
272 } 274 }
273 } 275 }
274 276
275 if (isPaused != animation->paused()) { 277 if (isPaused != animation->paused()) {
276 ASSERT(!isAnimationStyleChange); 278 ASSERT(!isAnimationStyleChange);
277 update->toggleAnimationPaused(animationName); 279 update->toggleAnimationPaused(animationName);
278 } 280 }
279 281
280 continue; 282 continue;
281 } 283 }
282 } 284 }
283 285
284 ASSERT(!isAnimationStyleChange); 286 ASSERT(!isAnimationStyleChange);
285 update->startAnimation(animationName, InertEffect::create( 287 update->startAnimation(animationName, InertEffect::create(
286 createKeyframeEffectModel(resolver, animatingElement, element, & style, parentStyle, animationName, keyframeTimingFunction.get()), 288 createKeyframeEffectModel(resolver, animatingElement, element, & style, parentStyle, animationName, keyframeTimingFunction.get(), i),
287 timing, isPaused, 0), specifiedTiming, keyframesRule); 289 timing, isPaused, 0), specifiedTiming, keyframesRule);
288 } 290 }
289 } 291 }
290 292
291 ASSERT(inactive.isEmpty() || cssAnimations); 293 ASSERT(inactive.isEmpty() || cssAnimations);
292 for (const AtomicString& animationName : inactive) { 294 for (const AtomicString& animationName : inactive) {
293 ASSERT(!isAnimationStyleChange); 295 ASSERT(!isAnimationStyleChange);
294 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->animation); 296 update->cancelAnimation(animationName, *cssAnimations->m_animations.get( animationName)->animation);
295 } 297 }
296 } 298 }
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 visitor->trace(m_activeInterpolationsForAnimations); 807 visitor->trace(m_activeInterpolationsForAnimations);
806 visitor->trace(m_activeInterpolationsForTransitions); 808 visitor->trace(m_activeInterpolationsForTransitions);
807 visitor->trace(m_newAnimations); 809 visitor->trace(m_newAnimations);
808 visitor->trace(m_suppressedAnimations); 810 visitor->trace(m_suppressedAnimations);
809 visitor->trace(m_animationsWithUpdates); 811 visitor->trace(m_animationsWithUpdates);
810 visitor->trace(m_animationsWithStyleUpdates); 812 visitor->trace(m_animationsWithStyleUpdates);
811 #endif 813 #endif
812 } 814 }
813 815
814 } // namespace blink 816 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/animations/use-count-stacked-neutral-keyframe.html ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698