| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac
kRate) const | 278 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac
kRate) const |
| 279 { | 279 { |
| 280 // Do not put transforms on compositor if more than one of them are defined | 280 // Do not put transforms on compositor if more than one of them are defined |
| 281 // in computed style because they need to be explicitly ordered | 281 // in computed style because they need to be explicitly ordered |
| 282 if (!model() | 282 if (!model() |
| 283 || !m_target | 283 || !m_target |
| 284 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat
h()) | 284 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat
h()) |
| 285 || hasMultipleTransformProperties()) | 285 || hasMultipleTransformProperties()) |
| 286 return false; | 286 return false; |
| 287 | 287 |
| 288 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor
(specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate); | 288 return CompositorAnimations::isCandidateForAnimationOnCompositor(specifiedTi
ming(), *m_target, animation(), *model(), animationPlaybackRate); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime
, double currentTime, double animationPlaybackRate) | 291 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime
, double currentTime, double animationPlaybackRate) |
| 292 { | 292 { |
| 293 ASSERT(!hasActiveAnimationsOnCompositor()); | 293 ASSERT(!hasActiveAnimationsOnCompositor()); |
| 294 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate)) | 294 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate)) |
| 295 return false; | 295 return false; |
| 296 if (!CompositorAnimations::instance()->canStartAnimationOnCompositor(*m_targ
et)) | 296 if (!CompositorAnimations::canStartAnimationOnCompositor(*m_target)) |
| 297 return false; | 297 return false; |
| 298 CompositorAnimations::instance()->startAnimationOnCompositor(*m_target, grou
p, startTime, currentTime, specifiedTiming(), *animation(), *model(), m_composit
orAnimationIds, animationPlaybackRate); | 298 CompositorAnimations::startAnimationOnCompositor(*m_target, group, startTime
, currentTime, specifiedTiming(), *animation(), *model(), m_compositorAnimationI
ds, animationPlaybackRate); |
| 299 ASSERT(!m_compositorAnimationIds.isEmpty()); | 299 ASSERT(!m_compositorAnimationIds.isEmpty()); |
| 300 return true; | 300 return true; |
| 301 } | 301 } |
| 302 | 302 |
| 303 bool KeyframeEffect::hasActiveAnimationsOnCompositor() const | 303 bool KeyframeEffect::hasActiveAnimationsOnCompositor() const |
| 304 { | 304 { |
| 305 return !m_compositorAnimationIds.isEmpty(); | 305 return !m_compositorAnimationIds.isEmpty(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool KeyframeEffect::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st | 308 bool KeyframeEffect::hasActiveAnimationsOnCompositor(CSSPropertyID property) con
st |
| (...skipping 11 matching lines...) Expand all Loading... |
| 320 // FIXME: cancelAnimationOnCompositor is called from withins style recalc. | 320 // FIXME: cancelAnimationOnCompositor is called from withins style recalc. |
| 321 // This queries compositingState, which is not necessarily up to date. | 321 // This queries compositingState, which is not necessarily up to date. |
| 322 // https://code.google.com/p/chromium/issues/detail?id=339847 | 322 // https://code.google.com/p/chromium/issues/detail?id=339847 |
| 323 DisableCompositingQueryAsserts disabler; | 323 DisableCompositingQueryAsserts disabler; |
| 324 if (!hasActiveAnimationsOnCompositor()) | 324 if (!hasActiveAnimationsOnCompositor()) |
| 325 return false; | 325 return false; |
| 326 if (!m_target || !m_target->layoutObject()) | 326 if (!m_target || !m_target->layoutObject()) |
| 327 return false; | 327 return false; |
| 328 ASSERT(animation()); | 328 ASSERT(animation()); |
| 329 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 329 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
| 330 CompositorAnimations::instance()->cancelAnimationOnCompositor(*m_target,
*animation(), compositorAnimationId); | 330 CompositorAnimations::cancelAnimationOnCompositor(*m_target, *animation(
), compositorAnimationId); |
| 331 m_compositorAnimationIds.clear(); | 331 m_compositorAnimationIds.clear(); |
| 332 return true; | 332 return true; |
| 333 } | 333 } |
| 334 | 334 |
| 335 void KeyframeEffect::restartAnimationOnCompositor() | 335 void KeyframeEffect::restartAnimationOnCompositor() |
| 336 { | 336 { |
| 337 if (cancelAnimationOnCompositor()) | 337 if (cancelAnimationOnCompositor()) |
| 338 animation()->setCompositorPending(true); | 338 animation()->setCompositorPending(true); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void KeyframeEffect::cancelIncompatibleAnimationsOnCompositor() | 341 void KeyframeEffect::cancelIncompatibleAnimationsOnCompositor() |
| 342 { | 342 { |
| 343 if (m_target && animation() && model()) | 343 if (m_target && animation() && model()) |
| 344 CompositorAnimations::instance()->cancelIncompatibleAnimationsOnComposit
or(*m_target, *animation(), *model()); | 344 CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(*m_target
, *animation(), *model()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void KeyframeEffect::pauseAnimationForTestingOnCompositor(double pauseTime) | 347 void KeyframeEffect::pauseAnimationForTestingOnCompositor(double pauseTime) |
| 348 { | 348 { |
| 349 ASSERT(hasActiveAnimationsOnCompositor()); | 349 ASSERT(hasActiveAnimationsOnCompositor()); |
| 350 if (!m_target || !m_target->layoutObject()) | 350 if (!m_target || !m_target->layoutObject()) |
| 351 return; | 351 return; |
| 352 ASSERT(animation()); | 352 ASSERT(animation()); |
| 353 for (const auto& compositorAnimationId : m_compositorAnimationIds) | 353 for (const auto& compositorAnimationId : m_compositorAnimationIds) |
| 354 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target, *animation(), compositorAnimationId, pauseTime); | 354 CompositorAnimations::pauseAnimationForTestingOnCompositor(*m_target, *a
nimation(), compositorAnimationId, pauseTime); |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool KeyframeEffect::canAttachCompositedLayers() const | 357 bool KeyframeEffect::canAttachCompositedLayers() const |
| 358 { | 358 { |
| 359 if (!m_target || !animation()) | 359 if (!m_target || !animation()) |
| 360 return false; | 360 return false; |
| 361 | 361 |
| 362 return CompositorAnimations::instance()->canAttachCompositedLayers(*m_target
, *animation()); | 362 return CompositorAnimations::canAttachCompositedLayers(*m_target, *animation
()); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void KeyframeEffect::attachCompositedLayers() | 365 void KeyframeEffect::attachCompositedLayers() |
| 366 { | 366 { |
| 367 ASSERT(m_target); | 367 ASSERT(m_target); |
| 368 ASSERT(animation()); | 368 ASSERT(animation()); |
| 369 CompositorAnimations::instance()->attachCompositedLayers(*m_target, *animati
on()); | 369 CompositorAnimations::attachCompositedLayers(*m_target, *animation()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 DEFINE_TRACE(KeyframeEffect) | 372 DEFINE_TRACE(KeyframeEffect) |
| 373 { | 373 { |
| 374 visitor->trace(m_target); | 374 visitor->trace(m_target); |
| 375 visitor->trace(m_model); | 375 visitor->trace(m_model); |
| 376 visitor->trace(m_sampledEffect); | 376 visitor->trace(m_sampledEffect); |
| 377 AnimationEffect::trace(visitor); | 377 AnimationEffect::trace(visitor); |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace blink | 380 } // namespace blink |
| OLD | NEW |