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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); | 236 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, player(), *effect(), playerPlaybackRate); |
237 } | 237 } |
238 | 238 |
239 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) | 239 bool Animation::maybeStartAnimationOnCompositor(int group, double startTime, dou
ble currentTime, double playerPlaybackRate) |
240 { | 240 { |
241 ASSERT(!hasActiveAnimationsOnCompositor()); | 241 ASSERT(!hasActiveAnimationsOnCompositor()); |
242 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) | 242 if (!isCandidateForAnimationOnCompositor(playerPlaybackRate)) |
243 return false; | 243 return false; |
244 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et)) | 244 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et)) |
245 return false; | 245 return false; |
246 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target,
group, startTime, currentTime, specifiedTiming(), player(), *effect(), m_compos
itorAnimationIds, playerPlaybackRate)) | 246 if (!CompositorAnimations::instance()->startAnimationOnCompositor(*m_target,
group, startTime, currentTime, specifiedTiming(), *player(), *effect(), m_compo
sitorAnimationIds, playerPlaybackRate)) |
247 return false; | 247 return false; |
248 ASSERT(!m_compositorAnimationIds.isEmpty()); | 248 ASSERT(!m_compositorAnimationIds.isEmpty()); |
249 return true; | 249 return true; |
250 } | 250 } |
251 | 251 |
252 bool Animation::hasActiveAnimationsOnCompositor() const | 252 bool Animation::hasActiveAnimationsOnCompositor() const |
253 { | 253 { |
254 return !m_compositorAnimationIds.isEmpty(); | 254 return !m_compositorAnimationIds.isEmpty(); |
255 } | 255 } |
256 | 256 |
(...skipping 10 matching lines...) Expand all Loading... |
267 bool Animation::cancelAnimationOnCompositor() | 267 bool Animation::cancelAnimationOnCompositor() |
268 { | 268 { |
269 // FIXME: cancelAnimationOnCompositor is called from withins style recalc. | 269 // FIXME: cancelAnimationOnCompositor is called from withins style recalc. |
270 // This queries compositingState, which is not necessarily up to date. | 270 // This queries compositingState, which is not necessarily up to date. |
271 // https://code.google.com/p/chromium/issues/detail?id=339847 | 271 // https://code.google.com/p/chromium/issues/detail?id=339847 |
272 DisableCompositingQueryAsserts disabler; | 272 DisableCompositingQueryAsserts disabler; |
273 if (!hasActiveAnimationsOnCompositor()) | 273 if (!hasActiveAnimationsOnCompositor()) |
274 return false; | 274 return false; |
275 if (!m_target || !m_target->layoutObject()) | 275 if (!m_target || !m_target->layoutObject()) |
276 return false; | 276 return false; |
| 277 ASSERT(player()); |
277 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 278 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
278 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target,
compositorAnimationId); | 279 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target,
*player(), compositorAnimationId); |
279 m_compositorAnimationIds.clear(); | 280 m_compositorAnimationIds.clear(); |
280 return true; | 281 return true; |
281 } | 282 } |
282 | 283 |
283 void Animation::restartAnimationOnCompositor() | 284 void Animation::restartAnimationOnCompositor() |
284 { | 285 { |
285 if (cancelAnimationOnCompositor()) | 286 if (cancelAnimationOnCompositor()) |
286 player()->setCompositorPending(true); | 287 player()->setCompositorPending(true); |
287 } | 288 } |
288 | 289 |
289 void Animation::cancelIncompatibleAnimationsOnCompositor() | 290 void Animation::cancelIncompatibleAnimationsOnCompositor() |
290 { | 291 { |
291 if (m_target && player() && effect()) | 292 if (m_target && player() && effect()) |
292 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit
or(*m_target, *player(), *effect()); | 293 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit
or(*m_target, *player(), *effect()); |
293 } | 294 } |
294 | 295 |
295 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) | 296 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) |
296 { | 297 { |
297 ASSERT(hasActiveAnimationsOnCompositor()); | 298 ASSERT(hasActiveAnimationsOnCompositor()); |
298 if (!m_target || !m_target->layoutObject()) | 299 if (!m_target || !m_target->layoutObject()) |
299 return; | 300 return; |
| 301 ASSERT(player()); |
300 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 302 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
301 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, compositorAnimationId, pauseTime); | 303 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, *player(), compositorAnimationId, pauseTime); |
| 304 } |
| 305 |
| 306 bool Animation::canAttachElementToCompositorPlayer() const |
| 307 { |
| 308 if (!m_target || !player()) |
| 309 return false; |
| 310 |
| 311 return CompositorAnimations::instance()->canAttachElementToCompositorPlayer(
*m_target, *player()); |
| 312 } |
| 313 |
| 314 void Animation::attachElementToCompositorPlayer() |
| 315 { |
| 316 ASSERT(m_target); |
| 317 ASSERT(player()); |
| 318 CompositorAnimations::instance()->attachElementToCompositorPlayer(*m_target,
*player()); |
302 } | 319 } |
303 | 320 |
304 DEFINE_TRACE(Animation) | 321 DEFINE_TRACE(Animation) |
305 { | 322 { |
306 visitor->trace(m_target); | 323 visitor->trace(m_target); |
307 visitor->trace(m_effect); | 324 visitor->trace(m_effect); |
308 visitor->trace(m_sampledEffect); | 325 visitor->trace(m_sampledEffect); |
309 AnimationNode::trace(visitor); | 326 AnimationNode::trace(visitor); |
310 } | 327 } |
311 | 328 |
312 } // namespace blink | 329 } // namespace blink |
OLD | NEW |