Bug 1101628 - Fix function name and documentation to reflect reality. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 01 Jun 2016 15:48:05 -0400
changeset 339006 274c6d39f9635a7ef4844930043a9d28c13130b5
parent 339005 c8011fc5c80b24911c1aabfd0de37f004eb7f587
child 339007 f06e9936989826dcdcaee97cf8f75fb03381190f
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1101628
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1101628 - Fix function name and documentation to reflect reality. r=botond MozReview-Commit-ID: 4DN8owPZH65
gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
--- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
@@ -74,35 +74,35 @@ function nativeMouseUpEventMsg() {
     case "mac": return 2; // NSLeftMouseUp
     case "linux": return 7; // GDK_BUTTON_RELEASE
     case "android": return 6; // ACTION_POINTER_UP
   }
   throw "Native mouse-up events not supported on platform " + getPlatform();
 }
 
 // Convert (aX, aY), in CSS pixels relative to aElement's bounding rect,
-// to device pixels relative to aElement's containing window.
-function coordinatesRelativeToWindow(aX, aY, aElement) {
+// to device pixels relative to the screen.
+function coordinatesRelativeToScreen(aX, aY, aElement) {
   var targetWindow = aElement.ownerDocument.defaultView;
   var scale = targetWindow.devicePixelRatio;
   var rect = aElement.getBoundingClientRect();
   return {
     x: (targetWindow.mozInnerScreenX + rect.left + aX) * scale,
     y: (targetWindow.mozInnerScreenY + rect.top + aY) * scale
   };
 }
 
 // Synthesizes a native mousewheel event and returns immediately. This does not
 // guarantee anything; you probably want to use one of the other functions below
 // which actually wait for results.
 // aX and aY are relative to the top-left of |aElement|'s containing window.
 // aDeltaX and aDeltaY are pixel deltas, and aObserver can be left undefined
 // if not needed.
 function synthesizeNativeWheel(aElement, aX, aY, aDeltaX, aDeltaY, aObserver) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   if (aDeltaX && aDeltaY) {
     throw "Simultaneous wheeling of horizontal and vertical is not supported on all platforms.";
   }
   aDeltaX = nativeScrollUnits(aElement, aDeltaX);
   aDeltaY = nativeScrollUnits(aElement, aDeltaY);
   var msg = aDeltaX ? nativeHorizontalWheelEventMsg() : nativeVerticalWheelEventMsg();
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeMouseScrollEvent(pt.x, pt.y, msg, aDeltaX, aDeltaY, 0, 0, 0, aElement, aObserver);
@@ -150,17 +150,17 @@ function synthesizeNativeWheelAndWaitFor
     setTimeout(aCallback, 0);
   }, useCapture);
   return synthesizeNativeWheel(aElement, aX, aY, aDeltaX, aDeltaY);
 }
 
 // Synthesizes a native mouse move event and returns immediately.
 // aX and aY are relative to the top-left of |aElement|'s containing window.
 function synthesizeNativeMouseMove(aElement, aX, aY) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeMouseEvent(pt.x, pt.y, nativeMouseMoveEventMsg(), 0, aElement);
   return true;
 }
 
 // Synthesizes a native mouse move event and invokes the callback once the
 // mouse move event is dispatched to |aElement|'s containing window. If the event
 // targets content in a subdocument, |aElement| should be inside the
@@ -173,17 +173,17 @@ function synthesizeNativeMouseMoveAndWai
     setTimeout(aCallback, 0);
   });
   return synthesizeNativeMouseMove(aElement, aX, aY);
 }
 
 // Synthesizes a native touch event and dispatches it. aX and aY in CSS pixels
 // relative to the top-left of |aElement|'s bounding rect.
 function synthesizeNativeTouch(aElement, aX, aY, aType, aObserver = null, aTouchId = 0) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeTouchPoint(aTouchId, aType, pt.x, pt.y, 1, 90, aObserver);
   return true;
 }
 
 // A handy constant when synthesizing native touch drag events with the pref
 // "apz.touch_start_tolerance" set to 0. In this case, the first touchmove with
 // a nonzero pixel movement is consumed by the APZ to transition from the
@@ -201,29 +201,29 @@ function synthesizeNativeTouchDrag(aElem
     var dy = i * (aDeltaY / steps);
     synthesizeNativeTouch(aElement, aX + dx, aY + dy, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, null, aTouchId);
   }
   synthesizeNativeTouch(aElement, aX + aDeltaX, aY + aDeltaY, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, null, aTouchId);
   return synthesizeNativeTouch(aElement, aX + aDeltaX, aY + aDeltaY, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, aObserver, aTouchId);
 }
 
 function synthesizeNativeTap(aElement, aX, aY, aObserver = null) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeTouchTap(pt.x, pt.y, false, aObserver);
   return true;
 }
 
 function synthesizeNativeMouseEvent(aElement, aX, aY, aType, aObserver = null) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeMouseEvent(pt.x, pt.y, aType, 0, aElement, aObserver);
   return true;
 }
 
 function synthesizeNativeClick(aElement, aX, aY, aObserver = null) {
-  var pt = coordinatesRelativeToWindow(aX, aY, aElement);
+  var pt = coordinatesRelativeToScreen(aX, aY, aElement);
   var utils = SpecialPowers.getDOMWindowUtils(aElement.ownerDocument.defaultView);
   utils.sendNativeMouseEvent(pt.x, pt.y, nativeMouseDownEventMsg(), 0, aElement, function() {
     utils.sendNativeMouseEvent(pt.x, pt.y, nativeMouseUpEventMsg(), 0, aElement, aObserver);
   });
   return true;
 }