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

Side by Side Diff: content/browser/renderer_host/overscroll_controller.cc

Issue 52263006: Put vertical overscroll behind kScrollEndEffect flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « components/breakpad.gypi ('k') | content/browser/web_contents/web_contents_view_aura.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/overscroll_controller.h" 5 #include "content/browser/renderer_host/overscroll_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
9 #include "content/public/browser/overscroll_configuration.h" 9 #include "content/public/browser/overscroll_configuration.h"
10 #include "content/public/common/content_switches_util.h"
10 11
11 using WebKit::WebInputEvent; 12 using WebKit::WebInputEvent;
12 13
13 namespace content { 14 namespace content {
14 15
15 OverscrollController::OverscrollController() 16 OverscrollController::OverscrollController()
16 : overscroll_mode_(OVERSCROLL_NONE), 17 : overscroll_mode_(OVERSCROLL_NONE),
17 scroll_state_(STATE_UNKNOWN), 18 scroll_state_(STATE_UNKNOWN),
18 overscroll_delta_x_(0.f), 19 overscroll_delta_x_(0.f),
19 overscroll_delta_y_(0.f), 20 overscroll_delta_y_(0.f),
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // to make sure that subsequent scroll events go through to the page first. 294 // to make sure that subsequent scroll events go through to the page first.
294 OverscrollMode new_mode = OVERSCROLL_NONE; 295 OverscrollMode new_mode = OVERSCROLL_NONE;
295 const float kMinRatio = 2.5; 296 const float kMinRatio = 2.5;
296 if (fabs(overscroll_delta_x_) > horiz_threshold && 297 if (fabs(overscroll_delta_x_) > horiz_threshold &&
297 fabs(overscroll_delta_x_) > fabs(overscroll_delta_y_) * kMinRatio) 298 fabs(overscroll_delta_x_) > fabs(overscroll_delta_y_) * kMinRatio)
298 new_mode = overscroll_delta_x_ > 0.f ? OVERSCROLL_EAST : OVERSCROLL_WEST; 299 new_mode = overscroll_delta_x_ > 0.f ? OVERSCROLL_EAST : OVERSCROLL_WEST;
299 else if (fabs(overscroll_delta_y_) > vert_threshold && 300 else if (fabs(overscroll_delta_y_) > vert_threshold &&
300 fabs(overscroll_delta_y_) > fabs(overscroll_delta_x_) * kMinRatio) 301 fabs(overscroll_delta_y_) > fabs(overscroll_delta_x_) * kMinRatio)
301 new_mode = overscroll_delta_y_ > 0.f ? OVERSCROLL_SOUTH : OVERSCROLL_NORTH; 302 new_mode = overscroll_delta_y_ > 0.f ? OVERSCROLL_SOUTH : OVERSCROLL_NORTH;
302 303
304 // The vertical oversrcoll currently does not have any UX effects other then
305 // for the scroll end effect, so testing if it is enabled.
306 if ((new_mode == OVERSCROLL_SOUTH || new_mode == OVERSCROLL_NORTH) &&
307 !switches::IsScrollEndEffectEnabled())
308 new_mode = OVERSCROLL_NONE;
sadrul 2013/10/30 16:06:50 This should be a separate CL from the content_swit
rharrison 2013/10/30 18:16:26 Done.
309
303 if (overscroll_mode_ == OVERSCROLL_NONE) 310 if (overscroll_mode_ == OVERSCROLL_NONE)
304 SetOverscrollMode(new_mode); 311 SetOverscrollMode(new_mode);
305 else if (new_mode != overscroll_mode_) 312 else if (new_mode != overscroll_mode_)
306 SetOverscrollMode(OVERSCROLL_NONE); 313 SetOverscrollMode(OVERSCROLL_NONE);
307 314
308 if (overscroll_mode_ == OVERSCROLL_NONE) 315 if (overscroll_mode_ == OVERSCROLL_NONE)
309 return; 316 return;
310 317
311 // Tell the delegate about the overscroll update so that it can update 318 // Tell the delegate about the overscroll update so that it can update
312 // the display accordingly (e.g. show history preview etc.). 319 // the display accordingly (e.g. show history preview etc.).
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 overscroll_mode_ = mode; 357 overscroll_mode_ = mode;
351 if (overscroll_mode_ == OVERSCROLL_NONE) 358 if (overscroll_mode_ == OVERSCROLL_NONE)
352 overscroll_delta_x_ = overscroll_delta_y_ = 0.f; 359 overscroll_delta_x_ = overscroll_delta_y_ = 0.f;
353 else 360 else
354 scroll_state_ = STATE_OVERSCROLLING; 361 scroll_state_ = STATE_OVERSCROLLING;
355 if (delegate_) 362 if (delegate_)
356 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); 363 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_);
357 } 364 }
358 365
359 } // namespace content 366 } // namespace content
OLDNEW
« no previous file with comments | « components/breakpad.gypi ('k') | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698