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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 | 287 |
288 ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarg et()); | 288 ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarg et()); |
289 | 289 |
290 EventTarget* relatedTarget = mouseEvent.relatedTarget(); | 290 EventTarget* relatedTarget = mouseEvent.relatedTarget(); |
291 | 291 |
292 DispatchEventResult dispatchResult = dispatcher.dispatch(); | 292 DispatchEventResult dispatchResult = dispatcher.dispatch(); |
293 | 293 |
294 if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2) | 294 if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2) |
295 return dispatchResult; | 295 return dispatchResult; |
296 | 296 |
297 // Do not send dblclick event for middle click | |
298 if (mouseEvent.button() == MouseButton::MiddleButton) | |
dtapuska
2016/04/22 18:32:30
I don't think this is what the spec indicates. It
Navid Zolghadr
2016/04/22 19:09:58
Right. So much focusing on middlebutton that I for
| |
299 return dispatchResult; | |
300 | |
297 // Special case: If it's a double click event, we also send the dblclick eve nt. This is not part | 301 // Special case: If it's a double click event, we also send the dblclick eve nt. This is not part |
298 // of the DOM specs, but is used for compatibility with the ondblclick="" at tribute. This is treated | 302 // of the DOM specs, but is used for compatibility with the ondblclick="" at tribute. This is treated |
299 // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same. | 303 // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same. |
300 MouseEvent* doubleClickEvent = MouseEvent::create(); | 304 MouseEvent* doubleClickEvent = MouseEvent::create(); |
301 doubleClickEvent->initMouseEventInternal(EventTypeNames::dblclick, mouseEven t.bubbles(), mouseEvent.cancelable(), mouseEvent.view(), | 305 doubleClickEvent->initMouseEventInternal(EventTypeNames::dblclick, mouseEven t.bubbles(), mouseEvent.cancelable(), mouseEvent.view(), |
302 mouseEvent.detail(), mouseEvent.screenX(), mouseEvent.screenY(), mouseEv ent.clientX(), mouseEvent.clientY(), | 306 mouseEvent.detail(), mouseEvent.screenX(), mouseEvent.screenY(), mouseEv ent.clientX(), mouseEvent.clientY(), |
303 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, mouseEvent.s ourceCapabilities(), mouseEvent.buttons()); | 307 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, mouseEvent.s ourceCapabilities(), mouseEvent.buttons()); |
304 | 308 |
305 // Inherit the trusted status from the original event. | 309 // Inherit the trusted status from the original event. |
306 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); | 310 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); |
307 if (mouseEvent.defaultHandled()) | 311 if (mouseEvent.defaultHandled()) |
308 doubleClickEvent->setDefaultHandled(); | 312 doubleClickEvent->setDefaultHandled(); |
309 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent)); | 313 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent)); |
310 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) | 314 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) |
311 return doubleClickDispatchResult; | 315 return doubleClickDispatchResult; |
312 return dispatchResult; | 316 return dispatchResult; |
313 } | 317 } |
314 | 318 |
315 } // namespace blink | 319 } // namespace blink |
OLD | NEW |