| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) | 102 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
ializer) |
| 103 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable
(), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in
itializer.screenY()), | 103 : MouseRelatedEvent(eventType, initializer.bubbles(), initializer.cancelable
(), initializer.view(), initializer.detail(), IntPoint(initializer.screenX(), in
itializer.screenY()), |
| 104 IntPoint(0 /* pageX */, 0 /* pageY */), | 104 IntPoint(0 /* pageX */, 0 /* pageY */), |
| 105 IntPoint(initializer.movementX(), initializer.movementY()), | 105 IntPoint(initializer.movementX(), initializer.movementY()), |
| 106 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini
tializer.metaKey(), false /* isSimulated */) | 106 initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), ini
tializer.metaKey(), false /* isSimulated */) |
| 107 , m_button(initializer.button()) | 107 , m_button(initializer.button()) |
| 108 , m_buttons(initializer.buttons()) | 108 , m_buttons(initializer.buttons()) |
| 109 , m_relatedTarget(initializer.relatedTarget()) | 109 , m_relatedTarget(initializer.relatedTarget()) |
| 110 , m_dataTransfer(nullptr) | 110 , m_dataTransfer(nullptr) |
| 111 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) | 111 , m_syntheticEventType(PlatformMouseEvent::FromScript) |
| 112 { | 112 { |
| 113 initCoordinates(IntPoint(initializer.clientX(), initializer.clientY())); | 113 initCoordinates(IntPoint(initializer.clientX(), initializer.clientY())); |
| 114 } | 114 } |
| 115 | 115 |
| 116 MouseEvent::~MouseEvent() | 116 MouseEvent::~MouseEvent() |
| 117 { | 117 { |
| 118 } | 118 } |
| 119 | 119 |
| 120 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) | 120 unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) |
| 121 { | 121 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 145 initUIEvent(type, canBubble, cancelable, view, detail); | 145 initUIEvent(type, canBubble, cancelable, view, detail); |
| 146 | 146 |
| 147 m_screenLocation = IntPoint(screenX, screenY); | 147 m_screenLocation = IntPoint(screenX, screenY); |
| 148 m_ctrlKey = ctrlKey; | 148 m_ctrlKey = ctrlKey; |
| 149 m_altKey = altKey; | 149 m_altKey = altKey; |
| 150 m_shiftKey = shiftKey; | 150 m_shiftKey = shiftKey; |
| 151 m_metaKey = metaKey; | 151 m_metaKey = metaKey; |
| 152 m_button = button; | 152 m_button = button; |
| 153 m_buttons = buttons; | 153 m_buttons = buttons; |
| 154 m_relatedTarget = relatedTarget; | 154 m_relatedTarget = relatedTarget; |
| 155 m_syntheticEventType = PlatformMouseEvent::FromScript; |
| 155 | 156 |
| 156 initCoordinates(IntPoint(clientX, clientY)); | 157 initCoordinates(IntPoint(clientX, clientY)); |
| 157 | 158 |
| 158 // FIXME: m_isSimulated is not set to false here. | 159 // FIXME: m_isSimulated is not set to false here. |
| 159 // FIXME: m_dataTransfer is not set to nullptr here. | 160 // FIXME: m_dataTransfer is not set to nullptr here. |
| 160 } | 161 } |
| 161 | 162 |
| 162 const AtomicString& MouseEvent::interfaceName() const | 163 const AtomicString& MouseEvent::interfaceName() const |
| 163 { | 164 { |
| 164 return EventNames::MouseEvent; | 165 return EventNames::MouseEvent; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 m_screenLocation = mouseEvent->screenLocation(); | 236 m_screenLocation = mouseEvent->screenLocation(); |
| 236 initCoordinates(mouseEvent->clientLocation()); | 237 initCoordinates(mouseEvent->clientLocation()); |
| 237 } | 238 } |
| 238 } | 239 } |
| 239 | 240 |
| 240 DEFINE_TRACE(SimulatedMouseEvent) | 241 DEFINE_TRACE(SimulatedMouseEvent) |
| 241 { | 242 { |
| 242 MouseEvent::trace(visitor); | 243 MouseEvent::trace(visitor); |
| 243 } | 244 } |
| 244 | 245 |
| 245 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c
reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventTy
pe) | 246 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c
reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent) |
| 246 { | 247 { |
| 247 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent, mouseEv
entType)); | 248 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent)); |
| 248 } | 249 } |
| 249 | 250 |
| 250 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo
useEvent> mouseEvent, MouseEventType mouseEventType) | 251 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo
useEvent> mouseEvent) |
| 251 : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType) | 252 : EventDispatchMediator(mouseEvent) |
| 252 { | 253 { |
| 253 } | 254 } |
| 254 | 255 |
| 255 MouseEvent& MouseEventDispatchMediator::event() const | 256 MouseEvent& MouseEventDispatchMediator::event() const |
| 256 { | 257 { |
| 257 return toMouseEvent(EventDispatchMediator::event()); | 258 return toMouseEvent(EventDispatchMediator::event()); |
| 258 } | 259 } |
| 259 | 260 |
| 260 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t | 261 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
t |
| 261 { | 262 { |
| 262 if (isSyntheticMouseEvent()) { | 263 if (event().fromScript()) { |
| 263 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re
latedTarget()); | 264 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re
latedTarget()); |
| 264 return dispatcher.dispatch(); | 265 return dispatcher.dispatch(); |
| 265 } | 266 } |
| 266 | 267 |
| 267 if (isDisabledFormControl(&dispatcher.node())) | 268 if (isDisabledFormControl(&dispatcher.node())) |
| 268 return false; | 269 return false; |
| 269 | 270 |
| 270 if (event().type().isEmpty()) | 271 if (event().type().isEmpty()) |
| 271 return true; // Shouldn't happen. | 272 return true; // Shouldn't happen. |
| 272 | 273 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 291 event().button(), relatedTarget, event().buttons()); | 292 event().button(), relatedTarget, event().buttons()); |
| 292 if (event().defaultHandled()) | 293 if (event().defaultHandled()) |
| 293 doubleClickEvent->setDefaultHandled(); | 294 doubleClickEvent->setDefaultHandled(); |
| 294 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator
::create(doubleClickEvent)); | 295 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator
::create(doubleClickEvent)); |
| 295 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) | 296 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented
()) |
| 296 return false; | 297 return false; |
| 297 return !swallowEvent; | 298 return !swallowEvent; |
| 298 } | 299 } |
| 299 | 300 |
| 300 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |