B2G/gecko/testing/marionette/marionette-listener.js
/**
 * This function returns if the element is in viewport
 */
This function returns if the element is in viewport
This function returns if the element is in viewport
function elementInViewport(el) {
  let rect = el.getBoundingClientRect();
  let viewPort = {top: curWindow.pageYOffset,
                  left: curWindow.pageXOffset,
                  bottom: (curWindow.pageYOffset + curWindow.innerHeight),
                  right:(curWindow.pageXOffset + curWindow.innerWidth)};
  return (viewPort.left <= rect.right + curWindow.pageXOffset &&
          rect.left + curWindow.pageXOffset <= viewPort.right &&
          viewPort.top <= rect.bottom + curWindow.pageYOffset &&
          rect.top + curWindow.pageYOffset <= viewPort.bottom);
}
function elementInViewport ( el ) { let rect = el . getBoundingClientRect ( ) ; let viewPort = { top : curWindow . pageYOffset , left : curWindow . pageXOffset , bottom : ( curWindow . pageYOffset + curWindow . innerHeight ) , right : ( curWindow . pageXOffset + curWindow . innerWidth ) } ; return ( viewPort . left <= rect . right + curWindow . pageXOffset && rect . left + curWindow . pageXOffset <= viewPort . right && viewPort . top <= rect . bottom + curWindow . pageYOffset && rect . top + curWindow . pageYOffset <= viewPort . bottom ) ; }
This function returns if the element is in viewport
This function returns if the element is in viewport