Bug 1491249 - Implement URL tooltip. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D7698

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2018-10-04 15:53:09 +00:00
Родитель de85cdbfc7
Коммит df77dbf5ba
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -104,6 +104,7 @@ class UrlbarInput {
this.inputField.addEventListener("blur", this);
this.inputField.addEventListener("focus", this);
this.inputField.addEventListener("mousedown", this);
this.inputField.addEventListener("mouseover", this);
this.inputField.addEventListener("overflow", this);
this.inputField.addEventListener("underflow", this);
this.inputField.addEventListener("scrollend", this);
@ -210,6 +211,14 @@ class UrlbarInput {
});
}
_updateUrlTooltip() {
if (this.focused || !this._inOverflow) {
this.inputField.removeAttribute("title");
} else {
this.inputField.setAttribute("title", this.value);
}
}
_getSelectedValueForClipboard() {
// Grab the actual input field's value, not our value, which could
// include "moz-action:".
@ -328,9 +337,15 @@ class UrlbarInput {
}
_on_focus(event) {
this._updateUrlTooltip();
this.formatValue();
}
_on_mouseover(event) {
this._updateUrlTooltip();
}
_on_mousedown(event) {
if (event.button == 0 &&
event.detail == 2 &&
@ -390,7 +405,10 @@ class UrlbarInput {
return;
}
this._inOverflow = false;
this._updateTextOverflow();
this._updateUrlTooltip();
}
_on_scrollend(event) {