Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: trunk/Source/core/events/MouseEvent.cpp

Issue 1184693003: Revert 196987 "Don't invoke default actions for MouseEvents gene..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/Source/core/events/MouseEvent.h ('k') | trunk/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::FromScript) 111 , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
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
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;
156 155
157 initCoordinates(IntPoint(clientX, clientY)); 156 initCoordinates(IntPoint(clientX, clientY));
158 157
159 // FIXME: m_isSimulated is not set to false here. 158 // FIXME: m_isSimulated is not set to false here.
160 // FIXME: m_dataTransfer is not set to nullptr here. 159 // FIXME: m_dataTransfer is not set to nullptr here.
161 } 160 }
162 161
163 const AtomicString& MouseEvent::interfaceName() const 162 const AtomicString& MouseEvent::interfaceName() const
164 { 163 {
165 return EventNames::MouseEvent; 164 return EventNames::MouseEvent;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 m_screenLocation = mouseEvent->screenLocation(); 235 m_screenLocation = mouseEvent->screenLocation();
237 initCoordinates(mouseEvent->clientLocation()); 236 initCoordinates(mouseEvent->clientLocation());
238 } 237 }
239 } 238 }
240 239
241 DEFINE_TRACE(SimulatedMouseEvent) 240 DEFINE_TRACE(SimulatedMouseEvent)
242 { 241 {
243 MouseEvent::trace(visitor); 242 MouseEvent::trace(visitor);
244 } 243 }
245 244
246 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent) 245 PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::c reate(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventTy pe)
247 { 246 {
248 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent)); 247 return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent, mouseEv entType));
249 } 248 }
250 249
251 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo useEvent> mouseEvent) 250 MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<Mo useEvent> mouseEvent, MouseEventType mouseEventType)
252 : EventDispatchMediator(mouseEvent) 251 : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType)
253 { 252 {
254 } 253 }
255 254
256 MouseEvent& MouseEventDispatchMediator::event() const 255 MouseEvent& MouseEventDispatchMediator::event() const
257 { 256 {
258 return toMouseEvent(EventDispatchMediator::event()); 257 return toMouseEvent(EventDispatchMediator::event());
259 } 258 }
260 259
261 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t 260 bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons t
262 { 261 {
263 if (event().fromScript()) { 262 if (isSyntheticMouseEvent()) {
264 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re latedTarget()); 263 event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().re latedTarget());
265 return dispatcher.dispatch(); 264 return dispatcher.dispatch();
266 } 265 }
267 266
268 if (isDisabledFormControl(&dispatcher.node())) 267 if (isDisabledFormControl(&dispatcher.node()))
269 return false; 268 return false;
270 269
271 if (event().type().isEmpty()) 270 if (event().type().isEmpty())
272 return true; // Shouldn't happen. 271 return true; // Shouldn't happen.
273 272
(...skipping 18 matching lines...) Expand all
292 event().button(), relatedTarget, event().buttons()); 291 event().button(), relatedTarget, event().buttons());
293 if (event().defaultHandled()) 292 if (event().defaultHandled())
294 doubleClickEvent->setDefaultHandled(); 293 doubleClickEvent->setDefaultHandled();
295 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent)); 294 EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator ::create(doubleClickEvent));
296 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ()) 295 if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented ())
297 return false; 296 return false;
298 return !swallowEvent; 297 return !swallowEvent;
299 } 298 }
300 299
301 } // namespace blink 300 } // namespace blink
OLDNEW
« no previous file with comments | « trunk/Source/core/events/MouseEvent.h ('k') | trunk/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698