mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
feat: Make URL bar stay perfectly at the center always, b=(no-bug), c=common
This commit is contained in:
@@ -9,7 +9,9 @@ pref('browser.urlbar.suggest.calculator', true);
|
||||
pref("browser.urlbar.trimHttps", true);
|
||||
pref("browser.urlbar.untrimOnUserInteraction.featureGate", true);
|
||||
|
||||
pref("browser.urlbar.maxRichResults", 8);
|
||||
// Keep in sync with browser/components/topsites/constants.mjs
|
||||
pref("browser.urlbar.maxRichResults", 7);
|
||||
|
||||
pref("browser.urlbar.trimHttps", true);
|
||||
pref("browser.search.separatePrivateDefault.ui.enabled", true);
|
||||
pref("browser.urlbar.update2.engineAliasRefresh", true);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234fbec468d5 100644
|
||||
index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..461bae1f8f4d208bc4048fb9494ec4864aad73f5 100644
|
||||
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
@@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
@@ -86,21 +86,19 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
startLayoutExtend() {
|
||||
if (!this.#allowBreakout || this.hasAttribute("breakout-extend")) {
|
||||
// Do not expand if the Urlbar does not support being expanded or it is
|
||||
@@ -2147,6 +2183,13 @@ export class UrlbarInput {
|
||||
@@ -2147,6 +2183,11 @@ export class UrlbarInput {
|
||||
|
||||
this.setAttribute("breakout-extend", "true");
|
||||
|
||||
+ if (lazy.ZEN_URLBAR_BEHAVIOR == 'float' || (lazy.ZEN_URLBAR_BEHAVIOR == 'floating-on-type' && !this.focusedViaMousedown)) {
|
||||
+ this.setAttribute("zen-floating-urlbar", "true");
|
||||
+ // Divide the window by 2 and subtract the urlbar height to get the top
|
||||
+ this.textbox.style.setProperty("--zen-urlbar-top", `${(this.window.innerHeight / 4)}px`);
|
||||
+ } else {
|
||||
+ this.removeAttribute("zen-floating-urlbar");
|
||||
+ }
|
||||
// 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")) {
|
||||
@@ -2166,6 +2209,24 @@ export class UrlbarInput {
|
||||
@@ -2166,6 +2207,24 @@ export class UrlbarInput {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +123,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
this.removeAttribute("breakout-extend");
|
||||
this.#updateTextboxPosition();
|
||||
}
|
||||
@@ -2485,7 +2546,7 @@ export class UrlbarInput {
|
||||
@@ -2485,7 +2544,7 @@ export class UrlbarInput {
|
||||
|
||||
this.textbox.parentNode.style.setProperty(
|
||||
"--urlbar-container-height",
|
||||
@@ -134,7 +132,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
);
|
||||
this.textbox.style.setProperty(
|
||||
"--urlbar-height",
|
||||
@@ -2998,7 +3059,7 @@ export class UrlbarInput {
|
||||
@@ -2998,7 +3057,7 @@ export class UrlbarInput {
|
||||
*/
|
||||
_trimValue(val) {
|
||||
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
|
||||
@@ -143,7 +141,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
: val;
|
||||
// Only trim value if the directionality doesn't change to RTL and we're not
|
||||
// showing a strikeout https protocol.
|
||||
@@ -3368,6 +3429,10 @@ export class UrlbarInput {
|
||||
@@ -3368,6 +3427,10 @@ export class UrlbarInput {
|
||||
}
|
||||
reuseEmpty = true;
|
||||
}
|
||||
@@ -154,7 +152,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
if (
|
||||
where == "tab" &&
|
||||
reuseEmpty &&
|
||||
@@ -3375,6 +3440,9 @@ export class UrlbarInput {
|
||||
@@ -3375,6 +3438,9 @@ export class UrlbarInput {
|
||||
) {
|
||||
where = "current";
|
||||
}
|
||||
@@ -164,7 +162,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
return where;
|
||||
}
|
||||
|
||||
@@ -3632,6 +3700,7 @@ export class UrlbarInput {
|
||||
@@ -3632,6 +3698,7 @@ export class UrlbarInput {
|
||||
this.setResultForCurrentValue(null);
|
||||
this.handleCommand();
|
||||
this.controller.clearLastQueryContextCache();
|
||||
@@ -172,7 +170,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
|
||||
this._suppressStartQuery = false;
|
||||
});
|
||||
@@ -3639,7 +3708,6 @@ export class UrlbarInput {
|
||||
@@ -3639,7 +3706,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.
|
||||
@@ -180,7 +178,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
|
||||
let controller =
|
||||
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
@@ -4053,6 +4121,11 @@ export class UrlbarInput {
|
||||
@@ -4053,6 +4119,11 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_click(event) {
|
||||
@@ -192,7 +190,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
if (
|
||||
event.target == this.inputField ||
|
||||
event.target == this._inputContainer ||
|
||||
@@ -4124,7 +4197,7 @@ export class UrlbarInput {
|
||||
@@ -4124,7 +4195,7 @@ export class UrlbarInput {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +199,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
this.view.autoOpen({ event });
|
||||
} else {
|
||||
if (this._untrimOnFocusAfterKeydown) {
|
||||
@@ -4164,9 +4237,12 @@ export class UrlbarInput {
|
||||
@@ -4164,9 +4235,12 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
@@ -215,7 +213,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
|
||||
if (
|
||||
event.target != this.inputField &&
|
||||
@@ -4176,8 +4252,8 @@ export class UrlbarInput {
|
||||
@@ -4176,8 +4250,8 @@ export class UrlbarInput {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -226,7 +224,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..ebeaf33206649069b5307c400ada234f
|
||||
|
||||
// Keep the focus status, since the attribute may be changed
|
||||
// upon calling this.focus().
|
||||
@@ -4218,7 +4294,7 @@ export class UrlbarInput {
|
||||
@@ -4218,7 +4292,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.
|
||||
|
@@ -0,0 +1,12 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs b/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
|
||||
index dcf1af43d62979d3226d7f704c51a2f0bb935cc0..8879d657b99cb20cd657c2e4841738ffaa09c658 100644
|
||||
--- a/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
|
||||
@@ -794,6 +794,7 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
|
||||
}
|
||||
|
||||
if (result.providerName == lazy.UrlbarProviderTabToSearch.name) {
|
||||
+ return false;
|
||||
// Discard the result if a tab-to-search result was added already.
|
||||
if (!state.canAddTabToSearch) {
|
||||
return false;
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarView.sys.mjs b/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
index d5382623595de8daed8cd13ea2eb2de329a4bd92..3b33e083c40f70a97d153934f2eb6ba73bf986b5 100644
|
||||
index d5382623595de8daed8cd13ea2eb2de329a4bd92..c3b5d1bad0bf4e1c5a5875a83751cfa96cdf1510 100644
|
||||
--- a/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
@@ -609,7 +609,7 @@ export class UrlbarView {
|
||||
@@ -11,6 +11,15 @@ index d5382623595de8daed8cd13ea2eb2de329a4bd92..3b33e083c40f70a97d153934f2eb6ba7
|
||||
// Try to reuse the cached top-sites context. If it's not cached, then
|
||||
// there will be a gap of time between when the input is focused and
|
||||
// when the view opens that can be perceived as flicker.
|
||||
@@ -1325,7 +1325,7 @@ export class UrlbarView {
|
||||
includeHiddenExposures: true,
|
||||
});
|
||||
let canBeVisible =
|
||||
- newSpanCount <= this.#queryContext.maxResults && !seenMisplacedResult;
|
||||
+ newSpanCount < this.#queryContext.maxResults && !seenMisplacedResult;
|
||||
if (result.isHiddenExposure) {
|
||||
if (canBeVisible) {
|
||||
this.controller.engagementEvent.addExposure(
|
||||
@@ -2975,7 +2975,7 @@ export class UrlbarView {
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,10 @@ var gZenUIManager = {
|
||||
},
|
||||
|
||||
updateTabsToolbar() {
|
||||
gURLBar.textbox.style.setProperty(
|
||||
'--zen-urlbar-top',
|
||||
`${window.innerHeight / 2 - gURLBar.textbox.getBoundingClientRect().height / 2}px`
|
||||
);
|
||||
gZenVerticalTabsManager.actualWindowButtons.removeAttribute('zen-has-hover');
|
||||
gZenVerticalTabsManager.recalculateURLBarHeight();
|
||||
if (!this._preventToolbarRebuild) {
|
||||
|
Reference in New Issue
Block a user