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

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

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, 207 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
208 scrollbar->id())) { 208 scrollbar->id())) {
209 property_trees->effect_tree.OnOpacityAnimated( 209 property_trees->effect_tree.OnOpacityAnimated(
210 effective_opacity, 210 effective_opacity,
211 property_trees->effect_id_to_index_map[scrollbar->id()], 211 property_trees->effect_id_to_index_map[scrollbar->id()],
212 scrollbar->layer_tree_impl()); 212 scrollbar->layer_tree_impl());
213 } 213 }
214 } 214 }
215 215
216 opacity_ = opacity; 216 opacity_ = opacity;
217
218 if (opacity_ == 0.0f || opacity_ == 1.0f)
aelias_OOO_until_Jul13 2016/10/26 19:01:03 I think this if statement could just be removed wi
bokan 2016/10/27 20:56:46 Done.
219 client_->SetScrollbarsHidden(scroll_layer_id_, opacity_ == 0.0f);
217 } 220 }
218 221
219 void ScrollbarAnimationControllerThinning::ApplyThumbThicknessScale( 222 void ScrollbarAnimationControllerThinning::ApplyThumbThicknessScale(
220 float thumb_thickness_scale) { 223 float thumb_thickness_scale) {
221 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { 224 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
222 if (!scrollbar->is_overlay_scrollbar()) 225 if (!scrollbar->is_overlay_scrollbar())
223 continue; 226 continue;
224 227
225 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( 228 scrollbar->SetThumbThicknessScaleFactor(AdjustScale(
226 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), 229 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(),
227 thickness_change_, kIdleThicknessScale, 1)); 230 thickness_change_, kIdleThicknessScale, 1));
228 } 231 }
229 } 232 }
230 233
231 void ScrollbarAnimationControllerThinning::SetCurrentAnimatingProperty( 234 void ScrollbarAnimationControllerThinning::SetCurrentAnimatingProperty(
232 AnimatingProperty property) { 235 AnimatingProperty property) {
233 if (current_animating_property_ == property) 236 if (current_animating_property_ == property)
234 return; 237 return;
235 238
236 StopAnimation(); 239 StopAnimation();
237 current_animating_property_ = property; 240 current_animating_property_ = property;
238 if (current_animating_property_ == THICKNESS) 241 if (current_animating_property_ == THICKNESS)
239 ApplyOpacity(1.f); 242 ApplyOpacity(1.f);
240 } 243 }
241 244
242 } // namespace cc 245 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698