fix: Fixed omnibox not appearing on fullscreen, b=closes #5229, c=common

This commit is contained in:
Mr. M
2025-10-05 19:14:15 +02:00
parent e340923623
commit 0feb6ac3f9
2 changed files with 38 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079774eed27 100644
index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..b63bf54956a42c63d5cadc9360545e235161f625 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -74,6 +74,13 @@ ChromeUtils.defineLazyGetter(lazy, "logger", () =>
@@ -75,11 +75,25 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
}
if (isCanonized) {
@@ -2205,6 +2237,12 @@ export class UrlbarInput {
@@ -2191,6 +2223,13 @@ export class UrlbarInput {
await this.#updateLayoutBreakoutDimensions();
}
+ get zenUrlbarBehavior() {
+ if (this.document.documentElement.hasAttribute("inDOMFullscreen")) {
+ return "float";
+ }
+ return lazy.ZEN_URLBAR_BEHAVIOR;
+ }
+
startLayoutExtend() {
if (!this.#allowBreakout || this.hasAttribute("breakout-extend")) {
// Do not expand if the Urlbar does not support being expanded or it is
@@ -2205,6 +2244,12 @@ export class UrlbarInput {
this.setAttribute("breakout-extend", "true");
+ if (lazy.ZEN_URLBAR_BEHAVIOR == 'float' || (lazy.ZEN_URLBAR_BEHAVIOR == 'floating-on-type' && !this.focusedViaMousedown)) {
+ if (this.zenUrlbarBehavior == 'float' || (this.zenUrlbarBehavior == 'floating-on-type' && !this.focusedViaMousedown)) {
+ this.setAttribute("zen-floating-urlbar", "true");
+ this.window.gZenUIManager.onFloatingURLBarOpen();
+ } else {
@@ -88,7 +102,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
// Enable the animation only after the first extend call to ensure it
// doesn't run when opening a new window.
if (!this.hasAttribute("breakout-extend-animate")) {
@@ -2224,6 +2262,24 @@ export class UrlbarInput {
@@ -2224,6 +2269,24 @@ export class UrlbarInput {
return;
}
@@ -113,7 +127,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
this.removeAttribute("breakout-extend");
this.#updateTextboxPosition();
}
@@ -2553,7 +2609,7 @@ export class UrlbarInput {
@@ -2553,7 +2616,7 @@ export class UrlbarInput {
this.textbox.parentNode.style.setProperty(
"--urlbar-container-height",
@@ -122,7 +136,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
);
this.textbox.style.setProperty(
"--urlbar-height",
@@ -2986,6 +3042,7 @@ export class UrlbarInput {
@@ -2986,6 +3049,7 @@ export class UrlbarInput {
}
_toggleActionOverride(event) {
@@ -130,7 +144,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
if (
event.keyCode == KeyEvent.DOM_VK_SHIFT ||
event.keyCode == KeyEvent.DOM_VK_ALT ||
@@ -3087,7 +3144,7 @@ export class UrlbarInput {
@@ -3087,7 +3151,7 @@ export class UrlbarInput {
*/
_trimValue(val) {
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
@@ -139,7 +153,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
: val;
// Only trim value if the directionality doesn't change to RTL and we're not
// showing a strikeout https protocol.
@@ -3303,6 +3360,7 @@ export class UrlbarInput {
@@ -3303,6 +3367,7 @@ export class UrlbarInput {
resultDetails = null,
browser = this.window.gBrowser.selectedBrowser
) {
@@ -147,7 +161,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
// No point in setting these because we'll handleRevert() a few rows below.
if (openUILinkWhere == "current") {
// Make sure URL is formatted properly (don't show punycode).
@@ -3455,6 +3513,10 @@ export class UrlbarInput {
@@ -3455,6 +3520,10 @@ export class UrlbarInput {
}
reuseEmpty = true;
}
@@ -158,7 +172,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
if (
where == "tab" &&
reuseEmpty &&
@@ -3462,6 +3524,9 @@ export class UrlbarInput {
@@ -3462,6 +3531,9 @@ export class UrlbarInput {
) {
where = "current";
}
@@ -168,7 +182,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
return where;
}
@@ -3719,6 +3784,7 @@ export class UrlbarInput {
@@ -3719,6 +3791,7 @@ export class UrlbarInput {
this.setResultForCurrentValue(null);
this.handleCommand();
this.controller.clearLastQueryContextCache();
@@ -176,7 +190,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
this._suppressStartQuery = false;
});
@@ -3726,7 +3792,6 @@ export class UrlbarInput {
@@ -3726,7 +3799,6 @@ export class UrlbarInput {
contextMenu.addEventListener("popupshowing", () => {
// Close the results pane when the input field contextual menu is open,
// because paste and go doesn't want a result selection.
@@ -184,7 +198,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
let controller =
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
@@ -3836,7 +3901,11 @@ export class UrlbarInput {
@@ -3836,7 +3908,11 @@ export class UrlbarInput {
if (!engineName && !source && !this.hasAttribute("searchmode")) {
return;
}
@@ -197,7 +211,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
this._searchModeIndicatorTitle.textContent = "";
this._searchModeIndicatorTitle.removeAttribute("data-l10n-id");
@@ -4130,6 +4199,7 @@ export class UrlbarInput {
@@ -4130,6 +4206,7 @@ export class UrlbarInput {
this.document.l10n.setAttributes(
this.inputField,
@@ -205,7 +219,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
l10nId,
l10nId == "urlbar-placeholder-with-name" ? { name } : undefined
);
@@ -4241,6 +4311,11 @@ export class UrlbarInput {
@@ -4241,6 +4318,11 @@ export class UrlbarInput {
}
_on_click(event) {
@@ -217,7 +231,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
if (
event.target == this.inputField ||
event.target == this._inputContainer
@@ -4311,7 +4386,7 @@ export class UrlbarInput {
@@ -4311,7 +4393,7 @@ export class UrlbarInput {
}
}
@@ -226,7 +240,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
this.view.autoOpen({ event });
} else {
if (this._untrimOnFocusAfterKeydown) {
@@ -4351,9 +4426,16 @@ export class UrlbarInput {
@@ -4351,9 +4433,16 @@ export class UrlbarInput {
}
_on_mousedown(event) {
@@ -235,16 +249,16 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
case this.textbox: {
this._mousedownOnUrlbarDescendant = true;
+ const isProbablyFloating =
+ (lazy.ZEN_URLBAR_BEHAVIOR == "floating-on-type" &&
+ (this.zenUrlbarBehavior == "floating-on-type" &&
+ this.hasAttribute("breakout-extend") && !this.focusedViaMousedown) ||
+ (lazy.ZEN_URLBAR_BEHAVIOR == "float") || this.window.gZenVerticalTabsManager._hasSetSingleToolbar;
+ (this.zenUrlbarBehavior == "float") || this.window.gZenVerticalTabsManager._hasSetSingleToolbar;
+ if (event.type != "click" && isProbablyFloating || event.type == "click" && !isProbablyFloating) {
+ return true;
+ }
if (
event.target != this.inputField &&
@@ -4364,6 +4446,10 @@ export class UrlbarInput {
@@ -4364,6 +4453,10 @@ export class UrlbarInput {
this.focusedViaMousedown = !this.focused;
this._preventClickSelectsAll = this.focused;
@@ -255,7 +269,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
// Keep the focus status, since the attribute may be changed
// upon calling this.focus().
@@ -4399,7 +4485,7 @@ export class UrlbarInput {
@@ -4399,7 +4492,7 @@ export class UrlbarInput {
}
// Don't close the view when clicking on a tab; we may want to keep the
// view open on tab switch, and the TabSelect event arrived earlier.
@@ -264,7 +278,7 @@ index 1c447bd31de854d1522dbcfb5d7ad557c84f1388..1dc520f63b240cccda7be074346d2079
break;
}
@@ -4716,7 +4802,7 @@ export class UrlbarInput {
@@ -4716,7 +4809,7 @@ export class UrlbarInput {
// When we are in actions search mode we can show more results so
// increase the limit.
let maxResults =