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

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

Issue 10696154: Merge 120639 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 94 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
95 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 95 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
96 CompositeAnimation* compAnim = it->second.get(); 96 CompositeAnimation* compAnim = it->second.get();
97 if (!compAnim->suspended() && compAnim->hasAnimations()) { 97 if (!compAnim->suspended() && compAnim->hasAnimations()) {
98 double t = compAnim->timeToNextService(); 98 double t = compAnim->timeToNextService();
99 if (t != -1 && (t < timeToNextService || timeToNextService == -1)) 99 if (t != -1 && (t < timeToNextService || timeToNextService == -1))
100 timeToNextService = t; 100 timeToNextService = t;
101 if (!timeToNextService) { 101 if (!timeToNextService) {
102 if (callSetChanged == CallSetChanged) { 102 if (callSetChanged == CallSetChanged) {
103 Node* node = it->first->styledGeneratingNode(); 103 Node* node = it->first->node();
104 ASSERT(!node || (node->document() && !node->document()->inPa geCache())); 104 ASSERT(!node || (node->document() && !node->document()->inPa geCache()));
105 node->setNeedsStyleRecalc(SyntheticStyleChange); 105 node->setNeedsStyleRecalc(SyntheticStyleChange);
106 calledSetChanged = true; 106 calledSetChanged = true;
107 } 107 }
108 else 108 else
109 break; 109 break;
110 } 110 }
111 } 111 }
112 } 112 }
113 113
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool AnimationControllerPrivate::pauseAnimationAtTime(RenderObject* renderer, co nst String& name, double t) 321 bool AnimationControllerPrivate::pauseAnimationAtTime(RenderObject* renderer, co nst String& name, double t)
322 { 322 {
323 if (!renderer) 323 if (!renderer)
324 return false; 324 return false;
325 325
326 RefPtr<CompositeAnimation> compAnim = accessCompositeAnimation(renderer); 326 RefPtr<CompositeAnimation> compAnim = accessCompositeAnimation(renderer);
327 if (!compAnim) 327 if (!compAnim)
328 return false; 328 return false;
329 329
330 if (compAnim->pauseAnimationAtTime(name, t)) { 330 if (compAnim->pauseAnimationAtTime(name, t)) {
331 renderer->styledGeneratingNode()->setNeedsStyleRecalc(SyntheticStyleChan ge); 331 renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
332 startUpdateStyleIfNeededDispatcher(); 332 startUpdateStyleIfNeededDispatcher();
333 return true; 333 return true;
334 } 334 }
335 335
336 return false; 336 return false;
337 } 337 }
338 338
339 bool AnimationControllerPrivate::pauseTransitionAtTime(RenderObject* renderer, c onst String& property, double t) 339 bool AnimationControllerPrivate::pauseTransitionAtTime(RenderObject* renderer, c onst String& property, double t)
340 { 340 {
341 if (!renderer) 341 if (!renderer)
342 return false; 342 return false;
343 343
344 RefPtr<CompositeAnimation> compAnim = accessCompositeAnimation(renderer); 344 RefPtr<CompositeAnimation> compAnim = accessCompositeAnimation(renderer);
345 if (!compAnim) 345 if (!compAnim)
346 return false; 346 return false;
347 347
348 if (compAnim->pauseTransitionAtTime(cssPropertyID(property), t)) { 348 if (compAnim->pauseTransitionAtTime(cssPropertyID(property), t)) {
349 renderer->styledGeneratingNode()->setNeedsStyleRecalc(SyntheticStyleChan ge); 349 renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
350 startUpdateStyleIfNeededDispatcher(); 350 startUpdateStyleIfNeededDispatcher();
351 return true; 351 return true;
352 } 352 }
353 353
354 return false; 354 return false;
355 } 355 }
356 356
357 double AnimationControllerPrivate::beginAnimationUpdateTime() 357 double AnimationControllerPrivate::beginAnimationUpdateTime()
358 { 358 {
359 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet) 359 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 AnimationController::~AnimationController() 501 AnimationController::~AnimationController()
502 { 502 {
503 } 503 }
504 504
505 void AnimationController::cancelAnimations(RenderObject* renderer) 505 void AnimationController::cancelAnimations(RenderObject* renderer)
506 { 506 {
507 if (!m_data->hasAnimations()) 507 if (!m_data->hasAnimations())
508 return; 508 return;
509 509
510 if (m_data->clear(renderer)) { 510 if (m_data->clear(renderer)) {
511 Node* node = renderer->styledGeneratingNode(); 511 Node* node = renderer->node();
512 ASSERT(!node || (node->document() && !node->document()->inPageCache())); 512 ASSERT(!node || (node->document() && !node->document()->inPageCache()));
513 node->setNeedsStyleRecalc(SyntheticStyleChange); 513 node->setNeedsStyleRecalc(SyntheticStyleChange);
514 } 514 }
515 } 515 }
516 516
517 PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* rend erer, RenderStyle* newStyle) 517 PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* rend erer, RenderStyle* newStyle)
518 { 518 {
519 // Don't do anything if we're in the cache 519 // Don't do anything if we're in the cache
520 if (!renderer->document() || renderer->document()->inPageCache()) 520 if (!renderer->document() || renderer->document()->inPageCache())
521 return newStyle; 521 return newStyle;
522 522
523 RenderStyle* oldStyle = renderer->style(); 523 RenderStyle* oldStyle = renderer->style();
524 524
525 if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions())) 525 if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions()))
526 return newStyle; 526 return newStyle;
527 527
528 // Don't run transitions when printing. 528 // Don't run transitions when printing.
529 if (renderer->view()->printing()) 529 if (renderer->view()->printing())
530 return newStyle; 530 return newStyle;
531 531
532 // Fetch our current set of implicit animations from a hashtable. We then c ompare them 532 // Fetch our current set of implicit animations from a hashtable. We then c ompare them
533 // against the animations in the style and make sure we're in sync. If dest ination values 533 // against the animations in the style and make sure we're in sync. If dest ination values
534 // have changed, we reset the animation. We then do a blend to get new valu es and we return 534 // have changed, we reset the animation. We then do a blend to get new valu es and we return
535 // a new style. 535 // a new style.
536 ASSERT(renderer->node()); // FIXME: We do not animate generated content yet.
536 537
537 RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnima tion(renderer); 538 RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnima tion(renderer);
538 RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, old Style, newStyle); 539 RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, old Style, newStyle);
539 540
540 if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->a nimations())) { 541 if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->a nimations())) {
541 m_data->updateAnimationTimerForRenderer(renderer); 542 m_data->updateAnimationTimerForRenderer(renderer);
542 #if ENABLE(REQUEST_ANIMATION_FRAME) 543 #if ENABLE(REQUEST_ANIMATION_FRAME)
543 if (FrameView* view = renderer->document()->view()) 544 if (FrameView* view = renderer->document()->view())
544 view->scheduleAnimation(); 545 view->scheduleAnimation();
545 #endif 546 #endif
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return false; 642 return false;
642 #endif 643 #endif
643 } 644 }
644 645
645 PassRefPtr<WebKitAnimationList> AnimationController::animationsForRenderer(Rende rObject* renderer) const 646 PassRefPtr<WebKitAnimationList> AnimationController::animationsForRenderer(Rende rObject* renderer) const
646 { 647 {
647 return m_data->animationsForRenderer(renderer); 648 return m_data->animationsForRenderer(renderer);
648 } 649 }
649 650
650 } // namespace WebCore 651 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/page/animation/AnimationBase.cpp ('k') | Source/WebCore/page/animation/ImplicitAnimation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698