| OLD | NEW |
| 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 Loading... |
| 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> |
| 38 | 39 |
| 39 namespace WebCore { | 40 namespace WebCore { |
| 40 | 41 |
| 41 static const double cAnimationTimerDelay = 0.025; | 42 static const double cAnimationTimerDelay = 0.025; |
| 42 static const double cBeginAnimationUpdateTimeNotSet = -1; | 43 static const double cBeginAnimationUpdateTimeNotSet = -1; |
| 43 | 44 |
| 44 AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame) | 45 AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame) |
| 45 : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired) | 46 : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired) |
| 46 , m_updateRenderingDispatcher(this, &AnimationControllerPrivate::updateRende
ringDispatcherFired) | 47 , m_updateRenderingDispatcher(this, &AnimationControllerPrivate::updateRende
ringDispatcherFired) |
| 47 , m_frame(frame) | 48 , m_frame(frame) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 { | 184 { |
| 184 // Make sure animationUpdateTime is updated, so that it is current even if n
o | 185 // Make sure animationUpdateTime is updated, so that it is current even if n
o |
| 185 // styleChange has happened (e.g. accelerated animations) | 186 // styleChange has happened (e.g. accelerated animations) |
| 186 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); | 187 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); |
| 187 | 188 |
| 188 // When the timer fires, all we do is call setChanged on all DOM nodes with
running animations and then do an immediate | 189 // When the timer fires, all we do is call setChanged on all DOM nodes with
running animations and then do an immediate |
| 189 // updateRendering. It will then call back to us with new information. | 190 // updateRendering. It will then call back to us with new information. |
| 190 updateAnimationTimer(true); | 191 updateAnimationTimer(true); |
| 191 } | 192 } |
| 192 | 193 |
| 193 bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* ren
derer, int property, bool isRunningNow) const | 194 bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* ren
derer, CSSPropertyID property, bool isRunningNow) const |
| 194 { | 195 { |
| 195 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); | 196 RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer); |
| 196 if (!animation) | 197 if (!animation) |
| 197 return false; | 198 return false; |
| 198 | 199 |
| 199 return animation->isAnimatingProperty(property, isRunningNow); | 200 return animation->isAnimatingProperty(property, isRunningNow); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void AnimationControllerPrivate::suspendAnimations(Document* document) | 203 void AnimationControllerPrivate::suspendAnimations(Document* document) |
| 203 { | 204 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 264 |
| 264 double AnimationControllerPrivate::beginAnimationUpdateTime() | 265 double AnimationControllerPrivate::beginAnimationUpdateTime() |
| 265 { | 266 { |
| 266 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet) | 267 if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet) |
| 267 m_beginAnimationUpdateTime = currentTime(); | 268 m_beginAnimationUpdateTime = currentTime(); |
| 268 return m_beginAnimationUpdateTime; | 269 return m_beginAnimationUpdateTime; |
| 269 } | 270 } |
| 270 | 271 |
| 271 PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer(
RenderObject* renderer) | 272 PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer(
RenderObject* renderer) |
| 272 { | 273 { |
| 274 if (!renderer) |
| 275 return 0; |
| 276 |
| 277 RefPtr<CompositeAnimation> rendererAnimations = m_compositeAnimations.get(re
nderer); |
| 278 if (!rendererAnimations) |
| 279 return renderer->style(); |
| 280 |
| 273 // Make sure animationUpdateTime is updated, so that it is current even if n
o | 281 // Make sure animationUpdateTime is updated, so that it is current even if n
o |
| 274 // styleChange has happened (e.g. accelerated animations) | 282 // styleChange has happened (e.g. accelerated animations). |
| 275 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); | 283 setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); |
| 276 | |
| 277 RefPtr<CompositeAnimation> rendererAnimations = accessCompositeAnimation(ren
derer); | |
| 278 return rendererAnimations->getAnimatedStyle(); | 284 return rendererAnimations->getAnimatedStyle(); |
| 279 } | 285 } |
| 280 | 286 |
| 281 unsigned AnimationControllerPrivate::numberOfActiveAnimations() const | 287 unsigned AnimationControllerPrivate::numberOfActiveAnimations() const |
| 282 { | 288 { |
| 283 unsigned count = 0; | 289 unsigned count = 0; |
| 284 | 290 |
| 285 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio
ns.end(); | 291 RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimatio
ns.end(); |
| 286 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg
in(); it != animationsEnd; ++it) { | 292 for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.beg
in(); it != animationsEnd; ++it) { |
| 287 CompositeAnimation* compAnim = it->second.get(); | 293 CompositeAnimation* compAnim = it->second.get(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 unsigned AnimationController::numberOfActiveAnimations() const | 479 unsigned AnimationController::numberOfActiveAnimations() const |
| 474 { | 480 { |
| 475 return m_data->numberOfActiveAnimations(); | 481 return m_data->numberOfActiveAnimations(); |
| 476 } | 482 } |
| 477 | 483 |
| 478 bool AnimationController::pauseTransitionAtTime(RenderObject* renderer, const St
ring& property, double t) | 484 bool AnimationController::pauseTransitionAtTime(RenderObject* renderer, const St
ring& property, double t) |
| 479 { | 485 { |
| 480 return m_data->pauseTransitionAtTime(renderer, property, t); | 486 return m_data->pauseTransitionAtTime(renderer, property, t); |
| 481 } | 487 } |
| 482 | 488 |
| 483 bool AnimationController::isAnimatingPropertyOnRenderer(RenderObject* renderer,
int property, bool isRunningNow) const | 489 bool AnimationController::isAnimatingPropertyOnRenderer(RenderObject* renderer,
CSSPropertyID property, bool isRunningNow) const |
| 484 { | 490 { |
| 485 return m_data->isAnimatingPropertyOnRenderer(renderer, property, isRunningNo
w); | 491 return m_data->isAnimatingPropertyOnRenderer(renderer, property, isRunningNo
w); |
| 486 } | 492 } |
| 487 | 493 |
| 488 void AnimationController::suspendAnimations(Document* document) | 494 void AnimationController::suspendAnimations(Document* document) |
| 489 { | 495 { |
| 490 m_data->suspendAnimations(document); | 496 m_data->suspendAnimations(document); |
| 491 } | 497 } |
| 492 | 498 |
| 493 void AnimationController::resumeAnimations(Document* document) | 499 void AnimationController::resumeAnimations(Document* document) |
| 494 { | 500 { |
| 495 m_data->resumeAnimations(document); | 501 m_data->resumeAnimations(document); |
| 496 } | 502 } |
| 497 | 503 |
| 498 void AnimationController::beginAnimationUpdate() | 504 void AnimationController::beginAnimationUpdate() |
| 499 { | 505 { |
| 500 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); | 506 m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet); |
| 501 } | 507 } |
| 502 | 508 |
| 503 void AnimationController::endAnimationUpdate() | 509 void AnimationController::endAnimationUpdate() |
| 504 { | 510 { |
| 505 m_data->endAnimationUpdate(); | 511 m_data->endAnimationUpdate(); |
| 506 } | 512 } |
| 507 | 513 |
| 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 |
| 508 } // namespace WebCore | 524 } // namespace WebCore |
| 509 | 525 |
| OLD | NEW |