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

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

Issue 1313353010: 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
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): Understand why we need this code in html_viewer.
sadrul 2015/09/09 04:19:04 GR currently happens in html_viewer. So it needs t
rjkroege 2015/09/09 19:45:38 thanks. TODO updated.
18 void SetPropertiesFromEvent(const mojo::Event& event, 19 void SetPropertiesFromEvent(const mojo::Event& event,
19 ui::PointerProperties* properties) { 20 ui::PointerProperties* properties) {
20 properties->id = event.pointer_data->pointer_id; 21 properties->id = event.pointer_data->pointer_id;
21 properties->x = event.pointer_data->x; 22 properties->x = event.pointer_data->x;
22 properties->y = event.pointer_data->y; 23 properties->y = event.pointer_data->y;
23 properties->raw_x = event.pointer_data->screen_x; 24 properties->raw_x = event.pointer_data->screen_x;
24 properties->raw_y = event.pointer_data->screen_y; 25 properties->raw_y = event.pointer_data->screen_y;
25 properties->pressure = event.pointer_data->pressure; 26
26 properties->SetAxesAndOrientation(event.pointer_data->radius_major, 27 if (event.pointer_data->kind == mojo::POINTER_KIND_TOUCH ||
27 event.pointer_data->radius_minor, 28 event.pointer_data->kind == mojo::POINTER_KIND_PEN) {
28 event.pointer_data->orientation); 29 properties->pressure = event.pointer_data->brush_data->pressure;
30
31 // TODO(rjkroege): vary orientation for width, height.
32 properties->SetAxesAndOrientation(event.pointer_data->brush_data->width,
33 event.pointer_data->brush_data->height,
34 0.0);
35 } else {
36 // TODO(rjkroege): This might need to .5 when the button is down to
37 // satisfy the Pointer events specification.
38 properties->pressure = 0.0;
39 }
29 // TODO(sky): Add support for tool_type. 40 // TODO(sky): Add support for tool_type.
30 } 41 }
31 42
32 } // namespace 43 } // namespace
33 44
34 TouchHandler::TouchHandler(blink::WebWidget* web_widget) 45 TouchHandler::TouchHandler(blink::WebWidget* web_widget)
35 : web_widget_(web_widget), 46 : web_widget_(web_widget),
36 gesture_provider_(ui::GetGestureProviderConfig( 47 gesture_provider_(ui::GetGestureProviderConfig(
37 ui::GestureProviderConfigType::CURRENT_PLATFORM), 48 ui::GestureProviderConfigType::CURRENT_PLATFORM),
38 this) { 49 this) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 case mojo::EVENT_TYPE_POINTER_CANCEL: 191 case mojo::EVENT_TYPE_POINTER_CANCEL:
181 current_motion_event_.reset(); 192 current_motion_event_.reset();
182 break; 193 break;
183 194
184 default: 195 default:
185 break; 196 break;
186 } 197 }
187 } 198 }
188 199
189 } // namespace html_viewer 200 } // namespace html_viewer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698