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

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

Issue 2384053002: cancel overlay-scrollbar hover state when moving pointer out of window for ChromeOS (Closed)
Patch Set: remove fix for not chromeos Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_thinning.h" 5 #include "cc/input/scrollbar_animation_controller_thinning.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/layers/scrollbar_layer_impl_base.h" 10 #include "cc/layers/scrollbar_layer_impl_base.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 if (mouse_is_near_scrollbar_ != mouse_is_near_scrollbar) { 128 if (mouse_is_near_scrollbar_ != mouse_is_near_scrollbar) {
129 mouse_is_near_scrollbar_ = mouse_is_near_scrollbar; 129 mouse_is_near_scrollbar_ = mouse_is_near_scrollbar;
130 thickness_change_ = mouse_is_near_scrollbar_ ? INCREASE : DECREASE; 130 thickness_change_ = mouse_is_near_scrollbar_ ? INCREASE : DECREASE;
131 } 131 }
132 132
133 StartAnimation(); 133 StartAnimation();
134 } 134 }
135 } 135 }
136 136
137 void ScrollbarAnimationControllerThinning::DidMouseLeave() {
138 if (captured_)
139 return;
140
141 if (mouse_is_over_scrollbar_) {
142 mouse_is_over_scrollbar_ = false;
143 opacity_change_ = DECREASE;
dtapuska 2016/10/04 20:16:22 Is it possible that the mouse_is_over_scrollbar_ a
chaopeng 2016/10/04 20:48:10 I have a issue have, should move StartAnimation ou
144 }
145
146 if (mouse_is_near_scrollbar_) {
147 mouse_is_near_scrollbar_ = false;
148 thickness_change_ = DECREASE;
149
150 StartAnimation();
151 }
152 }
153
137 float ScrollbarAnimationControllerThinning::OpacityAtAnimationProgress( 154 float ScrollbarAnimationControllerThinning::OpacityAtAnimationProgress(
138 float progress) { 155 float progress) {
139 if (opacity_change_ == NONE) 156 if (opacity_change_ == NONE)
140 return mouse_is_over_scrollbar_ ? 1.f : kIdleOpacity; 157 return mouse_is_over_scrollbar_ ? 1.f : kIdleOpacity;
141 float factor = opacity_change_ == INCREASE ? progress : (1.f - progress); 158 float factor = opacity_change_ == INCREASE ? progress : (1.f - progress);
142 float ret = ((1.f - kIdleOpacity) * factor) + kIdleOpacity; 159 float ret = ((1.f - kIdleOpacity) * factor) + kIdleOpacity;
143 return ret; 160 return ret;
144 } 161 }
145 162
146 float ScrollbarAnimationControllerThinning:: 163 float ScrollbarAnimationControllerThinning::
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 property_trees->effect_id_to_index_map[scrollbar->id()], 213 property_trees->effect_id_to_index_map[scrollbar->id()],
197 scrollbar->layer_tree_impl()); 214 scrollbar->layer_tree_impl());
198 } 215 }
199 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( 216 scrollbar->SetThumbThicknessScaleFactor(AdjustScale(
200 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), 217 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(),
201 thickness_change_, kIdleThicknessScale, 1)); 218 thickness_change_, kIdleThicknessScale, 1));
202 } 219 }
203 } 220 }
204 221
205 } // namespace cc 222 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/scrollbar_animation_controller_thinning.h ('k') | cc/input/scrollbar_animation_controller_thinning_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698