Bug 781977 - Add optional pressure and source parameters to nsIDOMWindowUtils's sendMouse methods, r=roc+smaug.

This commit is contained in:
Jim Mathies 2012-08-14 09:27:39 -05:00
Родитель 19d06abdb4
Коммит 340d440706
4 изменённых файлов: 31 добавлений и 9 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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.

Просмотреть файл

@ -810,7 +810,7 @@ TabChild::RecvMouseEvent(const nsString& aType,
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window);
NS_ENSURE_TRUE(utils, true);
utils->SendMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers,
aIgnoreRootScrollFrame);
aIgnoreRootScrollFrame, 0, 0);
return true;
}