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

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

Issue 1347493004: Recomposite transform animations when CSS zoom changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix tests Created 5 years, 3 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
« no previous file with comments | « LayoutTests/virtual/threaded/animations/zoom-responsive-transform-animation-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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr; 221 ElementAnimations* elementAnimations = animatingElement ? animatingElement-> elementAnimations() : nullptr;
222 222
223 // We only update compositor animations in response to changes in the base s tyle. 223 // We only update compositor animations in response to changes in the base s tyle.
224 if (!elementAnimations || elementAnimations->isAnimationStyleChange()) 224 if (!elementAnimations || elementAnimations->isAnimationStyleChange())
225 return; 225 return;
226 226
227 if (!animatingElement->layoutObject() || !animatingElement->layoutObject()-> style()) 227 if (!animatingElement->layoutObject() || !animatingElement->layoutObject()-> style())
228 return; 228 return;
229 229
230 const ComputedStyle& oldStyle = *animatingElement->layoutObject()->style(); 230 const ComputedStyle& oldStyle = *animatingElement->layoutObject()->style();
231 if (!oldStyle.shouldCompositeForCurrentAnimations())
232 return;
231 233
232 CSSAnimations& cssAnimations = elementAnimations->cssAnimations(); 234 CSSAnimations& cssAnimations = elementAnimations->cssAnimations();
233 for (auto& runningAnimation : cssAnimations.m_animations.values()) { 235 for (auto& runningAnimation : cssAnimations.m_animations.values()) {
234 Animation& animation = *runningAnimation->animation; 236 Animation& animation = *runningAnimation->animation;
235 if (animation.effect() && animation.effect()->isKeyframeEffect()) { 237 if (animation.effect() && animation.effect()->isKeyframeEffect()) {
236 EffectModel* model = toKeyframeEffect(animation.effect())->model(); 238 EffectModel* model = toKeyframeEffect(animation.effect())->model();
237 if (model && model->isKeyframeEffectModel()) { 239 if (model && model->isKeyframeEffectModel()) {
238 KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectModelB ase(model); 240 KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectModelB ase(model);
239 if (keyframeEffect->hasSyntheticKeyframes() && keyframeEffect->s napshotNeutralCompositorKeyframes(element, oldStyle, style)) 241 if (keyframeEffect->hasSyntheticKeyframes() && keyframeEffect->s napshotNeutralCompositorKeyframes(element, oldStyle, style))
240 update.updateCompositorKeyframes(&animation); 242 update.updateCompositorKeyframes(&animation);
241 } 243 }
242 } 244 }
243 } 245 }
246
247 if (oldStyle.hasCurrentTransformAnimation() && oldStyle.effectiveZoom() != s tyle.effectiveZoom()) {
248 for (auto& entry : elementAnimations->animations()) {
249 Animation& animation = *entry.key;
250 if (animation.effect() && animation.effect()->isKeyframeEffect()) {
251 EffectModel* model = toKeyframeEffect(animation.effect())->model ();
252 if (model && model->isKeyframeEffectModel()) {
253 KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectMo delBase(model);
254 if (keyframeEffect->affects(PropertyHandle(CSSPropertyTransf orm)) && keyframeEffect->snapshotAllCompositorKeyframes(element, &style))
255 update.updateCompositorKeyframes(&animation);
256 }
257 }
258 }
259 }
244 } 260 }
245 261
246 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate& update, const E lement* animatingElement, Element& element, const ComputedStyle& style, Computed Style* parentStyle, StyleResolver* resolver) 262 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate& update, const E lement* animatingElement, Element& element, const ComputedStyle& style, Computed Style* parentStyle, StyleResolver* resolver)
247 { 263 {
248 const ElementAnimations* elementAnimations = animatingElement ? animatingEle ment->elementAnimations() : nullptr; 264 const ElementAnimations* elementAnimations = animatingElement ? animatingEle ment->elementAnimations() : nullptr;
249 265
250 bool isAnimationStyleChange = elementAnimations && elementAnimations->isAnim ationStyleChange(); 266 bool isAnimationStyleChange = elementAnimations && elementAnimations->isAnim ationStyleChange();
251 267
252 #if !ENABLE(ASSERT) 268 #if !ENABLE(ASSERT)
253 // If we're in an animation style change, no animations can have started, be en cancelled or changed play state. 269 // If we're in an animation style change, no animations can have started, be en cancelled or changed play state.
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 } 812 }
797 813
798 DEFINE_TRACE(CSSAnimations) 814 DEFINE_TRACE(CSSAnimations)
799 { 815 {
800 visitor->trace(m_transitions); 816 visitor->trace(m_transitions);
801 visitor->trace(m_pendingUpdate); 817 visitor->trace(m_pendingUpdate);
802 visitor->trace(m_animations); 818 visitor->trace(m_animations);
803 } 819 }
804 820
805 } // namespace blink 821 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/virtual/threaded/animations/zoom-responsive-transform-animation-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698