diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 8164b5d59023..ce36e6f1bd27 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -477,10 +477,13 @@ nsDOMWindowUtils::SendMouseEvent(const nsAString& aType, PRInt32 aButton, PRInt32 aClickCount, PRInt32 aModifiers, - bool aIgnoreRootScrollFrame) + bool aIgnoreRootScrollFrame, + float aPressure, + unsigned short aInputSourceArg) { return SendMouseEventCommon(aType, aX, aY, aButton, aClickCount, aModifiers, - aIgnoreRootScrollFrame, false); + aIgnoreRootScrollFrame, false, aPressure, + aInputSourceArg); } NS_IMETHODIMP @@ -490,11 +493,14 @@ nsDOMWindowUtils::SendMouseEventToWindow(const nsAString& aType, PRInt32 aButton, PRInt32 aClickCount, PRInt32 aModifiers, - bool aIgnoreRootScrollFrame) + bool aIgnoreRootScrollFrame, + float aPressure, + unsigned short aInputSourceArg) { SAMPLE_LABEL("nsDOMWindowUtils", "SendMouseEventToWindow"); return SendMouseEventCommon(aType, aX, aY, aButton, aClickCount, aModifiers, - aIgnoreRootScrollFrame, true); + aIgnoreRootScrollFrame, true, aPressure, + aInputSourceArg); } static nsIntPoint @@ -515,6 +521,8 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, PRInt32 aClickCount, PRInt32 aModifiers, bool aIgnoreRootScrollFrame, + float aPressure, + unsigned short aInputSourceArg, bool aToWindow) { if (!IsUniversalXPConnectCapable()) { @@ -545,13 +553,18 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType, } else return NS_ERROR_FAILURE; + if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) { + aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE; + } + nsMouseEvent event(true, msg, widget, nsMouseEvent::eReal, contextMenuKey ? nsMouseEvent::eContextMenuKey : nsMouseEvent::eNormal); event.modifiers = GetWidgetModifiers(aModifiers); event.button = aButton; event.widget = widget; - + event.pressure = aPressure; + event.inputSource = aInputSourceArg; event.clickCount = aClickCount; event.time = PR_IntervalNow(); event.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT; diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h index df1dd7c96d6b..5d61cbfd57cf 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h @@ -42,6 +42,8 @@ protected: PRInt32 aClickCount, PRInt32 aModifiers, bool aIgnoreRootScrollFrame, + float aPressure, + unsigned short aInputSourceArg, bool aToWindow); static mozilla::widget::Modifiers GetWidgetModifiers(PRInt32 aModifiers); diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index cbd369c3cbc6..41ede6480dad 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -39,7 +39,7 @@ interface nsIFile; interface nsIDOMTouch; interface nsIDOMClientRect; -[scriptable, uuid(5fc61d7b-a303-4f34-adfe-b7828675ba45)] +[scriptable, uuid(f7222baa-7c4b-4079-a9e0-db13cf797f58)] interface nsIDOMWindowUtils : nsISupports { /** @@ -215,6 +215,9 @@ interface nsIDOMWindowUtils : nsISupports { * @param aModifiers modifiers pressed, using constants defined as MODIFIER_* * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds * during dispatch + * @param aPressure touch input pressure: 0.0 -> 1.0 + * @param aInputSourceArg input source, see nsIDOMMouseEvent for values, + * defaults to mouse input. */ void sendMouseEvent(in AString aType, in float aX, @@ -222,7 +225,9 @@ interface nsIDOMWindowUtils : nsISupports { in long aButton, in long aClickCount, in long aModifiers, - [optional] in boolean aIgnoreRootScrollFrame); + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg); /** Synthesize a touch event. The event types supported are: * touchstart, touchend, touchmove, and touchcancel @@ -272,7 +277,9 @@ interface nsIDOMWindowUtils : nsISupports { in long aButton, in long aClickCount, in long aModifiers, - [optional] in boolean aIgnoreRootScrollFrame); + [optional] in boolean aIgnoreRootScrollFrame, + [optional] in float aPressure, + [optional] in unsigned short aInputSourceArg); /** Synthesize a wheel event for a window. The event types supported is only * wheel. diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 5dae57e27a3a..3f0cc9e244a9 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -810,7 +810,7 @@ TabChild::RecvMouseEvent(const nsString& aType, nsCOMPtr utils = do_GetInterface(window); NS_ENSURE_TRUE(utils, true); utils->SendMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers, - aIgnoreRootScrollFrame); + aIgnoreRootScrollFrame, 0, 0); return true; }