| 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/top_controls_manager.h" | 5 #include "cc/input/top_controls_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 void TopControlsManager::ScrollBegin() { | 93 void TopControlsManager::ScrollBegin() { |
| 94 DCHECK(!pinch_gesture_active_); | 94 DCHECK(!pinch_gesture_active_); |
| 95 ResetAnimations(); | 95 ResetAnimations(); |
| 96 current_scroll_delta_ = 0.f; | 96 current_scroll_delta_ = 0.f; |
| 97 controls_scroll_begin_offset_ = controls_top_offset_; | 97 controls_scroll_begin_offset_ = controls_top_offset_; |
| 98 } | 98 } |
| 99 | 99 |
| 100 gfx::Vector2dF TopControlsManager::ScrollBy( | 100 gfx::Vector2dF TopControlsManager::ScrollBy( |
| 101 const gfx::Vector2dF pending_delta) { | 101 const gfx::Vector2dF& pending_delta) { |
| 102 if (pinch_gesture_active_) | 102 if (pinch_gesture_active_) |
| 103 return pending_delta; | 103 return pending_delta; |
| 104 | 104 |
| 105 if (permitted_state_ == SHOWN && pending_delta.y() > 0) | 105 if (permitted_state_ == SHOWN && pending_delta.y() > 0) |
| 106 return pending_delta; | 106 return pending_delta; |
| 107 else if (permitted_state_ == HIDDEN && pending_delta.y() < 0) | 107 else if (permitted_state_ == HIDDEN && pending_delta.y() < 0) |
| 108 return pending_delta; | 108 return pending_delta; |
| 109 | 109 |
| 110 current_scroll_delta_ += pending_delta.y(); | 110 current_scroll_delta_ += pending_delta.y(); |
| 111 | 111 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 243 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
| 244 (animation_direction_ == HIDING_CONTROLS | 244 (animation_direction_ == HIDING_CONTROLS |
| 245 && new_offset <= -top_controls_height_)) { | 245 && new_offset <= -top_controls_height_)) { |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 return false; | 248 return false; |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace cc | 251 } // namespace cc |
| OLD | NEW |