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

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

Issue 2039133002: Include Web Animations when updating composited neutral keyframes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ref Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/responsive-neutral-keyframe-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (!elementAnimations || elementAnimations->isAnimationStyleChange()) 226 if (!elementAnimations || elementAnimations->isAnimationStyleChange())
227 return; 227 return;
228 228
229 if (!animatingElement->layoutObject() || !animatingElement->layoutObject()-> style()) 229 if (!animatingElement->layoutObject() || !animatingElement->layoutObject()-> style())
230 return; 230 return;
231 231
232 const ComputedStyle& oldStyle = *animatingElement->layoutObject()->style(); 232 const ComputedStyle& oldStyle = *animatingElement->layoutObject()->style();
233 if (!oldStyle.shouldCompositeForCurrentAnimations()) 233 if (!oldStyle.shouldCompositeForCurrentAnimations())
234 return; 234 return;
235 235
236 CSSAnimations& cssAnimations = elementAnimations->cssAnimations(); 236 bool transformZoomChanged = oldStyle.hasCurrentTransformAnimation() && oldSt yle.effectiveZoom() != style.effectiveZoom();
237 for (auto& runningAnimation : cssAnimations.m_runningAnimations) { 237 for (auto& entry : elementAnimations->animations()) {
238 Animation& animation = *runningAnimation->animation; 238 Animation& animation = *entry.key;
239 if (animation.effect() && animation.effect()->isKeyframeEffect()) { 239 if (!animation.effect() || !animation.effect()->isKeyframeEffect())
240 EffectModel* model = toKeyframeEffect(animation.effect())->model(); 240 continue;
241 if (model && model->isKeyframeEffectModel()) { 241 EffectModel* model = toKeyframeEffect(animation.effect())->model();
242 KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectModelB ase(model); 242 if (!model || !model->isKeyframeEffectModel())
243 if (keyframeEffect->hasSyntheticKeyframes() && keyframeEffect->s napshotNeutralCompositorKeyframes(element, oldStyle, style)) 243 continue;
244 update.updateCompositorKeyframes(&animation); 244 KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(*mod el);
245 } 245
246 bool updateCompositorKeyframes = false;
247 if (transformZoomChanged && keyframeEffect.affects(PropertyHandle(CSSPro pertyTransform))
248 && keyframeEffect.snapshotAllCompositorKeyframes(element, &style)) {
249 updateCompositorKeyframes = true;
250 } else if (keyframeEffect.hasSyntheticKeyframes()
251 && keyframeEffect.snapshotNeutralCompositorKeyframes(element, oldSty le, style)) {
252 updateCompositorKeyframes = true;
246 } 253 }
247 }
248 254
249 if (oldStyle.hasCurrentTransformAnimation() && oldStyle.effectiveZoom() != s tyle.effectiveZoom()) { 255 if (updateCompositorKeyframes)
250 for (auto& entry : elementAnimations->animations()) { 256 update.updateCompositorKeyframes(&animation);
251 Animation& animation = *entry.key;
252 if (animation.effect() && animation.effect()->isKeyframeEffect()) {
253 EffectModel* model = toKeyframeEffect(animation.effect())->model ();
254 if (model && model->isKeyframeEffectModel()) {
255 KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectMo delBase(model);
256 if (keyframeEffect->affects(PropertyHandle(CSSPropertyTransf orm)) && keyframeEffect->snapshotAllCompositorKeyframes(element, &style))
257 update.updateCompositorKeyframes(&animation);
258 }
259 }
260 }
261 } 257 }
262 } 258 }
263 259
264 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate& update, const E lement* animatingElement, Element& element, const ComputedStyle& style, Computed Style* parentStyle, StyleResolver* resolver) 260 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate& update, const E lement* animatingElement, Element& element, const ComputedStyle& style, Computed Style* parentStyle, StyleResolver* resolver)
265 { 261 {
266 const ElementAnimations* elementAnimations = animatingElement ? animatingEle ment->elementAnimations() : nullptr; 262 const ElementAnimations* elementAnimations = animatingElement ? animatingEle ment->elementAnimations() : nullptr;
267 263
268 bool isAnimationStyleChange = elementAnimations && elementAnimations->isAnim ationStyleChange(); 264 bool isAnimationStyleChange = elementAnimations && elementAnimations->isAnim ationStyleChange();
269 265
270 #if !ENABLE(ASSERT) 266 #if !ENABLE(ASSERT)
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 } 864 }
869 865
870 DEFINE_TRACE(CSSAnimations) 866 DEFINE_TRACE(CSSAnimations)
871 { 867 {
872 visitor->trace(m_transitions); 868 visitor->trace(m_transitions);
873 visitor->trace(m_pendingUpdate); 869 visitor->trace(m_pendingUpdate);
874 visitor->trace(m_runningAnimations); 870 visitor->trace(m_runningAnimations);
875 } 871 }
876 872
877 } // namespace blink 873 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/animations/responsive-neutral-keyframe-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698