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

Unified Diff: Source/core/frame/animation/AnimationController.cpp

Issue 57643004: Pass RenderStyle / RenderObject by reference in more places (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/animation/AnimationController.cpp
diff --git a/Source/core/frame/animation/AnimationController.cpp b/Source/core/frame/animation/AnimationController.cpp
index 152fa96927294366ae3cce48b72135056c6e88e1..8521e139a08ee89ddf419b11a46af630f1d36c3d 100644
--- a/Source/core/frame/animation/AnimationController.cpp
+++ b/Source/core/frame/animation/AnimationController.cpp
@@ -62,12 +62,12 @@ AnimationControllerPrivate::~AnimationControllerPrivate()
{
}
-PassRefPtr<CompositeAnimation> AnimationControllerPrivate::accessCompositeAnimation(RenderObject* renderer)
+PassRefPtr<CompositeAnimation> AnimationControllerPrivate::accessCompositeAnimation(RenderObject& renderer)
{
- RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
+ RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(&renderer);
if (!animation) {
animation = CompositeAnimation::create(this);
- m_compositeAnimations.set(renderer, animation);
+ m_compositeAnimations.set(&renderer, animation);
}
return animation;
}
@@ -118,12 +118,12 @@ void AnimationControllerPrivate::updateAnimations(double& timeToNextService, dou
timeToNextEvent = minTimeToNextEvent;
}
-void AnimationControllerPrivate::scheduleServiceForRenderer(RenderObject* renderer)
+void AnimationControllerPrivate::scheduleServiceForRenderer(RenderObject& renderer)
{
double timeToNextService = -1;
double timeToNextEvent = -1;
- RefPtr<CompositeAnimation> compAnim = m_compositeAnimations.get(renderer);
+ RefPtr<CompositeAnimation> compAnim = m_compositeAnimations.get(&renderer);
if (compAnim->hasAnimations()) {
timeToNextService = compAnim->timeToNextService();
timeToNextEvent = compAnim->timeToNextEvent();
@@ -443,16 +443,16 @@ void AnimationController::cancelAnimations(RenderObject* renderer)
}
}
-PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* renderer, RenderStyle* newStyle)
+PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject& renderer, RenderStyle& newStyle)
{
- RenderStyle* oldStyle = renderer->style();
+ RenderStyle* oldStyle = renderer.style();
- if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions()))
- return newStyle;
+ if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle.animations() && !newStyle.transitions()))
+ return PassRefPtr<RenderStyle>(newStyle);
// Don't run transitions when printing.
- if (renderer->view()->document().printing())
- return newStyle;
+ if (renderer.view()->document().printing())
+ return PassRefPtr<RenderStyle>(newStyle);
// Fetch our current set of implicit animations from a hashtable. We then compare them
// against the animations in the style and make sure we're in sync. If destination values
@@ -460,16 +460,16 @@ PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* rend
// a new style.
// We don't support anonymous pseudo elements like :first-line or :first-letter.
- ASSERT(renderer->node());
+ ASSERT(renderer.node());
RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer);
RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle);
- if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) {
+ if (renderer.parent() || newStyle.animations() || (oldStyle && oldStyle->animations())) {
m_data->scheduleServiceForRenderer(renderer);
}
- if (blendedStyle != newStyle) {
+ if (blendedStyle != &newStyle) {
// If the animations/transitions change opacity or transform, we need to update
// the style to impose the stacking rules. Note that this is also
// done in StyleResolver::adjustRenderStyle().
« no previous file with comments | « Source/core/frame/animation/AnimationController.h ('k') | Source/core/frame/animation/AnimationControllerPrivate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698