Bug 1476753 - Port bug 1476639 - Remove scrollToIndex. r=pmorris
authorGeoff Lankow <geoff@darktrojan.net>
Fri, 28 Feb 2020 18:38:20 +0200
changeset 37445 576c40b52ef8121f3a8112321c490631d08bcbaa
parent 37444 4c84501e222aba051de13c800f1819e4cf07768b
child 37446 55ccb8667c98613aefc31d98157b8fe4f8c42a8e
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspmorris
bugs1476753, 1476639
Bug 1476753 - Port bug 1476639 - Remove scrollToIndex. r=pmorris
calendar/base/content/dialogs/calendar-event-dialog-attendees-custom-elements.js
mail/base/content/FilterListDialog.js
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees-custom-elements.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees-custom-elements.js
@@ -526,17 +526,17 @@
     /**
      * Scrolls to the row with the index calculated in the method.
      *
      * @param {Number} val      Decimal number between 0 and 1
      * @returns {Number}        Decimal number between 0 and 1
      */
     set ratio(val) {
       let rowcount = this.getRowCount();
-      this.scrollToIndex(Math.floor(rowcount * val));
+      this.ensureElementIsVisible(this.getItemAtIndex(Math.floor(rowcount * val)), true);
       return val;
     }
 
     /**
      * Depending upon the original target of click event, toolip is updated or new row is appended
      * or nothing happens.
      *
      * @param {Object} event        Event object containing click event information
@@ -2657,17 +2657,17 @@
 
     /**
      * Scrolls to row with the index 'val'.
      *
      * @param {Number} val      Element index
      * @returns {Number}        Element index
      */
     set firstVisibleRow(val) {
-      this.scrollToIndex(val);
+      this.ensureElementIsVisible(this.getItemAtIndex(val), true);
       return val;
     }
 
     /**
      * Returns the index of first row element that is visible in the view box.
      *
      * @returns {Number}        First visible row
      */
@@ -2678,17 +2678,17 @@
     /**
      * Scrolls to the row with the index calculated in the method.
      *
      * @param {Number} val      A number between 0 and 1
      * @returns {Number}        A number between 0 and 1
      */
     set ratio(val) {
       let rowcount = this.getRowCount();
-      this.scrollToIndex(Math.floor(rowcount * val));
+      this.ensureElementIsVisible(this.getItemAtIndex(Math.floor(rowcount * val)), true);
       return val;
     }
 
     /**
      * Gets start date of the freebusy grid element.
      *
      * @returns {calIDateTime}       The start date
      */
--- a/mail/base/content/FilterListDialog.js
+++ b/mail/base/content/FilterListDialog.js
@@ -860,18 +860,21 @@ function rebuildFilterList() {
 
 function updateViewPosition(firstVisibleRowIndex) {
   if (firstVisibleRowIndex == -1) {
     firstVisibleRowIndex = gFilterListbox.getIndexOfFirstVisibleRow();
   }
 
   // Restore to the extent possible the scroll position.
   if (firstVisibleRowIndex && gFilterListbox.itemCount) {
-    gFilterListbox.scrollToIndex(
-      Math.min(firstVisibleRowIndex, gFilterListbox.itemCount - 1)
+    gFilterListbox.ensureElementIsVisible(
+      gFilterListbox.getItemAtIndex(
+        Math.min(firstVisibleRowIndex, gFilterListbox.itemCount - 1)
+      ),
+      true
     );
   }
 
   if (gFilterListbox.selectedCount) {
     // Make sure that at least the first selected item is visible.
     gFilterListbox.ensureElementIsVisible(gFilterListbox.selectedItems[0]);
 
     // The current item should be the first selected item, so that keyboard