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

Unified Diff: Source/core/dom/Node.cpp

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TIL, gclient sync may rebase changes back in time 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index aa67a5ea3fc523d3fff4d823531b89ee4e66fac3..b8e9cbc61c6377e69b2d57449986df40067fc249 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -2102,8 +2102,10 @@ void Node::dispatchScopedEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispa
bool Node::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
{
- if (event->isMouseEvent())
- return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::create(static_pointer_cast<MouseEvent>(event), MouseEventDispatchMediator::SyntheticMouseEvent));
+ if (event->isMouseEvent()) {
+ toMouseEvent(*event).setFromScript();
+ return dispatchMouseEvent(static_pointer_cast<MouseEvent>(event));
+ }
if (event->isTouchEvent())
return dispatchTouchEvent(static_pointer_cast<TouchEvent>(event));
return EventDispatcher::dispatchEvent(*this, EventDispatchMediator::create(event));
@@ -2142,6 +2144,11 @@ bool Node::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicStrin
return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::create(MouseEvent::create(eventType, document().domWindow(), event, detail, relatedTarget)));
}
+bool Node::dispatchMouseEvent(PassRefPtrWillBeRawPtr<MouseEvent> event)
+{
+ return EventDispatcher::dispatchEvent(*this, MouseEventDispatchMediator::create(event));
+}
+
bool Node::dispatchGestureEvent(const PlatformGestureEvent& event)
{
RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(document().domWindow(), event);
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/events/EventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698