Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: content/browser/renderer_host/render_widget_host_input_event_router.cc

Issue 2278283002: Implement Mac Pop-up Dictionary for OOPIF. (Closed)
Patch Set: Addressing lfg@'s comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/renderer_host/render_widget_host_input_event_router.h" 5 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "cc/quads/surface_draw_quad.h" 8 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/surfaces/surface_id_allocator.h" 9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "cc/surfaces/surface_manager.h" 10 #include "cc/surfaces/surface_manager.h"
11 #include "content/browser/renderer_host/render_widget_host_impl.h" 11 #include "content/browser/renderer_host/render_widget_host_impl.h"
12 #include "content/browser/renderer_host/render_widget_host_view_base.h" 12 #include "content/browser/renderer_host/render_widget_host_view_base.h"
13 #include "content/common/frame_messages.h" 13 #include "content/common/frame_messages.h"
14 #include "content/public/browser/render_widget_host.h"
Charlie Reis 2016/09/02 21:57:47 Stale?
EhsanK 2016/09/08 17:10:39 Yes. Thanks!
14 #include "third_party/WebKit/public/web/WebInputEvent.h" 15 #include "third_party/WebKit/public/web/WebInputEvent.h"
15 16
16 namespace { 17 namespace {
17 18
18 void TransformEventTouchPositions(blink::WebTouchEvent* event, 19 void TransformEventTouchPositions(blink::WebTouchEvent* event,
19 const gfx::Vector2d& delta) { 20 const gfx::Vector2d& delta) {
20 for (unsigned i = 0; i < event->touchesLength; ++i) { 21 for (unsigned i = 0; i < event->touchesLength; ++i) {
21 event->touches[i].position.x += delta.x(); 22 event->touches[i].position.x += delta.x();
22 event->touches[i].position.y += delta.y(); 23 event->touches[i].position.y += delta.y();
23 } 24 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 void RenderWidgetHostInputEventRouter::OnHittestData( 420 void RenderWidgetHostInputEventRouter::OnHittestData(
420 const FrameHostMsg_HittestData_Params& params) { 421 const FrameHostMsg_HittestData_Params& params) {
421 if (owner_map_.find(params.surface_id.client_id()) == owner_map_.end()) { 422 if (owner_map_.find(params.surface_id.client_id()) == owner_map_.end()) {
422 return; 423 return;
423 } 424 }
424 HittestData data; 425 HittestData data;
425 data.ignored_for_hittest = params.ignored_for_hittest; 426 data.ignored_for_hittest = params.ignored_for_hittest;
426 hittest_data_[params.surface_id] = data; 427 hittest_data_[params.surface_id] = data;
427 } 428 }
428 429
430 #if defined(OS_MACOSX)
431 RenderWidgetHostImpl*
432 RenderWidgetHostInputEventRouter::GetRenderWidgetHostAtPoint(
433 RenderWidgetHostViewBase* root_view,
434 const gfx::Point& point,
435 gfx::Point* transformed_point) {
436 return RenderWidgetHostImpl::From(
437 FindEventTarget(root_view, point, transformed_point)
438 ->GetRenderWidgetHost());
439 }
440 #endif
441
429 void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent( 442 void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent(
430 RenderWidgetHostViewBase* root_view, 443 RenderWidgetHostViewBase* root_view,
431 blink::WebGestureEvent* event, 444 blink::WebGestureEvent* event,
432 const ui::LatencyInfo& latency) { 445 const ui::LatencyInfo& latency) {
433 DCHECK_EQ(blink::WebGestureDeviceTouchscreen, event->sourceDevice); 446 DCHECK_EQ(blink::WebGestureDeviceTouchscreen, event->sourceDevice);
434 447
435 if (event->type == blink::WebInputEvent::GesturePinchBegin) { 448 if (event->type == blink::WebInputEvent::GesturePinchBegin) {
436 in_touchscreen_gesture_pinch_ = true; 449 in_touchscreen_gesture_pinch_ = true;
437 // If the root view wasn't already receiving the gesture stream, then we 450 // If the root view wasn't already receiving the gesture stream, then we
438 // need to wrap the diverted pinch events in a GestureScrollBegin/End. 451 // need to wrap the diverted pinch events in a GestureScrollBegin/End.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 if (!touchpad_gesture_target_.target) 556 if (!touchpad_gesture_target_.target)
544 return; 557 return;
545 558
546 // TODO(mohsen): Add tests to check event location. 559 // TODO(mohsen): Add tests to check event location.
547 event->x += touchpad_gesture_target_.delta.x(); 560 event->x += touchpad_gesture_target_.delta.x();
548 event->y += touchpad_gesture_target_.delta.y(); 561 event->y += touchpad_gesture_target_.delta.y();
549 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); 562 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency);
550 } 563 }
551 564
552 } // namespace content 565 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698