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

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

Issue 886763004: DO NOT MERGE: Fix top_controls_manager to stay hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 void TopControlsManager::SetTopControlsHeight(float top_controls_height) { 161 void TopControlsManager::SetTopControlsHeight(float top_controls_height) {
162 DCHECK_GE(top_controls_height, 0); 162 DCHECK_GE(top_controls_height, 0);
163 163
164 if (top_controls_height == top_controls_height_) 164 if (top_controls_height == top_controls_height_)
165 return; 165 return;
166 166
167 ResetAnimations(); 167 ResetAnimations();
168 float top_controls_offset = client_->ControlsTopOffset(); 168 float top_controls_offset = client_->ControlsTopOffset();
169 top_controls_height_ = top_controls_height; 169 top_controls_height_ = top_controls_height;
170
171 // Stay hidden if only HIDDEN state is permitted.
172 if (permitted_state_ == HIDDEN)
173 top_controls_offset = -top_controls_height_;
174
170 SetControlsTopOffset(top_controls_offset); 175 SetControlsTopOffset(top_controls_offset);
171 StartAnimationIfNecessary(); 176 StartAnimationIfNecessary();
172 } 177 }
173 178
174 gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) { 179 gfx::Vector2dF TopControlsManager::Animate(base::TimeTicks monotonic_time) {
175 if (!top_controls_animation_ || !client_->HaveRootScrollLayer()) 180 if (!top_controls_animation_ || !client_->HaveRootScrollLayer())
176 return gfx::Vector2dF(); 181 return gfx::Vector2dF();
177 182
178 base::TimeDelta time = monotonic_time - base::TimeTicks(); 183 base::TimeDelta time = monotonic_time - base::TimeTicks();
179 184
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 262
258 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || 263 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) ||
259 (animation_direction_ == HIDING_CONTROLS 264 (animation_direction_ == HIDING_CONTROLS
260 && new_offset <= -top_controls_height_)) { 265 && new_offset <= -top_controls_height_)) {
261 return true; 266 return true;
262 } 267 }
263 return false; 268 return false;
264 } 269 }
265 270
266 } // namespace cc 271 } // 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