зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1584167
- Merge UrlbarView's outside click handling into UrlbarInput. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D47236 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b9add81961
Коммит
28cffc3722
|
@ -1781,12 +1781,20 @@ class UrlbarInput {
|
|||
this._mousedownOnUrlbarDescendant = true;
|
||||
break;
|
||||
case this.window:
|
||||
// We collapse the Urlbar for any mousedowns outside of it.
|
||||
if (this._mousedownOnUrlbarDescendant) {
|
||||
this._mousedownOnUrlbarDescendant = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Close the view when clicking on toolbars and other UI pieces that might
|
||||
// not automatically remove focus from the input.
|
||||
// Respect the autohide preference for easier inspecting/debugging via
|
||||
// the browser toolbox.
|
||||
if (!UrlbarPrefs.get("ui.popup.disable_autohide")) {
|
||||
this.view.close();
|
||||
}
|
||||
|
||||
// We collapse the urlbar for any clicks outside of it.
|
||||
this.endLayoutExtend(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,10 +388,6 @@ class UrlbarView {
|
|||
|
||||
this.window.removeEventListener("resize", this);
|
||||
|
||||
this.window.removeEventListener("mousedown", this);
|
||||
this.panel.removeEventListener("mousedown", this);
|
||||
this.input.textbox.removeEventListener("mousedown", this);
|
||||
|
||||
this.controller.notify(this.controller.NOTIFICATIONS.VIEW_CLOSE);
|
||||
if (this.contextualTip) {
|
||||
this.contextualTip.hide();
|
||||
|
@ -597,10 +593,6 @@ class UrlbarView {
|
|||
this.input.setAttribute("open", "true");
|
||||
this.input.startLayoutExtend();
|
||||
|
||||
this.window.addEventListener("mousedown", this);
|
||||
this.panel.addEventListener("mousedown", this);
|
||||
this.input.textbox.addEventListener("mousedown", this);
|
||||
|
||||
this.window.addEventListener("resize", this);
|
||||
this._windowOuterWidth = this.window.outerWidth;
|
||||
|
||||
|
@ -1267,41 +1259,20 @@ class UrlbarView {
|
|||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
switch (event.currentTarget) {
|
||||
case this.panel:
|
||||
case this.input.textbox:
|
||||
this._mousedownOnViewOrInput = true;
|
||||
break;
|
||||
case this.window:
|
||||
// Close the view when clicking on toolbars and other UI pieces that might
|
||||
// not automatically remove focus from the input.
|
||||
if (this._mousedownOnViewOrInput) {
|
||||
this._mousedownOnViewOrInput = false;
|
||||
break;
|
||||
}
|
||||
// Respect the autohide preference for easier inspecting/debugging via
|
||||
// the browser toolbox.
|
||||
if (!UrlbarPrefs.get("ui.popup.disable_autohide")) {
|
||||
this.close();
|
||||
}
|
||||
break;
|
||||
case this._rows:
|
||||
if (event.button == 2) {
|
||||
// Ignore right clicks.
|
||||
break;
|
||||
}
|
||||
let row = event.target;
|
||||
while (!row.classList.contains("urlbarView-row")) {
|
||||
row = row.parentNode;
|
||||
}
|
||||
this._selectElement(row, { updateInput: false });
|
||||
this.controller.speculativeConnect(
|
||||
this.selectedResult,
|
||||
this._queryContext,
|
||||
"mousedown"
|
||||
);
|
||||
break;
|
||||
if (event.button == 2) {
|
||||
// Ignore right clicks.
|
||||
return;
|
||||
}
|
||||
let row = event.target;
|
||||
while (!row.classList.contains("urlbarView-row")) {
|
||||
row = row.parentNode;
|
||||
}
|
||||
this._selectElement(row, { updateInput: false });
|
||||
this.controller.speculativeConnect(
|
||||
this.selectedResult,
|
||||
this._queryContext,
|
||||
"mousedown"
|
||||
);
|
||||
}
|
||||
|
||||
_on_mouseup(event) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче