B2G/gecko/browser/devtools/webconsole/HUDService.jsm
/**
   * Position the Web Console UI.
   *
   * @param string aPosition
   *        The desired Web Console UI location: above, below or window.
   */
Position the Web Console UI.
@param string aPosition
The desired Web Console UI location: above, below or window.
Position the Web Console UI . @param string aPosition The desired Web Console UI location : above below or window .
function WC_positionConsole(aPosition)
  {
    if (!(aPosition in this.positions)) {
      throw new Error("Incorrect argument: " + aPosition +
        ". Cannot position Web Console");
    }
    if (aPosition == "window") {
      this._createOwnWindowPanel();
      return;
    }
    let height = this.iframe.clientHeight;
    let nodeIdx = this.positions[aPosition];
    let nBox = this.chromeDocument.getElementById(this.tab.linkedPanel);
    let node = nBox.childNodes[nodeIdx];
    if (node == this.iframe) {
      return;
    }
    let lastIndex = -1;
    if (this.outputNode && this.outputNode.getIndexOfFirstVisibleRow) {
      lastIndex = this.outputNode.getIndexOfFirstVisibleRow() +
                  this.outputNode.getNumberOfVisibleRows() - 1;
    }
    if (this.splitter.parentNode) {
      this.splitter.parentNode.removeChild(this.splitter);
    }
    this._beforePositionConsole(aPosition, lastIndex);
    if (aPosition == "below") {
      nBox.appendChild(this.splitter);
      nBox.appendChild(this.iframe);
    }
    else {
      nBox.insertBefore(this.splitter, node);
      nBox.insertBefore(this.iframe, this.splitter);
    }
    if (this.consolePanel) {
      this.consoleWindowUnregisterOnHide = false;
      this.consolePanel.hidePopup();
      this.consolePanel.parentNode.removeChild(this.consolePanel);
      this.consolePanel = null;   
      this.iframe.removeAttribute("flex");
      this.iframe.removeAttribute("height");
      this.iframe.style.height = height + "px";
    }
  }
function WC_positionConsole ( aPosition ) { if ( ! ( aPosition in this . positions ) ) { throw new Error ( "Incorrect argument: " + aPosition + ". Cannot position Web Console" ) ; } if ( aPosition == "window" ) { this . _createOwnWindowPanel ( ) ; return ; } let height = this . iframe . clientHeight ; let nodeIdx = this . positions [ aPosition ] ; let nBox = this . chromeDocument . getElementById ( this . tab . linkedPanel ) ; let node = nBox . childNodes [ nodeIdx ] ; if ( node == this . iframe ) { return ; } let lastIndex = - 1 ; if ( this . outputNode && this . outputNode . getIndexOfFirstVisibleRow ) { lastIndex = this . outputNode . getIndexOfFirstVisibleRow ( ) + this . outputNode . getNumberOfVisibleRows ( ) - 1 ; } if ( this . splitter . parentNode ) { this . splitter . parentNode . removeChild ( this . splitter ) ; } this . _beforePositionConsole ( aPosition , lastIndex ) ; if ( aPosition == "below" ) { nBox . appendChild ( this . splitter ) ; nBox . appendChild ( this . iframe ) ; } else { nBox . insertBefore ( this . splitter , node ) ; nBox . insertBefore ( this . iframe , this . splitter ) ; } if ( this . consolePanel ) { this . consoleWindowUnregisterOnHide = false ; this . consolePanel . hidePopup ( ) ; this . consolePanel . parentNode . removeChild ( this . consolePanel ) ; this . consolePanel = null ; this . iframe . removeAttribute ( "flex" ) ; this . iframe . removeAttribute ( "height" ) ; this . iframe . style . height = height + "px" ; } }
Position the Web Console UI.
Position the Web Console UI .
// get the node position index // check to see if console is already positioned in aPosition // remove the console and splitter and reposition // must destroy the consolePanel // remove this as we're not in panel anymore