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

Side by Side Diff: Source/core/frame/animation/AnimationController.cpp

Issue 23874019: Web Animations CSS: Start running animations on the compositor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPr ivate>*) 251 void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPr ivate>*)
252 { 252 {
253 // Make sure animationUpdateTime is updated, so that it is current even if n o 253 // Make sure animationUpdateTime is updated, so that it is current even if n o
254 // styleChange has happened (e.g. accelerated animations) 254 // styleChange has happened (e.g. accelerated animations)
255 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 255 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
256 serviceAnimations(); 256 serviceAnimations();
257 } 257 }
258 258
259 bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderObject* rend erer, CSSPropertyID property, bool isRunningNow) const 259 bool AnimationControllerPrivate::isRunningAnimationOnRenderer(const RenderObject * renderer, CSSPropertyID property, bool isRunningNow) const
260 { 260 {
261 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); 261 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(const_cast< RenderObject*>(renderer));
262 if (!animation) 262 if (!animation)
263 return false; 263 return false;
264 264
265 return animation->isAnimatingProperty(property, false, isRunningNow); 265 return animation->isAnimatingProperty(property, false, isRunningNow);
266 } 266 }
267 267
268 bool AnimationControllerPrivate::isRunningAcceleratableAnimationOnRenderer(Rende rObject *renderer) const 268 bool AnimationControllerPrivate::isRunningAcceleratableAnimationOnRenderer(const RenderObject *renderer) const
269 { 269 {
270 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); 270 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(const_cast< RenderObject*>(renderer));
271 if (!animation) 271 if (!animation)
272 return false; 272 return false;
273 273
274 bool acceleratedOnly = false; 274 bool acceleratedOnly = false;
275 bool isRunningNow = true; 275 bool isRunningNow = true;
276 return animation->isAnimatingProperty(CSSPropertyOpacity, acceleratedOnly, i sRunningNow) 276 return animation->isAnimatingProperty(CSSPropertyOpacity, acceleratedOnly, i sRunningNow)
277 || animation->isAnimatingProperty(CSSPropertyWebkitTransform, accelerate dOnly, isRunningNow) 277 || animation->isAnimatingProperty(CSSPropertyWebkitTransform, accelerate dOnly, isRunningNow)
278 || animation->isAnimatingProperty(CSSPropertyWebkitFilter, acceleratedOn ly, isRunningNow); 278 || animation->isAnimatingProperty(CSSPropertyWebkitFilter, acceleratedOn ly, isRunningNow);
279 } 279 }
280 280
281 bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderO bject* renderer, CSSPropertyID property, bool isRunningNow) const 281 bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(const R enderObject* renderer, CSSPropertyID property, bool isRunningNow) const
282 { 282 {
283 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); 283 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(const_cast< RenderObject*>(renderer));
284 if (!animation) 284 if (!animation)
285 return false; 285 return false;
286 286
287 return animation->isAnimatingProperty(property, true, isRunningNow); 287 return animation->isAnimatingProperty(property, true, isRunningNow);
288 } 288 }
289 289
290 void AnimationControllerPrivate::pauseAnimationsForTesting(double t) 290 void AnimationControllerPrivate::pauseAnimationsForTesting(double t)
291 { 291 {
292 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 292 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
293 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 293 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // the style to impose the stacking rules. Note that this is also 474 // the style to impose the stacking rules. Note that this is also
475 // done in StyleResolver::adjustRenderStyle(). 475 // done in StyleResolver::adjustRenderStyle().
476 if (blendedStyle->hasAutoZIndex() && (blendedStyle->opacity() < 1.0f || blendedStyle->hasTransform())) 476 if (blendedStyle->hasAutoZIndex() && (blendedStyle->opacity() < 1.0f || blendedStyle->hasTransform()))
477 blendedStyle->setZIndex(0); 477 blendedStyle->setZIndex(0);
478 } 478 }
479 return blendedStyle.release(); 479 return blendedStyle.release();
480 } 480 }
481 481
482 PassRefPtr<RenderStyle> AnimationController::getAnimatedStyleForRenderer(RenderO bject* renderer) 482 PassRefPtr<RenderStyle> AnimationController::getAnimatedStyleForRenderer(RenderO bject* renderer)
483 { 483 {
484 ASSERT(!RuntimeEnabledFeatures::webAnimationsCSSEnabled());
Steve Block 2013/11/18 05:03:03 Shouldn't we just assert in the constructor?
dstockwell 2013/11/18 05:30:34 I removed these for now. But I think this object i
484 return m_data->getAnimatedStyleForRenderer(renderer); 485 return m_data->getAnimatedStyleForRenderer(renderer);
485 } 486 }
486 487
487 void AnimationController::notifyAnimationStarted(RenderObject*, double startTime ) 488 void AnimationController::notifyAnimationStarted(RenderObject*, double startTime )
488 { 489 {
489 m_data->receivedStartTimeResponse(startTime); 490 m_data->receivedStartTimeResponse(startTime);
490 } 491 }
491 492
492 void AnimationController::pauseAnimationsForTesting(double t) 493 void AnimationController::pauseAnimationsForTesting(double t)
493 { 494 {
494 m_data->pauseAnimationsForTesting(t); 495 m_data->pauseAnimationsForTesting(t);
495 } 496 }
496 497
497 unsigned AnimationController::numberOfActiveAnimations(Document* document) const 498 unsigned AnimationController::numberOfActiveAnimations(Document* document) const
498 { 499 {
499 return m_data->numberOfActiveAnimations(document); 500 return m_data->numberOfActiveAnimations(document);
500 } 501 }
501 502
502 bool AnimationController::isRunningAnimationOnRenderer(RenderObject* renderer, C SSPropertyID property, bool isRunningNow) const 503 bool AnimationController::isRunningAnimationOnRenderer(const RenderObject* rende rer, CSSPropertyID property, bool isRunningNow) const
503 { 504 {
505 ASSERT(!RuntimeEnabledFeatures::webAnimationsCSSEnabled());
504 return m_data->isRunningAnimationOnRenderer(renderer, property, isRunningNow ); 506 return m_data->isRunningAnimationOnRenderer(renderer, property, isRunningNow );
505 } 507 }
506 508
507 bool AnimationController::isRunningAcceleratableAnimationOnRenderer(RenderObject * renderer) const 509 bool AnimationController::isRunningAcceleratableAnimationOnRenderer(const Render Object* renderer) const
508 { 510 {
511 ASSERT(!RuntimeEnabledFeatures::webAnimationsCSSEnabled());
509 return m_data->isRunningAcceleratableAnimationOnRenderer(renderer); 512 return m_data->isRunningAcceleratableAnimationOnRenderer(renderer);
510 } 513 }
511 514
512 bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const 515 bool AnimationController::isRunningAcceleratedAnimationOnRenderer(const RenderOb ject* renderer, CSSPropertyID property, bool isRunningNow) const
513 { 516 {
517 ASSERT(!RuntimeEnabledFeatures::webAnimationsCSSEnabled());
514 return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, i sRunningNow); 518 return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, i sRunningNow);
515 } 519 }
516 520
517 void AnimationController::serviceAnimations() 521 void AnimationController::serviceAnimations()
518 { 522 {
519 m_data->serviceAnimations(); 523 m_data->serviceAnimations();
520 } 524 }
521 525
522 void AnimationController::beginAnimationUpdate() 526 void AnimationController::beginAnimationUpdate()
523 { 527 {
524 if (!m_beginAnimationUpdateCount) 528 if (!m_beginAnimationUpdateCount)
525 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 529 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
526 ++m_beginAnimationUpdateCount; 530 ++m_beginAnimationUpdateCount;
527 } 531 }
528 532
529 void AnimationController::endAnimationUpdate() 533 void AnimationController::endAnimationUpdate()
530 { 534 {
531 ASSERT(m_beginAnimationUpdateCount > 0); 535 ASSERT(m_beginAnimationUpdateCount > 0);
532 --m_beginAnimationUpdateCount; 536 --m_beginAnimationUpdateCount;
533 if (!m_beginAnimationUpdateCount) 537 if (!m_beginAnimationUpdateCount)
534 m_data->endAnimationUpdate(); 538 m_data->endAnimationUpdate();
535 } 539 }
536 540
537 bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID p roperty) 541 bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID p roperty)
538 { 542 {
539 return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property); 543 return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property);
540 } 544 }
541 545
542 } // namespace WebCore 546 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698