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

Side by Side Diff: content/browser/web_contents/aura/overscroll_window_delegate.cc

Issue 1167013002: Fix OverscrollWindowDelegate to not dispatch superfluous OverscrollModeChange events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web_contents/aura/overscroll_window_delegate.h" 5 #include "content/browser/web_contents/aura/overscroll_window_delegate.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "content/browser/frame_host/navigation_controller_impl.h" 8 #include "content/browser/frame_host/navigation_controller_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 10 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
(...skipping 25 matching lines...) Expand all
36 void OverscrollWindowDelegate::StartOverscroll() { 36 void OverscrollWindowDelegate::StartOverscroll() {
37 OverscrollMode old_mode = overscroll_mode_; 37 OverscrollMode old_mode = overscroll_mode_;
38 if (delta_x_ > 0) 38 if (delta_x_ > 0)
39 overscroll_mode_ = OVERSCROLL_EAST; 39 overscroll_mode_ = OVERSCROLL_EAST;
40 else 40 else
41 overscroll_mode_ = OVERSCROLL_WEST; 41 overscroll_mode_ = OVERSCROLL_WEST;
42 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); 42 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_);
43 } 43 }
44 44
45 void OverscrollWindowDelegate::ResetOverscroll() { 45 void OverscrollWindowDelegate::ResetOverscroll() {
46 if (overscroll_mode_ == OVERSCROLL_NONE)
47 return;
46 delegate_->OnOverscrollModeChange(overscroll_mode_, OVERSCROLL_NONE); 48 delegate_->OnOverscrollModeChange(overscroll_mode_, OVERSCROLL_NONE);
47 overscroll_mode_ = OVERSCROLL_NONE; 49 overscroll_mode_ = OVERSCROLL_NONE;
48 delta_x_ = 0; 50 delta_x_ = 0;
49 } 51 }
50 52
51 void OverscrollWindowDelegate::CompleteOrResetOverscroll() { 53 void OverscrollWindowDelegate::CompleteOrResetOverscroll() {
52 if (overscroll_mode_ == OVERSCROLL_NONE) 54 if (overscroll_mode_ == OVERSCROLL_NONE)
53 return; 55 return;
54 int width = delegate_->GetVisibleBounds().width(); 56 int width = delegate_->GetVisibleBounds().width();
55 float ratio = (fabs(delta_x_)) / width; 57 float ratio = (fabs(delta_x_)) / width;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ResetOverscroll(); 122 ResetOverscroll();
121 break; 123 break;
122 124
123 default: 125 default:
124 break; 126 break;
125 } 127 }
126 event->SetHandled(); 128 event->SetHandled();
127 } 129 }
128 130
129 } // namespace content 131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698