Bug 1179335: Remove unused Marionette mouse scroll functions; r?whimboo draft
authorDavid Burns <dburns@mozilla.com>
Mon, 29 May 2017 13:57:05 +0100
changeset 585967 83b61e06f1202931329f4ec503b007146631b2dc
parent 583263 0daf960b8d19f53403d15721d76dd3ed5b571c9e
child 630843 3f234dd9be6f3871c3218488fb633aa8c204fbde
push id61244
push userbmo:dburns@mozilla.com
push dateMon, 29 May 2017 12:57:52 +0000
reviewerswhimboo
bugs1179335
milestone55.0a1
Bug 1179335: Remove unused Marionette mouse scroll functions; r?whimboo The underlying code that this method calls from nsIDOMWindowUtils was removed and has not caused issues in here. This is dead code. MozReview-Commit-ID: K245et5SmxJ
testing/marionette/event.js
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -279,84 +279,16 @@ event.synthesizeMouseAtCenter = function
   event.synthesizeMouse(
       element,
       rect.width / 2,
       rect.height / 2,
       event,
       window);
 };
 
-/**
- * Synthesise a mouse scroll event on a target.
- *
- * The actual client point is determined by taking the target's client
- * box and offseting it by |offsetX| and |offsetY|.
- *
- * If the |type| property is specified for the |event| argument, a mouse
- * scroll event of that type is fired.  Otherwise, DOMMouseScroll is used.
- *
- * If the |axis| is specified, it must be one of "horizontal" or
- * "vertical". If not specified, "vertical" is used.
- *
- * |delta| is the amount to scroll by (can be positive or negative).
- * It must be specified.
- *
- * |hasPixels| specifies whether kHasPixels should be set in the
- * |scrollFlags|.
- *
- * |isMomentum| specifies whether kIsMomentum should be set in the
- * |scrollFlags|.
- *
- * @param {Element} target
- * @param {number} offsetY
- * @param {number} offsetY
- * @param {Object.<string, ?>} event
- *     Object which may contain the properties shiftKey, ctrlKey, altKey,
- *     metaKey, accessKey, button, type, axis, delta, and hasPixels.
- * @param {Window=} window
- *     Window object.  Defaults to the current window.
- */
-event.synthesizeMouseScroll = function (
-    target, offsetX, offsetY, ev, window = undefined) {
-
-  let domutils = getDOMWindowUtils(window);
-
-  // see nsMouseScrollFlags in nsGUIEvent.h
-  const kIsVertical = 0x02;
-  const kIsHorizontal = 0x04;
-  const kHasPixels = 0x08;
-  const kIsMomentum = 0x40;
-
-  let button = ev.button || 0;
-  let modifiers = event.parseModifiers_(ev);
-
-  let rect = target.getBoundingClientRect();
-  let left = rect.left;
-  let top = rect.top;
-
-  let type = (("type" in ev) && ev.type) || "DOMMouseScroll";
-  let axis = ev.axis || "vertical";
-  let scrollFlags = (axis == "horizontal") ? kIsHorizontal : kIsVertical;
-  if (ev.hasPixels) {
-    scrollFlags |= kHasPixels;
-  }
-  if (ev.isMomentum) {
-    scrollFlags |= kIsMomentum;
-  }
-
-  domutils.sendMouseScrollEvent(
-      type,
-      left + offsetX,
-      top + offsetY,
-      button,
-      scrollFlags,
-      ev.delta,
-      modifiers);
-};
-
 function computeKeyCodeFromChar_(char) {
   if (char.length != 1) {
     return 0;
   }
 
   if (char in VIRTUAL_KEYCODE_LOOKUP) {
     return Ci.nsIDOMKeyEvent["DOM_" + VIRTUAL_KEYCODE_LOOKUP[char]];
   }