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

Side by Side Diff: components/html_viewer/touch_handler.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « components/html_viewer/input_events_unittest.cc ('k') | components/mus/display_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/html_viewer/touch_handler.h" 5 #include "components/html_viewer/touch_handler.h"
6 6
7 #include "third_party/WebKit/public/web/WebInputEvent.h" 7 #include "third_party/WebKit/public/web/WebInputEvent.h"
8 #include "third_party/WebKit/public/web/WebWidget.h" 8 #include "third_party/WebKit/public/web/WebWidget.h"
9 #include "ui/events/base_event_utils.h" 9 #include "ui/events/base_event_utils.h"
10 #include "ui/events/blink/blink_event_util.h" 10 #include "ui/events/blink/blink_event_util.h"
11 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 11 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
12 #include "ui/events/gesture_detection/motion_event_generic.h" 12 #include "ui/events/gesture_detection/motion_event_generic.h"
13 #include "ui/mojo/events/input_events.mojom.h" 13 #include "ui/mojo/events/input_events.mojom.h"
14 14
15 namespace html_viewer { 15 namespace html_viewer {
16 namespace { 16 namespace {
17 17
18 // TODO(rjkroege): Gesture recognition currently happens in the html_viewer.
19 // In phase2, it will be relocated to MUS. Update this code at that time.
20 void SetPropertiesFromEvent(const mojo::Event& event, 18 void SetPropertiesFromEvent(const mojo::Event& event,
21 ui::PointerProperties* properties) { 19 ui::PointerProperties* properties) {
22 properties->id = event.pointer_data->pointer_id; 20 properties->id = event.pointer_data->pointer_id;
23 properties->x = event.pointer_data->location->x; 21 properties->x = event.pointer_data->x;
24 properties->y = event.pointer_data->location->y; 22 properties->y = event.pointer_data->y;
25 properties->raw_x = event.pointer_data->location->screen_x; 23 properties->raw_x = event.pointer_data->screen_x;
26 properties->raw_y = event.pointer_data->location->screen_y; 24 properties->raw_y = event.pointer_data->screen_y;
27 25 properties->pressure = event.pointer_data->pressure;
28 if (event.pointer_data->kind == mojo::POINTER_KIND_TOUCH || 26 properties->SetAxesAndOrientation(event.pointer_data->radius_major,
29 event.pointer_data->kind == mojo::POINTER_KIND_PEN) { 27 event.pointer_data->radius_minor,
30 properties->pressure = event.pointer_data->brush_data->pressure; 28 event.pointer_data->orientation);
31
32 // TODO(rjkroege): vary orientation for width, height.
33 properties->SetAxesAndOrientation(event.pointer_data->brush_data->width,
34 event.pointer_data->brush_data->height,
35 0.0);
36 } else {
37 if (event.flags & mojo::EVENT_FLAGS_LEFT_MOUSE_BUTTON ||
38 event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON ||
39 event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) {
40 properties->pressure = 0.5;
41 } else {
42 properties->pressure = 0.0;
43 }
44 }
45 // TODO(sky): Add support for tool_type. 29 // TODO(sky): Add support for tool_type.
46 } 30 }
47 31
48 } // namespace 32 } // namespace
49 33
50 TouchHandler::TouchHandler(blink::WebWidget* web_widget) 34 TouchHandler::TouchHandler(blink::WebWidget* web_widget)
51 : web_widget_(web_widget), 35 : web_widget_(web_widget),
52 gesture_provider_(ui::GetGestureProviderConfig( 36 gesture_provider_(ui::GetGestureProviderConfig(
53 ui::GestureProviderConfigType::CURRENT_PLATFORM), 37 ui::GestureProviderConfigType::CURRENT_PLATFORM),
54 this) { 38 this) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 case mojo::EVENT_TYPE_POINTER_CANCEL: 180 case mojo::EVENT_TYPE_POINTER_CANCEL:
197 current_motion_event_.reset(); 181 current_motion_event_.reset();
198 break; 182 break;
199 183
200 default: 184 default:
201 break; 185 break;
202 } 186 }
203 } 187 }
204 188
205 } // namespace html_viewer 189 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/input_events_unittest.cc ('k') | components/mus/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698