| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/gpu/input_handler_proxy.h" | 5 #include "content/renderer/gpu/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/renderer/gpu/input_handler_proxy_client.h" | 9 #include "content/renderer/gpu/input_handler_proxy_client.h" |
| 10 #include "third_party/WebKit/public/platform/Platform.h" | 10 #include "third_party/WebKit/public/platform/Platform.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 input_handler_ = NULL; | 39 input_handler_ = NULL; |
| 40 DCHECK(client_); | 40 DCHECK(client_); |
| 41 client_->WillShutdown(); | 41 client_->WillShutdown(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) { | 44 void InputHandlerProxy::SetClient(InputHandlerProxyClient* client) { |
| 45 DCHECK(!client_ || !client); | 45 DCHECK(!client_ || !client); |
| 46 client_ = client; | 46 client_ = client; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void InputHandlerProxy::HandleInputEvent(const WebInputEvent& event) { | 49 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent( |
| 50 const WebInputEvent& event) { |
| 50 DCHECK(client_); | 51 DCHECK(client_); |
| 51 DCHECK(input_handler_); | 52 DCHECK(input_handler_); |
| 52 | 53 |
| 53 InputHandlerProxy::EventDisposition disposition = | 54 InputHandlerProxy::EventDisposition disposition = |
| 54 HandleInputEventInternal(event); | 55 HandleInputEventInternal(event); |
| 55 switch (disposition) { | |
| 56 case DidHandle: | |
| 57 client_->DidHandleInputEvent(); | |
| 58 break; | |
| 59 case DidNotHandle: | |
| 60 client_->DidNotHandleInputEvent(true /* send_to_widget */); | |
| 61 break; | |
| 62 case DropEvent: | |
| 63 client_->DidNotHandleInputEvent(false /* send_to_widget */); | |
| 64 break; | |
| 65 } | |
| 66 if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) { | 56 if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync) { |
| 67 input_handler_->DidReceiveLastInputEventForBeginFrame( | 57 input_handler_->DidReceiveLastInputEventForBeginFrame( |
| 68 base::TimeTicks::FromInternalValue(event.timeStampSeconds * | 58 base::TimeTicks::FromInternalValue(event.timeStampSeconds * |
| 69 base::Time::kMicrosecondsPerSecond)); | 59 base::Time::kMicrosecondsPerSecond)); |
| 70 } | 60 } |
| 61 return disposition; |
| 71 } | 62 } |
| 72 | 63 |
| 73 InputHandlerProxy::EventDisposition | 64 InputHandlerProxy::EventDisposition |
| 74 InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) { | 65 InputHandlerProxy::HandleInputEventInternal(const WebInputEvent& event) { |
| 75 if (event.type == WebInputEvent::MouseWheel) { | 66 if (event.type == WebInputEvent::MouseWheel) { |
| 76 const WebMouseWheelEvent& wheel_event = | 67 const WebMouseWheelEvent& wheel_event = |
| 77 *static_cast<const WebMouseWheelEvent*>(&event); | 68 *static_cast<const WebMouseWheelEvent*>(&event); |
| 78 if (wheel_event.scrollByPage) { | 69 if (wheel_event.scrollByPage) { |
| 79 // TODO(jamesr): We don't properly handle scroll by page in the compositor | 70 // TODO(jamesr): We don't properly handle scroll by page in the compositor |
| 80 // thread, so punt it to the main thread. http://crbug.com/236639 | 71 // thread, so punt it to the main thread. http://crbug.com/236639 |
| 81 return DidNotHandle; | 72 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 82 } | 73 } |
| 83 cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin( | 74 cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin( |
| 84 gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::Wheel); | 75 gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::Wheel); |
| 85 switch (scroll_status) { | 76 switch (scroll_status) { |
| 86 case cc::InputHandler::ScrollStarted: { | 77 case cc::InputHandler::ScrollStarted: { |
| 87 TRACE_EVENT_INSTANT2( | 78 TRACE_EVENT_INSTANT2( |
| 88 "renderer", | 79 "renderer", |
| 89 "InputHandlerProxy::handle_input wheel scroll", | 80 "InputHandlerProxy::handle_input wheel scroll", |
| 90 TRACE_EVENT_SCOPE_THREAD, | 81 TRACE_EVENT_SCOPE_THREAD, |
| 91 "deltaX", | 82 "deltaX", |
| 92 -wheel_event.deltaX, | 83 -wheel_event.deltaX, |
| 93 "deltaY", | 84 "deltaY", |
| 94 -wheel_event.deltaY); | 85 -wheel_event.deltaY); |
| 95 bool did_scroll = input_handler_->ScrollBy( | 86 bool did_scroll = input_handler_->ScrollBy( |
| 96 gfx::Point(wheel_event.x, wheel_event.y), | 87 gfx::Point(wheel_event.x, wheel_event.y), |
| 97 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); | 88 gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY)); |
| 98 input_handler_->ScrollEnd(); | 89 input_handler_->ScrollEnd(); |
| 99 return did_scroll ? DidHandle : DropEvent; | 90 return did_scroll ? EVENT_DISPOSITION_DID_HANDLE |
| 91 : EVENT_DISPOSITION_DROP_EVENT; |
| 100 } | 92 } |
| 101 case cc::InputHandler::ScrollIgnored: | 93 case cc::InputHandler::ScrollIgnored: |
| 102 // TODO(jamesr): This should be DropEvent, but in cases where we fail to | 94 // TODO(jamesr): This should be EVENT_DISPOSITION_DROP_EVENT, but in |
| 103 // properly sync scrollability it's safer to send the | 95 // cases where we fail to properly sync scrollability it's safer to send |
| 104 // event to the main thread. Change back to DropEvent once we have | 96 // the event to the main thread. Change back to |
| 105 // synchronization bugs sorted out. | 97 // EVENT_DISPOSITION_DROP_EVENT once we have synchronization bugs sorted |
| 106 return DidNotHandle; | 98 // out. |
| 99 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 107 case cc::InputHandler::ScrollOnMainThread: | 100 case cc::InputHandler::ScrollOnMainThread: |
| 108 return DidNotHandle; | 101 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 109 } | 102 } |
| 110 } else if (event.type == WebInputEvent::GestureScrollBegin) { | 103 } else if (event.type == WebInputEvent::GestureScrollBegin) { |
| 111 DCHECK(!gesture_scroll_on_impl_thread_); | 104 DCHECK(!gesture_scroll_on_impl_thread_); |
| 112 #ifndef NDEBUG | 105 #ifndef NDEBUG |
| 113 DCHECK(!expect_scroll_update_end_); | 106 DCHECK(!expect_scroll_update_end_); |
| 114 expect_scroll_update_end_ = true; | 107 expect_scroll_update_end_ = true; |
| 115 #endif | 108 #endif |
| 116 const WebGestureEvent& gesture_event = | 109 const WebGestureEvent& gesture_event = |
| 117 *static_cast<const WebGestureEvent*>(&event); | 110 *static_cast<const WebGestureEvent*>(&event); |
| 118 cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin( | 111 cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin( |
| 119 gfx::Point(gesture_event.x, gesture_event.y), | 112 gfx::Point(gesture_event.x, gesture_event.y), |
| 120 cc::InputHandler::Gesture); | 113 cc::InputHandler::Gesture); |
| 121 switch (scroll_status) { | 114 switch (scroll_status) { |
| 122 case cc::InputHandler::ScrollStarted: | 115 case cc::InputHandler::ScrollStarted: |
| 123 gesture_scroll_on_impl_thread_ = true; | 116 gesture_scroll_on_impl_thread_ = true; |
| 124 return DidHandle; | 117 return EVENT_DISPOSITION_DID_HANDLE; |
| 125 case cc::InputHandler::ScrollOnMainThread: | 118 case cc::InputHandler::ScrollOnMainThread: |
| 126 return DidNotHandle; | 119 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 127 case cc::InputHandler::ScrollIgnored: | 120 case cc::InputHandler::ScrollIgnored: |
| 128 return DropEvent; | 121 return EVENT_DISPOSITION_DROP_EVENT; |
| 129 } | 122 } |
| 130 } else if (event.type == WebInputEvent::GestureScrollUpdate) { | 123 } else if (event.type == WebInputEvent::GestureScrollUpdate) { |
| 131 #ifndef NDEBUG | 124 #ifndef NDEBUG |
| 132 DCHECK(expect_scroll_update_end_); | 125 DCHECK(expect_scroll_update_end_); |
| 133 #endif | 126 #endif |
| 134 | 127 |
| 135 if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_) | 128 if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_) |
| 136 return DidNotHandle; | 129 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 137 | 130 |
| 138 const WebGestureEvent& gesture_event = | 131 const WebGestureEvent& gesture_event = |
| 139 *static_cast<const WebGestureEvent*>(&event); | 132 *static_cast<const WebGestureEvent*>(&event); |
| 140 bool did_scroll = input_handler_->ScrollBy( | 133 bool did_scroll = input_handler_->ScrollBy( |
| 141 gfx::Point(gesture_event.x, gesture_event.y), | 134 gfx::Point(gesture_event.x, gesture_event.y), |
| 142 gfx::Vector2dF(-gesture_event.data.scrollUpdate.deltaX, | 135 gfx::Vector2dF(-gesture_event.data.scrollUpdate.deltaX, |
| 143 -gesture_event.data.scrollUpdate.deltaY)); | 136 -gesture_event.data.scrollUpdate.deltaY)); |
| 144 return did_scroll ? DidHandle : DropEvent; | 137 return did_scroll ? EVENT_DISPOSITION_DID_HANDLE |
| 138 : EVENT_DISPOSITION_DROP_EVENT; |
| 145 } else if (event.type == WebInputEvent::GestureScrollEnd) { | 139 } else if (event.type == WebInputEvent::GestureScrollEnd) { |
| 146 #ifndef NDEBUG | 140 #ifndef NDEBUG |
| 147 DCHECK(expect_scroll_update_end_); | 141 DCHECK(expect_scroll_update_end_); |
| 148 expect_scroll_update_end_ = false; | 142 expect_scroll_update_end_ = false; |
| 149 #endif | 143 #endif |
| 150 if (!gesture_scroll_on_impl_thread_) | 144 if (!gesture_scroll_on_impl_thread_) |
| 151 return DidNotHandle; | 145 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 152 | 146 |
| 153 input_handler_->ScrollEnd(); | 147 input_handler_->ScrollEnd(); |
| 154 gesture_scroll_on_impl_thread_ = false; | 148 gesture_scroll_on_impl_thread_ = false; |
| 155 return DidHandle; | 149 return EVENT_DISPOSITION_DID_HANDLE; |
| 156 } else if (event.type == WebInputEvent::GesturePinchBegin) { | 150 } else if (event.type == WebInputEvent::GesturePinchBegin) { |
| 157 #ifndef NDEBUG | 151 #ifndef NDEBUG |
| 158 DCHECK(!expect_pinch_update_end_); | 152 DCHECK(!expect_pinch_update_end_); |
| 159 expect_pinch_update_end_ = true; | 153 expect_pinch_update_end_ = true; |
| 160 #endif | 154 #endif |
| 161 input_handler_->PinchGestureBegin(); | 155 input_handler_->PinchGestureBegin(); |
| 162 gesture_pinch_on_impl_thread_ = true; | 156 gesture_pinch_on_impl_thread_ = true; |
| 163 return DidHandle; | 157 return EVENT_DISPOSITION_DID_HANDLE; |
| 164 } else if (event.type == WebInputEvent::GesturePinchEnd) { | 158 } else if (event.type == WebInputEvent::GesturePinchEnd) { |
| 165 #ifndef NDEBUG | 159 #ifndef NDEBUG |
| 166 DCHECK(expect_pinch_update_end_); | 160 DCHECK(expect_pinch_update_end_); |
| 167 expect_pinch_update_end_ = false; | 161 expect_pinch_update_end_ = false; |
| 168 #endif | 162 #endif |
| 169 gesture_pinch_on_impl_thread_ = false; | 163 gesture_pinch_on_impl_thread_ = false; |
| 170 input_handler_->PinchGestureEnd(); | 164 input_handler_->PinchGestureEnd(); |
| 171 return DidHandle; | 165 return EVENT_DISPOSITION_DID_HANDLE; |
| 172 } else if (event.type == WebInputEvent::GesturePinchUpdate) { | 166 } else if (event.type == WebInputEvent::GesturePinchUpdate) { |
| 173 #ifndef NDEBUG | 167 #ifndef NDEBUG |
| 174 DCHECK(expect_pinch_update_end_); | 168 DCHECK(expect_pinch_update_end_); |
| 175 #endif | 169 #endif |
| 176 const WebGestureEvent& gesture_event = | 170 const WebGestureEvent& gesture_event = |
| 177 *static_cast<const WebGestureEvent*>(&event); | 171 *static_cast<const WebGestureEvent*>(&event); |
| 178 input_handler_->PinchGestureUpdate( | 172 input_handler_->PinchGestureUpdate( |
| 179 gesture_event.data.pinchUpdate.scale, | 173 gesture_event.data.pinchUpdate.scale, |
| 180 gfx::Point(gesture_event.x, gesture_event.y)); | 174 gfx::Point(gesture_event.x, gesture_event.y)); |
| 181 return DidHandle; | 175 return EVENT_DISPOSITION_DID_HANDLE; |
| 182 } else if (event.type == WebInputEvent::GestureFlingStart) { | 176 } else if (event.type == WebInputEvent::GestureFlingStart) { |
| 183 const WebGestureEvent& gesture_event = | 177 const WebGestureEvent& gesture_event = |
| 184 *static_cast<const WebGestureEvent*>(&event); | 178 *static_cast<const WebGestureEvent*>(&event); |
| 185 return HandleGestureFling(gesture_event); | 179 return HandleGestureFling(gesture_event); |
| 186 } else if (event.type == WebInputEvent::GestureFlingCancel) { | 180 } else if (event.type == WebInputEvent::GestureFlingCancel) { |
| 187 if (CancelCurrentFling()) | 181 if (CancelCurrentFling()) |
| 188 return DidHandle; | 182 return EVENT_DISPOSITION_DID_HANDLE; |
| 189 else if (!fling_may_be_active_on_main_thread_) | 183 else if (!fling_may_be_active_on_main_thread_) |
| 190 return DropEvent; | 184 return EVENT_DISPOSITION_DROP_EVENT; |
| 191 } else if (event.type == WebInputEvent::TouchStart) { | 185 } else if (event.type == WebInputEvent::TouchStart) { |
| 192 const WebTouchEvent& touch_event = | 186 const WebTouchEvent& touch_event = |
| 193 *static_cast<const WebTouchEvent*>(&event); | 187 *static_cast<const WebTouchEvent*>(&event); |
| 194 if (!input_handler_->HaveTouchEventHandlersAt(touch_event.touches[0] | 188 if (!input_handler_->HaveTouchEventHandlersAt(touch_event.touches[0] |
| 195 .position)) | 189 .position)) |
| 196 return DropEvent; | 190 return EVENT_DISPOSITION_DROP_EVENT; |
| 197 } else if (WebInputEvent::isKeyboardEventType(event.type)) { | 191 } else if (WebInputEvent::isKeyboardEventType(event.type)) { |
| 198 CancelCurrentFling(); | 192 CancelCurrentFling(); |
| 199 } | 193 } |
| 200 | 194 |
| 201 return DidNotHandle; | 195 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 202 } | 196 } |
| 203 | 197 |
| 204 InputHandlerProxy::EventDisposition | 198 InputHandlerProxy::EventDisposition |
| 205 InputHandlerProxy::HandleGestureFling( | 199 InputHandlerProxy::HandleGestureFling( |
| 206 const WebGestureEvent& gesture_event) { | 200 const WebGestureEvent& gesture_event) { |
| 207 cc::InputHandler::ScrollStatus scroll_status; | 201 cc::InputHandler::ScrollStatus scroll_status; |
| 208 | 202 |
| 209 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) { | 203 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) { |
| 210 scroll_status = input_handler_->ScrollBegin( | 204 scroll_status = input_handler_->ScrollBegin( |
| 211 gfx::Point(gesture_event.x, gesture_event.y), | 205 gfx::Point(gesture_event.x, gesture_event.y), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 237 this); | 231 this); |
| 238 fling_parameters_.delta = | 232 fling_parameters_.delta = |
| 239 WebFloatPoint(gesture_event.data.flingStart.velocityX, | 233 WebFloatPoint(gesture_event.data.flingStart.velocityX, |
| 240 gesture_event.data.flingStart.velocityY); | 234 gesture_event.data.flingStart.velocityY); |
| 241 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); | 235 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |
| 242 fling_parameters_.globalPoint = | 236 fling_parameters_.globalPoint = |
| 243 WebPoint(gesture_event.globalX, gesture_event.globalY); | 237 WebPoint(gesture_event.globalX, gesture_event.globalY); |
| 244 fling_parameters_.modifiers = gesture_event.modifiers; | 238 fling_parameters_.modifiers = gesture_event.modifiers; |
| 245 fling_parameters_.sourceDevice = gesture_event.sourceDevice; | 239 fling_parameters_.sourceDevice = gesture_event.sourceDevice; |
| 246 input_handler_->ScheduleAnimation(); | 240 input_handler_->ScheduleAnimation(); |
| 247 return DidHandle; | 241 return EVENT_DISPOSITION_DID_HANDLE; |
| 248 } | 242 } |
| 249 case cc::InputHandler::ScrollOnMainThread: { | 243 case cc::InputHandler::ScrollOnMainThread: { |
| 250 TRACE_EVENT_INSTANT0("renderer", | 244 TRACE_EVENT_INSTANT0("renderer", |
| 251 "InputHandlerProxy::HandleGestureFling::" | 245 "InputHandlerProxy::HandleGestureFling::" |
| 252 "scroll_on_main_thread", | 246 "scroll_on_main_thread", |
| 253 TRACE_EVENT_SCOPE_THREAD); | 247 TRACE_EVENT_SCOPE_THREAD); |
| 254 fling_may_be_active_on_main_thread_ = true; | 248 fling_may_be_active_on_main_thread_ = true; |
| 255 return DidNotHandle; | 249 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 256 } | 250 } |
| 257 case cc::InputHandler::ScrollIgnored: { | 251 case cc::InputHandler::ScrollIgnored: { |
| 258 TRACE_EVENT_INSTANT0( | 252 TRACE_EVENT_INSTANT0( |
| 259 "renderer", | 253 "renderer", |
| 260 "InputHandlerProxy::HandleGestureFling::ignored", | 254 "InputHandlerProxy::HandleGestureFling::ignored", |
| 261 TRACE_EVENT_SCOPE_THREAD); | 255 TRACE_EVENT_SCOPE_THREAD); |
| 262 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) { | 256 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) { |
| 263 // We still pass the curve to the main thread if there's nothing | 257 // We still pass the curve to the main thread if there's nothing |
| 264 // scrollable, in case something | 258 // scrollable, in case something |
| 265 // registers a handler before the curve is over. | 259 // registers a handler before the curve is over. |
| 266 return DidNotHandle; | 260 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 267 } | 261 } |
| 268 return DropEvent; | 262 return EVENT_DISPOSITION_DROP_EVENT; |
| 269 } | 263 } |
| 270 } | 264 } |
| 271 return DidNotHandle; | 265 return EVENT_DISPOSITION_DID_NOT_HANDLE; |
| 272 } | 266 } |
| 273 | 267 |
| 274 void InputHandlerProxy::Animate(base::TimeTicks time) { | 268 void InputHandlerProxy::Animate(base::TimeTicks time) { |
| 275 if (!fling_curve_) | 269 if (!fling_curve_) |
| 276 return; | 270 return; |
| 277 | 271 |
| 278 double monotonic_time_sec = (time - base::TimeTicks()).InSecondsF(); | 272 double monotonic_time_sec = (time - base::TimeTicks()).InSecondsF(); |
| 279 if (!fling_parameters_.startTime) { | 273 if (!fling_parameters_.startTime) { |
| 280 fling_parameters_.startTime = monotonic_time_sec; | 274 fling_parameters_.startTime = monotonic_time_sec; |
| 281 input_handler_->ScheduleAnimation(); | 275 input_handler_->ScheduleAnimation(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 synthetic_wheel.hasPreciseScrollingDeltas = true; | 328 synthetic_wheel.hasPreciseScrollingDeltas = true; |
| 335 synthetic_wheel.x = fling_parameters_.point.x; | 329 synthetic_wheel.x = fling_parameters_.point.x; |
| 336 synthetic_wheel.y = fling_parameters_.point.y; | 330 synthetic_wheel.y = fling_parameters_.point.y; |
| 337 synthetic_wheel.globalX = fling_parameters_.globalPoint.x; | 331 synthetic_wheel.globalX = fling_parameters_.globalPoint.x; |
| 338 synthetic_wheel.globalY = fling_parameters_.globalPoint.y; | 332 synthetic_wheel.globalY = fling_parameters_.globalPoint.y; |
| 339 synthetic_wheel.modifiers = fling_parameters_.modifiers; | 333 synthetic_wheel.modifiers = fling_parameters_.modifiers; |
| 340 | 334 |
| 341 InputHandlerProxy::EventDisposition disposition = | 335 InputHandlerProxy::EventDisposition disposition = |
| 342 HandleInputEventInternal(synthetic_wheel); | 336 HandleInputEventInternal(synthetic_wheel); |
| 343 switch (disposition) { | 337 switch (disposition) { |
| 344 case DidHandle: | 338 case EVENT_DISPOSITION_DID_HANDLE: |
| 345 return true; | 339 return true; |
| 346 case DropEvent: | 340 case EVENT_DISPOSITION_DROP_EVENT: |
| 347 break; | 341 break; |
| 348 case DidNotHandle: | 342 case EVENT_DISPOSITION_DID_NOT_HANDLE: |
| 349 TRACE_EVENT_INSTANT0("renderer", | 343 TRACE_EVENT_INSTANT0("renderer", |
| 350 "InputHandlerProxy::scrollBy::AbortFling", | 344 "InputHandlerProxy::scrollBy::AbortFling", |
| 351 TRACE_EVENT_SCOPE_THREAD); | 345 TRACE_EVENT_SCOPE_THREAD); |
| 352 // If we got a DidNotHandle, that means we need to deliver wheels on the | 346 // If we got a EVENT_DISPOSITION_DID_NOT_HANDLE, that means we need to |
| 353 // main thread. In this case we need to schedule a commit and transfer the | 347 // deliver wheels on the main thread. In this case we need to schedule a |
| 354 // fling curve over to the main thread and run the rest of the wheels from | 348 // commit and transfer the fling curve over to the main thread and run the |
| 355 // there. This can happen when flinging a page that contains a scrollable | 349 // rest of the wheels from there. This can happen when flinging a page |
| 356 // subarea that we can't scroll on the thread if the fling starts outside | 350 // that contains a scrollable subarea that we can't scroll on the thread |
| 357 // the subarea but then is flung "under" the pointer. | 351 // if the fling starts outside the subarea but then is flung "under" the |
| 352 // pointer. |
| 358 client_->TransferActiveWheelFlingAnimation(fling_parameters_); | 353 client_->TransferActiveWheelFlingAnimation(fling_parameters_); |
| 359 fling_may_be_active_on_main_thread_ = true; | 354 fling_may_be_active_on_main_thread_ = true; |
| 360 CancelCurrentFling(); | 355 CancelCurrentFling(); |
| 361 break; | 356 break; |
| 362 } | 357 } |
| 363 | 358 |
| 364 return false; | 359 return false; |
| 365 } | 360 } |
| 366 | 361 |
| 367 static gfx::Vector2dF ToClientScrollIncrement(const WebFloatSize& increment) { | 362 static gfx::Vector2dF ToClientScrollIncrement(const WebFloatSize& increment) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 TRACE_EVENT2("renderer", | 397 TRACE_EVENT2("renderer", |
| 403 "InputHandlerProxy::notifyCurrentFlingVelocity", | 398 "InputHandlerProxy::notifyCurrentFlingVelocity", |
| 404 "vx", | 399 "vx", |
| 405 velocity.width, | 400 velocity.width, |
| 406 "vy", | 401 "vy", |
| 407 velocity.height); | 402 velocity.height); |
| 408 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); | 403 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); |
| 409 } | 404 } |
| 410 | 405 |
| 411 } // namespace content | 406 } // namespace content |
| OLD | NEW |