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

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

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

Powered by Google App Engine
This is Rietveld 408576698