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

Side by Side Diff: third_party/WebKit/WebCore/page/animation/AnimationController.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 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 17 matching lines...) Expand all
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "AnimationController.h" 30 #include "AnimationController.h"
31 #include "AnimationControllerPrivate.h" 31 #include "AnimationControllerPrivate.h"
32 #include "AnimationBase.h" 32 #include "AnimationBase.h"
33 #include "CompositeAnimation.h" 33 #include "CompositeAnimation.h"
34 #include "CSSParser.h" 34 #include "CSSParser.h"
35 #include "EventNames.h" 35 #include "EventNames.h"
36 #include "Frame.h" 36 #include "Frame.h"
37 #include <wtf/CurrentTime.h> 37 #include <wtf/CurrentTime.h>
38 #include <wtf/UnusedParam.h>
39 38
40 namespace WebCore { 39 namespace WebCore {
41 40
42 static const double cAnimationTimerDelay = 0.025; 41 static const double cAnimationTimerDelay = 0.025;
43 static const double cBeginAnimationUpdateTimeNotSet = -1; 42 static const double cBeginAnimationUpdateTimeNotSet = -1;
44 43
45 AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame) 44 AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
46 : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired) 45 : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired)
47 , m_updateRenderingDispatcher(this, &AnimationControllerPrivate::updateRende ringDispatcherFired) 46 , m_updateRenderingDispatcher(this, &AnimationControllerPrivate::updateRende ringDispatcherFired)
48 , m_frame(frame) 47 , m_frame(frame)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 { 183 {
185 // Make sure animationUpdateTime is updated, so that it is current even if n o 184 // Make sure animationUpdateTime is updated, so that it is current even if n o
186 // styleChange has happened (e.g. accelerated animations) 185 // styleChange has happened (e.g. accelerated animations)
187 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 186 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
188 187
189 // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate 188 // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate
190 // updateRendering. It will then call back to us with new information. 189 // updateRendering. It will then call back to us with new information.
191 updateAnimationTimer(true); 190 updateAnimationTimer(true);
192 } 191 }
193 192
194 bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* ren derer, CSSPropertyID property, bool isRunningNow) const 193 bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* ren derer, int property, bool isRunningNow) const
195 { 194 {
196 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); 195 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
197 if (!animation) 196 if (!animation)
198 return false; 197 return false;
199 198
200 return animation->isAnimatingProperty(property, isRunningNow); 199 return animation->isAnimatingProperty(property, isRunningNow);
201 } 200 }
202 201
203 void AnimationControllerPrivate::suspendAnimations(Document* document) 202 void AnimationControllerPrivate::suspendAnimations(Document* document)
204 { 203 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 263
265 double AnimationControllerPrivate::beginAnimationUpdateTime() 264 double AnimationControllerPrivate::beginAnimationUpdateTime()
266 { 265 {
267 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet) 266 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
268 m_beginAnimationUpdateTime = currentTime(); 267 m_beginAnimationUpdateTime = currentTime();
269 return m_beginAnimationUpdateTime; 268 return m_beginAnimationUpdateTime;
270 } 269 }
271 270
272 PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer( RenderObject* renderer) 271 PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer( RenderObject* renderer)
273 { 272 {
274 if (!renderer)
275 return 0;
276
277 RefPtr<CompositeAnimation> rendererAnimations = m_compositeAnimations.get(re nderer);
278 if (!rendererAnimations)
279 return renderer->style();
280
281 // Make sure animationUpdateTime is updated, so that it is current even if n o 273 // Make sure animationUpdateTime is updated, so that it is current even if n o
282 // styleChange has happened (e.g. accelerated animations). 274 // styleChange has happened (e.g. accelerated animations)
283 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 275 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
276
277 RefPtr<CompositeAnimation> rendererAnimations = accessCompositeAnimation(ren derer);
284 return rendererAnimations->getAnimatedStyle(); 278 return rendererAnimations->getAnimatedStyle();
285 } 279 }
286 280
287 unsigned AnimationControllerPrivate::numberOfActiveAnimations() const 281 unsigned AnimationControllerPrivate::numberOfActiveAnimations() const
288 { 282 {
289 unsigned count = 0; 283 unsigned count = 0;
290 284
291 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end(); 285 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio ns.end();
292 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) { 286 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg in(); it != animationsEnd; ++it) {
293 CompositeAnimation* compAnim = it->second.get(); 287 CompositeAnimation* compAnim = it->second.get();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 unsigned AnimationController::numberOfActiveAnimations() const 473 unsigned AnimationController::numberOfActiveAnimations() const
480 { 474 {
481 return m_data->numberOfActiveAnimations(); 475 return m_data->numberOfActiveAnimations();
482 } 476 }
483 477
484 bool AnimationController::pauseTransitionAtTime(RenderObject* renderer, const St ring& property, double t) 478 bool AnimationController::pauseTransitionAtTime(RenderObject* renderer, const St ring& property, double t)
485 { 479 {
486 return m_data->pauseTransitionAtTime(renderer, property, t); 480 return m_data->pauseTransitionAtTime(renderer, property, t);
487 } 481 }
488 482
489 bool AnimationController::isAnimatingPropertyOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const 483 bool AnimationController::isAnimatingPropertyOnRenderer(RenderObject* renderer, int property, bool isRunningNow) const
490 { 484 {
491 return m_data->isAnimatingPropertyOnRenderer(renderer, property, isRunningNo w); 485 return m_data->isAnimatingPropertyOnRenderer(renderer, property, isRunningNo w);
492 } 486 }
493 487
494 void AnimationController::suspendAnimations(Document* document) 488 void AnimationController::suspendAnimations(Document* document)
495 { 489 {
496 m_data->suspendAnimations(document); 490 m_data->suspendAnimations(document);
497 } 491 }
498 492
499 void AnimationController::resumeAnimations(Document* document) 493 void AnimationController::resumeAnimations(Document* document)
500 { 494 {
501 m_data->resumeAnimations(document); 495 m_data->resumeAnimations(document);
502 } 496 }
503 497
504 void AnimationController::beginAnimationUpdate() 498 void AnimationController::beginAnimationUpdate()
505 { 499 {
506 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); 500 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
507 } 501 }
508 502
509 void AnimationController::endAnimationUpdate() 503 void AnimationController::endAnimationUpdate()
510 { 504 {
511 m_data->endAnimationUpdate(); 505 m_data->endAnimationUpdate();
512 } 506 }
513 507
514 bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID p roperty)
515 {
516 #if USE(ACCELERATED_COMPOSITING)
517 return AnimationBase::animationOfPropertyIsAccelerated(property);
518 #else
519 UNUSED_PARAM(property);
520 return false;
521 #endif
522 }
523
524 } // namespace WebCore 508 } // namespace WebCore
525 509
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698