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

Side by Side Diff: ui/compositor/scoped_layer_animation_settings.cc

Issue 105673008: Remove unneeded ScopedLayerAnimationSettings::LockTransitionDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « ui/compositor/scoped_layer_animation_settings.h ('k') | ui/views/corewm/window_animations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/scoped_layer_animation_settings.h" 5 #include "ui/compositor/scoped_layer_animation_settings.h"
6 6
7 #include "ui/compositor/layer.h" 7 #include "ui/compositor/layer.h"
8 #include "ui/compositor/layer_animation_observer.h" 8 #include "ui/compositor/layer_animation_observer.h"
9 #include "ui/compositor/layer_animation_sequence.h" 9 #include "ui/compositor/layer_animation_sequence.h"
10 #include "ui/compositor/layer_animator.h" 10 #include "ui/compositor/layer_animator.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Layer* base_layer_; 74 Layer* base_layer_;
75 // child layers 75 // child layers
76 std::vector<Layer*> inverse_layers_; 76 std::vector<Layer*> inverse_layers_;
77 }; 77 };
78 78
79 79
80 // ScoperLayerAnimationSettings ------------------------------------------------ 80 // ScoperLayerAnimationSettings ------------------------------------------------
81 ScopedLayerAnimationSettings::ScopedLayerAnimationSettings( 81 ScopedLayerAnimationSettings::ScopedLayerAnimationSettings(
82 LayerAnimator* animator) 82 LayerAnimator* animator)
83 : animator_(animator), 83 : animator_(animator),
84 old_is_transition_duration_locked_( 84 old_transition_duration_(animator->transition_duration_),
85 animator->is_transition_duration_locked_),
86 old_transition_duration_(animator->GetTransitionDuration()),
87 old_tween_type_(animator->tween_type()), 85 old_tween_type_(animator->tween_type()),
88 old_preemption_strategy_(animator->preemption_strategy()), 86 old_preemption_strategy_(animator->preemption_strategy()),
89 inverse_observer_(new InvertingObserver()) { 87 inverse_observer_(new InvertingObserver()) {
90 SetTransitionDuration( 88 SetTransitionDuration(
91 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs)); 89 base::TimeDelta::FromMilliseconds(kDefaultTransitionDurationMs));
92 } 90 }
93 91
94 ScopedLayerAnimationSettings::~ScopedLayerAnimationSettings() { 92 ScopedLayerAnimationSettings::~ScopedLayerAnimationSettings() {
95 animator_->is_transition_duration_locked_ = 93 animator_->transition_duration_ = old_transition_duration_;
96 old_is_transition_duration_locked_;
97 animator_->SetTransitionDuration(old_transition_duration_);
98 animator_->set_tween_type(old_tween_type_); 94 animator_->set_tween_type(old_tween_type_);
99 animator_->set_preemption_strategy(old_preemption_strategy_); 95 animator_->set_preemption_strategy(old_preemption_strategy_);
100 96
101 for (std::set<ImplicitAnimationObserver*>::const_iterator i = 97 for (std::set<ImplicitAnimationObserver*>::const_iterator i =
102 observers_.begin(); i != observers_.end(); ++i) { 98 observers_.begin(); i != observers_.end(); ++i) {
103 animator_->observers_.RemoveObserver(*i); 99 animator_->observers_.RemoveObserver(*i);
104 (*i)->SetActive(true); 100 (*i)->SetActive(true);
105 } 101 }
106 102
107 if (inverse_observer_->layer()) { 103 if (inverse_observer_->layer()) {
108 animator_->observers_.RemoveObserver(inverse_observer_.get()); 104 animator_->observers_.RemoveObserver(inverse_observer_.get());
109 } 105 }
110 } 106 }
111 107
112 void ScopedLayerAnimationSettings::AddObserver( 108 void ScopedLayerAnimationSettings::AddObserver(
113 ImplicitAnimationObserver* observer) { 109 ImplicitAnimationObserver* observer) {
114 observers_.insert(observer); 110 observers_.insert(observer);
115 animator_->AddObserver(observer); 111 animator_->AddObserver(observer);
116 } 112 }
117 113
118 void ScopedLayerAnimationSettings::SetTransitionDuration( 114 void ScopedLayerAnimationSettings::SetTransitionDuration(
119 base::TimeDelta duration) { 115 base::TimeDelta duration) {
120 animator_->SetTransitionDuration(duration); 116 animator_->transition_duration_ = duration;
121 }
122
123 void ScopedLayerAnimationSettings::LockTransitionDuration() {
124 animator_->is_transition_duration_locked_ = true;
125 } 117 }
126 118
127 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const { 119 base::TimeDelta ScopedLayerAnimationSettings::GetTransitionDuration() const {
128 return animator_->GetTransitionDuration(); 120 return animator_->GetTransitionDuration();
129 } 121 }
130 122
131 void ScopedLayerAnimationSettings::SetTweenType(gfx::Tween::Type tween_type) { 123 void ScopedLayerAnimationSettings::SetTweenType(gfx::Tween::Type tween_type) {
132 animator_->set_tween_type(tween_type); 124 animator_->set_tween_type(tween_type);
133 } 125 }
134 126
(...skipping 19 matching lines...) Expand all
154 } 146 }
155 inverse_observer_->SetLayer(base); 147 inverse_observer_->SetLayer(base);
156 } 148 }
157 149
158 void ScopedLayerAnimationSettings::AddInverselyAnimatedLayer( 150 void ScopedLayerAnimationSettings::AddInverselyAnimatedLayer(
159 Layer* inverse_layer) { 151 Layer* inverse_layer) {
160 inverse_observer_->AddInverselyAnimatedLayer(inverse_layer); 152 inverse_observer_->AddInverselyAnimatedLayer(inverse_layer);
161 } 153 }
162 154
163 } // namespace ui 155 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/scoped_layer_animation_settings.h ('k') | ui/views/corewm/window_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698