OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/input/input_handler_proxy.h" | 5 #include "content/renderer/input/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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/renderer/input/input_handler_proxy_client.h" | 10 #include "content/renderer/input/input_handler_proxy_client.h" |
11 #include "third_party/WebKit/public/platform/Platform.h" | 11 #include "third_party/WebKit/public/platform/Platform.h" |
12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
13 #include "ui/events/latency_info.h" | 13 #include "ui/events/latency_info.h" |
14 #include "ui/gfx/frame_time.h" | 14 #include "ui/gfx/frame_time.h" |
15 #include "ui/gfx/geometry/point_conversions.h" | |
15 | 16 |
16 using blink::WebFloatPoint; | 17 using blink::WebFloatPoint; |
17 using blink::WebFloatSize; | 18 using blink::WebFloatSize; |
18 using blink::WebGestureEvent; | 19 using blink::WebGestureEvent; |
19 using blink::WebInputEvent; | 20 using blink::WebInputEvent; |
20 using blink::WebMouseEvent; | 21 using blink::WebMouseEvent; |
21 using blink::WebMouseWheelEvent; | 22 using blink::WebMouseWheelEvent; |
22 using blink::WebPoint; | 23 using blink::WebPoint; |
23 using blink::WebTouchEvent; | 24 using blink::WebTouchEvent; |
24 using blink::WebTouchPoint; | 25 using blink::WebTouchPoint; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 return DID_HANDLE; | 222 return DID_HANDLE; |
222 else if (!fling_may_be_active_on_main_thread_) | 223 else if (!fling_may_be_active_on_main_thread_) |
223 return DROP_EVENT; | 224 return DROP_EVENT; |
224 } else if (event.type == WebInputEvent::TouchStart) { | 225 } else if (event.type == WebInputEvent::TouchStart) { |
225 const WebTouchEvent& touch_event = | 226 const WebTouchEvent& touch_event = |
226 *static_cast<const WebTouchEvent*>(&event); | 227 *static_cast<const WebTouchEvent*>(&event); |
227 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 228 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
228 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) | 229 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) |
229 continue; | 230 continue; |
230 if (input_handler_->HaveTouchEventHandlersAt( | 231 if (input_handler_->HaveTouchEventHandlersAt( |
231 blink::WebPoint(touch_event.touches[i].position.x, | 232 gfx::ToFlooredPoint(touch_event.touches[i].position))) { |
jdduke (slow)
2014/03/10 22:03:23
What about changing InputHandler::HaveTouchEventHa
tdresser
2014/03/12 13:54:40
I did that in patch set #4. It felt like it involv
| |
232 touch_event.touches[i].position.y))) { | |
233 return DID_NOT_HANDLE; | 233 return DID_NOT_HANDLE; |
234 } | 234 } |
235 } | 235 } |
236 return DROP_EVENT; | 236 return DROP_EVENT; |
237 } else if (WebInputEvent::isKeyboardEventType(event.type)) { | 237 } else if (WebInputEvent::isKeyboardEventType(event.type)) { |
238 CancelCurrentFling(true); | 238 CancelCurrentFling(true); |
239 } else if (event.type == WebInputEvent::MouseMove) { | 239 } else if (event.type == WebInputEvent::MouseMove) { |
240 const WebMouseEvent& mouse_event = | 240 const WebMouseEvent& mouse_event = |
241 *static_cast<const WebMouseEvent*>(&event); | 241 *static_cast<const WebMouseEvent*>(&event); |
242 // TODO(tony): Ignore when mouse buttons are down? | 242 // TODO(tony): Ignore when mouse buttons are down? |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 TRACE_EVENT2("renderer", | 486 TRACE_EVENT2("renderer", |
487 "InputHandlerProxy::notifyCurrentFlingVelocity", | 487 "InputHandlerProxy::notifyCurrentFlingVelocity", |
488 "vx", | 488 "vx", |
489 velocity.width, | 489 velocity.width, |
490 "vy", | 490 "vy", |
491 velocity.height); | 491 velocity.height); |
492 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); | 492 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); |
493 } | 493 } |
494 | 494 |
495 } // namespace content | 495 } // namespace content |
OLD | NEW |