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

Unified Diff: Source/core/events/MouseEvent.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/events/MouseEvent.h ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/MouseEvent.cpp
diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp
index cba1190a3047dba42be57d947a694f65d5184043..6e6eff4a3f927bbc4141f17d6bdcff09a4d094a0 100644
--- a/Source/core/events/MouseEvent.cpp
+++ b/Source/core/events/MouseEvent.cpp
@@ -108,7 +108,7 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
, m_buttons(initializer.buttons())
, m_relatedTarget(initializer.relatedTarget())
, m_dataTransfer(nullptr)
- , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
+ , m_syntheticEventType(PlatformMouseEvent::FromScript)
{
initCoordinates(IntPoint(initializer.clientX(), initializer.clientY()));
}
@@ -152,6 +152,7 @@ void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& ty
m_button = button;
m_buttons = buttons;
m_relatedTarget = relatedTarget;
+ m_syntheticEventType = PlatformMouseEvent::FromScript;
initCoordinates(IntPoint(clientX, clientY));
@@ -242,13 +243,13 @@ DEFINE_TRACE(SimulatedMouseEvent)
MouseEvent::trace(visitor);
}
-PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
+PassRefPtrWillBeRawPtr<MouseEventDispatchMediator> MouseEventDispatchMediator::create(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent)
{
- return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent, mouseEventType));
+ return adoptRefWillBeNoop(new MouseEventDispatchMediator(mouseEvent));
}
-MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent, MouseEventType mouseEventType)
- : EventDispatchMediator(mouseEvent), m_mouseEventType(mouseEventType)
+MouseEventDispatchMediator::MouseEventDispatchMediator(PassRefPtrWillBeRawPtr<MouseEvent> mouseEvent)
+ : EventDispatchMediator(mouseEvent)
{
}
@@ -259,7 +260,7 @@ MouseEvent& MouseEventDispatchMediator::event() const
bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
- if (isSyntheticMouseEvent()) {
+ if (event().fromScript()) {
event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget());
return dispatcher.dispatch();
}
« no previous file with comments | « Source/core/events/MouseEvent.h ('k') | Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698