| 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/gesture_event_filter.h" | 7 #include "content/browser/renderer_host/gesture_event_filter.h" |
| 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 10 #include "content/public/browser/overscroll_configuration.h" | 10 #include "content/public/browser/overscroll_configuration.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 return !WebKit::WebInputEvent::isTouchEventType(event.type); | 164 return !WebKit::WebInputEvent::isTouchEventType(event.type); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 void OverscrollController::ProcessEventForOverscroll( | 168 void OverscrollController::ProcessEventForOverscroll( |
| 169 const WebKit::WebInputEvent& event) { | 169 const WebKit::WebInputEvent& event) { |
| 170 switch (event.type) { | 170 switch (event.type) { |
| 171 case WebKit::WebInputEvent::MouseWheel: { | 171 case WebKit::WebInputEvent::MouseWheel: { |
| 172 const WebKit::WebMouseWheelEvent& wheel = | 172 const WebKit::WebMouseWheelEvent& wheel = |
| 173 static_cast<const WebKit::WebMouseWheelEvent&>(event); | 173 static_cast<const WebKit::WebMouseWheelEvent&>(event); |
| 174 if (wheel.hasPreciseScrollingDeltas) | 174 if (wheel.hasPreciseScrollingDeltas) { |
| 175 ProcessOverscroll(wheel.deltaX, wheel.deltaY); | 175 ProcessOverscroll(wheel.deltaX * wheel.accelerationRatioX, |
| 176 wheel.deltaY * wheel.accelerationRatioY); |
| 177 } |
| 176 break; | 178 break; |
| 177 } | 179 } |
| 178 case WebKit::WebInputEvent::GestureScrollUpdate: { | 180 case WebKit::WebInputEvent::GestureScrollUpdate: { |
| 179 const WebKit::WebGestureEvent& gesture = | 181 const WebKit::WebGestureEvent& gesture = |
| 180 static_cast<const WebKit::WebGestureEvent&>(event); | 182 static_cast<const WebKit::WebGestureEvent&>(event); |
| 181 ProcessOverscroll(gesture.data.scrollUpdate.deltaX, | 183 ProcessOverscroll(gesture.data.scrollUpdate.deltaX, |
| 182 gesture.data.scrollUpdate.deltaY); | 184 gesture.data.scrollUpdate.deltaY); |
| 183 break; | 185 break; |
| 184 } | 186 } |
| 185 case WebKit::WebInputEvent::GestureFlingStart: { | 187 case WebKit::WebInputEvent::GestureFlingStart: { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 const WebKit::WebInputEvent& event) const { | 287 const WebKit::WebInputEvent& event) const { |
| 286 if (!WebKit::WebInputEvent::isGestureEventType(event.type)) | 288 if (!WebKit::WebInputEvent::isGestureEventType(event.type)) |
| 287 return false; | 289 return false; |
| 288 | 290 |
| 289 // If the GestureEventFilter already processed this event, then the event must | 291 // If the GestureEventFilter already processed this event, then the event must |
| 290 // not be sent to the filter again. | 292 // not be sent to the filter again. |
| 291 return !render_widget_host_->gesture_event_filter()->HasQueuedGestureEvents(); | 293 return !render_widget_host_->gesture_event_filter()->HasQueuedGestureEvents(); |
| 292 } | 294 } |
| 293 | 295 |
| 294 } // namespace content | 296 } // namespace content |
| OLD | NEW |