Added options for floating urlbar, fixed macos weird window control positioning, added newtab animations, fixed top toolbar hiding when hovering reload button and new URLBar UI

This commit is contained in:
mr. M
2024-12-13 00:49:43 +01:00
parent 85028b060c
commit c67fc71069
13 changed files with 253 additions and 79 deletions

View File

@@ -1,36 +1,65 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index c504c9afc43785b5f003bb1f9f1dfbddef38d78b..e5a1ce5d61962d485d092cf3d1a90ff4833037f1 100644
index c504c9afc43785b5f003bb1f9f1dfbddef38d78b..289a9dfdc2fd38f7d7c3571732e3897aa978d8d9 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -3901,6 +3901,9 @@ export class UrlbarInput {
@@ -65,6 +65,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
+XPCOMUtils.defineLazyPreferenceGetter(
+ lazy,
+ "ZEN_URLBAR_BEHAVIOR",
+ "zen.urlbar.behavior",
+ 'default'
+);
+
const DEFAULT_FORM_HISTORY_NAME = "searchbar-history";
const SEARCH_BUTTON_CLASS = "urlbar-search-button";
@@ -2154,6 +2161,10 @@ 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");
+ } 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")) {
@@ -3901,6 +3912,11 @@ export class UrlbarInput {
}
_on_click(event) {
+ event.zenOriginalTarget = this.textbox;
+ this._on_mousedown(event);
+ if (lazy.ZEN_URLBAR_BEHAVIOR === 'float') {
+ event.zenOriginalTarget = this.textbox;
+ this._on_mousedown(event);
+ }
+
if (
event.target == this.inputField ||
event.target == this._inputContainer ||
@@ -4012,8 +4015,11 @@ export class UrlbarInput {
@@ -4012,8 +4028,11 @@ export class UrlbarInput {
}
_on_mousedown(event) {
- switch (event.currentTarget) {
+ switch (event.zenOriginalTarget || event.currentTarget) {
case this.textbox: {
+ if (event.type != "click") {
+ if (event.type != "click" && lazy.ZEN_URLBAR_BEHAVIOR === 'float') {
+ return true;
+ }
this._mousedownOnUrlbarDescendant = true;
if (
@@ -4025,7 +4031,7 @@ export class UrlbarInput {
@@ -4024,8 +4043,8 @@ export class UrlbarInput {
break;
}
this.focusedViaMousedown = !this.focused;
- this.focusedViaMousedown = !this.focused;
- this._preventClickSelectsAll = this.focused;
+ this._preventClickSelectsAll = this.hasAttribute("breakout-extend");
+ this.focusedViaMousedown = !(lazy.ZEN_URLBAR_BEHAVIOR === 'float' ? this.hasAttribute("breakout-extend") : this.focused);
+ this._preventClickSelectsAll = lazy.ZEN_URLBAR_BEHAVIOR === 'default' ? this.focused : this.hasAttribute("breakout-extend");
// Keep the focus status, since the attribute may be changed
// upon calling this.focus().