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

Side by Side Diff: cc/input/scrollbar_animation_controller.cc

Issue 2716453005: Aura Overlay Scrollbars appear when mouse hovers over scroller edge (Closed)
Patch Set: rename fade in to show Created 3 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/input/scrollbar_animation_controller.h" 5 #include "cc/input/scrollbar_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 std::unique_ptr<ScrollbarAnimationController> 14 std::unique_ptr<ScrollbarAnimationController>
15 ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid( 15 ScrollbarAnimationController::CreateScrollbarAnimationControllerAndroid(
16 int scroll_layer_id, 16 int scroll_layer_id,
17 ScrollbarAnimationControllerClient* client, 17 ScrollbarAnimationControllerClient* client,
18 base::TimeDelta delay_before_starting, 18 base::TimeDelta fade_out_delay,
19 base::TimeDelta resize_delay_before_starting, 19 base::TimeDelta fade_out_resize_delay,
20 base::TimeDelta fade_duration) { 20 base::TimeDelta fade_out_duration) {
21 return base::WrapUnique(new ScrollbarAnimationController( 21 return base::WrapUnique(new ScrollbarAnimationController(
22 scroll_layer_id, client, delay_before_starting, 22 scroll_layer_id, client, fade_out_delay, fade_out_resize_delay,
23 resize_delay_before_starting, fade_duration)); 23 fade_out_duration));
24 } 24 }
25 25
26 std::unique_ptr<ScrollbarAnimationController> 26 std::unique_ptr<ScrollbarAnimationController>
27 ScrollbarAnimationController::CreateScrollbarAnimationControllerAuraOverlay( 27 ScrollbarAnimationController::CreateScrollbarAnimationControllerAuraOverlay(
28 int scroll_layer_id, 28 int scroll_layer_id,
29 ScrollbarAnimationControllerClient* client, 29 ScrollbarAnimationControllerClient* client,
30 base::TimeDelta delay_before_starting, 30 base::TimeDelta show_delay,
31 base::TimeDelta resize_delay_before_starting, 31 base::TimeDelta fade_out_delay,
32 base::TimeDelta fade_duration, 32 base::TimeDelta fade_out_resize_delay,
33 base::TimeDelta fade_out_duration,
33 base::TimeDelta thinning_duration) { 34 base::TimeDelta thinning_duration) {
34 return base::WrapUnique(new ScrollbarAnimationController( 35 return base::WrapUnique(new ScrollbarAnimationController(
35 scroll_layer_id, client, delay_before_starting, 36 scroll_layer_id, client, show_delay, fade_out_delay,
36 resize_delay_before_starting, fade_duration, thinning_duration)); 37 fade_out_resize_delay, fade_out_duration, thinning_duration));
37 } 38 }
38 39
39 ScrollbarAnimationController::ScrollbarAnimationController( 40 ScrollbarAnimationController::ScrollbarAnimationController(
40 int scroll_layer_id, 41 int scroll_layer_id,
41 ScrollbarAnimationControllerClient* client, 42 ScrollbarAnimationControllerClient* client,
42 base::TimeDelta delay_before_starting, 43 base::TimeDelta fade_out_delay,
43 base::TimeDelta resize_delay_before_starting, 44 base::TimeDelta fade_out_resize_delay,
44 base::TimeDelta fade_duration) 45 base::TimeDelta fade_out_duration)
45 : client_(client), 46 : client_(client),
46 delay_before_starting_(delay_before_starting), 47 fade_out_delay_(fade_out_delay),
47 resize_delay_before_starting_(resize_delay_before_starting), 48 fade_out_resize_delay_(fade_out_resize_delay),
49 need_trigger_scrollbar_show_(false),
48 is_animating_(false), 50 is_animating_(false),
49 scroll_layer_id_(scroll_layer_id), 51 scroll_layer_id_(scroll_layer_id),
50 currently_scrolling_(false), 52 currently_scrolling_(false),
51 scroll_gesture_has_scrolled_(false), 53 scroll_gesture_has_scrolled_(false),
52 opacity_(0.0f), 54 opacity_(0.0f),
53 fade_duration_(fade_duration), 55 fade_out_duration_(fade_out_duration),
54 need_thinning_animation_(false), 56 need_thinning_animation_(false),
55 weak_factory_(this) { 57 weak_factory_(this) {
56 ApplyOpacityToScrollbars(0.0f); 58 ApplyOpacityToScrollbars(0.0f);
57 } 59 }
58 60
59 ScrollbarAnimationController::ScrollbarAnimationController( 61 ScrollbarAnimationController::ScrollbarAnimationController(
60 int scroll_layer_id, 62 int scroll_layer_id,
61 ScrollbarAnimationControllerClient* client, 63 ScrollbarAnimationControllerClient* client,
62 base::TimeDelta delay_before_starting, 64 base::TimeDelta show_delay,
63 base::TimeDelta resize_delay_before_starting, 65 base::TimeDelta fade_out_delay,
64 base::TimeDelta fade_duration, 66 base::TimeDelta fade_out_resize_delay,
67 base::TimeDelta fade_out_duration,
65 base::TimeDelta thinning_duration) 68 base::TimeDelta thinning_duration)
66 : client_(client), 69 : client_(client),
67 delay_before_starting_(delay_before_starting), 70 show_delay_(show_delay),
68 resize_delay_before_starting_(resize_delay_before_starting), 71 fade_out_delay_(fade_out_delay),
72 fade_out_resize_delay_(fade_out_resize_delay),
73 need_trigger_scrollbar_show_(false),
69 is_animating_(false), 74 is_animating_(false),
70 scroll_layer_id_(scroll_layer_id), 75 scroll_layer_id_(scroll_layer_id),
71 currently_scrolling_(false), 76 currently_scrolling_(false),
72 scroll_gesture_has_scrolled_(false), 77 scroll_gesture_has_scrolled_(false),
73 opacity_(0.0f), 78 opacity_(0.0f),
74 fade_duration_(fade_duration), 79 fade_out_duration_(fade_out_duration),
75 need_thinning_animation_(true), 80 need_thinning_animation_(true),
76 weak_factory_(this) { 81 weak_factory_(this) {
77 vertical_controller_ = SingleScrollbarAnimationControllerThinning::Create( 82 vertical_controller_ = SingleScrollbarAnimationControllerThinning::Create(
78 scroll_layer_id, ScrollbarOrientation::VERTICAL, client, 83 scroll_layer_id, ScrollbarOrientation::VERTICAL, client,
79 thinning_duration); 84 thinning_duration);
80 horizontal_controller_ = SingleScrollbarAnimationControllerThinning::Create( 85 horizontal_controller_ = SingleScrollbarAnimationControllerThinning::Create(
81 scroll_layer_id, ScrollbarOrientation::HORIZONTAL, client, 86 scroll_layer_id, ScrollbarOrientation::HORIZONTAL, client,
82 thinning_duration); 87 thinning_duration);
83 ApplyOpacityToScrollbars(0.0f); 88 ApplyOpacityToScrollbars(0.0f);
84 } 89 }
85 90
86 ScrollbarAnimationController::~ScrollbarAnimationController() {} 91 ScrollbarAnimationController::~ScrollbarAnimationController() {}
87 92
88 ScrollbarSet ScrollbarAnimationController::Scrollbars() const { 93 ScrollbarSet ScrollbarAnimationController::Scrollbars() const {
89 return client_->ScrollbarsFor(scroll_layer_id_); 94 return client_->ScrollbarsFor(scroll_layer_id_);
90 } 95 }
91 96
92 SingleScrollbarAnimationControllerThinning& 97 SingleScrollbarAnimationControllerThinning&
93 ScrollbarAnimationController::GetScrollbarAnimationController( 98 ScrollbarAnimationController::GetScrollbarAnimationController(
94 ScrollbarOrientation orientation) const { 99 ScrollbarOrientation orientation) const {
95 DCHECK(need_thinning_animation_); 100 DCHECK(need_thinning_animation_);
96 if (orientation == ScrollbarOrientation::VERTICAL) 101 if (orientation == ScrollbarOrientation::VERTICAL)
97 return *(vertical_controller_.get()); 102 return *(vertical_controller_.get());
98 else 103 else
99 return *(horizontal_controller_.get()); 104 return *(horizontal_controller_.get());
100 } 105 }
101 106
102 void ScrollbarAnimationController::StartAnimation() { 107 void ScrollbarAnimationController::StartAnimation() {
103 delayed_scrollbar_fade_.Cancel(); 108 delayed_scrollbar_show_.Cancel();
109 delayed_scrollbar_fade_out_.Cancel();
104 is_animating_ = true; 110 is_animating_ = true;
105 last_awaken_time_ = base::TimeTicks(); 111 last_awaken_time_ = base::TimeTicks();
106 client_->SetNeedsAnimateForScrollbarAnimation(); 112 client_->SetNeedsAnimateForScrollbarAnimation();
107 } 113 }
108 114
109 void ScrollbarAnimationController::StopAnimation() { 115 void ScrollbarAnimationController::StopAnimation() {
110 delayed_scrollbar_fade_.Cancel(); 116 delayed_scrollbar_show_.Cancel();
117 delayed_scrollbar_fade_out_.Cancel();
111 is_animating_ = false; 118 is_animating_ = false;
112 } 119 }
113 120
114 void ScrollbarAnimationController::PostDelayedAnimationTask(bool on_resize) { 121 void ScrollbarAnimationController::PostDelayedShow() {
115 base::TimeDelta delay = 122 DCHECK(delayed_scrollbar_fade_out_.IsCancelled());
116 on_resize ? resize_delay_before_starting_ : delay_before_starting_; 123 delayed_scrollbar_show_.Reset(base::Bind(&ScrollbarAnimationController::Show,
117 delayed_scrollbar_fade_.Reset( 124 weak_factory_.GetWeakPtr()));
125 client_->PostDelayedScrollbarAnimationTask(delayed_scrollbar_show_.callback(),
126 show_delay_);
127 }
128
129 void ScrollbarAnimationController::PostDelayedFadeOut(bool on_resize) {
130 DCHECK(delayed_scrollbar_show_.IsCancelled());
131 base::TimeDelta delay = on_resize ? fade_out_resize_delay_ : fade_out_delay_;
132 delayed_scrollbar_fade_out_.Reset(
118 base::Bind(&ScrollbarAnimationController::StartAnimation, 133 base::Bind(&ScrollbarAnimationController::StartAnimation,
119 weak_factory_.GetWeakPtr())); 134 weak_factory_.GetWeakPtr()));
120 client_->PostDelayedScrollbarAnimationTask(delayed_scrollbar_fade_.callback(), 135 client_->PostDelayedScrollbarAnimationTask(
121 delay); 136 delayed_scrollbar_fade_out_.callback(), delay);
122 } 137 }
123 138
124 bool ScrollbarAnimationController::Animate(base::TimeTicks now) { 139 bool ScrollbarAnimationController::Animate(base::TimeTicks now) {
125 bool animated = false; 140 bool animated = false;
126 141
127 if (is_animating_) { 142 if (is_animating_) {
128 if (last_awaken_time_.is_null()) 143 if (last_awaken_time_.is_null())
129 last_awaken_time_ = now; 144 last_awaken_time_ = now;
130 145
131 float progress = AnimationProgressAtTime(now); 146 float progress = AnimationProgressAtTime(now);
132 RunAnimationFrame(progress); 147 RunAnimationFrame(progress);
133 148
134 if (is_animating_) 149 if (is_animating_)
135 client_->SetNeedsAnimateForScrollbarAnimation(); 150 client_->SetNeedsAnimateForScrollbarAnimation();
136 animated = true; 151 animated = true;
137 } 152 }
138 153
139 if (need_thinning_animation_) { 154 if (need_thinning_animation_) {
140 animated |= vertical_controller_->Animate(now); 155 animated |= vertical_controller_->Animate(now);
141 animated |= horizontal_controller_->Animate(now); 156 animated |= horizontal_controller_->Animate(now);
142 } 157 }
143 158
144 return animated; 159 return animated;
145 } 160 }
146 161
147 float ScrollbarAnimationController::AnimationProgressAtTime( 162 float ScrollbarAnimationController::AnimationProgressAtTime(
148 base::TimeTicks now) { 163 base::TimeTicks now) {
149 base::TimeDelta delta = now - last_awaken_time_; 164 base::TimeDelta delta = now - last_awaken_time_;
150 float progress = delta.InSecondsF() / fade_duration_.InSecondsF(); 165 float progress = delta.InSecondsF() / fade_out_duration_.InSecondsF();
151 return std::max(std::min(progress, 1.f), 0.f); 166 return std::max(std::min(progress, 1.f), 0.f);
152 } 167 }
153 168
154 void ScrollbarAnimationController::DidScrollBegin() { 169 void ScrollbarAnimationController::DidScrollBegin() {
155 currently_scrolling_ = true; 170 currently_scrolling_ = true;
156 } 171 }
157 172
158 void ScrollbarAnimationController::RunAnimationFrame(float progress) { 173 void ScrollbarAnimationController::RunAnimationFrame(float progress) {
159 ApplyOpacityToScrollbars(1.f - progress); 174 ApplyOpacityToScrollbars(1.f - progress);
160 client_->SetNeedsRedrawForScrollbarAnimation(); 175 client_->SetNeedsRedrawForScrollbarAnimation();
161 if (progress == 1.f) 176 if (progress == 1.f)
162 StopAnimation(); 177 StopAnimation();
163 } 178 }
164 179
165 void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) { 180 void ScrollbarAnimationController::DidScrollUpdate(bool on_resize) {
166 if (need_thinning_animation_ && Captured()) 181 if (need_thinning_animation_ && Captured())
167 return; 182 return;
168 183
169 StopAnimation(); 184 StopAnimation();
170 185
171 // As an optimization, we avoid spamming fade delay tasks during active fast 186 // As an optimization, we avoid spamming fade delay tasks during active fast
172 // scrolls. But if we're not within one, we need to post every scroll update. 187 // scrolls. But if we're not within one, we need to post every scroll update.
173 if (!currently_scrolling_) { 188 if (!currently_scrolling_) {
174 // We don't fade out scrollbar if they need thinning animation and mouse is 189 // We don't fade out scrollbar if they need thinning animation and mouse is
175 // near. 190 // near.
176 if (!need_thinning_animation_ || !mouse_is_near_any_scrollbar()) 191 if (!need_thinning_animation_ || !mouse_is_near_any_scrollbar())
177 PostDelayedAnimationTask(on_resize); 192 PostDelayedFadeOut(on_resize);
178 } else { 193 } else {
179 scroll_gesture_has_scrolled_ = true; 194 scroll_gesture_has_scrolled_ = true;
180 } 195 }
181 196
182 ApplyOpacityToScrollbars(1); 197 Show();
183 198
184 if (need_thinning_animation_) { 199 if (need_thinning_animation_) {
185 vertical_controller_->UpdateThumbThicknessScale(); 200 vertical_controller_->UpdateThumbThicknessScale();
186 horizontal_controller_->UpdateThumbThicknessScale(); 201 horizontal_controller_->UpdateThumbThicknessScale();
187 } 202 }
188 } 203 }
189 204
190 void ScrollbarAnimationController::DidScrollEnd() { 205 void ScrollbarAnimationController::DidScrollEnd() {
191 bool has_scrolled = scroll_gesture_has_scrolled_; 206 bool has_scrolled = scroll_gesture_has_scrolled_;
192 scroll_gesture_has_scrolled_ = false; 207 scroll_gesture_has_scrolled_ = false;
193 208
194 currently_scrolling_ = false; 209 currently_scrolling_ = false;
195 210
196 // We don't fade out scrollbar if they need thinning animation and mouse is 211 // We don't fade out scrollbar if they need thinning animation and mouse is
197 // near. 212 // near.
198 if (need_thinning_animation_ && mouse_is_near_any_scrollbar()) 213 if (need_thinning_animation_ && mouse_is_near_any_scrollbar())
199 return; 214 return;
200 215
201 if (has_scrolled) 216 if (has_scrolled)
202 PostDelayedAnimationTask(false); 217 PostDelayedFadeOut(false);
203 } 218 }
204 219
205 void ScrollbarAnimationController::DidMouseDown() { 220 void ScrollbarAnimationController::DidMouseDown() {
206 if (!need_thinning_animation_ || ScrollbarsHidden()) 221 if (!need_thinning_animation_ || ScrollbarsHidden())
207 return; 222 return;
208 223
209 vertical_controller_->DidMouseDown(); 224 vertical_controller_->DidMouseDown();
210 horizontal_controller_->DidMouseDown(); 225 horizontal_controller_->DidMouseDown();
211 } 226 }
212 227
213 void ScrollbarAnimationController::DidMouseUp() { 228 void ScrollbarAnimationController::DidMouseUp() {
214 if (!need_thinning_animation_) 229 if (!need_thinning_animation_)
215 return; 230 return;
216 231
217 vertical_controller_->DidMouseUp(); 232 vertical_controller_->DidMouseUp();
218 horizontal_controller_->DidMouseUp(); 233 horizontal_controller_->DidMouseUp();
219 234
220 if (!mouse_is_near_any_scrollbar()) 235 if (!mouse_is_near_any_scrollbar())
221 PostDelayedAnimationTask(false); 236 PostDelayedFadeOut(false);
222 } 237 }
223 238
224 void ScrollbarAnimationController::DidMouseLeave() { 239 void ScrollbarAnimationController::DidMouseLeave() {
225 if (!need_thinning_animation_) 240 if (!need_thinning_animation_)
226 return; 241 return;
227 242
228 vertical_controller_->DidMouseLeave(); 243 vertical_controller_->DidMouseLeave();
229 horizontal_controller_->DidMouseLeave(); 244 horizontal_controller_->DidMouseLeave();
230 245
231 if (ScrollbarsHidden() || Captured()) 246 if (ScrollbarsHidden() || Captured())
232 return; 247 return;
233 248
234 PostDelayedAnimationTask(false); 249 PostDelayedFadeOut(false);
235 } 250 }
236 251
237 void ScrollbarAnimationController::DidMouseMoveNear( 252 void ScrollbarAnimationController::DidMouseMoveNear(
238 ScrollbarOrientation orientation, 253 ScrollbarOrientation orientation,
239 float distance) { 254 float distance) {
240 if (!need_thinning_animation_) 255 if (!need_thinning_animation_)
241 return; 256 return;
242 257
258 bool need_trigger_scrollbar_show_before = need_trigger_scrollbar_show_;
259
243 GetScrollbarAnimationController(orientation).DidMouseMoveNear(distance); 260 GetScrollbarAnimationController(orientation).DidMouseMoveNear(distance);
244 261
245 if (ScrollbarsHidden() || Captured()) 262 need_trigger_scrollbar_show_ =
263 CalcNeedTriggerScrollbarShow(orientation, distance);
264
265 if (Captured())
246 return; 266 return;
247 267
248 if (mouse_is_near_any_scrollbar()) { 268 if (ScrollbarsHidden()) {
249 ApplyOpacityToScrollbars(1); 269 if (need_trigger_scrollbar_show_before != need_trigger_scrollbar_show_) {
250 StopAnimation(); 270 if (need_trigger_scrollbar_show_) {
251 } else if (!is_animating_) { 271 PostDelayedShow();
252 PostDelayedAnimationTask(false); 272 } else {
273 delayed_scrollbar_show_.Cancel();
274 }
275 }
276 } else {
277 if (mouse_is_near_any_scrollbar()) {
278 Show();
279 StopAnimation();
280 } else if (!is_animating_) {
281 PostDelayedFadeOut(false);
282 }
253 } 283 }
254 } 284 }
255 285
286 bool ScrollbarAnimationController::CalcNeedTriggerScrollbarShow(
287 ScrollbarOrientation orientation,
288 float distance) const {
289 DCHECK(need_thinning_animation_);
290
291 if (vertical_controller_->mouse_is_over_scrollbar() ||
292 horizontal_controller_->mouse_is_over_scrollbar())
293 return true;
294
295 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
296 if (scrollbar->orientation() != orientation)
297 continue;
298
299 if (distance <
300 (kMouseMoveDistanceToTriggerShow - scrollbar->ThumbThickness()))
301 return true;
302 }
303
304 return false;
305 }
306
256 bool ScrollbarAnimationController::mouse_is_over_scrollbar( 307 bool ScrollbarAnimationController::mouse_is_over_scrollbar(
257 ScrollbarOrientation orientation) const { 308 ScrollbarOrientation orientation) const {
258 DCHECK(need_thinning_animation_); 309 DCHECK(need_thinning_animation_);
259 return GetScrollbarAnimationController(orientation).mouse_is_over_scrollbar(); 310 return GetScrollbarAnimationController(orientation).mouse_is_over_scrollbar();
260 } 311 }
261 312
262 bool ScrollbarAnimationController::mouse_is_near_scrollbar( 313 bool ScrollbarAnimationController::mouse_is_near_scrollbar(
263 ScrollbarOrientation orientation) const { 314 ScrollbarOrientation orientation) const {
264 DCHECK(need_thinning_animation_); 315 DCHECK(need_thinning_animation_);
265 return GetScrollbarAnimationController(orientation).mouse_is_near_scrollbar(); 316 return GetScrollbarAnimationController(orientation).mouse_is_near_scrollbar();
266 } 317 }
267 318
268 bool ScrollbarAnimationController::mouse_is_near_any_scrollbar() const { 319 bool ScrollbarAnimationController::mouse_is_near_any_scrollbar() const {
269 DCHECK(need_thinning_animation_); 320 DCHECK(need_thinning_animation_);
270 return vertical_controller_->mouse_is_near_scrollbar() || 321 return vertical_controller_->mouse_is_near_scrollbar() ||
271 horizontal_controller_->mouse_is_near_scrollbar(); 322 horizontal_controller_->mouse_is_near_scrollbar();
272 } 323 }
273 324
274 bool ScrollbarAnimationController::ScrollbarsHidden() const { 325 bool ScrollbarAnimationController::ScrollbarsHidden() const {
275 return opacity_ == 0.0f; 326 return opacity_ == 0.0f;
276 } 327 }
277 328
278 bool ScrollbarAnimationController::Captured() const { 329 bool ScrollbarAnimationController::Captured() const {
279 DCHECK(need_thinning_animation_); 330 DCHECK(need_thinning_animation_);
280 return vertical_controller_->captured() || horizontal_controller_->captured(); 331 return vertical_controller_->captured() || horizontal_controller_->captured();
281 } 332 }
282 333
334 void ScrollbarAnimationController::Show() {
335 ApplyOpacityToScrollbars(1.0f);
336 }
337
283 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) { 338 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) {
284 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { 339 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
285 if (!scrollbar->is_overlay_scrollbar()) 340 if (!scrollbar->is_overlay_scrollbar())
286 continue; 341 continue;
287 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0; 342 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0;
288 PropertyTrees* property_trees = 343 PropertyTrees* property_trees =
289 scrollbar->layer_tree_impl()->property_trees(); 344 scrollbar->layer_tree_impl()->property_trees();
290 // If this method is called during LayerImpl::PushPropertiesTo, we may not 345 // If this method is called during LayerImpl::PushPropertiesTo, we may not
291 // yet have valid layer_id_to_effect_node_index entries as property trees 346 // yet have valid layer_id_to_effect_node_index entries as property trees
292 // are pushed after layers during activation. We can skip updating opacity 347 // are pushed after layers during activation. We can skip updating opacity
(...skipping 11 matching lines...) Expand all
304 bool previouslyVisible = opacity_ > 0.0f; 359 bool previouslyVisible = opacity_ > 0.0f;
305 bool currentlyVisible = opacity > 0.0f; 360 bool currentlyVisible = opacity > 0.0f;
306 361
307 opacity_ = opacity; 362 opacity_ = opacity;
308 363
309 if (previouslyVisible != currentlyVisible) 364 if (previouslyVisible != currentlyVisible)
310 client_->DidChangeScrollbarVisibility(); 365 client_->DidChangeScrollbarVisibility();
311 } 366 }
312 367
313 } // namespace cc 368 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller.h ('k') | cc/input/scrollbar_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698