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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 case ui::ET_GESTURE_MULTIFINGER_SWIPE: | 406 case ui::ET_GESTURE_MULTIFINGER_SWIPE: |
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.deltaX = event->details().generic_x(); | 412 gesture_event.deltaX = event->details().generic_x(); |
413 gesture_event.deltaY = event->details().generic_y(); | 413 gesture_event.deltaY = event->details().generic_y(); |
414 gesture_event.modifiers = EventFlagsToWebEventModifiers(event->flags()); | 414 gesture_event.modifiers = EventFlagsToWebEventModifiers(event->flags()); |
415 | 415 |
| 416 // WebKit gesture events do not have bounding-boxes yet, and expect the data |
| 417 // in deltaX/deltaY instead (and instead of bounding box, WebKit expects the |
| 418 // radius). This is currently used only for tap events. So special case this |
| 419 // particular case. |
| 420 // http://crbug.com/138572 |
| 421 if (event->type() == ui::ET_GESTURE_TAP) { |
| 422 gesture_event.deltaX = event->details().bounding_box().width() / 2; |
| 423 gesture_event.deltaY = event->details().bounding_box().height() / 2; |
| 424 } |
| 425 |
416 return gesture_event; | 426 return gesture_event; |
417 } | 427 } |
418 | 428 |
419 WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( | 429 WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent( |
420 aura::TouchEvent* event, WebKit::WebTouchEvent* web_event) { | 430 aura::TouchEvent* event, WebKit::WebTouchEvent* web_event) { |
421 WebKit::WebTouchPoint* point = NULL; | 431 WebKit::WebTouchPoint* point = NULL; |
422 switch (event->type()) { | 432 switch (event->type()) { |
423 case ui::ET_TOUCH_PRESSED: | 433 case ui::ET_TOUCH_PRESSED: |
424 // Add a new touch point. | 434 // Add a new touch point. |
425 if (web_event->touchesLength < WebKit::WebTouchEvent::touchesLengthCap) { | 435 if (web_event->touchesLength < WebKit::WebTouchEvent::touchesLengthCap) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 491 |
482 // Update the type of the touch event. | 492 // Update the type of the touch event. |
483 web_event->type = TouchEventTypeFromEvent(event); | 493 web_event->type = TouchEventTypeFromEvent(event); |
484 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); | 494 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); |
485 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); | 495 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); |
486 | 496 |
487 return point; | 497 return point; |
488 } | 498 } |
489 | 499 |
490 } // namespace content | 500 } // namespace content |
OLD | NEW |