Bug 1607181 - eagerly set [smoothscroll] on arrowscrollbox instead of waiting for the getter to be called;r=dao a=RyanVM DEVEDITION_73_0b5_BUILD1 DEVEDITION_73_0b5_RELEASE FIREFOX_73_0b5_BUILD1 FIREFOX_73_0b5_RELEASE
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 08 Jan 2020 13:15:32 +0000
changeset 571175 087b0cab93cc2c55a84e3fd491160cc183e60bfd
parent 571174 52fba9ebcb6f9f1460edc899a24b4fd41517cac6
child 571176 7fd18e25a37e39937e311f285c865075c5347d44
push id12554
push usercbrindusan@mozilla.com
push dateWed, 15 Jan 2020 02:09:58 +0000
treeherdermozilla-beta@087b0cab93cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, RyanVM
bugs1607181
milestone73.0
Bug 1607181 - eagerly set [smoothscroll] on arrowscrollbox instead of waiting for the getter to be called;r=dao a=RyanVM The XBL implementation set the attribute in the constructor if it wasn't already: - https://hg.mozilla.org/mozilla-central/file/94eaa02e0ea1725512893cd5139b1d200fcf4fdd/toolkit/content/widgets/scrollbox.xml#l34. In the Custom Element conversion this check was moved into the getter, which isn't called until a scrollbutton is clicked, which meant that we'd get non-smooth scrolling if just mousewheeling the button. I can't find any reason for intentionally changing that in the bug or review, so I think it was just an oversight. Differential Revision: https://phabricator.services.mozilla.com/D58985
toolkit/content/widgets/arrowscrollbox.js
--- a/toolkit/content/widgets/arrowscrollbox.js
+++ b/toolkit/content/widgets/arrowscrollbox.js
@@ -130,16 +130,23 @@
     }
 
     connectedCallback() {
       if (this.hasConnected) {
         return;
       }
       this.hasConnected = true;
 
+      if (!this.hasAttribute("smoothscroll")) {
+        this.smoothScroll = Services.prefs.getBoolPref(
+          "toolkit.scrollbox.smoothScroll",
+          true
+        );
+      }
+
       this.setAttribute("notoverflowing", "true");
       this.initializeAttributeInheritance();
       this._updateScrollButtonsDisabledState();
     }
 
     get fragment() {
       if (!this.constructor.hasOwnProperty("_fragment")) {
         this.constructor._fragment = MozXULElement.parseXULToFragment(
@@ -176,23 +183,16 @@
     }
 
     set smoothScroll(val) {
       this.setAttribute("smoothscroll", !!val);
       return val;
     }
 
     get smoothScroll() {
-      if (!this.hasAttribute("smoothscroll")) {
-        this.smoothScroll = Services.prefs.getBoolPref(
-          "toolkit.scrollbox.smoothScroll",
-          true
-        );
-      }
-
       return this.getAttribute("smoothscroll") == "true";
     }
 
     get scrollClientRect() {
       return this.scrollbox.getBoundingClientRect();
     }
 
     get scrollClientSize() {