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

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: changed failing tests to use eventsender Created 5 years, 8 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 eb4c1bf47978b85189ae7a7957406e0a674f8c1f..abeacc2d8492836240b7416b4cc9787e1816a375 100644
--- a/Source/core/events/MouseEvent.cpp
+++ b/Source/core/events/MouseEvent.cpp
@@ -107,7 +107,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()));
}
@@ -149,6 +149,7 @@ void MouseEvent::initMouseEvent(const AtomicString& type, bool canBubble, bool c
m_buttons = buttons;
m_buttonDown = button != (unsigned short)-1;
m_relatedTarget = relatedTarget;
+ m_syntheticEventType = PlatformMouseEvent::FromScript;
initCoordinates(IntPoint(clientX, clientY));
@@ -241,13 +242,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)
{
}
@@ -258,7 +259,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