Bug 1510599 - Backport simplified URL tooltip implementation from UrlbarInput.jsm to urlbarBindings.xml. r=adw
authorDão Gottwald <dao@mozilla.com>
Wed, 28 Nov 2018 19:08:46 +0000
changeset 507774 7235cbf1093860707e4094dd2cb1fe4c3f229596
parent 507773 db4247c271273dc6316f9cea5f3fd6d42e83e0d6
child 507775 0146ddab71767245ac84916ff0e038567e0e57b1
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)
reviewersadw
bugs1510599
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 1510599 - Backport simplified URL tooltip implementation from UrlbarInput.jsm to urlbarBindings.xml. r=adw Differential Revision: https://phabricator.services.mozilla.com/D13248
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -124,18 +124,17 @@ file, You can obtain one at http://mozil
         this.urlbarSearchSuggestEnabled = this._prefs.getBoolPref("suggest.searches");
         this.timeout = this._prefs.getIntPref("delay");
         this._mayTrimURLs = this._prefs.getBoolPref("trimURLs");
         this._adoptIntoActiveWindow = this._prefs.getBoolPref("switchTabs.adoptIntoActiveWindow");
         this._ctrlCanonizesURLs = this._prefs.getBoolPref("ctrlCanonizesURLs");
         this.inputField.controllers.insertControllerAt(0, this._copyCutController);
         this.inputField.addEventListener("paste", this);
         this.inputField.addEventListener("mousedown", this);
-        this.inputField.addEventListener("mousemove", this);
-        this.inputField.addEventListener("mouseout", this);
+        this.inputField.addEventListener("mouseover", this);
         this.inputField.addEventListener("overflow", this);
         this.inputField.addEventListener("underflow", this);
         this.inputField.addEventListener("scrollend", this);
         window.addEventListener("resize", this);
 
         var textBox = document.getAnonymousElementByAttribute(this,
                                                 "anonid", "moz-input-box");
         // Force the Custom Element to upgrade until Bug 1470242 handles this:
@@ -190,18 +189,17 @@ file, You can obtain one at http://mozil
           return;
         }
         this._prefs.removeObserver("", this);
         this._prefs = null;
         Services.prefs.removeObserver("browser.search.suggest.enabled", this);
         this.inputField.controllers.removeController(this._copyCutController);
         this.inputField.removeEventListener("paste", this);
         this.inputField.removeEventListener("mousedown", this);
-        this.inputField.removeEventListener("mousemove", this);
-        this.inputField.removeEventListener("mouseout", this);
+        this.inputField.removeEventListener("mouseover", this);
         this.inputField.removeEventListener("overflow", this);
         this.inputField.removeEventListener("underflow", this);
         this.inputField.removeEventListener("scrollend", this);
         window.removeEventListener("resize", this);
 
         if (this._deferredKeyEventTimeout) {
           clearTimeout(this._deferredKeyEventTimeout);
           this._deferredKeyEventTimeout = null;
@@ -972,27 +970,23 @@ file, You can obtain one at http://mozil
           } else {
             url = url + suffix;
           }
 
           this.popup.overrideValue = "http://www." + url;
         ]]></body>
       </method>
 
-      <method name="_initURLTooltip">
+      <method name="_updateUrlTooltip">
         <body><![CDATA[
-          if (this.focused || !this._inOverflow)
-            return;
-          this.inputField.setAttribute("title", this.value);
-        ]]></body>
-      </method>
-
-      <method name="_hideURLTooltip">
-        <body><![CDATA[
-          this.inputField.removeAttribute("title");
+          if (this.focused || !this._inOverflow) {
+            this.inputField.removeAttribute("title");
+          } else {
+            this.inputField.setAttribute("title", this.value);
+          }
         ]]></body>
       </method>
 
       <!-- Returns:
            null if there's a security issue and we should do nothing.
            a URL object if there is one that we're OK with loading,
            a text value otherwise.
            -->
@@ -1310,21 +1304,18 @@ file, You can obtain one at http://mozil
               break;
             case "mousedown":
               if (this.doubleClickSelectsAll &&
                   aEvent.button == 0 && aEvent.detail == 2) {
                 this.editor.selectAll();
                 aEvent.preventDefault();
               }
               break;
-            case "mousemove":
-              this._initURLTooltip();
-              break;
-            case "mouseout":
-              this._hideURLTooltip();
+            case "mouseover":
+              this._updateUrlTooltip();
               break;
             case "overflow": {
               const targetIsPlaceholder =
                 !aEvent.originalTarget.classList.contains("anonymous-div");
               // We only care about the non-placeholder text.
               // This shouldn't be needed, see bug 1487036.
               if (targetIsPlaceholder) {
                 break;
@@ -1338,17 +1329,17 @@ file, You can obtain one at http://mozil
                 !aEvent.originalTarget.classList.contains("anonymous-div");
               // We only care about the non-placeholder text.
               // This shouldn't be needed, see bug 1487036.
               if (targetIsPlaceholder) {
                 break;
               }
               this._inOverflow = false;
               this.updateTextOverflow();
-              this._hideURLTooltip();
+              this._updateUrlTooltip();
               break;
             }
             case "scrollend":
               this.updateTextOverflow();
               break;
             case "TabSelect":
               // The autocomplete controller uses heuristic on some internal caches
               // to handle cases like backspace, autofill or repeated searches.
@@ -1759,17 +1750,17 @@ file, You can obtain one at http://mozil
           if (this.focused && this.textValue == "") {
             this.maybeShowSearchSuggestionsNotificationOnFocus(true);
           }
         }
       ]]></handler>
 
       <handler event="focus"><![CDATA[
         if (event.originalTarget == this.inputField) {
-          this._hideURLTooltip();
+          this._updateUrlTooltip();
           this.formatValue();
           if (this.getAttribute("pageproxystate") != "valid") {
             UpdatePopupNotificationsVisibility();
           }
 
           // We show the opt-out notification when the mouse/keyboard focus the
           // urlbar, but in any case we want to enforce at least one
           // notification when the user focuses it with the mouse.