Bug 1511744 - Move UrlbarView overflow and underflow handlers from the class constructor to dedicated methods. r=Standard8
authorDão Gottwald <dao@mozilla.com>
Tue, 04 Dec 2018 19:26:49 +0000
changeset 508526 0e2e18a54e1c8b0e04d4aa62f9fe0cec65fa74d4
parent 508525 5ef83bfaf2bb736224682ae84dbe7a8c60ca5fb6
child 508527 c6135d5825bbfc19dfd4400a807bbbfaa16a22b1
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1511744
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511744 - Move UrlbarView overflow and underflow handlers from the class constructor to dedicated methods. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D13653
browser/components/urlbar/UrlbarView.jsm
--- a/browser/components/urlbar/UrlbarView.jsm
+++ b/browser/components/urlbar/UrlbarView.jsm
@@ -26,26 +26,18 @@ class UrlbarView {
     this.document = urlbar.panel.ownerDocument;
     this.window = this.document.defaultView;
 
     this._mainContainer = this.panel.querySelector(".urlbarView-body-inner");
     this._rows = this.panel.querySelector(".urlbarView-results");
 
     // For the horizontal fade-out effect, set the overflow attribute on result
     // rows when they overflow.
-    this._rows.addEventListener("overflow", event => {
-      if (event.target.classList.contains("urlbarView-row-inner")) {
-        event.target.toggleAttribute("overflow", true);
-      }
-    });
-    this._rows.addEventListener("underflow", event => {
-      if (event.target.classList.contains("urlbarView-row-inner")) {
-        event.target.toggleAttribute("overflow", false);
-      }
-    });
+    this._rows.addEventListener("overflow", this);
+    this._rows.addEventListener("underflow", this);
 
     this.controller.addQueryListener(this);
   }
 
   get oneOffSearchButtons() {
     return this._oneOffSearchButtons ||
       (this._oneOffSearchButtons =
          new this.window.SearchOneOffs(this.panel.querySelector(".search-one-offs")));
@@ -215,9 +207,21 @@ class UrlbarView {
     }
     let resultIndex = row.getAttribute("resultIndex");
     let result = this._queryContext.results[resultIndex];
     if (result) {
       this.urlbar.resultSelected(event, result);
     }
     this.close();
   }
+
+  _on_overflow(event) {
+    if (event.target.classList.contains("urlbarView-row-inner")) {
+      event.target.toggleAttribute("overflow", true);
+    }
+  }
+
+  _on_underflow(event) {
+    if (event.target.classList.contains("urlbarView-row-inner")) {
+      event.target.toggleAttribute("overflow", false);
+    }
+  }
 }