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

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

Issue 2735603002: Call delay_show Cancel in ScrollbarAnimationControlller::Show (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller_unittest.cc » ('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 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"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 PostDelayedFadeOut(false); 236 PostDelayedFadeOut(false);
237 } 237 }
238 238
239 void ScrollbarAnimationController::DidMouseLeave() { 239 void ScrollbarAnimationController::DidMouseLeave() {
240 if (!need_thinning_animation_) 240 if (!need_thinning_animation_)
241 return; 241 return;
242 242
243 vertical_controller_->DidMouseLeave(); 243 vertical_controller_->DidMouseLeave();
244 horizontal_controller_->DidMouseLeave(); 244 horizontal_controller_->DidMouseLeave();
245 245
246 delayed_scrollbar_show_.Cancel();
247
246 if (ScrollbarsHidden() || Captured()) 248 if (ScrollbarsHidden() || Captured())
247 return; 249 return;
248 250
249 PostDelayedFadeOut(false); 251 PostDelayedFadeOut(false);
250 } 252 }
251 253
252 void ScrollbarAnimationController::DidMouseMoveNear( 254 void ScrollbarAnimationController::DidMouseMoveNear(
253 ScrollbarOrientation orientation, 255 ScrollbarOrientation orientation,
254 float distance) { 256 float distance) {
255 if (!need_thinning_animation_) 257 if (!need_thinning_animation_)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 bool ScrollbarAnimationController::ScrollbarsHidden() const { 327 bool ScrollbarAnimationController::ScrollbarsHidden() const {
326 return opacity_ == 0.0f; 328 return opacity_ == 0.0f;
327 } 329 }
328 330
329 bool ScrollbarAnimationController::Captured() const { 331 bool ScrollbarAnimationController::Captured() const {
330 DCHECK(need_thinning_animation_); 332 DCHECK(need_thinning_animation_);
331 return vertical_controller_->captured() || horizontal_controller_->captured(); 333 return vertical_controller_->captured() || horizontal_controller_->captured();
332 } 334 }
333 335
334 void ScrollbarAnimationController::Show() { 336 void ScrollbarAnimationController::Show() {
337 delayed_scrollbar_show_.Cancel();
335 ApplyOpacityToScrollbars(1.0f); 338 ApplyOpacityToScrollbars(1.0f);
336 } 339 }
337 340
338 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) { 341 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) {
339 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { 342 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
340 if (!scrollbar->is_overlay_scrollbar()) 343 if (!scrollbar->is_overlay_scrollbar())
341 continue; 344 continue;
342 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0; 345 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0;
343 PropertyTrees* property_trees = 346 PropertyTrees* property_trees =
344 scrollbar->layer_tree_impl()->property_trees(); 347 scrollbar->layer_tree_impl()->property_trees();
(...skipping 14 matching lines...) Expand all
359 bool previouslyVisible = opacity_ > 0.0f; 362 bool previouslyVisible = opacity_ > 0.0f;
360 bool currentlyVisible = opacity > 0.0f; 363 bool currentlyVisible = opacity > 0.0f;
361 364
362 opacity_ = opacity; 365 opacity_ = opacity;
363 366
364 if (previouslyVisible != currentlyVisible) 367 if (previouslyVisible != currentlyVisible)
365 client_->DidChangeScrollbarVisibility(); 368 client_->DidChangeScrollbarVisibility();
366 } 369 }
367 370
368 } // namespace cc 371 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698