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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; | 56 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; |
57 bool isCancelable = !isMouseEnterOrLeave; | 57 bool isCancelable = !isMouseEnterOrLeave; |
58 bool isBubbling = !isMouseEnterOrLeave; | 58 bool isBubbling = !isMouseEnterOrLeave; |
59 | 59 |
60 return MouseEvent::create( | 60 return MouseEvent::create( |
61 eventType, isBubbling, isCancelable, view, | 61 eventType, isBubbling, isCancelable, view, |
62 detail, event.globalPosition().x(), event.globalPosition().y(), event.po
sition().x(), event.position().y(), | 62 detail, event.globalPosition().x(), event.globalPosition().y(), event.po
sition().x(), event.position().y(), |
63 event.movementDelta().x(), event.movementDelta().y(), | 63 event.movementDelta().x(), event.movementDelta().y(), |
64 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), even
t.button(), | 64 event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), even
t.button(), |
65 relatedTarget, nullptr, false); | 65 relatedTarget, nullptr, false, event.syntheticEventType()); |
66 } | 66 } |
67 | 67 |
68 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type,
bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, | 68 PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type,
bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, |
69 int detail, int screenX, int screenY, int pageX, int pageY, | 69 int detail, int screenX, int screenY, int pageX, int pageY, |
70 int movementX, int movementY, | 70 int movementX, int movementY, |
71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto
n, | 71 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short butto
n, |
72 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Da
taTransfer> dataTransfer, bool isSimulated) | 72 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Da
taTransfer> dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticEventTy
pe syntheticEventType) |
73 { | 73 { |
74 return adoptRefWillBeNoop(new MouseEvent(type, canBubble, cancelable, view, | 74 return adoptRefWillBeNoop(new MouseEvent(type, canBubble, cancelable, view, |
75 detail, screenX, screenY, pageX, pageY, | 75 detail, screenX, screenY, pageX, pageY, |
76 movementX, movementY, | 76 movementX, movementY, |
77 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, dataTransfer,
isSimulated)); | 77 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, dataTransfer,
isSimulated, syntheticEventType)); |
78 } | 78 } |
79 | 79 |
80 MouseEvent::MouseEvent() | 80 MouseEvent::MouseEvent() |
81 : m_button(0) | 81 : m_button(0) |
82 , m_buttonDown(false) | 82 , m_buttonDown(false) |
83 { | 83 { |
84 ScriptWrappable::init(this); | 84 ScriptWrappable::init(this); |
85 } | 85 } |
86 | 86 |
87 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, PassRefPtrWillBeRawPtr<AbstractView> view, | 87 MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance
lable, PassRefPtrWillBeRawPtr<AbstractView> view, |
88 int detail, int screenX, int screenY, int pageX, int pageY, | 88 int detail, int screenX, int screenY, int pageX, int pageY, |
89 int movementX, int movementY, | 89 int movementX, int movementY, |
90 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, | 90 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
91 unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 91 unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, |
92 PassRefPtrWillBeRawPtr<DataTransfer> dataTransfer, bool isSimulated) | 92 PassRefPtrWillBeRawPtr<DataTransfer> dataTransfer, bool isSimulated, Platfor
mMouseEvent::SyntheticEventType syntheticEventType) |
93 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint
(screenX, screenY), | 93 : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint
(screenX, screenY), |
94 IntPoint(pageX, pageY), | 94 IntPoint(pageX, pageY), |
95 IntPoint(movementX, movementY), | 95 IntPoint(movementX, movementY), |
96 ctrlKey, altKey, shiftKey, metaKey, isSimulated) | 96 ctrlKey, altKey, shiftKey, metaKey, isSimulated) |
97 , m_button(button == (unsigned short)-1 ? 0 : button) | 97 , m_button(button == (unsigned short)-1 ? 0 : button) |
98 , m_buttonDown(button != (unsigned short)-1) | 98 , m_buttonDown(button != (unsigned short)-1) |
99 , m_relatedTarget(relatedTarget) | 99 , m_relatedTarget(relatedTarget) |
100 , m_dataTransfer(dataTransfer) | 100 , m_dataTransfer(dataTransfer) |
| 101 , m_syntheticEventType(syntheticEventType) |
101 { | 102 { |
102 ScriptWrappable::init(this); | 103 ScriptWrappable::init(this); |
103 } | 104 } |
104 | 105 |
105 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) | 106 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) |
106 : MouseRelatedEvent(eventType, initializer.bubbles, initializer.cancelable,
initializer.view, initializer.detail, IntPoint(initializer.screenX, initializer.
screenY), | 107 : MouseRelatedEvent(eventType, initializer.bubbles, initializer.cancelable,
initializer.view, initializer.detail, IntPoint(initializer.screenX, initializer.
screenY), |
107 IntPoint(0 /* pageX */, 0 /* pageY */), | 108 IntPoint(0 /* pageX */, 0 /* pageY */), |
108 IntPoint(0 /* movementX */, 0 /* movementY */), | 109 IntPoint(0 /* movementX */, 0 /* movementY */), |
109 initializer.ctrlKey, initializer.altKey, initializer.shiftKey, initializ
er.metaKey, false /* isSimulated */) | 110 initializer.ctrlKey, initializer.altKey, initializer.shiftKey, initializ
er.metaKey, false /* isSimulated */) |
110 , m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button
) | 111 , m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button
) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 PassRefPtrWillBeRawPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const At
omicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWill
BeRawPtr<Event> underlyingEvent) | 201 PassRefPtrWillBeRawPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const At
omicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWill
BeRawPtr<Event> underlyingEvent) |
201 { | 202 { |
202 return adoptRefWillBeNoop(new SimulatedMouseEvent(eventType, view, underlyin
gEvent)); | 203 return adoptRefWillBeNoop(new SimulatedMouseEvent(eventType, view, underlyin
gEvent)); |
203 } | 204 } |
204 | 205 |
205 SimulatedMouseEvent::~SimulatedMouseEvent() | 206 SimulatedMouseEvent::~SimulatedMouseEvent() |
206 { | 207 { |
207 } | 208 } |
208 | 209 |
209 SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
trWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> underlyingEvent
) | 210 SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
trWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<Event> underlyingEvent
) |
210 : MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0, | 211 : MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0, 0, 0, false, false,
false, false, 0, |
211 0, 0, | 212 nullptr, nullptr, true, PlatformMouseEvent::RealOrIndistinguishable) |
212 false, false, false, false, 0, nullptr, nullptr, true) | |
213 { | 213 { |
214 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt.get())) { | 214 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt.get())) { |
215 m_ctrlKey = keyStateEvent->ctrlKey(); | 215 m_ctrlKey = keyStateEvent->ctrlKey(); |
216 m_altKey = keyStateEvent->altKey(); | 216 m_altKey = keyStateEvent->altKey(); |
217 m_shiftKey = keyStateEvent->shiftKey(); | 217 m_shiftKey = keyStateEvent->shiftKey(); |
218 m_metaKey = keyStateEvent->metaKey(); | 218 m_metaKey = keyStateEvent->metaKey(); |
219 } | 219 } |
220 setUnderlyingEvent(underlyingEvent); | 220 setUnderlyingEvent(underlyingEvent); |
221 | 221 |
222 if (this->underlyingEvent() && this->underlyingEvent()->isMouseEvent()) { | 222 if (this->underlyingEvent() && this->underlyingEvent()->isMouseEvent()) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 event()->button(), relatedTarget); | 280 event()->button(), relatedTarget); |
281 if (event()->defaultHandled()) | 281 if (event()->defaultHandled()) |
282 doubleClickEvent->setDefaultHandled(); | 282 doubleClickEvent->setDefaultHandled(); |
283 EventDispatcher::dispatchEvent(dispatcher->node(), MouseEventDispatchMediato
r::create(doubleClickEvent)); | 283 EventDispatcher::dispatchEvent(dispatcher->node(), MouseEventDispatchMediato
r::create(doubleClickEvent)); |
284 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) | 284 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) |
285 return false; | 285 return false; |
286 return !swallowEvent; | 286 return !swallowEvent; |
287 } | 287 } |
288 | 288 |
289 } // namespace blink | 289 } // namespace blink |
OLD | NEW |