mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Bug 1928550 - Don't breakout on readonly urlbar. r=urlbar-reviewers,dao, a=dmeehan
This was a pre-existing issue that was only papered by chance. this._toolbar is set before the early return for readonly urlbars, but the ResizeObserver is only set up after it. Be more explicit about when we allow breaking out of the container (and effectively do it only for non-readonly urlbars). Differential Revision: https://phabricator.services.mozilla.com/D227760
This commit is contained in:
parent
74cf86283e
commit
ff17955e2b
@ -81,6 +81,8 @@ let px = number => number.toFixed(2) + "px";
|
||||
* Implements the text input part of the address bar UI.
|
||||
*/
|
||||
export class UrlbarInput {
|
||||
#allowBreakout = false;
|
||||
|
||||
/**
|
||||
* @param {object} options
|
||||
* The initial options for UrlbarInput.
|
||||
@ -199,7 +201,6 @@ export class UrlbarInput {
|
||||
"#urlbar-search-mode-indicator-close"
|
||||
);
|
||||
this._searchModeLabel = this.querySelector("#urlbar-label-search-mode");
|
||||
this._toolbar = this.textbox.closest("toolbar");
|
||||
|
||||
ChromeUtils.defineLazyGetter(this, "valueFormatter", () => {
|
||||
return new lazy.UrlbarValueFormatter(this);
|
||||
@ -279,7 +280,9 @@ export class UrlbarInput {
|
||||
menubar.addEventListener("DOMMenuBarActive", this);
|
||||
}
|
||||
|
||||
if (this._toolbar) {
|
||||
// Expanding requires a parent toolbar, and us not being read-only.
|
||||
this.#allowBreakout = !!this.textbox.closest("toolbar");
|
||||
if (this.#allowBreakout) {
|
||||
// TODO(emilio): This could use CSS anchor positioning rather than this
|
||||
// ResizeObserver, eventually.
|
||||
let observer = new this.window.ResizeObserver(([entry]) => {
|
||||
@ -2108,8 +2111,7 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
async updateLayoutBreakout() {
|
||||
if (!this._toolbar) {
|
||||
// Expanding requires a parent toolbar.
|
||||
if (!this.#allowBreakout) {
|
||||
return;
|
||||
}
|
||||
if (this.document.fullscreenElement) {
|
||||
|
Loading…
Reference in New Issue
Block a user