OLD | NEW |
---|---|
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 "content/browser/renderer_host/input/gesture_event_filter.h" | |
7 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "content/public/browser/overscroll_configuration.h" | 10 #include "content/public/browser/overscroll_configuration.h" |
10 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
11 | 12 |
12 using WebKit::WebInputEvent; | 13 using WebKit::WebInputEvent; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 OverscrollController::OverscrollController( | 17 OverscrollController::OverscrollController( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // Consume the event only if it updates the overscroll state. | 98 // Consume the event only if it updates the overscroll state. |
98 if (ProcessEventForOverscroll(event)) | 99 if (ProcessEventForOverscroll(event)) |
99 return false; | 100 return false; |
100 } | 101 } |
101 | 102 |
102 return true; | 103 return true; |
103 } | 104 } |
104 | 105 |
105 void OverscrollController::ReceivedEventACK(const WebKit::WebInputEvent& event, | 106 void OverscrollController::ReceivedEventACK(const WebKit::WebInputEvent& event, |
106 bool processed) { | 107 bool processed) { |
108 if (GestureEventFilter::IsGestureEventTypeAsync(event.type)) | |
jdduke (slow)
2013/09/30 15:42:56
Make this a DCHECK(!GestureEventFilter::IsGestureE
tdresser
2013/09/30 18:05:03
Done.
| |
109 return; | |
107 if (processed) { | 110 if (processed) { |
108 // If a scroll event is consumed by the page, i.e. some content on the page | 111 // If a scroll event is consumed by the page, i.e. some content on the page |
109 // has been scrolled, then there is not going to be an overscroll gesture, | 112 // has been scrolled, then there is not going to be an overscroll gesture, |
110 // until the current scroll ends, and a new scroll gesture starts. | 113 // until the current scroll ends, and a new scroll gesture starts. |
111 if (scroll_state_ == STATE_UNKNOWN && | 114 if (scroll_state_ == STATE_UNKNOWN && |
112 (event.type == WebKit::WebInputEvent::MouseWheel || | 115 (event.type == WebKit::WebInputEvent::MouseWheel || |
113 event.type == WebKit::WebInputEvent::GestureScrollUpdate)) { | 116 event.type == WebKit::WebInputEvent::GestureScrollUpdate)) { |
114 scroll_state_ = STATE_CONTENT_SCROLLING; | 117 scroll_state_ = STATE_CONTENT_SCROLLING; |
115 } | 118 } |
116 return; | 119 return; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 overscroll_mode_ = mode; | 365 overscroll_mode_ = mode; |
363 if (overscroll_mode_ == OVERSCROLL_NONE) | 366 if (overscroll_mode_ == OVERSCROLL_NONE) |
364 overscroll_delta_x_ = overscroll_delta_y_ = 0.f; | 367 overscroll_delta_x_ = overscroll_delta_y_ = 0.f; |
365 else | 368 else |
366 scroll_state_ = STATE_OVERSCROLLING; | 369 scroll_state_ = STATE_OVERSCROLLING; |
367 if (delegate_) | 370 if (delegate_) |
368 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); | 371 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); |
369 } | 372 } |
370 | 373 |
371 } // namespace content | 374 } // namespace content |
OLD | NEW |