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

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: 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 bool ScrollbarAnimationControllerThinning::MouseIsNearScrollbar() {
138 return mouse_is_near_scrollbar_;
139 }
140
137 float ScrollbarAnimationControllerThinning::OpacityAtAnimationProgress( 141 float ScrollbarAnimationControllerThinning::OpacityAtAnimationProgress(
138 float progress) { 142 float progress) {
139 if (opacity_change_ == NONE) 143 if (opacity_change_ == NONE)
140 return mouse_is_over_scrollbar_ ? 1.f : kIdleOpacity; 144 return mouse_is_over_scrollbar_ ? 1.f : kIdleOpacity;
141 float factor = opacity_change_ == INCREASE ? progress : (1.f - progress); 145 float factor = opacity_change_ == INCREASE ? progress : (1.f - progress);
142 float ret = ((1.f - kIdleOpacity) * factor) + kIdleOpacity; 146 float ret = ((1.f - kIdleOpacity) * factor) + kIdleOpacity;
143 return ret; 147 return ret;
144 } 148 }
145 149
146 float ScrollbarAnimationControllerThinning:: 150 float ScrollbarAnimationControllerThinning::
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 property_trees->effect_id_to_index_map[scrollbar->id()], 200 property_trees->effect_id_to_index_map[scrollbar->id()],
197 scrollbar->layer_tree_impl()); 201 scrollbar->layer_tree_impl());
198 } 202 }
199 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( 203 scrollbar->SetThumbThicknessScaleFactor(AdjustScale(
200 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), 204 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(),
201 thickness_change_, kIdleThicknessScale, 1)); 205 thickness_change_, kIdleThicknessScale, 1));
202 } 206 }
203 } 207 }
204 208
205 } // namespace cc 209 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698