mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1299209 - Part 3: Use the default pointerId if needed in EventUtils.js. f=sshih, r=smaug
--HG-- extra : rebase_source : 2b67489658ade21ed6304c4c2f0eb2f01155d47e
This commit is contained in:
parent
7bc745d410
commit
e4f7b97c15
@ -360,7 +360,20 @@ function synthesizeMouseAtPoint(left, top, aEvent, aWindow = window)
|
||||
var clickCount = aEvent.clickCount || 1;
|
||||
var modifiers = _parseModifiers(aEvent, aWindow);
|
||||
var pressure = ("pressure" in aEvent) ? aEvent.pressure : 0;
|
||||
var inputSource = ("inputSource" in aEvent) ? aEvent.inputSource : 0;
|
||||
|
||||
// Default source to mouse.
|
||||
var inputSource = ("inputSource" in aEvent) ? aEvent.inputSource :
|
||||
_EU_Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
|
||||
// Compute a pointerId if needed.
|
||||
var id;
|
||||
if ("id" in aEvent) {
|
||||
id = aEvent.id;
|
||||
} else {
|
||||
var isFromPen = inputSource === _EU_Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN;
|
||||
id = isFromPen ? utils.DEFAULT_PEN_POINTER_ID :
|
||||
utils.DEFAULT_MOUSE_POINTER_ID;
|
||||
}
|
||||
|
||||
var isDOMEventSynthesized =
|
||||
("isSynthesized" in aEvent) ? aEvent.isSynthesized : true;
|
||||
var isWidgetEventSynthesized =
|
||||
@ -373,15 +386,15 @@ function synthesizeMouseAtPoint(left, top, aEvent, aWindow = window)
|
||||
pressure, inputSource,
|
||||
isDOMEventSynthesized,
|
||||
isWidgetEventSynthesized,
|
||||
buttons);
|
||||
buttons, id);
|
||||
}
|
||||
else {
|
||||
utils.sendMouseEvent("mousedown", left, top, button, clickCount, modifiers,
|
||||
false, pressure, inputSource, isDOMEventSynthesized,
|
||||
isWidgetEventSynthesized, buttons);
|
||||
isWidgetEventSynthesized, buttons, id);
|
||||
utils.sendMouseEvent("mouseup", left, top, button, clickCount, modifiers,
|
||||
false, pressure, inputSource, isDOMEventSynthesized,
|
||||
isWidgetEventSynthesized, buttons);
|
||||
isWidgetEventSynthesized, buttons, id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,7 +406,7 @@ function synthesizeTouchAtPoint(left, top, aEvent, aWindow = window)
|
||||
var utils = _getDOMWindowUtils(aWindow);
|
||||
|
||||
if (utils) {
|
||||
var id = aEvent.id || 0;
|
||||
var id = aEvent.id || utils.DEFAULT_TOUCH_POINTER_ID;
|
||||
var rx = aEvent.rx || 1;
|
||||
var ry = aEvent.rx || 1;
|
||||
var angle = aEvent.angle || 0;
|
||||
|
Loading…
Reference in New Issue
Block a user