Index: Source/core/events/EventDispatcher.cpp |
diff --git a/Source/core/events/EventDispatcher.cpp b/Source/core/events/EventDispatcher.cpp |
index 9bae23167fa3f3d5d8759026052af3b64339c45f..6180764c3af2394870d122cd42e46a339fb22379 100644 |
--- a/Source/core/events/EventDispatcher.cpp |
+++ b/Source/core/events/EventDispatcher.cpp |
@@ -69,7 +69,7 @@ void EventDispatcher::dispatchScopedEvent(Node& node, PassRefPtrWillBeRawPtr<Eve |
ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); |
} |
-void EventDispatcher::dispatchSimulatedClick(Node& node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions) |
+void EventDispatcher::dispatchSimulatedClick(Node& node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickCreationScope creationScope) |
{ |
// This persistent vector doesn't cause leaks, because added Nodes are removed |
// before dispatchSimulatedClick() returns. This vector is here just to prevent |
@@ -84,20 +84,22 @@ void EventDispatcher::dispatchSimulatedClick(Node& node, Event* underlyingEvent, |
nodesDispatchingSimulatedClicks->add(&node); |
+ bool isTrusted = creationScope == SimulatedClickCreationScope::FromUserAgent; |
+ |
if (mouseEventOptions == SendMouseOverUpDownEvents) |
- EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseover, node.document().domWindow(), underlyingEvent)).dispatch(); |
+ EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseover, node.document().domWindow(), underlyingEvent, isTrusted)).dispatch(); |
if (mouseEventOptions != SendNoEvents) { |
- EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mousedown, node.document().domWindow(), underlyingEvent)).dispatch(); |
+ EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mousedown, node.document().domWindow(), underlyingEvent, isTrusted)).dispatch(); |
node.setActive(true); |
- EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseup, node.document().domWindow(), underlyingEvent)).dispatch(); |
+ EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseup, node.document().domWindow(), underlyingEvent, isTrusted)).dispatch(); |
} |
// Some elements (e.g. the color picker) may set active state to true before |
// calling this method and expect the state to be reset during the call. |
node.setActive(false); |
// always send click |
- EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, node.document().domWindow(), underlyingEvent)).dispatch(); |
+ EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, node.document().domWindow(), underlyingEvent, isTrusted)).dispatch(); |
nodesDispatchingSimulatedClicks->remove(&node); |
} |