OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 break; | 502 break; |
503 case RightButton: | 503 case RightButton: |
504 modifiers |= WebInputEvent::RightButtonDown; | 504 modifiers |= WebInputEvent::RightButtonDown; |
505 break; | 505 break; |
506 } | 506 } |
507 } else | 507 } else |
508 button = WebMouseEvent::ButtonNone; | 508 button = WebMouseEvent::ButtonNone; |
509 movementX = event.movementX(); | 509 movementX = event.movementX(); |
510 movementY = event.movementY(); | 510 movementY = event.movementY(); |
511 clickCount = event.detail(); | 511 clickCount = event.detail(); |
| 512 |
| 513 pointerType = WebPointerProperties::PointerType::Mouse; |
512 } | 514 } |
513 | 515 |
514 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use | 516 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use |
515 // with touch input for plugins that don't support touch input). | 517 // with touch input for plugins that don't support touch input). |
516 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const TouchEvent& event) | 518 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const TouchEvent& event) |
517 { | 519 { |
518 if (!event.touches()) | 520 if (!event.touches()) |
519 return; | 521 return; |
520 if (event.touches()->length() != 1) { | 522 if (event.touches()->length() != 1) { |
521 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) | 523 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) |
(...skipping 28 matching lines...) Expand all Loading... |
550 windowX = pointInRootFrame.x(); | 552 windowX = pointInRootFrame.x(); |
551 windowY = pointInRootFrame.y(); | 553 windowY = pointInRootFrame.y(); |
552 | 554 |
553 button = WebMouseEvent::ButtonLeft; | 555 button = WebMouseEvent::ButtonLeft; |
554 modifiers |= WebInputEvent::LeftButtonDown; | 556 modifiers |= WebInputEvent::LeftButtonDown; |
555 clickCount = (type == MouseDown || type == MouseUp); | 557 clickCount = (type == MouseDown || type == MouseUp); |
556 | 558 |
557 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absolute
Location(), *layoutObject); | 559 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absolute
Location(), *layoutObject); |
558 x = localPoint.x(); | 560 x = localPoint.x(); |
559 y = localPoint.y(); | 561 y = localPoint.y(); |
| 562 |
| 563 pointerType = WebPointerProperties::PointerType::Touch; |
560 } | 564 } |
561 | 565 |
562 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
LayoutObject* layoutObject, const WheelEvent& event) | 566 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
LayoutObject* layoutObject, const WheelEvent& event) |
563 { | 567 { |
564 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) | 568 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) |
565 return; | 569 return; |
566 type = WebInputEvent::MouseWheel; | 570 type = WebInputEvent::MouseWheel; |
567 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); | 571 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); |
568 deltaX = -event.deltaX(); | 572 deltaX = -event.deltaX(); |
569 deltaY = -event.deltaY(); | 573 deltaY = -event.deltaY(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 case PlatformEvent::Char: | 623 case PlatformEvent::Char: |
620 return WebInputEvent::Char; | 624 return WebInputEvent::Char; |
621 default: | 625 default: |
622 return WebInputEvent::Undefined; | 626 return WebInputEvent::Undefined; |
623 } | 627 } |
624 } | 628 } |
625 | 629 |
626 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) | 630 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) |
627 { | 631 { |
628 WebTouchPoint point; | 632 WebTouchPoint point; |
| 633 point.pointerType = WebPointerProperties::PointerType::Touch; |
629 point.id = touch->identifier(); | 634 point.id = touch->identifier(); |
630 point.screenPosition = touch->screenLocation(); | 635 point.screenPosition = touch->screenLocation(); |
631 point.position = convertAbsoluteLocationForLayoutObjectFloat(touch->absolute
Location(), *layoutObject); | 636 point.position = convertAbsoluteLocationForLayoutObjectFloat(touch->absolute
Location(), *layoutObject); |
632 point.radiusX = touch->radiusX(); | 637 point.radiusX = touch->radiusX(); |
633 point.radiusY = touch->radiusY(); | 638 point.radiusY = touch->radiusY(); |
634 point.rotationAngle = touch->rotationAngle(); | 639 point.rotationAngle = touch->rotationAngle(); |
635 point.force = touch->force(); | 640 point.force = touch->force(); |
636 point.state = state; | 641 point.state = state; |
637 return point; | 642 return point; |
638 } | 643 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 break; | 745 break; |
741 case GestureSourceTouchscreen: | 746 case GestureSourceTouchscreen: |
742 sourceDevice = WebGestureDeviceTouchscreen; | 747 sourceDevice = WebGestureDeviceTouchscreen; |
743 break; | 748 break; |
744 case GestureSourceUninitialized: | 749 case GestureSourceUninitialized: |
745 ASSERT_NOT_REACHED(); | 750 ASSERT_NOT_REACHED(); |
746 } | 751 } |
747 } | 752 } |
748 | 753 |
749 } // namespace blink | 754 } // namespace blink |
OLD | NEW |