| 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 29 matching lines...) Expand all Loading... |
| 40 #include "core/events/WheelEvent.h" | 40 #include "core/events/WheelEvent.h" |
| 41 #include "core/frame/FrameHost.h" | 41 #include "core/frame/FrameHost.h" |
| 42 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
| 43 #include "core/frame/PinchViewport.h" | 43 #include "core/frame/PinchViewport.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "core/rendering/RenderObject.h" | 45 #include "core/rendering/RenderObject.h" |
| 46 #include "platform/KeyboardCodes.h" | 46 #include "platform/KeyboardCodes.h" |
| 47 #include "platform/Widget.h" | 47 #include "platform/Widget.h" |
| 48 #include "platform/scroll/ScrollView.h" | 48 #include "platform/scroll/ScrollView.h" |
| 49 | 49 |
| 50 using namespace WebCore; | 50 using namespace blink; |
| 51 | 51 |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 static const double millisPerSecond = 1000.0; | 54 static const double millisPerSecond = 1000.0; |
| 55 | 55 |
| 56 static float widgetInputEventsScaleFactor(const Widget* widget) | 56 static float widgetInputEventsScaleFactor(const Widget* widget) |
| 57 { | 57 { |
| 58 if (!widget) | 58 if (!widget) |
| 59 return 1; | 59 return 1; |
| 60 | 60 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 m_modifiers |= PlatformEvent::ShiftKey; | 161 m_modifiers |= PlatformEvent::ShiftKey; |
| 162 if (e.modifiers & WebInputEvent::ControlKey) | 162 if (e.modifiers & WebInputEvent::ControlKey) |
| 163 m_modifiers |= PlatformEvent::CtrlKey; | 163 m_modifiers |= PlatformEvent::CtrlKey; |
| 164 if (e.modifiers & WebInputEvent::AltKey) | 164 if (e.modifiers & WebInputEvent::AltKey) |
| 165 m_modifiers |= PlatformEvent::AltKey; | 165 m_modifiers |= PlatformEvent::AltKey; |
| 166 if (e.modifiers & WebInputEvent::MetaKey) | 166 if (e.modifiers & WebInputEvent::MetaKey) |
| 167 m_modifiers |= PlatformEvent::MetaKey; | 167 m_modifiers |= PlatformEvent::MetaKey; |
| 168 | 168 |
| 169 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; | 169 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; |
| 170 #if OS(MACOSX) | 170 #if OS(MACOSX) |
| 171 m_phase = static_cast<WebCore::PlatformWheelEventPhase>(e.phase); | 171 m_phase = static_cast<blink::PlatformWheelEventPhase>(e.phase); |
| 172 m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(e.momentumPh
ase); | 172 m_momentumPhase = static_cast<blink::PlatformWheelEventPhase>(e.momentumPhas
e); |
| 173 m_timestamp = e.timeStampSeconds; | 173 m_timestamp = e.timeStampSeconds; |
| 174 m_scrollCount = 0; | 174 m_scrollCount = 0; |
| 175 m_unacceleratedScrollingDeltaX = e.deltaX; | 175 m_unacceleratedScrollingDeltaX = e.deltaX; |
| 176 m_unacceleratedScrollingDeltaY = e.deltaY; | 176 m_unacceleratedScrollingDeltaY = e.deltaY; |
| 177 m_canRubberbandLeft = e.canRubberbandLeft; | 177 m_canRubberbandLeft = e.canRubberbandLeft; |
| 178 m_canRubberbandRight = e.canRubberbandRight; | 178 m_canRubberbandRight = e.canRubberbandRight; |
| 179 #endif | 179 #endif |
| 180 } | 180 } |
| 181 | 181 |
| 182 // PlatformGestureEventBuilder -------------------------------------------------
- | 182 // PlatformGestureEventBuilder -------------------------------------------------
- |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 modifiers |= WebInputEvent::ControlKey; | 469 modifiers |= WebInputEvent::ControlKey; |
| 470 if (event.shiftKey()) | 470 if (event.shiftKey()) |
| 471 modifiers |= WebInputEvent::ShiftKey; | 471 modifiers |= WebInputEvent::ShiftKey; |
| 472 if (event.altKey()) | 472 if (event.altKey()) |
| 473 modifiers |= WebInputEvent::AltKey; | 473 modifiers |= WebInputEvent::AltKey; |
| 474 if (event.metaKey()) | 474 if (event.metaKey()) |
| 475 modifiers |= WebInputEvent::MetaKey; | 475 modifiers |= WebInputEvent::MetaKey; |
| 476 return modifiers; | 476 return modifiers; |
| 477 } | 477 } |
| 478 | 478 |
| 479 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint&
location, const WebCore::RenderObject& renderObject) | 479 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint&
location, const blink::RenderObject& renderObject) |
| 480 { | 480 { |
| 481 return renderObject.absoluteToLocal(location, UseTransforms); | 481 return renderObject.absoluteToLocal(location, UseTransforms); |
| 482 } | 482 } |
| 483 | 483 |
| 484 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const WebCore::RenderObject& renderObject) | 484 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const blink::RenderObject& renderObject) |
| 485 { | 485 { |
| 486 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location,
renderObject)); | 486 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location,
renderObject)); |
| 487 } | 487 } |
| 488 | 488 |
| 489 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEv
ent& webEvent) | 489 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const blink::RenderObject& renderObject, WebMouseEven
t& webEvent) |
| 490 { | 490 { |
| 491 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 491 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 492 webEvent.modifiers = getWebInputModifiers(event); | 492 webEvent.modifiers = getWebInputModifiers(event); |
| 493 | 493 |
| 494 ScrollView* view = toScrollView(widget.parent()); | 494 ScrollView* view = toScrollView(widget.parent()); |
| 495 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); | 495 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); |
| 496 if (view) | 496 if (view) |
| 497 windowPoint = view->contentsToWindow(windowPoint); | 497 windowPoint = view->contentsToWindow(windowPoint); |
| 498 webEvent.globalX = event.screenX(); | 498 webEvent.globalX = event.screenX(); |
| 499 webEvent.globalY = event.screenY(); | 499 webEvent.globalY = event.screenY(); |
| 500 webEvent.windowX = windowPoint.x(); | 500 webEvent.windowX = windowPoint.x(); |
| 501 webEvent.windowY = windowPoint.y(); | 501 webEvent.windowY = windowPoint.y(); |
| 502 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); | 502 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); |
| 503 webEvent.x = localPoint.x(); | 503 webEvent.x = localPoint.x(); |
| 504 webEvent.y = localPoint.y(); | 504 webEvent.y = localPoint.y(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::
RenderObject* renderObject, const MouseEvent& event) | 507 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const blink::Re
nderObject* renderObject, const MouseEvent& event) |
| 508 { | 508 { |
| 509 if (event.type() == EventTypeNames::mousemove) | 509 if (event.type() == EventTypeNames::mousemove) |
| 510 type = WebInputEvent::MouseMove; | 510 type = WebInputEvent::MouseMove; |
| 511 else if (event.type() == EventTypeNames::mouseout) | 511 else if (event.type() == EventTypeNames::mouseout) |
| 512 type = WebInputEvent::MouseLeave; | 512 type = WebInputEvent::MouseLeave; |
| 513 else if (event.type() == EventTypeNames::mouseover) | 513 else if (event.type() == EventTypeNames::mouseover) |
| 514 type = WebInputEvent::MouseEnter; | 514 type = WebInputEvent::MouseEnter; |
| 515 else if (event.type() == EventTypeNames::mousedown) | 515 else if (event.type() == EventTypeNames::mousedown) |
| 516 type = WebInputEvent::MouseDown; | 516 type = WebInputEvent::MouseDown; |
| 517 else if (event.type() == EventTypeNames::mouseup) | 517 else if (event.type() == EventTypeNames::mouseup) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 548 } | 548 } |
| 549 } else | 549 } else |
| 550 button = WebMouseEvent::ButtonNone; | 550 button = WebMouseEvent::ButtonNone; |
| 551 movementX = event.movementX(); | 551 movementX = event.movementX(); |
| 552 movementY = event.movementY(); | 552 movementY = event.movementY(); |
| 553 clickCount = event.detail(); | 553 clickCount = event.detail(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use | 556 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use |
| 557 // with touch input for plugins that don't support touch input). | 557 // with touch input for plugins that don't support touch input). |
| 558 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::
RenderObject* renderObject, const TouchEvent& event) | 558 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const blink::Re
nderObject* renderObject, const TouchEvent& event) |
| 559 { | 559 { |
| 560 if (!event.touches()) | 560 if (!event.touches()) |
| 561 return; | 561 return; |
| 562 if (event.touches()->length() != 1) { | 562 if (event.touches()->length() != 1) { |
| 563 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) | 563 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(
0) : event.changedTouches()->item(0); | 567 const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(
0) : event.changedTouches()->item(0); |
| 568 if (touch->identifier()) | 568 if (touch->identifier()) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 593 | 593 |
| 594 button = WebMouseEvent::ButtonLeft; | 594 button = WebMouseEvent::ButtonLeft; |
| 595 modifiers |= WebInputEvent::LeftButtonDown; | 595 modifiers |= WebInputEvent::LeftButtonDown; |
| 596 clickCount = (type == MouseDown || type == MouseUp); | 596 clickCount = (type == MouseDown || type == MouseUp); |
| 597 | 597 |
| 598 IntPoint localPoint = convertAbsoluteLocationForRenderObject(touch->absolute
Location(), *renderObject); | 598 IntPoint localPoint = convertAbsoluteLocationForRenderObject(touch->absolute
Location(), *renderObject); |
| 599 x = localPoint.x(); | 599 x = localPoint.x(); |
| 600 y = localPoint.y(); | 600 y = localPoint.y(); |
| 601 } | 601 } |
| 602 | 602 |
| 603 WebMouseEventBuilder::WebMouseEventBuilder(const WebCore::Widget* widget, const
WebCore::PlatformMouseEvent& event) | 603 WebMouseEventBuilder::WebMouseEventBuilder(const blink::Widget* widget, const bl
ink::PlatformMouseEvent& event) |
| 604 { | 604 { |
| 605 switch (event.type()) { | 605 switch (event.type()) { |
| 606 case PlatformEvent::MouseMoved: | 606 case PlatformEvent::MouseMoved: |
| 607 type = MouseMove; | 607 type = MouseMove; |
| 608 break; | 608 break; |
| 609 case PlatformEvent::MousePressed: | 609 case PlatformEvent::MousePressed: |
| 610 type = MouseDown; | 610 type = MouseDown; |
| 611 break; | 611 break; |
| 612 case PlatformEvent::MouseReleased: | 612 case PlatformEvent::MouseReleased: |
| 613 type = MouseUp; | 613 type = MouseUp; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 639 y = position.y(); | 639 y = position.y(); |
| 640 globalX = event.globalPosition().x(); | 640 globalX = event.globalPosition().x(); |
| 641 globalY = event.globalPosition().y(); | 641 globalY = event.globalPosition().y(); |
| 642 movementX = event.movementDelta().x() * scale; | 642 movementX = event.movementDelta().x() * scale; |
| 643 movementY = event.movementDelta().y() * scale; | 643 movementY = event.movementDelta().y() * scale; |
| 644 | 644 |
| 645 button = static_cast<Button>(event.button()); | 645 button = static_cast<Button>(event.button()); |
| 646 clickCount = event.clickCount(); | 646 clickCount = event.clickCount(); |
| 647 } | 647 } |
| 648 | 648 |
| 649 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
WebCore::RenderObject* renderObject, const WheelEvent& event) | 649 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
blink::RenderObject* renderObject, const WheelEvent& event) |
| 650 { | 650 { |
| 651 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) | 651 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) |
| 652 return; | 652 return; |
| 653 type = WebInputEvent::MouseWheel; | 653 type = WebInputEvent::MouseWheel; |
| 654 updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *thi
s); | 654 updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *thi
s); |
| 655 deltaX = -event.deltaX(); | 655 deltaX = -event.deltaX(); |
| 656 deltaY = -event.deltaY(); | 656 deltaY = -event.deltaY(); |
| 657 wheelTicksX = event.ticksX(); | 657 wheelTicksX = event.ticksX(); |
| 658 wheelTicksY = event.ticksY(); | 658 wheelTicksY = event.ticksY(); |
| 659 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; | 659 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 newModifiers |= WebInputEvent::ShiftKey; | 717 newModifiers |= WebInputEvent::ShiftKey; |
| 718 if (modifiers & PlatformEvent::CtrlKey) | 718 if (modifiers & PlatformEvent::CtrlKey) |
| 719 newModifiers |= WebInputEvent::ControlKey; | 719 newModifiers |= WebInputEvent::ControlKey; |
| 720 if (modifiers & PlatformEvent::AltKey) | 720 if (modifiers & PlatformEvent::AltKey) |
| 721 newModifiers |= WebInputEvent::AltKey; | 721 newModifiers |= WebInputEvent::AltKey; |
| 722 if (modifiers & PlatformEvent::MetaKey) | 722 if (modifiers & PlatformEvent::MetaKey) |
| 723 newModifiers |= WebInputEvent::MetaKey; | 723 newModifiers |= WebInputEvent::MetaKey; |
| 724 return newModifiers; | 724 return newModifiers; |
| 725 } | 725 } |
| 726 | 726 |
| 727 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const WebCore::PlatformKeyboard
Event& event) | 727 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const blink::PlatformKeyboardEv
ent& event) |
| 728 { | 728 { |
| 729 type = toWebKeyboardEventType(event.type()); | 729 type = toWebKeyboardEventType(event.type()); |
| 730 modifiers = toWebKeyboardEventModifiers(event.modifiers()); | 730 modifiers = toWebKeyboardEventModifiers(event.modifiers()); |
| 731 if (event.isAutoRepeat()) | 731 if (event.isAutoRepeat()) |
| 732 modifiers |= WebInputEvent::IsAutoRepeat; | 732 modifiers |= WebInputEvent::IsAutoRepeat; |
| 733 if (event.isKeypad()) | 733 if (event.isKeypad()) |
| 734 modifiers |= WebInputEvent::IsKeyPad; | 734 modifiers |= WebInputEvent::IsKeyPad; |
| 735 isSystemKey = event.isSystemKey(); | 735 isSystemKey = event.isSystemKey(); |
| 736 nativeKeyCode = event.nativeVirtualKeyCode(); | 736 nativeKeyCode = event.nativeVirtualKeyCode(); |
| 737 | 737 |
| 738 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); | 738 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); |
| 739 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); | 739 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); |
| 740 | 740 |
| 741 event.text().copyTo(text, 0, textLengthCap); | 741 event.text().copyTo(text, 0, textLengthCap); |
| 742 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); | 742 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); |
| 743 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); | 743 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); |
| 744 } | 744 } |
| 745 | 745 |
| 746 static void addTouchPoints(const Widget* widget, const AtomicString& touchType,
TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con
st WebCore::RenderObject* renderObject) | 746 static void addTouchPoints(const Widget* widget, const AtomicString& touchType,
TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con
st blink::RenderObject* renderObject) |
| 747 { | 747 { |
| 748 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>
(WebTouchEvent::touchesLengthCap)); | 748 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>
(WebTouchEvent::touchesLengthCap)); |
| 749 for (unsigned i = 0; i < numberOfTouches; ++i) { | 749 for (unsigned i = 0; i < numberOfTouches; ++i) { |
| 750 const Touch* touch = touches->item(i); | 750 const Touch* touch = touches->item(i); |
| 751 | 751 |
| 752 WebTouchPoint point; | 752 WebTouchPoint point; |
| 753 point.id = touch->identifier(); | 753 point.id = touch->identifier(); |
| 754 point.screenPosition = touch->screenLocation(); | 754 point.screenPosition = touch->screenLocation(); |
| 755 point.position = convertAbsoluteLocationForRenderObjectFloat(touch->abso
luteLocation(), *renderObject); | 755 point.position = convertAbsoluteLocationForRenderObjectFloat(touch->abso
luteLocation(), *renderObject); |
| 756 point.radiusX = touch->radiusX(); | 756 point.radiusX = touch->radiusX(); |
| 757 point.radiusY = touch->radiusY(); | 757 point.radiusY = touch->radiusY(); |
| 758 point.rotationAngle = touch->webkitRotationAngle(); | 758 point.rotationAngle = touch->webkitRotationAngle(); |
| 759 point.force = touch->force(); | 759 point.force = touch->force(); |
| 760 point.state = toWebTouchPointState(touchType); | 760 point.state = toWebTouchPointState(touchType); |
| 761 | 761 |
| 762 touchPoints[i] = point; | 762 touchPoints[i] = point; |
| 763 } | 763 } |
| 764 *touchPointsLength = numberOfTouches; | 764 *touchPointsLength = numberOfTouches; |
| 765 } | 765 } |
| 766 | 766 |
| 767 WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const WebCore::
RenderObject* renderObject, const TouchEvent& event) | 767 WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const blink::Re
nderObject* renderObject, const TouchEvent& event) |
| 768 { | 768 { |
| 769 if (event.type() == EventTypeNames::touchstart) | 769 if (event.type() == EventTypeNames::touchstart) |
| 770 type = TouchStart; | 770 type = TouchStart; |
| 771 else if (event.type() == EventTypeNames::touchmove) | 771 else if (event.type() == EventTypeNames::touchmove) |
| 772 type = TouchMove; | 772 type = TouchMove; |
| 773 else if (event.type() == EventTypeNames::touchend) | 773 else if (event.type() == EventTypeNames::touchend) |
| 774 type = TouchEnd; | 774 type = TouchEnd; |
| 775 else if (event.type() == EventTypeNames::touchcancel) | 775 else if (event.type() == EventTypeNames::touchcancel) |
| 776 type = TouchCancel; | 776 type = TouchCancel; |
| 777 else { | 777 else { |
| 778 ASSERT_NOT_REACHED(); | 778 ASSERT_NOT_REACHED(); |
| 779 type = Undefined; | 779 type = Undefined; |
| 780 return; | 780 return; |
| 781 } | 781 } |
| 782 | 782 |
| 783 modifiers = getWebInputModifiers(event); | 783 modifiers = getWebInputModifiers(event); |
| 784 timeStampSeconds = event.timeStamp() / millisPerSecond; | 784 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 785 cancelable = event.cancelable(); | 785 cancelable = event.cancelable(); |
| 786 | 786 |
| 787 addTouchPoints(widget, event.type(), event.touches(), touches, &touchesLengt
h, renderObject); | 787 addTouchPoints(widget, event.type(), event.touches(), touches, &touchesLengt
h, renderObject); |
| 788 addTouchPoints(widget, event.type(), event.changedTouches(), changedTouches,
&changedTouchesLength, renderObject); | 788 addTouchPoints(widget, event.type(), event.changedTouches(), changedTouches,
&changedTouchesLength, renderObject); |
| 789 addTouchPoints(widget, event.type(), event.targetTouches(), targetTouches, &
targetTouchesLength, renderObject); | 789 addTouchPoints(widget, event.type(), event.targetTouches(), targetTouches, &
targetTouchesLength, renderObject); |
| 790 } | 790 } |
| 791 | 791 |
| 792 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCo
re::RenderObject* renderObject, const GestureEvent& event) | 792 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const blink
::RenderObject* renderObject, const GestureEvent& event) |
| 793 { | 793 { |
| 794 if (event.type() == EventTypeNames::gestureshowpress) | 794 if (event.type() == EventTypeNames::gestureshowpress) |
| 795 type = GestureShowPress; | 795 type = GestureShowPress; |
| 796 else if (event.type() == EventTypeNames::gesturetapdown) | 796 else if (event.type() == EventTypeNames::gesturetapdown) |
| 797 type = GestureTapDown; | 797 type = GestureTapDown; |
| 798 else if (event.type() == EventTypeNames::gesturescrollstart) | 798 else if (event.type() == EventTypeNames::gesturescrollstart) |
| 799 type = GestureScrollBegin; | 799 type = GestureScrollBegin; |
| 800 else if (event.type() == EventTypeNames::gesturescrollend) | 800 else if (event.type() == EventTypeNames::gesturescrollend) |
| 801 type = GestureScrollEnd; | 801 type = GestureScrollEnd; |
| 802 else if (event.type() == EventTypeNames::gesturescrollupdate) { | 802 else if (event.type() == EventTypeNames::gesturescrollupdate) { |
| 803 type = GestureScrollUpdate; | 803 type = GestureScrollUpdate; |
| 804 data.scrollUpdate.deltaX = event.deltaX(); | 804 data.scrollUpdate.deltaX = event.deltaX(); |
| 805 data.scrollUpdate.deltaY = event.deltaY(); | 805 data.scrollUpdate.deltaY = event.deltaY(); |
| 806 } else if (event.type() == EventTypeNames::gesturetap) { | 806 } else if (event.type() == EventTypeNames::gesturetap) { |
| 807 type = GestureTap; | 807 type = GestureTap; |
| 808 data.tap.tapCount = 1; | 808 data.tap.tapCount = 1; |
| 809 } | 809 } |
| 810 | 810 |
| 811 timeStampSeconds = event.timeStamp() / millisPerSecond; | 811 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 812 modifiers = getWebInputModifiers(event); | 812 modifiers = getWebInputModifiers(event); |
| 813 | 813 |
| 814 globalX = event.screenX(); | 814 globalX = event.screenX(); |
| 815 globalY = event.screenY(); | 815 globalY = event.screenY(); |
| 816 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 816 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
| 817 x = localPoint.x(); | 817 x = localPoint.x(); |
| 818 y = localPoint.y(); | 818 y = localPoint.y(); |
| 819 } | 819 } |
| 820 | 820 |
| 821 } // namespace blink | 821 } // namespace blink |
| OLD | NEW |