mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-05 12:05:22 +00:00
Bug 1577000 - Fix Megabar breakout width on window resize. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D43674 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b108e38d22
commit
60ef93e2ce
@ -34,6 +34,7 @@ skip-if = os == "linux"
|
||||
skip-if = os == "linux"
|
||||
|
||||
[browser_918049_skipintoolbarset_dnd.js]
|
||||
skip-if = os == "mac" # Bug 1578485
|
||||
[browser_923857_customize_mode_event_wrapping_during_reset.js]
|
||||
[browser_927717_customize_drag_empty_toolbar.js]
|
||||
|
||||
|
@ -201,6 +201,8 @@ class UrlbarInput {
|
||||
|
||||
this.dropmarker.addEventListener("mousedown", this);
|
||||
|
||||
this.window.addEventListener("resize", this);
|
||||
|
||||
// This is used to detect commands launched from the panel, to avoid
|
||||
// recording abandonment events when the command causes a blur event.
|
||||
this.view.panel.addEventListener("command", this, true);
|
||||
@ -230,6 +232,7 @@ class UrlbarInput {
|
||||
this.removeEventListener(name, this);
|
||||
}
|
||||
this.dropmarker.removeEventListener("mousedown", this);
|
||||
this.window.removeEventListener("resize", this);
|
||||
|
||||
this.view.panel.remove();
|
||||
this.endLayoutBreakout(true);
|
||||
@ -1701,6 +1704,22 @@ class UrlbarInput {
|
||||
});
|
||||
}
|
||||
|
||||
async _on_resize(event) {
|
||||
if (!(this.megabar && this._layoutBreakoutPlaceholder)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let px = number => number.toFixed(2) + "px";
|
||||
let width = await this.window.promiseDocumentFlushed(() => {
|
||||
// We use the container because it remains flexible unlike the broken-out
|
||||
// Urlbar.
|
||||
return this.textbox.closest("#urlbar-container").clientWidth;
|
||||
});
|
||||
this.window.requestAnimationFrame(() => {
|
||||
this.textbox.style.setProperty("--urlbar-width", px(width));
|
||||
});
|
||||
}
|
||||
|
||||
_on_select(event) {
|
||||
// On certain user input, AutoCopyListener::OnSelectionChange() updates
|
||||
// the primary selection with user-selected text (when supported).
|
||||
|
@ -1045,6 +1045,10 @@ class UrlbarView {
|
||||
}
|
||||
|
||||
_on_resize() {
|
||||
if (this.megabar) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._windowOuterWidth == this.window.outerWidth) {
|
||||
// Sometimes a resize event is fired when the window's size doesn't
|
||||
// actually change; at least, browser_tabMatchesInAwesomebar.js triggers
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#urlbar-container,
|
||||
#search-container {
|
||||
padding: 3px 5px;
|
||||
margin: 3px 5px;
|
||||
}
|
||||
|
||||
#urlbar,
|
||||
|
Loading…
Reference in New Issue
Block a user