| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/Touch.h" | 34 #include "core/dom/Touch.h" |
| 35 #include "core/dom/TouchList.h" | 35 #include "core/dom/TouchList.h" |
| 36 #include "core/events/GestureEvent.h" | 36 #include "core/events/GestureEvent.h" |
| 37 #include "core/events/KeyboardEvent.h" | 37 #include "core/events/KeyboardEvent.h" |
| 38 #include "core/events/MouseEvent.h" | 38 #include "core/events/MouseEvent.h" |
| 39 #include "core/events/TouchEvent.h" | 39 #include "core/events/TouchEvent.h" |
| 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/layout/LayoutObject.h" |
| 44 #include "core/page/Page.h" | 45 #include "core/page/Page.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 "public/platform/Platform.h" | 48 #include "public/platform/Platform.h" |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 static const double millisPerSecond = 1000.0; | 52 static const double millisPerSecond = 1000.0; |
| 53 | 53 |
| 54 static float scaleDeltaToWindow(const Widget* widget, float delta) | 54 static float scaleDeltaToWindow(const Widget* widget, float delta) |
| 55 { | 55 { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 modifiers |= WebInputEvent::ControlKey; | 460 modifiers |= WebInputEvent::ControlKey; |
| 461 if (event.shiftKey()) | 461 if (event.shiftKey()) |
| 462 modifiers |= WebInputEvent::ShiftKey; | 462 modifiers |= WebInputEvent::ShiftKey; |
| 463 if (event.altKey()) | 463 if (event.altKey()) |
| 464 modifiers |= WebInputEvent::AltKey; | 464 modifiers |= WebInputEvent::AltKey; |
| 465 if (event.metaKey()) | 465 if (event.metaKey()) |
| 466 modifiers |= WebInputEvent::MetaKey; | 466 modifiers |= WebInputEvent::MetaKey; |
| 467 return modifiers; | 467 return modifiers; |
| 468 } | 468 } |
| 469 | 469 |
| 470 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint&
location, const RenderObject& renderObject) | 470 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat(const LayoutPoint&
location, const LayoutObject& layoutObject) |
| 471 { | 471 { |
| 472 return renderObject.absoluteToLocal(FloatPoint(location), UseTransforms); | 472 return layoutObject.absoluteToLocal(FloatPoint(location), UseTransforms); |
| 473 } | 473 } |
| 474 | 474 |
| 475 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const RenderObject& renderObject) | 475 static IntPoint convertAbsoluteLocationForLayoutObject(const LayoutPoint& locati
on, const LayoutObject& layoutObject) |
| 476 { | 476 { |
| 477 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location,
renderObject)); | 477 return roundedIntPoint(convertAbsoluteLocationForLayoutObjectFloat(location,
layoutObject)); |
| 478 } | 478 } |
| 479 | 479 |
| 480 // FIXME: Change |widget| to const Widget& after RemoteFrames get | 480 // FIXME: Change |widget| to const Widget& after RemoteFrames get |
| 481 // RemoteFrameViews. | 481 // RemoteFrameViews. |
| 482 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event
, const Widget* widget, const RenderObject& renderObject, WebMouseEvent& webEven
t) | 482 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event
, const Widget* widget, const LayoutObject& layoutObject, WebMouseEvent& webEven
t) |
| 483 { | 483 { |
| 484 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 484 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 485 webEvent.modifiers = getWebInputModifiers(event); | 485 webEvent.modifiers = getWebInputModifiers(event); |
| 486 | 486 |
| 487 FrameView* view = widget ? toFrameView(widget->parent()) : 0; | 487 FrameView* view = widget ? toFrameView(widget->parent()) : 0; |
| 488 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); | 488 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); |
| 489 if (view) | 489 if (view) |
| 490 windowPoint = view->contentsToWindow(windowPoint); | 490 windowPoint = view->contentsToWindow(windowPoint); |
| 491 webEvent.globalX = event.screenX(); | 491 webEvent.globalX = event.screenX(); |
| 492 webEvent.globalY = event.screenY(); | 492 webEvent.globalY = event.screenY(); |
| 493 webEvent.windowX = windowPoint.x(); | 493 webEvent.windowX = windowPoint.x(); |
| 494 webEvent.windowY = windowPoint.y(); | 494 webEvent.windowY = windowPoint.y(); |
| 495 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); | 495 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), layoutObject); |
| 496 webEvent.x = localPoint.x(); | 496 webEvent.x = localPoint.x(); |
| 497 webEvent.y = localPoint.y(); | 497 webEvent.y = localPoint.y(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj
ect* renderObject, const MouseEvent& event) | 500 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const MouseEvent& event) |
| 501 { | 501 { |
| 502 if (event.type() == EventTypeNames::mousemove) | 502 if (event.type() == EventTypeNames::mousemove) |
| 503 type = WebInputEvent::MouseMove; | 503 type = WebInputEvent::MouseMove; |
| 504 else if (event.type() == EventTypeNames::mouseout) | 504 else if (event.type() == EventTypeNames::mouseout) |
| 505 type = WebInputEvent::MouseLeave; | 505 type = WebInputEvent::MouseLeave; |
| 506 else if (event.type() == EventTypeNames::mouseover) | 506 else if (event.type() == EventTypeNames::mouseover) |
| 507 type = WebInputEvent::MouseEnter; | 507 type = WebInputEvent::MouseEnter; |
| 508 else if (event.type() == EventTypeNames::mousedown) | 508 else if (event.type() == EventTypeNames::mousedown) |
| 509 type = WebInputEvent::MouseDown; | 509 type = WebInputEvent::MouseDown; |
| 510 else if (event.type() == EventTypeNames::mouseup) | 510 else if (event.type() == EventTypeNames::mouseup) |
| 511 type = WebInputEvent::MouseUp; | 511 type = WebInputEvent::MouseUp; |
| 512 else if (event.type() == EventTypeNames::contextmenu) | 512 else if (event.type() == EventTypeNames::contextmenu) |
| 513 type = WebInputEvent::ContextMenu; | 513 type = WebInputEvent::ContextMenu; |
| 514 else | 514 else |
| 515 return; // Skip all other mouse events. | 515 return; // Skip all other mouse events. |
| 516 | 516 |
| 517 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); | 517 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); |
| 518 | 518 |
| 519 switch (event.button()) { | 519 switch (event.button()) { |
| 520 case LeftButton: | 520 case LeftButton: |
| 521 button = WebMouseEvent::ButtonLeft; | 521 button = WebMouseEvent::ButtonLeft; |
| 522 break; | 522 break; |
| 523 case MiddleButton: | 523 case MiddleButton: |
| 524 button = WebMouseEvent::ButtonMiddle; | 524 button = WebMouseEvent::ButtonMiddle; |
| 525 break; | 525 break; |
| 526 case RightButton: | 526 case RightButton: |
| 527 button = WebMouseEvent::ButtonRight; | 527 button = WebMouseEvent::ButtonRight; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 541 } | 541 } |
| 542 } else | 542 } else |
| 543 button = WebMouseEvent::ButtonNone; | 543 button = WebMouseEvent::ButtonNone; |
| 544 movementX = event.movementX(); | 544 movementX = event.movementX(); |
| 545 movementY = event.movementY(); | 545 movementY = event.movementY(); |
| 546 clickCount = event.detail(); | 546 clickCount = event.detail(); |
| 547 } | 547 } |
| 548 | 548 |
| 549 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use | 549 // Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mo
use |
| 550 // with touch input for plugins that don't support touch input). | 550 // with touch input for plugins that don't support touch input). |
| 551 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj
ect* renderObject, const TouchEvent& event) | 551 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const TouchEvent& event) |
| 552 { | 552 { |
| 553 if (!event.touches()) | 553 if (!event.touches()) |
| 554 return; | 554 return; |
| 555 if (event.touches()->length() != 1) { | 555 if (event.touches()->length() != 1) { |
| 556 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) | 556 if (event.touches()->length() || event.type() != EventTypeNames::touchen
d || !event.changedTouches() || event.changedTouches()->length() != 1) |
| 557 return; | 557 return; |
| 558 } | 558 } |
| 559 | 559 |
| 560 const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(
0) : event.changedTouches()->item(0); | 560 const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(
0) : event.changedTouches()->item(0); |
| 561 if (touch->identifier()) | 561 if (touch->identifier()) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 581 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); | 581 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); |
| 582 globalX = screenPoint.x(); | 582 globalX = screenPoint.x(); |
| 583 globalY = screenPoint.y(); | 583 globalY = screenPoint.y(); |
| 584 windowX = windowPoint.x(); | 584 windowX = windowPoint.x(); |
| 585 windowY = windowPoint.y(); | 585 windowY = windowPoint.y(); |
| 586 | 586 |
| 587 button = WebMouseEvent::ButtonLeft; | 587 button = WebMouseEvent::ButtonLeft; |
| 588 modifiers |= WebInputEvent::LeftButtonDown; | 588 modifiers |= WebInputEvent::LeftButtonDown; |
| 589 clickCount = (type == MouseDown || type == MouseUp); | 589 clickCount = (type == MouseDown || type == MouseUp); |
| 590 | 590 |
| 591 IntPoint localPoint = convertAbsoluteLocationForRenderObject(touch->absolute
Location(), *renderObject); | 591 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absolute
Location(), *layoutObject); |
| 592 x = localPoint.x(); | 592 x = localPoint.x(); |
| 593 y = localPoint.y(); | 593 y = localPoint.y(); |
| 594 } | 594 } |
| 595 | 595 |
| 596 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const PlatformM
ouseEvent& event) | 596 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const PlatformM
ouseEvent& event) |
| 597 { | 597 { |
| 598 switch (event.type()) { | 598 switch (event.type()) { |
| 599 case PlatformEvent::MouseMoved: | 599 case PlatformEvent::MouseMoved: |
| 600 type = MouseMove; | 600 type = MouseMove; |
| 601 break; | 601 break; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 628 y = position.y(); | 628 y = position.y(); |
| 629 globalX = event.globalPosition().x(); | 629 globalX = event.globalPosition().x(); |
| 630 globalY = event.globalPosition().y(); | 630 globalY = event.globalPosition().y(); |
| 631 movementX = event.movementDelta().x() * scale; | 631 movementX = event.movementDelta().x() * scale; |
| 632 movementY = event.movementDelta().y() * scale; | 632 movementY = event.movementDelta().y() * scale; |
| 633 | 633 |
| 634 button = static_cast<Button>(event.button()); | 634 button = static_cast<Button>(event.button()); |
| 635 clickCount = event.clickCount(); | 635 clickCount = event.clickCount(); |
| 636 } | 636 } |
| 637 | 637 |
| 638 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
RenderObject* renderObject, const WheelEvent& event) | 638 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const
LayoutObject* layoutObject, const WheelEvent& event) |
| 639 { | 639 { |
| 640 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) | 640 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) |
| 641 return; | 641 return; |
| 642 type = WebInputEvent::MouseWheel; | 642 type = WebInputEvent::MouseWheel; |
| 643 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); | 643 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); |
| 644 deltaX = -event.deltaX(); | 644 deltaX = -event.deltaX(); |
| 645 deltaY = -event.deltaY(); | 645 deltaY = -event.deltaY(); |
| 646 wheelTicksX = event.ticksX(); | 646 wheelTicksX = event.ticksX(); |
| 647 wheelTicksY = event.ticksY(); | 647 wheelTicksY = event.ticksY(); |
| 648 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; | 648 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; |
| 649 canScroll = event.canScroll(); | 649 canScroll = event.canScroll(); |
| 650 } | 650 } |
| 651 | 651 |
| 652 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) | 652 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) |
| 653 { | 653 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 domCode = Platform::current()->domEnumFromCodeString(event.code()); | 714 domCode = Platform::current()->domEnumFromCodeString(event.code()); |
| 715 | 715 |
| 716 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); | 716 windowsKeyCode = windowsKeyCodeWithoutLocation(event.windowsVirtualKeyCode()
); |
| 717 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); | 717 modifiers |= locationModifiersFromWindowsKeyCode(event.windowsVirtualKeyCode
()); |
| 718 | 718 |
| 719 event.text().copyTo(text, 0, textLengthCap); | 719 event.text().copyTo(text, 0, textLengthCap); |
| 720 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); | 720 event.unmodifiedText().copyTo(unmodifiedText, 0, textLengthCap); |
| 721 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); | 721 memcpy(keyIdentifier, event.keyIdentifier().ascii().data(), std::min(static_
cast<unsigned>(keyIdentifierLengthCap), event.keyIdentifier().length())); |
| 722 } | 722 } |
| 723 | 723 |
| 724 static WebTouchPoint toWebTouchPoint(const Touch* touch, const RenderObject* ren
derObject, WebTouchPoint::State state) | 724 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) |
| 725 { | 725 { |
| 726 WebTouchPoint point; | 726 WebTouchPoint point; |
| 727 point.id = touch->identifier(); | 727 point.id = touch->identifier(); |
| 728 point.screenPosition = touch->screenLocation(); | 728 point.screenPosition = touch->screenLocation(); |
| 729 point.position = convertAbsoluteLocationForRenderObjectFloat(touch->absolute
Location(), *renderObject); | 729 point.position = convertAbsoluteLocationForLayoutObjectFloat(touch->absolute
Location(), *layoutObject); |
| 730 point.radiusX = touch->radiusX(); | 730 point.radiusX = touch->radiusX(); |
| 731 point.radiusY = touch->radiusY(); | 731 point.radiusY = touch->radiusY(); |
| 732 point.rotationAngle = touch->webkitRotationAngle(); | 732 point.rotationAngle = touch->webkitRotationAngle(); |
| 733 point.force = touch->force(); | 733 point.force = touch->force(); |
| 734 point.state = state; | 734 point.state = state; |
| 735 return point; | 735 return point; |
| 736 } | 736 } |
| 737 | 737 |
| 738 static bool hasTouchPointWithId(const WebTouchPoint* touchPoints, unsigned touch
PointsLength, unsigned id) | 738 static bool hasTouchPointWithId(const WebTouchPoint* touchPoints, unsigned touch
PointsLength, unsigned id) |
| 739 { | 739 { |
| 740 for (unsigned i = 0; i < touchPointsLength; ++i) { | 740 for (unsigned i = 0; i < touchPointsLength; ++i) { |
| 741 if (touchPoints[i].id == static_cast<int>(id)) | 741 if (touchPoints[i].id == static_cast<int>(id)) |
| 742 return true; | 742 return true; |
| 743 } | 743 } |
| 744 return false; | 744 return false; |
| 745 } | 745 } |
| 746 | 746 |
| 747 static void addTouchPointsIfNotYetAdded(const Widget* widget, WebTouchPoint::Sta
te state, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsL
ength, const RenderObject* renderObject) | 747 static void addTouchPointsIfNotYetAdded(const Widget* widget, WebTouchPoint::Sta
te state, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsL
ength, const LayoutObject* layoutObject) |
| 748 { | 748 { |
| 749 unsigned initialTouchPointsLength = *touchPointsLength; | 749 unsigned initialTouchPointsLength = *touchPointsLength; |
| 750 for (unsigned i = 0; i < touches->length(); ++i) { | 750 for (unsigned i = 0; i < touches->length(); ++i) { |
| 751 const unsigned pointIndex = *touchPointsLength; | 751 const unsigned pointIndex = *touchPointsLength; |
| 752 if (pointIndex >= static_cast<unsigned>(WebTouchEvent::touchesLengthCap)
) | 752 if (pointIndex >= static_cast<unsigned>(WebTouchEvent::touchesLengthCap)
) |
| 753 return; | 753 return; |
| 754 | 754 |
| 755 const Touch* touch = touches->item(i); | 755 const Touch* touch = touches->item(i); |
| 756 if (hasTouchPointWithId(touchPoints, initialTouchPointsLength, touch->id
entifier())) | 756 if (hasTouchPointWithId(touchPoints, initialTouchPointsLength, touch->id
entifier())) |
| 757 continue; | 757 continue; |
| 758 | 758 |
| 759 touchPoints[pointIndex] = toWebTouchPoint(touch, renderObject, state); | 759 touchPoints[pointIndex] = toWebTouchPoint(touch, layoutObject, state); |
| 760 ++(*touchPointsLength); | 760 ++(*touchPointsLength); |
| 761 } | 761 } |
| 762 } | 762 } |
| 763 | 763 |
| 764 WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const RenderObj
ect* renderObject, const TouchEvent& event) | 764 WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const TouchEvent& event) |
| 765 { | 765 { |
| 766 if (event.type() == EventTypeNames::touchstart) | 766 if (event.type() == EventTypeNames::touchstart) |
| 767 type = TouchStart; | 767 type = TouchStart; |
| 768 else if (event.type() == EventTypeNames::touchmove) | 768 else if (event.type() == EventTypeNames::touchmove) |
| 769 type = TouchMove; | 769 type = TouchMove; |
| 770 else if (event.type() == EventTypeNames::touchend) | 770 else if (event.type() == EventTypeNames::touchend) |
| 771 type = TouchEnd; | 771 type = TouchEnd; |
| 772 else if (event.type() == EventTypeNames::touchcancel) | 772 else if (event.type() == EventTypeNames::touchcancel) |
| 773 type = TouchCancel; | 773 type = TouchCancel; |
| 774 else { | 774 else { |
| 775 ASSERT_NOT_REACHED(); | 775 ASSERT_NOT_REACHED(); |
| 776 type = Undefined; | 776 type = Undefined; |
| 777 return; | 777 return; |
| 778 } | 778 } |
| 779 | 779 |
| 780 modifiers = getWebInputModifiers(event); | 780 modifiers = getWebInputModifiers(event); |
| 781 timeStampSeconds = event.timeStamp() / millisPerSecond; | 781 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 782 cancelable = event.cancelable(); | 782 cancelable = event.cancelable(); |
| 783 | 783 |
| 784 addTouchPointsIfNotYetAdded(widget, toWebTouchPointState(event.type()), even
t.changedTouches(), touches, &touchesLength, renderObject); | 784 addTouchPointsIfNotYetAdded(widget, toWebTouchPointState(event.type()), even
t.changedTouches(), touches, &touchesLength, layoutObject); |
| 785 addTouchPointsIfNotYetAdded(widget, WebTouchPoint::StateStationary, event.to
uches(), touches, &touchesLength, renderObject); | 785 addTouchPointsIfNotYetAdded(widget, WebTouchPoint::StateStationary, event.to
uches(), touches, &touchesLength, layoutObject); |
| 786 } | 786 } |
| 787 | 787 |
| 788 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Rende
rObject* renderObject, const GestureEvent& event) | 788 WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Layou
tObject* layoutObject, const GestureEvent& event) |
| 789 { | 789 { |
| 790 if (event.type() == EventTypeNames::gestureshowpress) | 790 if (event.type() == EventTypeNames::gestureshowpress) |
| 791 type = GestureShowPress; | 791 type = GestureShowPress; |
| 792 else if (event.type() == EventTypeNames::gesturetapdown) | 792 else if (event.type() == EventTypeNames::gesturetapdown) |
| 793 type = GestureTapDown; | 793 type = GestureTapDown; |
| 794 else if (event.type() == EventTypeNames::gesturescrollstart) | 794 else if (event.type() == EventTypeNames::gesturescrollstart) |
| 795 type = GestureScrollBegin; | 795 type = GestureScrollBegin; |
| 796 else if (event.type() == EventTypeNames::gesturescrollend) | 796 else if (event.type() == EventTypeNames::gesturescrollend) |
| 797 type = GestureScrollEnd; | 797 type = GestureScrollEnd; |
| 798 else if (event.type() == EventTypeNames::gesturescrollupdate) { | 798 else if (event.type() == EventTypeNames::gesturescrollupdate) { |
| 799 type = GestureScrollUpdate; | 799 type = GestureScrollUpdate; |
| 800 data.scrollUpdate.deltaX = event.deltaX(); | 800 data.scrollUpdate.deltaX = event.deltaX(); |
| 801 data.scrollUpdate.deltaY = event.deltaY(); | 801 data.scrollUpdate.deltaY = event.deltaY(); |
| 802 } else if (event.type() == EventTypeNames::gesturetap) { | 802 } else if (event.type() == EventTypeNames::gesturetap) { |
| 803 type = GestureTap; | 803 type = GestureTap; |
| 804 data.tap.tapCount = 1; | 804 data.tap.tapCount = 1; |
| 805 } | 805 } |
| 806 | 806 |
| 807 timeStampSeconds = event.timeStamp() / millisPerSecond; | 807 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 808 modifiers = getWebInputModifiers(event); | 808 modifiers = getWebInputModifiers(event); |
| 809 | 809 |
| 810 globalX = event.screenX(); | 810 globalX = event.screenX(); |
| 811 globalY = event.screenY(); | 811 globalY = event.screenY(); |
| 812 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 812 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
| 813 x = localPoint.x(); | 813 x = localPoint.x(); |
| 814 y = localPoint.y(); | 814 y = localPoint.y(); |
| 815 } | 815 } |
| 816 | 816 |
| 817 } // namespace blink | 817 } // namespace blink |
| OLD | NEW |