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