| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) | 104 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) |
| 105 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable
(), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in
itializer.screenY()), | 105 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable
(), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in
itializer.screenY()), |
| 106 IntPoint(0 /* pageX */, 0 /* pageY */), | 106 IntPoint(0 /* pageX */, 0 /* pageY */), |
| 107 IntPoint(initializer.movementX(), initializer.movementY()), | 107 IntPoint(initializer.movementX(), initializer.movementY()), |
| 108 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini
tializer.metaKey(), false /* isSimulated */) | 108 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini
tializer.metaKey(), false /* isSimulated */) |
| 109 , m_button(initializer.button() == (unsigned short)-1 ? 0 : initializer.butt
on()) | 109 , m_button(initializer.button() == (unsigned short)-1 ? 0 : initializer.butt
on()) |
| 110 , m_buttons(initializer.buttons()) | 110 , m_buttons(initializer.buttons()) |
| 111 , m_buttonDown(initializer.button() != (unsigned short)-1) | 111 , m_buttonDown(initializer.button() != (unsigned short)-1) |
| 112 , m_relatedTarget(initializer.relatedTarget()) | 112 , m_relatedTarget(initializer.relatedTarget()) |
| 113 , m_dataTransfer(nullptr) | 113 , m_dataTransfer(nullptr) |
| 114 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) | 114 , m_syntheticEventType(PlatformMouseEvent::FromScript) |
| 115 { | 115 { |
| 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 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) | 123 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) |
| 124 { | 124 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 149 | 149 |
| 150 m_screenLocation = IntPoint(screenX, screenY); | 150 m_screenLocation = IntPoint(screenX, screenY); |
| 151 m_ctrlKey = ctrlKey; | 151 m_ctrlKey = ctrlKey; |
| 152 m_altKey = altKey; | 152 m_altKey = altKey; |
| 153 m_shiftKey = shiftKey; | 153 m_shiftKey = shiftKey; |
| 154 m_metaKey = metaKey; | 154 m_metaKey = metaKey; |
| 155 m_button = button == (unsigned short)-1 ? 0 : button; | 155 m_button = button == (unsigned short)-1 ? 0 : button; |
| 156 m_buttons = buttons; | 156 m_buttons = buttons; |
| 157 m_buttonDown = button != (unsigned short)-1; | 157 m_buttonDown = button != (unsigned short)-1; |
| 158 m_relatedTarget = relatedTarget; | 158 m_relatedTarget = relatedTarget; |
| 159 m_syntheticEventType = PlatformMouseEvent::FromScript; |
| 159 | 160 |
| 160 initCoordinates(IntPoint(clientX, clientY)); | 161 initCoordinates(IntPoint(clientX, clientY)); |
| 161 | 162 |
| 162 // FIXME: m_isSimulated is not set to false here. | 163 // FIXME: m_isSimulated is not set to false here. |
| 163 // FIXME: m_dataTransfer is not set to nullptr here. | 164 // FIXME: m_dataTransfer is not set to nullptr here. |
| 164 } | 165 } |
| 165 | 166 |
| 166 const AtomicString& MouseEvent::interfaceName() const | 167 const AtomicString& MouseEvent::interfaceName() const |
| 167 { | 168 { |
| 168 return EventNames::MouseEvent; | 169 return EventNames::MouseEvent; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 m_screenLocation = mouseEvent->screenLocation(); | 242 m_screenLocation = mouseEvent->screenLocation(); |
| 242 initCoordinates(mouseEvent->clientLocation()); | 243 initCoordinates(mouseEvent->clientLocation()); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 DEFINE_TRACE(SimulatedMouseEvent) | 247 DEFINE_TRACE(SimulatedMouseEvent) |
| 247 { | 248 { |
| 248 MouseEvent::trace(visitor); | 249 MouseEvent::trace(visitor); |
| 249 } | 250 } |
| 250 | 251 |
| 251 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c
reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventTy
pe) | 252 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c
reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent) |
| 252 { | 253 { |
| 253 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent, mouseEv
entType)); | 254 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent)); |
| 254 } | 255 } |
| 255 | 256 |
| 256 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo
useEvent> mouseEvent, MouseEventType mouseEventType) | 257 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo
useEvent> mouseEvent) |
| 257 : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType) | 258 : EventDispatchMediator(mouseEvent) |
| 258 { | 259 { |
| 259 } | 260 } |
| 260 | 261 |
| 261 MouseEvent& MouseEventDispatchMediator::event() const | 262 MouseEvent& MouseEventDispatchMediator::event() const |
| 262 { | 263 { |
| 263 return toMouseEvent(EventDispatchMediator::event()); | 264 return toMouseEvent(EventDispatchMediator::event()); |
| 264 } | 265 } |
| 265 | 266 |
| 266 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t | 267 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t |
| 267 { | 268 { |
| 268 if (isSyntheticMouseEvent()) { | 269 if (event().fromScript()) { |
| 269 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re
latedTarget()); | 270 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re
latedTarget()); |
| 270 return dispatcher.dispatch(); | 271 return dispatcher.dispatch(); |
| 271 } | 272 } |
| 272 | 273 |
| 273 if (isDisabledFormControl(&dispatcher.node())) | 274 if (isDisabledFormControl(&dispatcher.node())) |
| 274 return false; | 275 return false; |
| 275 | 276 |
| 276 if (event().type().isEmpty()) | 277 if (event().type().isEmpty()) |
| 277 return true; // Shouldn't happen. | 278 return true; // Shouldn't happen. |
| 278 | 279 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 297 event().button(), relatedTarget, event().buttons()); | 298 event().button(), relatedTarget, event().buttons()); |
| 298 if (event().defaultHandled()) | 299 if (event().defaultHandled()) |
| 299 doubleClickEvent->setDefaultHandled(); | 300 doubleClickEvent->setDefaultHandled(); |
| 300 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator
::create(doubleClickEvent)); | 301 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator
::create(doubleClickEvent)); |
| 301 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) | 302 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) |
| 302 return false; | 303 return false; |
| 303 return !swallowEvent; | 304 return !swallowEvent; |
| 304 } | 305 } |
| 305 | 306 |
| 306 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |