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

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: EventHandler.cpp moved from page to input dir 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
Index: Source/core/events/MouseEvent.cpp
diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp
index 2ecccb43c3dd31e669da96c199b179628a2bab6b..583fea1527c95125d754756ff809e3de6de9f95b 100644
--- a/Source/core/events/MouseEvent.cpp
+++ b/Source/core/events/MouseEvent.cpp
@@ -111,7 +111,7 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init
, m_buttonDown(initializer.button() != (unsigned short)-1)
, m_relatedTarget(initializer.relatedTarget())
, m_dataTransfer(nullptr)
- , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable)
+ , m_syntheticEventType(PlatformMouseEvent::FromScript)
{
initCoordinates(IntPoint(initializer.clientX(), initializer.clientY()));
}
@@ -156,6 +156,7 @@ void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& ty
m_buttons = buttons;
m_buttonDown = button != (unsigned short)-1;
m_relatedTarget = relatedTarget;
+ m_syntheticEventType = PlatformMouseEvent::FromScript;
initCoordinates(IntPoint(clientX, clientY));
@@ -248,13 +249,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)
{
}
@@ -265,7 +266,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();
}

Powered by Google App Engine
This is Rietveld 408576698