From 910c40e2bfd0ef96385f7bd5392b0576c1aeb47d Mon Sep 17 00:00:00 2001 From: Maja Frydrychowicz Date: Fri, 17 Feb 2017 16:49:03 -0500 Subject: [PATCH] Bug 1337133 - Add more MouseEvent event properties to synthesizeMouseAtPoint; r=ato+446296 Provide more control over event properties to caller. Changes are based on testing/mochitest/tests/SimpleTest/EventUtils.js MozReview-Commit-ID: 1p04Fv086Bj --HG-- extra : rebase_source : 827b91fb2c3e7970e53f5641308b69887eb1041a --- testing/marionette/event.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/testing/marionette/event.js b/testing/marionette/event.js index bb4ff5f5d396..1d3e25cad3f3 100644 --- a/testing/marionette/event.js +++ b/testing/marionette/event.js @@ -232,7 +232,7 @@ event.synthesizeMouse = function ( * CSS pixels from the left document margin. * @param {number} top * CSS pixels from the top document margin. - * @param {Object.} event + * @param {Object.} opts * Object which may contain the properties "shiftKey", "ctrlKey", * "altKey", "metaKey", "accessKey", "clickCount", "button", and * "type". @@ -247,15 +247,26 @@ event.synthesizeMouseAtPoint = function ( let button = opts.button || 0; let clickCount = opts.clickCount || 1; let modifiers = event.parseModifiers_(opts); + let pressure = ("pressure" in opts) ? opts.pressure : 0; + let inputSource = ("inputSource" in opts) ? opts.inputSource : + Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE; + let isDOMEventSynthesized = + ("isSynthesized" in opts) ? opts.isSynthesized : true; + let isWidgetEventSynthesized = + ("isWidgetEventSynthesized" in opts) ? opts.isWidgetEventSynthesized : false; + let buttons = ("buttons" in opts) ? opts.buttons : domutils.MOUSE_BUTTONS_NOT_SPECIFIED; - if (("type" in event) && opts.type) { + if (("type" in opts) && opts.type) { domutils.sendMouseEvent( - opts.type, left, top, button, clickCount, modifiers); + opts.type, left, top, button, clickCount, modifiers, false, pressure, inputSource, + isDOMEventSynthesized, isWidgetEventSynthesized, buttons); } else { domutils.sendMouseEvent( - "mousedown", left, top, button, clickCount, modifiers); + "mousedown", left, top, button, clickCount, modifiers, false, pressure, inputSource, + isDOMEventSynthesized, isWidgetEventSynthesized, buttons); domutils.sendMouseEvent( - "mouseup", left, top, button, clickCount, modifiers); + "mouseup", left, top, button, clickCount, modifiers, false, pressure, inputSource, + isDOMEventSynthesized, isWidgetEventSynthesized, buttons); } };