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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 child->animation()->resumeAnimations(); 306 child->animation()->resumeAnimations();
307 } 307 }
308 308
309 void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document ) 309 void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document )
310 { 310 {
311 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 311 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
312 312
313 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 313 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
314 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 314 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
315 RenderObject* renderer = it->key; 315 RenderObject* renderer = it->key;
316 if (renderer->document() == document) { 316 if (&renderer->document() == document) {
317 CompositeAnimation* compAnim = it->value.get(); 317 CompositeAnimation* compAnim = it->value.get();
318 compAnim->suspendAnimations(); 318 compAnim->suspendAnimations();
319 } 319 }
320 } 320 }
321 321
322 scheduleService(); 322 scheduleService();
323 } 323 }
324 324
325 void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document) 325 void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
326 { 326 {
327 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 327 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
328 328
329 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 329 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
330 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 330 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
331 RenderObject* renderer = it->key; 331 RenderObject* renderer = it->key;
332 if (renderer->document() == document) { 332 if (&renderer->document() == document) {
333 CompositeAnimation* compAnim = it->value.get(); 333 CompositeAnimation* compAnim = it->value.get();
334 compAnim->resumeAnimations(); 334 compAnim->resumeAnimations();
335 } 335 }
336 } 336 }
337 337
338 scheduleService(); 338 scheduleService();
339 } 339 }
340 340
341 void AnimationControllerPrivate::pauseAnimationsForTesting(double t) 341 void AnimationControllerPrivate::pauseAnimationsForTesting(double t)
342 { 342 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 385
386 unsigned AnimationControllerPrivate::numberOfActiveAnimations(Document* document ) const 386 unsigned AnimationControllerPrivate::numberOfActiveAnimations(Document* document ) const
387 { 387 {
388 unsigned count = 0; 388 unsigned count = 0;
389 389
390 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 390 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
391 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 391 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
392 RenderObject* renderer = it->key; 392 RenderObject* renderer = it->key;
393 CompositeAnimation* compAnim = it->value.get(); 393 CompositeAnimation* compAnim = it->value.get();
394 if (renderer->document() == document) 394 if (&renderer->document() == document)
395 count += compAnim->numberOfActiveAnimations(); 395 count += compAnim->numberOfActiveAnimations();
396 } 396 }
397 397
398 return count; 398 return count;
399 } 399 }
400 400
401 void AnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase* a nimation) 401 void AnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase* a nimation)
402 { 402 {
403 // Make sure this animation is not in the start time waiters 403 // Make sure this animation is not in the start time waiters
404 m_animationsWaitingForStartTimeResponse.remove(animation); 404 m_animationsWaitingForStartTimeResponse.remove(animation);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 return; 491 return;
492 492
493 if (m_data->clear(renderer)) { 493 if (m_data->clear(renderer)) {
494 if (Node* node = renderer->node()) 494 if (Node* node = renderer->node())
495 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer) ; 495 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer) ;
496 } 496 }
497 } 497 }
498 498
499 PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* rend erer, RenderStyle* newStyle) 499 PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* rend erer, RenderStyle* newStyle)
500 { 500 {
501 if (!renderer->document())
502 return newStyle;
503
504 RenderStyle* oldStyle = renderer->style(); 501 RenderStyle* oldStyle = renderer->style();
505 502
506 if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions())) 503 if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions()))
507 return newStyle; 504 return newStyle;
508 505
509 // Don't run transitions when printing. 506 // Don't run transitions when printing.
510 if (renderer->view()->printing()) 507 if (renderer->view()->printing())
511 return newStyle; 508 return newStyle;
512 509
513 // Fetch our current set of implicit animations from a hashtable. We then c ompare them 510 // Fetch our current set of implicit animations from a hashtable. We then c ompare them
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (!m_beginAnimationUpdateCount) 606 if (!m_beginAnimationUpdateCount)
610 m_data->endAnimationUpdate(); 607 m_data->endAnimationUpdate();
611 } 608 }
612 609
613 bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID p roperty) 610 bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID p roperty)
614 { 611 {
615 return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property); 612 return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property);
616 } 613 }
617 614
618 } // namespace WebCore 615 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/TouchDisambiguation.cpp ('k') | Source/core/page/animation/ImplicitAnimation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698