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

Side by Side Diff: Source/core/animation/KeyframeEffect.cpp

Issue 1196913005: Implement animations for Independent CSS Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix rotate-interpolation test Created 5 years, 5 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return element->ensureElementAnimations().defaultStack(); 129 return element->ensureElementAnimations().defaultStack();
130 } 130 }
131 131
132 void KeyframeEffect::applyEffects() 132 void KeyframeEffect::applyEffects()
133 { 133 {
134 ASSERT(isInEffect()); 134 ASSERT(isInEffect());
135 ASSERT(animation()); 135 ASSERT(animation());
136 if (!m_target || !m_model) 136 if (!m_target || !m_model)
137 return; 137 return;
138 138
139 // Cancel composited animation of transform if a motion path has been introd uced on the element. 139 // Cancel composited animation of transform if a motion path, translate,
140 // rotate or scale operation has been introduced on the element.
140 if (m_target->computedStyle() 141 if (m_target->computedStyle()
141 && m_target->computedStyle()->hasMotionPath() 142 && (m_target->computedStyle()->hasMotionPath()
143 || m_target->computedStyle()->translate()
144 || m_target->computedStyle()->rotate()
145 || m_target->computedStyle()->scale())
142 && animation()->hasActiveAnimationsOnCompositor() 146 && animation()->hasActiveAnimationsOnCompositor()
143 && animation()->affects(*m_target, CSSPropertyTransform)) { 147 && animation()->affects(*m_target, CSSPropertyTransform)) {
144 animation()->cancelAnimationOnCompositor(); 148 animation()->cancelAnimationOnCompositor();
145 } 149 }
146 150
147 double iteration = currentIteration(); 151 double iteration = currentIteration();
148 ASSERT(iteration >= 0); 152 ASSERT(iteration >= 0);
149 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r; 153 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r;
150 // FIXME: Handle iteration values which overflow int. 154 // FIXME: Handle iteration values which overflow int.
151 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati on(), interpolations); 155 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati on(), interpolations);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 m_sampledEffect = nullptr; 239 m_sampledEffect = nullptr;
236 if (sampledEffect) 240 if (sampledEffect)
237 sampledEffect->clear(); 241 sampledEffect->clear();
238 } 242 }
239 #endif 243 #endif
240 244
241 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac kRate) const 245 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac kRate) const
242 { 246 {
243 if (!model() 247 if (!model()
244 || !m_target 248 || !m_target
245 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat h())) 249 || (m_target->computedStyle() && (m_target->computedStyle()->hasMotionPa th() || m_target->computedStyle()->translate() || m_target->computedStyle()->rot ate() || m_target->computedStyle()->scale())))
246 return false; 250 return false;
247 251
248 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate); 252 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate);
249 } 253 }
250 254
251 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime , double currentTime, double animationPlaybackRate) 255 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime , double currentTime, double animationPlaybackRate)
252 { 256 {
253 ASSERT(!hasActiveAnimationsOnCompositor()); 257 ASSERT(!hasActiveAnimationsOnCompositor());
254 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate)) 258 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate))
255 return false; 259 return false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 336
333 DEFINE_TRACE(KeyframeEffect) 337 DEFINE_TRACE(KeyframeEffect)
334 { 338 {
335 visitor->trace(m_target); 339 visitor->trace(m_target);
336 visitor->trace(m_model); 340 visitor->trace(m_model);
337 visitor->trace(m_sampledEffect); 341 visitor->trace(m_sampledEffect);
338 AnimationEffect::trace(visitor); 342 AnimationEffect::trace(visitor);
339 } 343 }
340 344
341 } // namespace blink 345 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/DoubleStyleInterpolation.cpp ('k') | Source/core/animation/StringKeyframe.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698