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

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: Added Tests and Modified DEPS 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 "cc/quads/surface_draw_quad.h" 7 #include "cc/quads/surface_draw_quad.h"
8 #include "cc/surfaces/surface_id_allocator.h" 8 #include "cc/surfaces/surface_id_allocator.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "content/browser/renderer_host/render_widget_host_impl.h" 10 #include "content/browser/renderer_host/render_widget_host_impl.h"
11 #include "content/browser/renderer_host/render_widget_host_view_base.h" 11 #include "content/browser/renderer_host/render_widget_host_view_base.h"
12 #include "content/common/frame_messages.h" 12 #include "content/common/frame_messages.h"
13 #include "content/public/browser/render_widget_host.h"
13 #include "third_party/WebKit/public/web/WebInputEvent.h" 14 #include "third_party/WebKit/public/web/WebInputEvent.h"
14 15
15 namespace { 16 namespace {
16 17
17 void TransformEventTouchPositions(blink::WebTouchEvent* event, 18 void TransformEventTouchPositions(blink::WebTouchEvent* event,
18 const gfx::Vector2d& delta) { 19 const gfx::Vector2d& delta) {
19 for (unsigned i = 0; i < event->touchesLength; ++i) { 20 for (unsigned i = 0; i < event->touchesLength; ++i) {
20 event->touches[i].position.x += delta.x(); 21 event->touches[i].position.x += delta.x();
21 event->touches[i].position.y += delta.y(); 22 event->touches[i].position.y += delta.y();
22 } 23 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 void RenderWidgetHostInputEventRouter::OnHittestData( 386 void RenderWidgetHostInputEventRouter::OnHittestData(
386 const FrameHostMsg_HittestData_Params& params) { 387 const FrameHostMsg_HittestData_Params& params) {
387 if (owner_map_.find(params.surface_id.client_id()) == owner_map_.end()) { 388 if (owner_map_.find(params.surface_id.client_id()) == owner_map_.end()) {
388 return; 389 return;
389 } 390 }
390 HittestData data; 391 HittestData data;
391 data.ignored_for_hittest = params.ignored_for_hittest; 392 data.ignored_for_hittest = params.ignored_for_hittest;
392 hittest_data_[params.surface_id] = data; 393 hittest_data_[params.surface_id] = data;
393 } 394 }
394 395
396 #if defined(OS_MACOSX)
397 RenderWidgetHost* RenderWidgetHostInputEventRouter::GetRenderWidgetHostAtPos(
398 RenderWidgetHostViewBase* root_view,
399 const gfx::Point& point,
400 gfx::Point* transformed_point) {
401 RenderWidgetHostViewBase* view =
402 FindEventTarget(root_view, point, transformed_point);
403 return view ? view->GetRenderWidgetHost() : nullptr;
404 }
405 #endif
406
395 void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent( 407 void RenderWidgetHostInputEventRouter::RouteTouchscreenGestureEvent(
396 RenderWidgetHostViewBase* root_view, 408 RenderWidgetHostViewBase* root_view,
397 blink::WebGestureEvent* event, 409 blink::WebGestureEvent* event,
398 const ui::LatencyInfo& latency) { 410 const ui::LatencyInfo& latency) {
399 DCHECK_EQ(blink::WebGestureDeviceTouchscreen, event->sourceDevice); 411 DCHECK_EQ(blink::WebGestureDeviceTouchscreen, event->sourceDevice);
400 412
401 if (event->type == blink::WebInputEvent::GesturePinchBegin) { 413 if (event->type == blink::WebInputEvent::GesturePinchBegin) {
402 in_touchscreen_gesture_pinch_ = true; 414 in_touchscreen_gesture_pinch_ = true;
403 // If the root view wasn't already receiving the gesture stream, then we 415 // If the root view wasn't already receiving the gesture stream, then we
404 // need to wrap the diverted pinch events in a GestureScrollBegin/End. 416 // need to wrap the diverted pinch events in a GestureScrollBegin/End.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 if (!touchpad_gesture_target_.target) 516 if (!touchpad_gesture_target_.target)
505 return; 517 return;
506 518
507 // TODO(mohsen): Add tests to check event location. 519 // TODO(mohsen): Add tests to check event location.
508 event->x += touchpad_gesture_target_.delta.x(); 520 event->x += touchpad_gesture_target_.delta.x();
509 event->y += touchpad_gesture_target_.delta.y(); 521 event->y += touchpad_gesture_target_.delta.y();
510 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); 522 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency);
511 } 523 }
512 524
513 } // namespace content 525 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698