| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 ThumbThicknessScaleAtAnimationProgress(progress); | 59 ThumbThicknessScaleAtAnimationProgress(progress); |
| 60 ApplyOpacityAndThumbThicknessScale(opacity, thumb_thickness_scale); | 60 ApplyOpacityAndThumbThicknessScale(opacity, thumb_thickness_scale); |
| 61 client_->SetNeedsRedrawForScrollbarAnimation(); | 61 client_->SetNeedsRedrawForScrollbarAnimation(); |
| 62 if (progress == 1.f) { | 62 if (progress == 1.f) { |
| 63 opacity_change_ = NONE; | 63 opacity_change_ = NONE; |
| 64 thickness_change_ = NONE; | 64 thickness_change_ = NONE; |
| 65 StopAnimation(); | 65 StopAnimation(); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ScrollbarAnimationControllerThinning::DidCaptureScrollbarBegin() { | 69 void ScrollbarAnimationControllerThinning::DidMouseDown() { |
| 70 if (!mouse_is_over_scrollbar_) |
| 71 return; |
| 72 |
| 70 captured_ = true; | 73 captured_ = true; |
| 71 ApplyOpacityAndThumbThicknessScale(1, 1.f); | 74 ApplyOpacityAndThumbThicknessScale(1, 1.f); |
| 72 } | 75 } |
| 73 | 76 |
| 74 void ScrollbarAnimationControllerThinning::DidCaptureScrollbarEnd() { | 77 void ScrollbarAnimationControllerThinning::DidMouseUp() { |
| 78 if (!captured_) |
| 79 return; |
| 80 |
| 75 captured_ = false; | 81 captured_ = false; |
| 76 | |
| 77 if (!mouse_is_over_scrollbar_) | 82 if (!mouse_is_over_scrollbar_) |
| 78 opacity_change_ = DECREASE; | 83 opacity_change_ = DECREASE; |
| 79 if (!mouse_is_near_scrollbar_) | 84 if (!mouse_is_near_scrollbar_) |
| 80 thickness_change_ = DECREASE; | 85 thickness_change_ = DECREASE; |
| 81 StartAnimation(); | 86 StartAnimation(); |
| 82 } | 87 } |
| 83 | 88 |
| 84 void ScrollbarAnimationControllerThinning::DidMouseMoveOffScrollbar() { | 89 void ScrollbarAnimationControllerThinning::DidMouseMoveOffScrollbar() { |
| 85 if (!mouse_is_over_scrollbar_ && !mouse_is_near_scrollbar_) | 90 if (!mouse_is_over_scrollbar_ && !mouse_is_near_scrollbar_) |
| 86 return; | 91 return; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 property_trees->effect_id_to_index_map[scrollbar->id()], | 204 property_trees->effect_id_to_index_map[scrollbar->id()], |
| 200 scrollbar->layer_tree_impl()); | 205 scrollbar->layer_tree_impl()); |
| 201 } | 206 } |
| 202 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( | 207 scrollbar->SetThumbThicknessScaleFactor(AdjustScale( |
| 203 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), | 208 thumb_thickness_scale, scrollbar->thumb_thickness_scale_factor(), |
| 204 thickness_change_, kIdleThicknessScale, 1)); | 209 thickness_change_, kIdleThicknessScale, 1)); |
| 205 } | 210 } |
| 206 } | 211 } |
| 207 | 212 |
| 208 } // namespace cc | 213 } // namespace cc |
| OLD | NEW |