B2G/gecko/browser/base/content/sanitizeDialog.js
/**
   * Helper function for the keypress event.  Your keypress listener should
   * call this.  Users can use Up, Down, Page Up/Down, Home, and End to move
   * the bottom of the selection window.
   *
   * @param aEvent
   *        The observed keypress event
   */
Helper function for the keypress event.  Your keypress listener should
call this.  Users can use Up, Down, Page Up/Down, Home, and End to move
the bottom of the selection window.

@param aEvent
The observed keypress event
Helper function for the keypress event . Your keypress listener should call this . Users can use Up Down Page Up / Down Home and End to move the bottom of the selection window . @param aEvent The observed keypress event
function CSTH_onkeypress(aEvent)
  {
    var grippyRow = this.getGrippyRow();
    var tbo = this.tree.treeBoxObject;
    var rangeEnd;
    switch (aEvent.keyCode) {
    case aEvent.DOM_VK_HOME:
      rangeEnd = 0;
      break;
    case aEvent.DOM_VK_PAGE_UP:
      rangeEnd = grippyRow - tbo.getPageLength();
      break;
    case aEvent.DOM_VK_UP:
      rangeEnd = grippyRow - 2;
      break;
    case aEvent.DOM_VK_DOWN:
      rangeEnd = grippyRow;
      break;
    case aEvent.DOM_VK_PAGE_DOWN:
      rangeEnd = grippyRow + tbo.getPageLength();
      break;
    case aEvent.DOM_VK_END:
      rangeEnd = this.tree.view.rowCount - 2;
      break;
    default:
      return;
      break;
    }
    aEvent.stopPropagation();
    if (rangeEnd < 0)
      rangeEnd = -1;
    else if (this.tree.view.rowCount - 2 < rangeEnd)
      rangeEnd = this.tree.view.rowCount - 2;
    this.rangedSelect(rangeEnd);
    if (rangeEnd < grippyRow) 
      tbo.ensureRowIsVisible(rangeEnd < 0 ? 0 : rangeEnd);
    else {                    
      if (rangeEnd + 2 < this.tree.view.rowCount)
        tbo.ensureRowIsVisible(rangeEnd + 2);
      else if (rangeEnd + 1 < this.tree.view.rowCount)
        tbo.ensureRowIsVisible(rangeEnd + 1);
    }
  }
function CSTH_onkeypress ( aEvent ) { var grippyRow = this . getGrippyRow ( ) ; var tbo = this . tree . treeBoxObject ; var rangeEnd ; switch ( aEvent . keyCode ) { case aEvent . DOM_VK_HOME : rangeEnd = 0 ; break ; case aEvent . DOM_VK_PAGE_UP : rangeEnd = grippyRow - tbo . getPageLength ( ) ; break ; case aEvent . DOM_VK_UP : rangeEnd = grippyRow - 2 ; break ; case aEvent . DOM_VK_DOWN : rangeEnd = grippyRow ; break ; case aEvent . DOM_VK_PAGE_DOWN : rangeEnd = grippyRow + tbo . getPageLength ( ) ; break ; case aEvent . DOM_VK_END : rangeEnd = this . tree . view . rowCount - 2 ; break ; default : return ; break ; } aEvent . stopPropagation ( ) ; if ( rangeEnd < 0 ) rangeEnd = - 1 ; else if ( this . tree . view . rowCount - 2 < rangeEnd ) rangeEnd = this . tree . view . rowCount - 2 ; this . rangedSelect ( rangeEnd ) ; if ( rangeEnd < grippyRow ) tbo . ensureRowIsVisible ( rangeEnd < 0 ? 0 : rangeEnd ) ; else { if ( rangeEnd + 2 < this . tree . view . rowCount ) tbo . ensureRowIsVisible ( rangeEnd + 2 ) ; else if ( rangeEnd + 1 < this . tree . view . rowCount ) tbo . ensureRowIsVisible ( rangeEnd + 1 ) ; } }
Helper function for the keypress event.
Helper function for the keypress event .
// First, clip rangeEnd.  this.rangedSelect() doesn't clip the range if we // select past the ends of the tree. // Next, (de)select. // Finally, scroll the tree.  We always want one row above and below the // grippy row to be visible if possible. // moved up // moved down