Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: cc/input/top_controls_manager.cc

Issue 982333003: Don't calculate a shown ratio when top controls height is 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/input/top_controls_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DCHECK(!pinch_gesture_active_); 97 DCHECK(!pinch_gesture_active_);
98 ResetAnimations(); 98 ResetAnimations();
99 ResetBaseline(); 99 ResetBaseline();
100 } 100 }
101 101
102 gfx::Vector2dF TopControlsManager::ScrollBy( 102 gfx::Vector2dF TopControlsManager::ScrollBy(
103 const gfx::Vector2dF& pending_delta) { 103 const gfx::Vector2dF& pending_delta) {
104 if (pinch_gesture_active_) 104 if (pinch_gesture_active_)
105 return pending_delta; 105 return pending_delta;
106 106
107 if (!TopControlsHeight())
108 return pending_delta;
109
107 if (permitted_state_ == SHOWN && pending_delta.y() > 0) 110 if (permitted_state_ == SHOWN && pending_delta.y() > 0)
108 return pending_delta; 111 return pending_delta;
109 else if (permitted_state_ == HIDDEN && pending_delta.y() < 0) 112 else if (permitted_state_ == HIDDEN && pending_delta.y() < 0)
110 return pending_delta; 113 return pending_delta;
111 114
112 accumulated_scroll_delta_ += pending_delta.y(); 115 accumulated_scroll_delta_ += pending_delta.y();
113 116
114 float old_offset = ContentTopOffset(); 117 float old_offset = ContentTopOffset();
115 client_->SetCurrentTopControlsShownRatio( 118 client_->SetCurrentTopControlsShownRatio(
116 (baseline_content_offset_ - accumulated_scroll_delta_) / 119 (baseline_content_offset_ - accumulated_scroll_delta_) /
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 228 }
226 return false; 229 return false;
227 } 230 }
228 231
229 void TopControlsManager::ResetBaseline() { 232 void TopControlsManager::ResetBaseline() {
230 accumulated_scroll_delta_ = 0.f; 233 accumulated_scroll_delta_ = 0.f;
231 baseline_content_offset_ = ContentTopOffset(); 234 baseline_content_offset_ = ContentTopOffset();
232 } 235 }
233 236
234 } // namespace cc 237 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/input/top_controls_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698