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 178 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 PassRefPtrWillBeRawPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const At
omicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtr<Eve
nt> underlyingEvent) | 199 PassRefPtrWillBeRawPtr<SimulatedMouseEvent> SimulatedMouseEvent::create(const At
omicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, PassRefPtrWill
BeRawPtr<Event> underlyingEvent) |
200 { | 200 { |
201 return adoptRefWillBeRefCountedGarbageCollected(new SimulatedMouseEvent(even
tType, view, underlyingEvent)); | 201 return adoptRefWillBeRefCountedGarbageCollected(new SimulatedMouseEvent(even
tType, 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
trWillBeRawPtr<AbstractView> view, PassRefPtr<Event> underlyingEvent) | 208 SimulatedMouseEvent::SimulatedMouseEvent(const AtomicString& eventType, PassRefP
trWillBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<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 } |
219 setUnderlyingEvent(underlyingEvent); | 219 setUnderlyingEvent(underlyingEvent); |
220 | 220 |
221 if (this->underlyingEvent() && this->underlyingEvent()->isMouseEvent()) { | 221 if (this->underlyingEvent() && this->underlyingEvent()->isMouseEvent()) { |
222 MouseEvent* mouseEvent = toMouseEvent(this->underlyingEvent()); | 222 MouseEvent* mouseEvent = toMouseEvent(this->underlyingEvent()); |
223 m_screenLocation = mouseEvent->screenLocation(); | 223 m_screenLocation = mouseEvent->screenLocation(); |
224 initCoordinates(mouseEvent->clientLocation()); | 224 initCoordinates(mouseEvent->clientLocation()); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 void SimulatedMouseEvent::trace(Visitor* visitor) | 228 void SimulatedMouseEvent::trace(Visitor* visitor) |
229 { | 229 { |
230 MouseEvent::trace(visitor); | 230 MouseEvent::trace(visitor); |
231 } | 231 } |
232 | 232 |
233 PassRefPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRe
fPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType) | 233 PassRefPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRe
fPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType) |
234 { | 234 { |
235 return adoptRef(new MouseEventDispatchMediator(mouseEvent, mouseEventType)); | 235 return adoptRef(new MouseEventDispatchMediator(mouseEvent, mouseEventType)); |
236 } | 236 } |
237 | 237 |
238 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtr<MouseEvent> mo
useEvent, MouseEventType mouseEventType) | 238 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo
useEvent> mouseEvent, MouseEventType mouseEventType) |
239 : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType) | 239 : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType) |
240 { | 240 { |
241 } | 241 } |
242 | 242 |
243 MouseEvent* MouseEventDispatchMediator::event() const | 243 MouseEvent* MouseEventDispatchMediator::event() const |
244 { | 244 { |
245 return toMouseEvent(EventDispatchMediator::event()); | 245 return toMouseEvent(EventDispatchMediator::event()); |
246 } | 246 } |
247 | 247 |
248 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t | 248 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
t |
(...skipping 16 matching lines...) Expand all Loading... |
265 | 265 |
266 dispatcher->dispatch(); | 266 dispatcher->dispatch(); |
267 bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented()
; | 267 bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented()
; |
268 | 268 |
269 if (event()->type() != EventTypeNames::click || event()->detail() != 2) | 269 if (event()->type() != EventTypeNames::click || event()->detail() != 2) |
270 return !swallowEvent; | 270 return !swallowEvent; |
271 | 271 |
272 // Special case: If it's a double click event, we also send the dblclick eve
nt. This is not part | 272 // Special case: If it's a double click event, we also send the dblclick eve
nt. This is not part |
273 // of the DOM specs, but is used for compatibility with the ondblclick="" at
tribute. This is treated | 273 // of the DOM specs, but is used for compatibility with the ondblclick="" at
tribute. This is treated |
274 // as a separate event in other DOM-compliant browsers like Firefox, and so
we do the same. | 274 // as a separate event in other DOM-compliant browsers like Firefox, and so
we do the same. |
275 RefPtr<MouseEvent> doubleClickEvent = MouseEvent::create(); | 275 RefPtrWillBeRawPtr<MouseEvent> doubleClickEvent = MouseEvent::create(); |
276 doubleClickEvent->initMouseEvent(EventTypeNames::dblclick, event()->bubbles(
), event()->cancelable(), event()->view(), | 276 doubleClickEvent->initMouseEvent(EventTypeNames::dblclick, event()->bubbles(
), event()->cancelable(), event()->view(), |
277 event()->detail(), event()->screenX(), even
t()->screenY(), event()->clientX(), event()->clientY(), | 277 event()->detail(), event()->screenX(), even
t()->screenY(), event()->clientX(), event()->clientY(), |
278 event()->ctrlKey(), event()->altKey(), even
t()->shiftKey(), event()->metaKey(), | 278 event()->ctrlKey(), event()->altKey(), even
t()->shiftKey(), event()->metaKey(), |
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 |