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

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

Issue 2422353002: Iframe/div MD scrollbars get idle when mouse leaves the nested elements. (Closed)
Patch Set: Unittest passes asan build bot. Created 4 years, 1 month 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 } 78 }
79 79
80 const base::TimeDelta& ScrollbarAnimationControllerThinning::Duration() { 80 const base::TimeDelta& ScrollbarAnimationControllerThinning::Duration() {
81 if (current_animating_property_ == OPACITY) 81 if (current_animating_property_ == OPACITY)
82 return fade_duration_; 82 return fade_duration_;
83 else 83 else
84 return thinning_duration_; 84 return thinning_duration_;
85 } 85 }
86 86
87 void ScrollbarAnimationControllerThinning::DidCaptureScrollbarBegin() { 87 void ScrollbarAnimationControllerThinning::DidMouseDown() {
88 if (opacity_ == 0.0f) 88 if (!mouse_is_over_scrollbar_ || opacity_ == 0.0f)
89 return; 89 return;
90
90 StopAnimation(); 91 StopAnimation();
91 captured_ = true; 92 captured_ = true;
92 ApplyOpacity(1.f); 93 ApplyOpacity(1.f);
93 ApplyThumbThicknessScale(1.f); 94 ApplyThumbThicknessScale(1.f);
94 } 95 }
95 96
96 void ScrollbarAnimationControllerThinning::DidCaptureScrollbarEnd() { 97 void ScrollbarAnimationControllerThinning::DidMouseUp() {
97 if (opacity_ == 0.0f) 98 if (!captured_ || opacity_ == 0.0f)
98 return; 99 return;
100
99 captured_ = false; 101 captured_ = false;
100 StopAnimation(); 102 StopAnimation();
101 103
102 if (!mouse_is_near_scrollbar_) { 104 if (!mouse_is_near_scrollbar_) {
103 SetCurrentAnimatingProperty(THICKNESS); 105 SetCurrentAnimatingProperty(THICKNESS);
104 thickness_change_ = DECREASE; 106 thickness_change_ = DECREASE;
105 StartAnimation(); 107 StartAnimation();
106 } else { 108 } else {
107 SetCurrentAnimatingProperty(OPACITY); 109 SetCurrentAnimatingProperty(OPACITY);
108 PostDelayedAnimationTask(false); 110 PostDelayedAnimationTask(false);
109 } 111 }
110 } 112 }
111 113
112 void ScrollbarAnimationControllerThinning::DidMouseMoveOffScrollbar() { 114 void ScrollbarAnimationControllerThinning::DidMouseLeave() {
113 if (!mouse_is_over_scrollbar_ && !mouse_is_near_scrollbar_) 115 if (!mouse_is_over_scrollbar_ && !mouse_is_near_scrollbar_)
114 return; 116 return;
115 117
116 mouse_is_over_scrollbar_ = false; 118 mouse_is_over_scrollbar_ = false;
117 mouse_is_near_scrollbar_ = false; 119 mouse_is_near_scrollbar_ = false;
118 120
119 if (captured_ || opacity_ == 0.0f) 121 if (captured_ || opacity_ == 0.0f)
120 return; 122 return;
121 123
122 thickness_change_ = DECREASE; 124 thickness_change_ = DECREASE;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (current_animating_property_ == property) 233 if (current_animating_property_ == property)
232 return; 234 return;
233 235
234 StopAnimation(); 236 StopAnimation();
235 current_animating_property_ = property; 237 current_animating_property_ = property;
236 if (current_animating_property_ == THICKNESS) 238 if (current_animating_property_ == THICKNESS)
237 ApplyOpacity(1.f); 239 ApplyOpacity(1.f);
238 } 240 }
239 241
240 } // namespace cc 242 } // 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