OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Portions based heavily on: | 5 // Portions based heavily on: |
6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp | 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp |
7 // | 7 // |
8 /* | 8 /* |
9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. | 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 break; | 407 break; |
408 default: | 408 default: |
409 NOTREACHED() << "Unknown gesture type: " << event->type(); | 409 NOTREACHED() << "Unknown gesture type: " << event->type(); |
410 } | 410 } |
411 | 411 |
412 gesture_event.boundingBox = event->details().bounding_box(); | 412 gesture_event.boundingBox = event->details().bounding_box(); |
413 gesture_event.deltaX = event->details().generic_x(); | 413 gesture_event.deltaX = event->details().generic_x(); |
414 gesture_event.deltaY = event->details().generic_y(); | 414 gesture_event.deltaY = event->details().generic_y(); |
415 gesture_event.modifiers = EventFlagsToWebEventModifiers(event->flags()); | 415 gesture_event.modifiers = EventFlagsToWebEventModifiers(event->flags()); |
416 | 416 |
417 // WebKit gesture events do not have bounding-boxes yet, and expect the data | |
418 // in deltaX/deltaY instead (and instead of bounding box, WebKit expects the | |
419 // radius). This is currently used only for tap events. So special case this | |
420 // particular case. | |
421 // http://crbug.com/138572 | |
422 if (event->type() == ui::ET_GESTURE_TAP) { | |
423 gesture_event.deltaX = event->details().bounding_box().width() / 2; | |
424 gesture_event.deltaY = event->details().bounding_box().height() / 2; | |
425 } | |
426 | |
427 return gesture_event; | 417 return gesture_event; |
428 } | 418 } |
429 | 419 |
430 WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( | 420 WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( |
431 aura::TouchEvent* event, WebKit::WebTouchEvent* web_event) { | 421 aura::TouchEvent* event, WebKit::WebTouchEvent* web_event) { |
432 WebKit::WebTouchPoint* point = NULL; | 422 WebKit::WebTouchPoint* point = NULL; |
433 switch (event->type()) { | 423 switch (event->type()) { |
434 case ui::ET_TOUCH_PRESSED: | 424 case ui::ET_TOUCH_PRESSED: |
435 // Add a new touch point. | 425 // Add a new touch point. |
436 if (web_event->touchesLength < WebKit::WebTouchEvent::touchesLengthCap) { | 426 if (web_event->touchesLength < WebKit::WebTouchEvent::touchesLengthCap) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 482 |
493 // Update the type of the touch event. | 483 // Update the type of the touch event. |
494 web_event->type = TouchEventTypeFromEvent(event); | 484 web_event->type = TouchEventTypeFromEvent(event); |
495 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); | 485 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); |
496 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); | 486 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); |
497 | 487 |
498 return point; | 488 return point; |
499 } | 489 } |
500 | 490 |
501 } // namespace content | 491 } // namespace content |
OLD | NEW |