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

Side by Side Diff: third_party/WebKit/Source/core/events/MouseEvent.cpp

Issue 2107093003: Revert middle click related changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarg et()); 287 ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarg et());
288 288
289 EventTarget* relatedTarget = mouseEvent.relatedTarget(); 289 EventTarget* relatedTarget = mouseEvent.relatedTarget();
290 290
291 DispatchEventResult dispatchResult = dispatcher.dispatch(); 291 DispatchEventResult dispatchResult = dispatcher.dispatch();
292 292
293 if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2) 293 if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2)
294 return dispatchResult; 294 return dispatchResult;
295 295
296 // Do not send dblclick event for non-primary button clicks.
297 if (mouseEvent.button() != MouseButton::LeftButton)
298 return dispatchResult;
299
300 // Special case: If it's a double click event, we also send the dblclick eve nt. This is not part 296 // Special case: If it's a double click event, we also send the dblclick eve nt. This is not part
301 // of the DOM specs, but is used for compatibility with the ondblclick="" at tribute. This is treated 297 // of the DOM specs, but is used for compatibility with the ondblclick="" at tribute. This is treated
302 // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same. 298 // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
303 MouseEvent* doubleClickEvent = MouseEvent::create(); 299 MouseEvent* doubleClickEvent = MouseEvent::create();
304 doubleClickEvent->initMouseEventInternal(EventTypeNames::dblclick, mouseEven t.bubbles(), mouseEvent.cancelable(), mouseEvent.view(), 300 doubleClickEvent->initMouseEventInternal(EventTypeNames::dblclick, mouseEven t.bubbles(), mouseEvent.cancelable(), mouseEvent.view(),
305 mouseEvent.detail(), mouseEvent.screenX(), mouseEvent.screenY(), mouseEv ent.clientX(), mouseEvent.clientY(), 301 mouseEvent.detail(), mouseEvent.screenX(), mouseEvent.screenY(), mouseEv ent.clientX(), mouseEvent.clientY(),
306 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, mouseEvent.s ourceCapabilities(), mouseEvent.buttons()); 302 mouseEvent.modifiers(), mouseEvent.button(), relatedTarget, mouseEvent.s ourceCapabilities(), mouseEvent.buttons());
307 303
308 // Inherit the trusted status from the original event. 304 // Inherit the trusted status from the original event.
309 doubleClickEvent->setTrusted(mouseEvent.isTrusted()); 305 doubleClickEvent->setTrusted(mouseEvent.isTrusted());
310 if (mouseEvent.defaultHandled()) 306 if (mouseEvent.defaultHandled())
311 doubleClickEvent->setDefaultHandled(); 307 doubleClickEvent->setDefaultHandled();
312 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent)); 308 DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEve nt(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
313 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled) 309 if (doubleClickDispatchResult != DispatchEventResult::NotCanceled)
314 return doubleClickDispatchResult; 310 return doubleClickDispatchResult;
315 return dispatchResult; 311 return dispatchResult;
316 } 312 }
317 313
318 } // namespace blink 314 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698