OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |