| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; | 43 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; |
| 44 bool isCancelable = !isMouseEnterOrLeave; | 44 bool isCancelable = !isMouseEnterOrLeave; |
| 45 bool isBubbling = !isMouseEnterOrLeave; | 45 bool isBubbling = !isMouseEnterOrLeave; |
| 46 | 46 |
| 47 return MouseEvent::create( | 47 return MouseEvent::create( |
| 48 eventType, isBubbling, isCancelable, view, | 48 eventType, isBubbling, isCancelable, view, |
| 49 detail, event.globalPosition().x(), event.globalPosition().y(), event.po
sition().x(), event.position().y(), | 49 detail, event.globalPosition().x(), event.globalPosition().y(), event.po
sition().x(), event.position().y(), |
| 50 event.movementDelta().x(), event.movementDelta().y(), | 50 event.movementDelta().x(), event.movementDelta().y(), |
| 51 event.getModifiers(), static_cast<short>(event.pointerProperties().butto
n), | 51 event.getModifiers(), static_cast<short>(event.pointerProperties().butto
n), |
| 52 platformModifiersToButtons(event.getModifiers()), | 52 platformModifiersToButtons(event.getModifiers()), |
| 53 relatedTarget, event.timestamp(), event.getSyntheticEventType(), event.r
egion()); | 53 relatedTarget, event.timestamp(), event.getSyntheticEventType(), event.r
egion(), |
| 54 &event); |
| 54 } | 55 } |
| 55 | 56 |
| 56 MouseEvent* MouseEvent::create(const AtomicString& type, bool canBubble, bool ca
ncelable, AbstractView* view, | 57 MouseEvent* MouseEvent::create(const AtomicString& type, bool canBubble, bool ca
ncelable, AbstractView* view, |
| 57 int detail, int screenX, int screenY, int windowX, int windowY, | 58 int detail, int screenX, int screenY, int windowX, int windowY, |
| 58 int movementX, int movementY, | 59 int movementX, int movementY, |
| 59 PlatformEvent::Modifiers modifiers, | 60 PlatformEvent::Modifiers modifiers, |
| 60 short button, unsigned short buttons, | 61 short button, unsigned short buttons, |
| 61 EventTarget* relatedTarget, | 62 EventTarget* relatedTarget, |
| 62 double platformTimeStamp, | 63 double platformTimeStamp, |
| 63 PlatformMouseEvent::SyntheticEventType syntheticEventType, | 64 PlatformMouseEvent::SyntheticEventType syntheticEventType, |
| 64 const String& region) | 65 const String& region, |
| 66 const PlatformMouseEvent* mouseEvent) |
| 65 { | 67 { |
| 66 return new MouseEvent(type, canBubble, cancelable, view, | 68 return new MouseEvent(type, canBubble, cancelable, view, |
| 67 detail, screenX, screenY, windowX, windowY, | 69 detail, screenX, screenY, windowX, windowY, |
| 68 movementX, movementY, | 70 movementX, movementY, |
| 69 modifiers, button, buttons, relatedTarget, platformTimeStamp, syntheticE
ventType, region); | 71 modifiers, button, buttons, relatedTarget, platformTimeStamp, syntheticE
ventType, region, mouseEvent); |
| 70 } | 72 } |
| 71 | 73 |
| 72 MouseEvent* MouseEvent::create(const AtomicString& eventType, AbstractView* view
, Event* underlyingEvent, SimulatedClickCreationScope creationScope) | 74 MouseEvent* MouseEvent::create(const AtomicString& eventType, AbstractView* view
, Event* underlyingEvent, SimulatedClickCreationScope creationScope) |
| 73 { | 75 { |
| 74 PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers; | 76 PlatformEvent::Modifiers modifiers = PlatformEvent::NoModifiers; |
| 75 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt)) { | 77 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt)) { |
| 76 modifiers = keyStateEvent->modifiers(); | 78 modifiers = keyStateEvent->modifiers(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 PlatformMouseEvent::SyntheticEventType syntheticType = PlatformMouseEvent::P
ositionless; | 81 PlatformMouseEvent::SyntheticEventType syntheticType = PlatformMouseEvent::P
ositionless; |
| 80 int screenX = 0; | 82 int screenX = 0; |
| 81 int screenY = 0; | 83 int screenY = 0; |
| 82 if (underlyingEvent && underlyingEvent->isMouseEvent()) { | 84 if (underlyingEvent && underlyingEvent->isMouseEvent()) { |
| 83 syntheticType = PlatformMouseEvent::RealOrIndistinguishable; | 85 syntheticType = PlatformMouseEvent::RealOrIndistinguishable; |
| 84 MouseEvent* mouseEvent = toMouseEvent(underlyingEvent); | 86 MouseEvent* mouseEvent = toMouseEvent(underlyingEvent); |
| 85 screenX = mouseEvent->screenLocation().x(); | 87 screenX = mouseEvent->screenLocation().x(); |
| 86 screenY = mouseEvent->screenLocation().y(); | 88 screenY = mouseEvent->screenLocation().y(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 double timestamp = underlyingEvent ? underlyingEvent->platformTimeStamp() :
monotonicallyIncreasingTime(); | 91 double timestamp = underlyingEvent ? underlyingEvent->platformTimeStamp() :
monotonicallyIncreasingTime(); |
| 90 MouseEvent* createdEvent = MouseEvent::create(eventType, true, true, view, | 92 MouseEvent* createdEvent = MouseEvent::create(eventType, true, true, view, |
| 91 0, screenX, screenY, 0, 0, 0, 0, modifiers, 0, 0, nullptr, | 93 0, screenX, screenY, 0, 0, 0, 0, modifiers, 0, 0, nullptr, |
| 92 timestamp, syntheticType, String()); | 94 timestamp, syntheticType, String(), nullptr); |
| 93 | 95 |
| 94 createdEvent->setTrusted(creationScope == SimulatedClickCreationScope::FromU
serAgent); | 96 createdEvent->setTrusted(creationScope == SimulatedClickCreationScope::FromU
serAgent); |
| 95 createdEvent->setUnderlyingEvent(underlyingEvent); | 97 createdEvent->setUnderlyingEvent(underlyingEvent); |
| 96 if (syntheticType == PlatformMouseEvent::RealOrIndistinguishable) { | 98 if (syntheticType == PlatformMouseEvent::RealOrIndistinguishable) { |
| 97 MouseEvent* mouseEvent = toMouseEvent(createdEvent->underlyingEvent()); | 99 MouseEvent* mouseEvent = toMouseEvent(createdEvent->underlyingEvent()); |
| 98 createdEvent->initCoordinates(mouseEvent->clientLocation()); | 100 createdEvent->initCoordinates(mouseEvent->clientLocation()); |
| 99 } | 101 } |
| 100 | 102 |
| 101 return createdEvent; | 103 return createdEvent; |
| 102 } | 104 } |
| 103 | 105 |
| 104 MouseEvent::MouseEvent() | 106 MouseEvent::MouseEvent() |
| 105 : m_button(0) | 107 : m_button(0) |
| 106 , m_buttons(0) | 108 , m_buttons(0) |
| 107 , m_relatedTarget(nullptr) | 109 , m_relatedTarget(nullptr) |
| 108 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) | 110 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) |
| 109 { | 111 { |
| 110 } | 112 } |
| 111 | 113 |
| 112 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, AbstractView* view, | 114 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, AbstractView* view, |
| 113 int detail, int screenX, int screenY, int windowX, int windowY, | 115 int detail, int screenX, int screenY, int windowX, int windowY, |
| 114 int movementX, int movementY, | 116 int movementX, int movementY, |
| 115 PlatformEvent::Modifiers modifiers, | 117 PlatformEvent::Modifiers modifiers, |
| 116 short button, unsigned short buttons, | 118 short button, unsigned short buttons, |
| 117 EventTarget* relatedTarget, | 119 EventTarget* relatedTarget, |
| 118 double platformTimeStamp, | 120 double platformTimeStamp, |
| 119 PlatformMouseEvent::SyntheticEventType syntheticEventType, | 121 PlatformMouseEvent::SyntheticEventType syntheticEventType, |
| 120 const String& region) | 122 const String& region, |
| 123 const PlatformMouseEvent* mouseEvent) |
| 121 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint
(screenX, screenY), | 124 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint
(screenX, screenY), |
| 122 IntPoint(windowX, windowY), IntPoint(movementX, movementY), modifiers, | 125 IntPoint(windowX, windowY), IntPoint(movementX, movementY), modifiers, |
| 123 platformTimeStamp, | 126 platformTimeStamp, |
| 124 syntheticEventType == PlatformMouseEvent::Positionless ? PositionType::P
ositionless : PositionType::Position, | 127 syntheticEventType == PlatformMouseEvent::Positionless ? PositionType::P
ositionless : PositionType::Position, |
| 125 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDeviceCapabil
ities::firesTouchEventsSourceCapabilities() : InputDeviceCapabilities::doesntFir
eTouchEventsSourceCapabilities()) | 128 syntheticEventType == PlatformMouseEvent::FromTouch ? InputDeviceCapabil
ities::firesTouchEventsSourceCapabilities() : InputDeviceCapabilities::doesntFir
eTouchEventsSourceCapabilities()) |
| 126 , m_button(button) | 129 , m_button(button) |
| 127 , m_buttons(buttons) | 130 , m_buttons(buttons) |
| 128 , m_relatedTarget(relatedTarget) | 131 , m_relatedTarget(relatedTarget) |
| 129 , m_syntheticEventType(syntheticEventType) | 132 , m_syntheticEventType(syntheticEventType) |
| 130 , m_region(region) | 133 , m_region(region) |
| 131 { | 134 { |
| 135 if (mouseEvent) |
| 136 m_mouseEvent.reset(new PlatformMouseEvent(*mouseEvent)); |
| 132 } | 137 } |
| 133 | 138 |
| 134 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) | 139 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) |
| 135 : MouseRelatedEvent(eventType, initializer) | 140 : MouseRelatedEvent(eventType, initializer) |
| 136 , m_button(initializer.button()) | 141 , m_button(initializer.button()) |
| 137 , m_buttons(initializer.buttons()) | 142 , m_buttons(initializer.buttons()) |
| 138 , m_relatedTarget(initializer.relatedTarget()) | 143 , m_relatedTarget(initializer.relatedTarget()) |
| 139 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) | 144 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) |
| 140 , m_region(initializer.region()) | 145 , m_region(initializer.region()) |
| 141 { | 146 { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); | 293 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); |
| 289 if (mouseEvent.defaultHandled()) | 294 if (mouseEvent.defaultHandled()) |
| 290 doubleClickEvent->setDefaultHandled(); | 295 doubleClickEvent->setDefaultHandled(); |
| 291 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve
nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent)); | 296 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve
nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent)); |
| 292 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) | 297 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) |
| 293 return doubleClickDispatchResult; | 298 return doubleClickDispatchResult; |
| 294 return dispatchResult; | 299 return dispatchResult; |
| 295 } | 300 } |
| 296 | 301 |
| 297 } // namespace blink | 302 } // namespace blink |
| OLD | NEW |