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

Side by Side Diff: cc/animation/scrollbar_animation_controller_linear_fade.cc

Issue 640063002: Hide scrollbars when their dimensions are not scrollable. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Hide scrollbar by setting opacity to 0 Created 6 years, 2 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/animation/scrollbar_animation_controller_thinning.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/animation/scrollbar_animation_controller_linear_fade.h" 5 #include "cc/animation/scrollbar_animation_controller_linear_fade.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/layers/scrollbar_layer_impl_base.h" 9 #include "cc/layers/scrollbar_layer_impl_base.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars( 55 void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars(
56 float opacity) { 56 float opacity) {
57 if (!scroll_layer_->scrollbars()) 57 if (!scroll_layer_->scrollbars())
58 return; 58 return;
59 59
60 LayerImpl::ScrollbarSet* scrollbars = scroll_layer_->scrollbars(); 60 LayerImpl::ScrollbarSet* scrollbars = scroll_layer_->scrollbars();
61 for (LayerImpl::ScrollbarSet::iterator it = scrollbars->begin(); 61 for (LayerImpl::ScrollbarSet::iterator it = scrollbars->begin();
62 it != scrollbars->end(); 62 it != scrollbars->end();
63 ++it) { 63 ++it) {
64 ScrollbarLayerImplBase* scrollbar = *it; 64 ScrollbarLayerImplBase* scrollbar = *it;
65 if (scrollbar->is_overlay_scrollbar()) 65 if (scrollbar->is_overlay_scrollbar()) {
66 scrollbar->SetOpacity(opacity); 66 bool visible = scroll_layer_->user_scrollable(scrollbar->orientation()) &&
aelias_OOO_until_Jul13 2014/10/13 18:30:03 How about moving this logic to a method on Scrollb
67 scrollbar->maximum() > 0;
68 scrollbar->SetOpacity(visible ? opacity : 0);
69 }
67 } 70 }
68 } 71 }
69 72
70 } // namespace cc 73 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/animation/scrollbar_animation_controller_thinning.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698