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