| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 if (animate) { | 89 if (animate) { |
| 90 SetupAnimation(final_shown_ratio ? SHOWING_CONTROLS : HIDING_CONTROLS); | 90 SetupAnimation(final_shown_ratio ? SHOWING_CONTROLS : HIDING_CONTROLS); |
| 91 } else { | 91 } else { |
| 92 ResetAnimations(); | 92 ResetAnimations(); |
| 93 client_->SetCurrentTopControlsShownRatio(final_shown_ratio); | 93 client_->SetCurrentTopControlsShownRatio(final_shown_ratio); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void TopControlsManager::ScrollBegin() { | 97 void TopControlsManager::ScrollBegin() { |
| 98 DCHECK(!pinch_gesture_active_); | 98 if (pinch_gesture_active_) |
| 99 return; |
| 100 |
| 99 ResetAnimations(); | 101 ResetAnimations(); |
| 100 ResetBaseline(); | 102 ResetBaseline(); |
| 101 } | 103 } |
| 102 | 104 |
| 103 gfx::Vector2dF TopControlsManager::ScrollBy( | 105 gfx::Vector2dF TopControlsManager::ScrollBy( |
| 104 const gfx::Vector2dF& pending_delta) { | 106 const gfx::Vector2dF& pending_delta) { |
| 105 if (!TopControlsHeight()) | 107 if (!TopControlsHeight()) |
| 106 return pending_delta; | 108 return pending_delta; |
| 107 | 109 |
| 108 if (pinch_gesture_active_) | 110 if (pinch_gesture_active_) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 125 if (TopControlsShownRatio() == 1.f) | 127 if (TopControlsShownRatio() == 1.f) |
| 126 ResetBaseline(); | 128 ResetBaseline(); |
| 127 | 129 |
| 128 ResetAnimations(); | 130 ResetAnimations(); |
| 129 | 131 |
| 130 gfx::Vector2dF applied_delta(0.f, old_offset - ContentTopOffset()); | 132 gfx::Vector2dF applied_delta(0.f, old_offset - ContentTopOffset()); |
| 131 return pending_delta - applied_delta; | 133 return pending_delta - applied_delta; |
| 132 } | 134 } |
| 133 | 135 |
| 134 void TopControlsManager::ScrollEnd() { | 136 void TopControlsManager::ScrollEnd() { |
| 135 DCHECK(!pinch_gesture_active_); | 137 if (pinch_gesture_active_) |
| 138 return; |
| 139 |
| 136 StartAnimationIfNecessary(); | 140 StartAnimationIfNecessary(); |
| 137 } | 141 } |
| 138 | 142 |
| 139 void TopControlsManager::PinchBegin() { | 143 void TopControlsManager::PinchBegin() { |
| 140 DCHECK(!pinch_gesture_active_); | 144 DCHECK(!pinch_gesture_active_); |
| 141 pinch_gesture_active_ = true; | 145 pinch_gesture_active_ = true; |
| 142 StartAnimationIfNecessary(); | 146 StartAnimationIfNecessary(); |
| 143 } | 147 } |
| 144 | 148 |
| 145 void TopControlsManager::PinchEnd() { | 149 void TopControlsManager::PinchEnd() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || | 230 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || |
| 227 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); | 231 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); |
| 228 } | 232 } |
| 229 | 233 |
| 230 void TopControlsManager::ResetBaseline() { | 234 void TopControlsManager::ResetBaseline() { |
| 231 accumulated_scroll_delta_ = 0.f; | 235 accumulated_scroll_delta_ = 0.f; |
| 232 baseline_content_offset_ = ContentTopOffset(); | 236 baseline_content_offset_ = ContentTopOffset(); |
| 233 } | 237 } |
| 234 | 238 |
| 235 } // namespace cc | 239 } // namespace cc |
| OLD | NEW |