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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 float TopControlsManager::TopControlsShownRatio() const { | 63 float TopControlsManager::TopControlsShownRatio() const { |
64 return client_->CurrentTopControlsShownRatio(); | 64 return client_->CurrentTopControlsShownRatio(); |
65 } | 65 } |
66 | 66 |
67 float TopControlsManager::TopControlsHeight() const { | 67 float TopControlsManager::TopControlsHeight() const { |
68 return client_->TopControlsHeight(); | 68 return client_->TopControlsHeight(); |
69 } | 69 } |
70 | 70 |
| 71 float TopControlsManager::BottomControlsHeight() const { |
| 72 return client_->BottomControlsHeight(); |
| 73 } |
| 74 |
| 75 float TopControlsManager::ContentBottomOffset() const { |
| 76 return TopControlsShownRatio() * BottomControlsHeight(); |
| 77 } |
| 78 |
| 79 float TopControlsManager::BottomControlsShownRatio() const { |
| 80 return TopControlsShownRatio(); |
| 81 } |
| 82 |
71 void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, | 83 void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, |
72 TopControlsState current, | 84 TopControlsState current, |
73 bool animate) { | 85 bool animate) { |
74 DCHECK(!(constraints == SHOWN && current == HIDDEN)); | 86 DCHECK(!(constraints == SHOWN && current == HIDDEN)); |
75 DCHECK(!(constraints == HIDDEN && current == SHOWN)); | 87 DCHECK(!(constraints == HIDDEN && current == SHOWN)); |
76 | 88 |
77 permitted_state_ = constraints; | 89 permitted_state_ = constraints; |
78 | 90 |
79 // 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. |
80 if (constraints == BOTH && current == BOTH) | 92 if (constraints == BOTH && current == BOTH) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || | 247 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || |
236 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); | 248 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); |
237 } | 249 } |
238 | 250 |
239 void TopControlsManager::ResetBaseline() { | 251 void TopControlsManager::ResetBaseline() { |
240 accumulated_scroll_delta_ = 0.f; | 252 accumulated_scroll_delta_ = 0.f; |
241 baseline_content_offset_ = ContentTopOffset(); | 253 baseline_content_offset_ = ContentTopOffset(); |
242 } | 254 } |
243 | 255 |
244 } // namespace cc | 256 } // namespace cc |
OLD | NEW |