Bug 480443 - URLbar should only show address tooltip when overflowing. r=gavin
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -55,25 +55,29 @@
this.timeout = this._prefs.getIntPref("delay");
this._urlTooltip = document.getElementById("urlTooltip");
this.inputField.controllers.insertControllerAt(0, this._copyCutController);
this.inputField.addEventListener("mousedown", this, false);
this.inputField.addEventListener("mousemove", this, false);
this.inputField.addEventListener("mouseout", this, false);
+ this.inputField.addEventListener("overflow", this, false);
+ this.inputField.addEventListener("underflow", this, false);
]]></constructor>
<destructor><![CDATA[
this._prefs.removeObserver("", this);
this._prefs = null;
this.inputField.controllers.removeController(this._copyCutController);
this.inputField.removeEventListener("mousedown", this, false);
this.inputField.removeEventListener("mousemove", this, false);
this.inputField.removeEventListener("mouseout", this, false);
+ this.inputField.removeEventListener("overflow", this, false);
+ this.inputField.removeEventListener("underflow", this, false);
]]></destructor>
<method name="handleRevert">
<body><![CDATA[
var isScrolling = this.popupOpen;
gBrowser.userTypedValue = null;
@@ -206,20 +210,22 @@
}
var postData = {};
url = getShortcutOrURI(url, postData);
return [url, postData.value];
]]></body>
</method>
+
+ <field name="_contentIsCropped">false</field>
<method name="_initURLTooltip">
<body><![CDATA[
- if (this.focused || this.value == "")
+ if (this.focused || !this._contentIsCropped)
return;
if (this._tooltipTimer)
clearTimeout(this._tooltipTimer);
this._tooltipTimer = setTimeout(function (self) {
self._tooltipTimer = 0;
var label = self._urlTooltip.firstChild;
label.value = self.value;
var bO = self.boxObject;
@@ -373,16 +379,23 @@
}
break;
case "mousemove":
this._initURLTooltip();
break;
case "mouseout":
this._hideURLTooltip();
break;
+ case "overflow":
+ this._contentIsCropped = true;
+ break;
+ case "underflow":
+ this._contentIsCropped = false;
+ this._hideURLTooltip();
+ break;
}
]]></body>
</method>
<property name="textValue"
onget="return this.value;">
<setter>
<![CDATA[