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 , button(0) | 43 , button(0) |
44 , relatedTarget(nullptr) | 44 , relatedTarget(nullptr) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseE
ventInit& initializer) | 48 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseE
ventInit& initializer) |
49 { | 49 { |
50 return adoptRef(new MouseEvent(type, initializer)); | 50 return adoptRef(new MouseEvent(type, initializer)); |
51 } | 51 } |
52 | 52 |
53 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRef
Ptr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<
Node> relatedTarget) | 53 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRef
PtrWillBeRawPtr<AbstractView> view, const PlatformMouseEvent& event, int detail,
PassRefPtr<Node> relatedTarget) |
54 { | 54 { |
55 ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButt
on); | 55 ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButt
on); |
56 | 56 |
57 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; | 57 bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventT
ype == EventTypeNames::mouseleave; |
58 bool isCancelable = !isMouseEnterOrLeave; | 58 bool isCancelable = !isMouseEnterOrLeave; |
59 bool isBubbling = !isMouseEnterOrLeave; | 59 bool isBubbling = !isMouseEnterOrLeave; |
60 | 60 |
61 return MouseEvent::create(eventType, isBubbling, isCancelable, view, | 61 return MouseEvent::create(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); |
66 } | 66 } |
67 | 67 |
68 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubb
le, bool cancelable, PassRefPtr<AbstractView> view, | 68 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubb
le, 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 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, bool isSimulated) | 72 PassRefPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<Clipboard> cli
pboard, bool isSimulated) |
73 { | 73 { |
74 return adoptRef(new MouseEvent(type, canBubble, cancelable, view, | 74 return adoptRef(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, clipboard, is
Simulated)); | 77 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, is
Simulated)); |
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, PassRefPtr<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, PassRefPtr<EventTarget> relatedTarget, | 91 unsigned short button, PassRefPtr<EventTarget> relatedTarget, |
92 PassRefPtrWillBeRawPtr<Clipboard> clipboard, bool isSimulated) | 92 PassRefPtrWillBeRawPtr<Clipboard> clipboard, bool isSimulated) |
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) |
(...skipping 15 matching lines...) Expand all Loading... |
113 , m_clipboard(nullptr /* clipboard */) | 113 , m_clipboard(nullptr /* clipboard */) |
114 { | 114 { |
115 ScriptWrappable::init(this); | 115 ScriptWrappable::init(this); |
116 initCoordinates(IntPoint(initializer.clientX, initializer.clientY)); | 116 initCoordinates(IntPoint(initializer.clientX, initializer.clientY)); |
117 } | 117 } |
118 | 118 |
119 MouseEvent::~MouseEvent() | 119 MouseEvent::~MouseEvent() |
120 { | 120 { |
121 } | 121 } |
122 | 122 |
123 void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtr<AbstractView> view, | 123 void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
ancelable, PassRefPtrWillBeRawPtr<AbstractView> view, |
124 int detail, int screenX, int screenY, int client
X, int clientY, | 124 int detail, int screenX, int screenY, int client
X, int clientY, |
125 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey, | 125 bool ctrlKey, bool altKey, bool shiftKey, bool m
etaKey, |
126 unsigned short button, PassRefPtr<EventTarget> r
elatedTarget) | 126 unsigned short button, PassRefPtr<EventTarget> r
elatedTarget) |
127 { | 127 { |
128 if (dispatched()) | 128 if (dispatched()) |
129 return; | 129 return; |
130 | 130 |
131 initUIEvent(type, canBubble, cancelable, view, detail); | 131 initUIEvent(type, canBubble, cancelable, view, detail); |
132 | 132 |
133 m_screenLocation = IntPoint(screenX, screenY); | 133 m_screenLocation = IntPoint(screenX, screenY); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 return target() ? target()->toNode() : 0; | 190 return target() ? target()->toNode() : 0; |
191 } | 191 } |
192 | 192 |
193 void MouseEvent::trace(Visitor* visitor) | 193 void MouseEvent::trace(Visitor* visitor) |
194 { | 194 { |
195 visitor->trace(m_clipboard); | 195 visitor->trace(m_clipboard); |
196 MouseRelatedEvent::trace(visitor); | 196 MouseRelatedEvent::trace(visitor); |
197 } | 197 } |
198 | 198 |
199 PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString&
eventType, PassRefPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent) | 199 PassRefPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const AtomicString&
eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtr<Event> underlyi
ngEvent) |
200 { | 200 { |
201 return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent)); | 201 return adoptRef(new SimulatedMouseEvent(eventType, view, underlyingEvent)); |
202 } | 202 } |
203 | 203 |
204 SimulatedMouseEvent::~SimulatedMouseEvent() | 204 SimulatedMouseEvent::~SimulatedMouseEvent() |
205 { | 205 { |
206 } | 206 } |
207 | 207 |
208 SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
tr<AbstractView> view, PassRefPtr<Event> underlyingEvent) | 208 SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
trWillBeRawPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent) |
209 : MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0, | 209 : MouseEvent(eventType, true, true, view, 0, 0, 0, 0, 0, |
210 0, 0, | 210 0, 0, |
211 false, false, false, false, 0, nullptr, nullptr, true) | 211 false, false, false, false, 0, nullptr, nullptr, true) |
212 { | 212 { |
213 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt.get())) { | 213 if (UIEventWithKeyState* keyStateEvent = findEventWithKeyState(underlyingEve
nt.get())) { |
214 m_ctrlKey = keyStateEvent->ctrlKey(); | 214 m_ctrlKey = keyStateEvent->ctrlKey(); |
215 m_altKey = keyStateEvent->altKey(); | 215 m_altKey = keyStateEvent->altKey(); |
216 m_shiftKey = keyStateEvent->shiftKey(); | 216 m_shiftKey = keyStateEvent->shiftKey(); |
217 m_metaKey = keyStateEvent->metaKey(); | 217 m_metaKey = keyStateEvent->metaKey(); |
218 } | 218 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 event()->button(), relatedTarget); | 279 event()->button(), relatedTarget); |
280 if (event()->defaultHandled()) | 280 if (event()->defaultHandled()) |
281 doubleClickEvent->setDefaultHandled(); | 281 doubleClickEvent->setDefaultHandled(); |
282 EventDispatcher::dispatchEvent(dispatcher->node(), MouseEventDispatchMediato
r::create(doubleClickEvent)); | 282 EventDispatcher::dispatchEvent(dispatcher->node(), MouseEventDispatchMediato
r::create(doubleClickEvent)); |
283 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) | 283 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) |
284 return false; | 284 return false; |
285 return !swallowEvent; | 285 return !swallowEvent; |
286 } | 286 } |
287 | 287 |
288 } // namespace WebCore | 288 } // namespace WebCore |
OLD | NEW |