Changeset 211


Ignore:
Timestamp:
10/01/13 04:27:14 (6 years ago)
Author:
nhoyt
Message:

Improved scrolling behavior by modifying highlightNodeResults function to store reference to first visible node and then scroll it into view after insertDIV loop, rather than repeatedly scrolling within the insertDIV function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-14/chrome/content/highlight/highlight.js

    r210 r211  
    240240 
    241241    var node_results_len = node_results.length; 
     242    var first_visible_node = null; 
    242243    var off_screen_elements = []; 
    243244 
     
    300301        } 
    301302        else { 
     303          // store reference to first visible node 
     304          if (first_visible_node === null) first_visible_node = node; 
     305 
    302306          switch (node_result.getResultValue()) { 
    303307            case RESULT_VALUE.VIOLATION: 
     
    332336      } 
    333337    } //end for 
     338 
     339    // scroll the first node in the list into view 
     340    if (first_visible_node) first_visible_node.scrollIntoView(true); 
     341 
     342    // add an offset between top of viewport and div border 
     343    if (window.content.scrollY) { 
     344      var offset = window.content.scrollY - 10; 
     345      window.content.scroll(0, offset); 
     346    } 
     347 
    334348    if (off_screen_elements.length > 0) 
    335349      this.showOffScreenNodeResults(document, off_screen_elements, v, w, m, p, h); 
     
    581595    } 
    582596 
    583  
    584597    //  If true, element is aligned with top of scroll area. 
    585598    //  If false, it is aligned with bottom. 
     599    /* 
    586600    node.scrollIntoView(true); 
    587601    if (window.content.scrollY) { 
     
    589603      window.content.scroll(0, offset); 
    590604    } 
     605    */ 
    591606  }, 
    592607 
Note: See TracChangeset for help on using the changeset viewer.