| OLD | NEW |
| 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/renderer/input/render_widget_input_handler.h" | 5 #include "content/renderer/input/render_widget_input_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "cc/trees/swap_promise_monitor.h" | 15 #include "cc/trees/swap_promise_monitor.h" |
| 16 #include "content/common/input/input_event_ack.h" | 16 #include "content/common/input/input_event_ack.h" |
| 17 #include "content/common/input/input_event_ack_state.h" | 17 #include "content/common/input/input_event_ack_state.h" |
| 18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "content/public/renderer/render_frame.h" |
| 19 #include "content/renderer/gpu/render_widget_compositor.h" | 20 #include "content/renderer/gpu/render_widget_compositor.h" |
| 20 #include "content/renderer/ime_event_guard.h" | 21 #include "content/renderer/ime_event_guard.h" |
| 21 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 22 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
| 22 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
| 23 #include "content/renderer/render_widget.h" | 24 #include "content/renderer/render_widget.h" |
| 24 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 25 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 25 #include "third_party/WebKit/public/platform/WebFloatSize.h" | 26 #include "third_party/WebKit/public/platform/WebFloatSize.h" |
| 26 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 27 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 27 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" | 28 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" |
| 28 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" | 29 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
| 29 #include "third_party/WebKit/public/platform/WebTouchEvent.h" | 30 #include "third_party/WebKit/public/platform/WebTouchEvent.h" |
| 30 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 31 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 32 #include "third_party/WebKit/public/web/WebNode.h" |
| 31 #include "ui/events/blink/web_input_event_traits.h" | 33 #include "ui/events/blink/web_input_event_traits.h" |
| 32 #include "ui/gfx/geometry/point_conversions.h" | 34 #include "ui/gfx/geometry/point_conversions.h" |
| 33 #include "ui/latency/latency_info.h" | 35 #include "ui/latency/latency_info.h" |
| 34 | 36 |
| 35 #if defined(OS_ANDROID) | 37 #if defined(OS_ANDROID) |
| 36 #include <android/keycodes.h> | 38 #include <android/keycodes.h> |
| 37 #endif | 39 #endif |
| 38 | 40 |
| 39 using blink::WebFloatPoint; | 41 using blink::WebFloatPoint; |
| 40 using blink::WebFloatSize; | 42 using blink::WebFloatSize; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 handling_event_overscroll_(nullptr), | 200 handling_event_overscroll_(nullptr), |
| 199 handling_event_type_(WebInputEvent::kUndefined), | 201 handling_event_type_(WebInputEvent::kUndefined), |
| 200 suppress_next_char_events_(false) { | 202 suppress_next_char_events_(false) { |
| 201 DCHECK(delegate); | 203 DCHECK(delegate); |
| 202 DCHECK(widget); | 204 DCHECK(widget); |
| 203 delegate->SetInputHandler(this); | 205 delegate->SetInputHandler(this); |
| 204 } | 206 } |
| 205 | 207 |
| 206 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} | 208 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} |
| 207 | 209 |
| 210 int RenderWidgetInputHandler::HitTestFrameAt(const gfx::Point& point) { |
| 211 return RenderFrame::GetRoutingIdForWebFrame( |
| 212 widget_->GetWebWidget() |
| 213 ->HitTestResultAt(blink::WebPoint(point.x(), point.y())) |
| 214 .GetNode() |
| 215 .ContentFrame()); |
| 216 } |
| 217 |
| 208 void RenderWidgetInputHandler::HandleInputEvent( | 218 void RenderWidgetInputHandler::HandleInputEvent( |
| 209 const blink::WebCoalescedInputEvent& coalesced_event, | 219 const blink::WebCoalescedInputEvent& coalesced_event, |
| 210 const ui::LatencyInfo& latency_info, | 220 const ui::LatencyInfo& latency_info, |
| 211 HandledEventCallback callback) { | 221 HandledEventCallback callback) { |
| 212 const WebInputEvent& input_event = coalesced_event.Event(); | 222 const WebInputEvent& input_event = coalesced_event.Event(); |
| 213 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, | 223 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, |
| 214 true); | 224 true); |
| 215 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( | 225 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( |
| 216 &handling_event_type_, input_event.GetType()); | 226 &handling_event_type_, input_event.GetType()); |
| 217 | 227 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 // it can be bundled in the event ack. | 446 // it can be bundled in the event ack. |
| 437 if (handling_event_overscroll_) { | 447 if (handling_event_overscroll_) { |
| 438 *handling_event_overscroll_ = std::move(params); | 448 *handling_event_overscroll_ = std::move(params); |
| 439 return; | 449 return; |
| 440 } | 450 } |
| 441 | 451 |
| 442 delegate_->OnDidOverscroll(*params); | 452 delegate_->OnDidOverscroll(*params); |
| 443 } | 453 } |
| 444 | 454 |
| 445 } // namespace content | 455 } // namespace content |
| OLD | NEW |