Bug 1610473 - Use UrlbarInput::_toolbar property instead of textbox.closest("toolbar") in UrlbarInput and UrlbarView. r=mak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2020-01-24 16:20:11 +00:00
parent 6dc0e04393
commit 39e3f763f8
2 changed files with 8 additions and 8 deletions

View File

@ -963,6 +963,10 @@ class UrlbarInput {
if (!this.megabar) {
return;
}
if (!this._toolbar) {
// Expanding requires a parent toolbar.
return;
}
await this._updateLayoutBreakoutDimensions();
this.startLayoutExtend();
}
@ -987,9 +991,7 @@ class UrlbarInput {
}
this.removeAttribute("breakout-extend-disabled");
if (this._toolbar) {
this._toolbar.setAttribute("urlbar-exceeds-toolbar-bounds", "true");
}
this._toolbar.setAttribute("urlbar-exceeds-toolbar-bounds", "true");
this.setAttribute("breakout-extend", "true");
// Enable the animation only after the first extend call to ensure it
@ -1012,9 +1014,7 @@ class UrlbarInput {
return;
}
this.removeAttribute("breakout-extend");
if (this._toolbar) {
this._toolbar.removeAttribute("urlbar-exceeds-toolbar-bounds");
}
this._toolbar.removeAttribute("urlbar-exceeds-toolbar-bounds");
}
setPageProxyState(state) {
@ -1051,7 +1051,7 @@ class UrlbarInput {
);
this.textbox.style.setProperty(
"--urlbar-toolbar-height",
px(getBoundsWithoutFlushing(this.textbox.closest("toolbar")).height)
px(getBoundsWithoutFlushing(this._toolbar).height)
);
this.setAttribute("breakout", "true");

View File

@ -589,7 +589,7 @@ class UrlbarView {
// Align the panel with the parent toolbar.
this.panel.style.top = px(
getBoundsWithoutFlushing(this.input.textbox.closest("toolbar")).bottom
getBoundsWithoutFlushing(this.input._toolbar).bottom
);
this._mainContainer.style.maxWidth = px(width);