B2G/gecko/testing/marionette/marionette-listener.js
/**
 * This function generates a pair of coordinates relative to the viewport given a
 * target element and coordinates relative to that element's top-left corner.
 * @param 'x', and 'y' are the relative to the target.
 *        If they are not specified, then the center of the target is used.
 */
This function generates a pair of coordinates relative to the viewport given a
target element and coordinates relative to that element's top-left corner.
@param 'x', and 'y' are the relative to the target.
If they are not specified, then the center of the target is used.
This function generates a pair of coordinates relative to the viewport given a target element and coordinates relative to that element ' s top - left corner . @param ' x ' and ' y ' are the relative to the target . If they are not specified then the center of the target is used .
function coordinates(target, x, y) {
  let box = target.getBoundingClientRect();
  if (x == null) {
    x = box.width / 2;
  }
  if (y == null) {
    y = box.height / 2;
  }
  let coords = {};
  coords.x = box.left + x;
  coords.y = box.top + y;
  return coords;
}
function coordinates ( target , x , y ) { let box = target . getBoundingClientRect ( ) ; if ( x == null ) { x = box . width / 2 ; } if ( y == null ) { y = box . height / 2 ; } let coords = { } ; coords . x = box . left + x ; coords . y = box . top + y ; return coords ; }
This function generates a pair of coordinates relative to the viewport given a
 target element and coordinates relative to that element's top-left corner.
This function generates a pair of coordinates relative to the viewport given a target element and coordinates relative to that element ' s top - left corner .