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

Side by Side Diff: ui/events/blink/blink_event_util.cc

Issue 1989623002: Suppressed MEs for gestures from cancelled PEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 | « ui/events/blink/blink_event_util.h ('k') | ui/events/blink/blink_event_util_unittest.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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "ui/events/blink/blink_event_util.h" 8 #include "ui/events/blink/blink_event_util.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (flags & EF_TOUCH_ACCESSIBILITY) 219 if (flags & EF_TOUCH_ACCESSIBILITY)
220 modifiers |= blink::WebInputEvent::IsTouchAccessibility; 220 modifiers |= blink::WebInputEvent::IsTouchAccessibility;
221 221
222 return modifiers; 222 return modifiers;
223 } 223 }
224 224
225 WebGestureEvent CreateWebGestureEvent(const GestureEventDetails& details, 225 WebGestureEvent CreateWebGestureEvent(const GestureEventDetails& details,
226 base::TimeTicks timestamp, 226 base::TimeTicks timestamp,
227 const gfx::PointF& location, 227 const gfx::PointF& location,
228 const gfx::PointF& raw_location, 228 const gfx::PointF& raw_location,
229 int flags) { 229 int flags,
230 uint32_t unique_touch_event_id) {
230 WebGestureEvent gesture; 231 WebGestureEvent gesture;
231 gesture.timeStampSeconds = ui::EventTimeStampToSeconds(timestamp); 232 gesture.timeStampSeconds = ui::EventTimeStampToSeconds(timestamp);
232 gesture.x = gfx::ToFlooredInt(location.x()); 233 gesture.x = gfx::ToFlooredInt(location.x());
233 gesture.y = gfx::ToFlooredInt(location.y()); 234 gesture.y = gfx::ToFlooredInt(location.y());
234 gesture.globalX = gfx::ToFlooredInt(raw_location.x()); 235 gesture.globalX = gfx::ToFlooredInt(raw_location.x());
235 gesture.globalY = gfx::ToFlooredInt(raw_location.y()); 236 gesture.globalY = gfx::ToFlooredInt(raw_location.y());
236 gesture.modifiers = EventFlagsToWebEventModifiers(flags); 237 gesture.modifiers = EventFlagsToWebEventModifiers(flags);
237 238
238 switch (details.device_type()) { 239 switch (details.device_type()) {
239 case GestureDeviceType::DEVICE_TOUCHSCREEN: 240 case GestureDeviceType::DEVICE_TOUCHSCREEN:
240 gesture.sourceDevice = blink::WebGestureDeviceTouchscreen; 241 gesture.sourceDevice = blink::WebGestureDeviceTouchscreen;
241 break; 242 break;
242 case GestureDeviceType::DEVICE_TOUCHPAD: 243 case GestureDeviceType::DEVICE_TOUCHPAD:
243 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; 244 gesture.sourceDevice = blink::WebGestureDeviceTouchpad;
244 break; 245 break;
245 case GestureDeviceType::DEVICE_UNKNOWN: 246 case GestureDeviceType::DEVICE_UNKNOWN:
246 NOTREACHED() << "Unknown device type is not allowed"; 247 NOTREACHED() << "Unknown device type is not allowed";
247 gesture.sourceDevice = blink::WebGestureDeviceUninitialized; 248 gesture.sourceDevice = blink::WebGestureDeviceUninitialized;
248 break; 249 break;
249 } 250 }
250 251
252 gesture.uniqueTouchEventId = unique_touch_event_id;
253
251 switch (details.type()) { 254 switch (details.type()) {
252 case ET_GESTURE_SHOW_PRESS: 255 case ET_GESTURE_SHOW_PRESS:
253 gesture.type = WebInputEvent::GestureShowPress; 256 gesture.type = WebInputEvent::GestureShowPress;
254 gesture.data.showPress.width = details.bounding_box_f().width(); 257 gesture.data.showPress.width = details.bounding_box_f().width();
255 gesture.data.showPress.height = details.bounding_box_f().height(); 258 gesture.data.showPress.height = details.bounding_box_f().height();
256 break; 259 break;
257 case ET_GESTURE_DOUBLE_TAP: 260 case ET_GESTURE_DOUBLE_TAP:
258 gesture.type = WebInputEvent::GestureDoubleTap; 261 gesture.type = WebInputEvent::GestureDoubleTap;
259 DCHECK_EQ(1, details.tap_count()); 262 DCHECK_EQ(1, details.tap_count());
260 gesture.data.tap.tapCount = details.tap_count(); 263 gesture.data.tap.tapCount = details.tap_count();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 << details.type(); 346 << details.type();
344 } 347 }
345 348
346 return gesture; 349 return gesture;
347 } 350 }
348 351
349 WebGestureEvent CreateWebGestureEventFromGestureEventData( 352 WebGestureEvent CreateWebGestureEventFromGestureEventData(
350 const GestureEventData& data) { 353 const GestureEventData& data) {
351 return CreateWebGestureEvent(data.details, data.time, 354 return CreateWebGestureEvent(data.details, data.time,
352 gfx::PointF(data.x, data.y), 355 gfx::PointF(data.x, data.y),
353 gfx::PointF(data.raw_x, data.raw_y), data.flags); 356 gfx::PointF(data.raw_x, data.raw_y), data.flags,
357 data.unique_touch_event_id);
354 } 358 }
355 359
356 std::unique_ptr<blink::WebInputEvent> ScaleWebInputEvent( 360 std::unique_ptr<blink::WebInputEvent> ScaleWebInputEvent(
357 const blink::WebInputEvent& event, 361 const blink::WebInputEvent& event,
358 float scale) { 362 float scale) {
359 std::unique_ptr<blink::WebInputEvent> scaled_event; 363 std::unique_ptr<blink::WebInputEvent> scaled_event;
360 if (scale == 1.f) 364 if (scale == 1.f)
361 return scaled_event; 365 return scaled_event;
362 if (event.type == blink::WebMouseEvent::MouseWheel) { 366 if (event.type == blink::WebMouseEvent::MouseWheel) {
363 blink::WebMouseWheelEvent* wheel_event = new blink::WebMouseWheelEvent; 367 blink::WebMouseWheelEvent* wheel_event = new blink::WebMouseWheelEvent;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 case MotionEvent::TOOL_TYPE_MOUSE: 474 case MotionEvent::TOOL_TYPE_MOUSE:
471 return WebPointerProperties::PointerType::Mouse; 475 return WebPointerProperties::PointerType::Mouse;
472 case MotionEvent::TOOL_TYPE_ERASER: 476 case MotionEvent::TOOL_TYPE_ERASER:
473 return WebPointerProperties::PointerType::Unknown; 477 return WebPointerProperties::PointerType::Unknown;
474 } 478 }
475 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type; 479 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type;
476 return WebPointerProperties::PointerType::Unknown; 480 return WebPointerProperties::PointerType::Unknown;
477 } 481 }
478 482
479 } // namespace ui 483 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/blink_event_util.h ('k') | ui/events/blink/blink_event_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698