| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 89   permitted_state_ = constraints; | 89   permitted_state_ = constraints; | 
| 90 | 90 | 
| 91   // Don't do anything if it doesn't matter which state the controls are in. | 91   // Don't do anything if it doesn't matter which state the controls are in. | 
| 92   if (constraints == BOTH && current == BOTH) | 92   if (constraints == BOTH && current == BOTH) | 
| 93     return; | 93     return; | 
| 94 | 94 | 
| 95   // Don't do anything if there is no change in offset. | 95   // Don't do anything if there is no change in offset. | 
| 96   float final_shown_ratio = 1.f; | 96   float final_shown_ratio = 1.f; | 
| 97   if (constraints == HIDDEN || current == HIDDEN) | 97   if (constraints == HIDDEN || current == HIDDEN) | 
| 98     final_shown_ratio = 0.f; | 98     final_shown_ratio = 0.f; | 
| 99   if (final_shown_ratio == TopControlsShownRatio()) | 99   if (final_shown_ratio == TopControlsShownRatio()) { | 
|  | 100     ResetAnimations(); | 
| 100     return; | 101     return; | 
|  | 102   } | 
| 101 | 103 | 
| 102   if (animate) { | 104   if (animate) { | 
| 103     SetupAnimation(final_shown_ratio ? SHOWING_CONTROLS : HIDING_CONTROLS); | 105     SetupAnimation(final_shown_ratio ? SHOWING_CONTROLS : HIDING_CONTROLS); | 
| 104   } else { | 106   } else { | 
| 105     ResetAnimations(); | 107     ResetAnimations(); | 
| 106     client_->SetCurrentTopControlsShownRatio(final_shown_ratio); | 108     client_->SetCurrentTopControlsShownRatio(final_shown_ratio); | 
| 107   } | 109   } | 
| 108 } | 110 } | 
| 109 | 111 | 
| 110 void TopControlsManager::ScrollBegin() { | 112 void TopControlsManager::ScrollBegin() { | 
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 247   return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || | 249   return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || | 
| 248          (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); | 250          (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); | 
| 249 } | 251 } | 
| 250 | 252 | 
| 251 void TopControlsManager::ResetBaseline() { | 253 void TopControlsManager::ResetBaseline() { | 
| 252   accumulated_scroll_delta_ = 0.f; | 254   accumulated_scroll_delta_ = 0.f; | 
| 253   baseline_content_offset_ = ContentTopOffset(); | 255   baseline_content_offset_ = ContentTopOffset(); | 
| 254 } | 256 } | 
| 255 | 257 | 
| 256 }  // namespace cc | 258 }  // namespace cc | 
| OLD | NEW | 
|---|