B2G/gecko/browser/devtools/shared/LayoutHelpers.jsm
/**
   * Find an element from the given coordinates. This method descends through
   * frames to find the element the user clicked inside frames.
   *
   * @param DOMDocument aDocument the document to look into.
   * @param integer aX
   * @param integer aY
   * @returns Node|null the element node found at the given coordinates.
   */
Find an element from the given coordinates. This method descends through
frames to find the element the user clicked inside frames.

@param DOMDocument aDocument the document to look into.
@param integer aX
@param integer aY
@returns Node|null the element node found at the given coordinates.
Find an element from the given coordinates . This method descends through frames to find the element the user clicked inside frames . @param DOMDocument aDocument the document to look into . @param integer aX @param integer aY @returns Node|null the element node found at the given coordinates .
function LH_elementFromPoint(aDocument, aX, aY) {
    let node = aDocument.elementFromPoint(aX, aY);
    if (node && node.contentDocument) {
      if (node instanceof Ci.nsIDOMHTMLIFrameElement) {
        let rect = node.getBoundingClientRect();
        let [offsetTop, offsetLeft] = LayoutHelpers.getIframeContentOffset(node);
        aX -= rect.left + offsetLeft;
        aY -= rect.top + offsetTop;
        if (aX < 0 || aY < 0) {
          return node;
        }
      }
      if (node instanceof Ci.nsIDOMHTMLIFrameElement ||
          node instanceof Ci.nsIDOMHTMLFrameElement) {
        let subnode = this.getElementFromPoint(node.contentDocument, aX, aY);
        if (subnode) {
          node = subnode;
        }
      }
    }
    return node;
  }
function LH_elementFromPoint ( aDocument , aX , aY ) { let node = aDocument . elementFromPoint ( aX , aY ) ; if ( node && node . contentDocument ) { if ( node instanceof Ci . nsIDOMHTMLIFrameElement ) { let rect = node . getBoundingClientRect ( ) ; let [ offsetTop , offsetLeft ] = LayoutHelpers . getIframeContentOffset ( node ) ; aX -= rect . left + offsetLeft ; aY -= rect . top + offsetTop ; if ( aX < 0 || aY < 0 ) { return node ; } } if ( node instanceof Ci . nsIDOMHTMLIFrameElement || node instanceof Ci . nsIDOMHTMLFrameElement ) { let subnode = this . getElementFromPoint ( node . contentDocument , aX , aY ) ; if ( subnode ) { node = subnode ; } } } return node ; }
Find an element from the given coordinates.
Find an element from the given coordinates .
// Gap between the iframe and its content window. // Didn't reach the content document, still over the iframe.