feat: Improved double toolbar urlbar twitching, b=no-bug, c=common, compact-mode

This commit is contained in:
mr. m
2025-10-18 15:45:23 +02:00
parent 1e5d655fc6
commit 3801696adc
11 changed files with 137 additions and 133 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3a28e1f97 100644
index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..e31ad41ab28b2be67c25c2efc75e9dd1acfd896f 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -76,6 +76,13 @@ ChromeUtils.defineLazyGetter(lazy, "logger", () =>
@@ -146,7 +146,20 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
this.removeAttribute("breakout-extend");
this.#updateTextboxPosition();
}
@@ -2660,7 +2742,7 @@ export class UrlbarInput {
@@ -2595,10 +2677,12 @@ export class UrlbarInput {
return;
}
this.textbox.style.top = px(
+ this.window.gZenVerticalTabsManager._hasSetSingleToolbar ?
this.textbox.parentNode.getBoxQuads({
ignoreTransforms: true,
flush: false,
})[0].p1.y
+ : -5
);
}
@@ -2660,7 +2744,7 @@ export class UrlbarInput {
this.textbox.parentNode.style.setProperty(
"--urlbar-container-height",
@@ -155,7 +168,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
);
this.textbox.style.setProperty(
"--urlbar-height",
@@ -3093,6 +3175,7 @@ export class UrlbarInput {
@@ -3093,6 +3177,7 @@ export class UrlbarInput {
}
_toggleActionOverride(event) {
@@ -163,7 +176,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (
event.keyCode == KeyEvent.DOM_VK_SHIFT ||
event.keyCode == KeyEvent.DOM_VK_ALT ||
@@ -3197,7 +3280,7 @@ export class UrlbarInput {
@@ -3197,7 +3282,7 @@ export class UrlbarInput {
return val;
}
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
@@ -172,7 +185,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
: val;
// Only trim value if the directionality doesn't change to RTL and we're not
// showing a strikeout https protocol.
@@ -3501,6 +3584,7 @@ export class UrlbarInput {
@@ -3501,6 +3586,7 @@ export class UrlbarInput {
resultDetails = null,
browser = this.window.gBrowser.selectedBrowser
) {
@@ -180,7 +193,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (this.isAddressbar) {
this.#prepareAddressbarLoad(
url,
@@ -3608,6 +3692,10 @@ export class UrlbarInput {
@@ -3608,6 +3694,10 @@ export class UrlbarInput {
}
reuseEmpty = true;
}
@@ -191,7 +204,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (
where == "tab" &&
reuseEmpty &&
@@ -3615,6 +3703,9 @@ export class UrlbarInput {
@@ -3615,6 +3705,9 @@ export class UrlbarInput {
) {
where = "current";
}
@@ -201,7 +214,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
return where;
}
@@ -3872,6 +3963,7 @@ export class UrlbarInput {
@@ -3872,6 +3965,7 @@ export class UrlbarInput {
this.setResultForCurrentValue(null);
this.handleCommand();
this.controller.clearLastQueryContextCache();
@@ -209,7 +222,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
this._suppressStartQuery = false;
});
@@ -3879,7 +3971,6 @@ export class UrlbarInput {
@@ -3879,7 +3973,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.
@@ -217,7 +230,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
let controller =
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
@@ -3991,7 +4082,11 @@ export class UrlbarInput {
@@ -3991,7 +4084,11 @@ export class UrlbarInput {
if (!engineName && !source && !this.hasAttribute("searchmode")) {
return;
}
@@ -230,7 +243,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (this._searchModeIndicatorTitle) {
this._searchModeIndicatorTitle.textContent = "";
this._searchModeIndicatorTitle.removeAttribute("data-l10n-id");
@@ -4302,6 +4397,7 @@ export class UrlbarInput {
@@ -4302,6 +4399,7 @@ export class UrlbarInput {
this.document.l10n.setAttributes(
this.inputField,
@@ -238,7 +251,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
l10nId,
l10nId == "urlbar-placeholder-with-name" ? { name } : undefined
);
@@ -4413,6 +4509,11 @@ export class UrlbarInput {
@@ -4413,6 +4511,11 @@ export class UrlbarInput {
}
_on_click(event) {
@@ -250,7 +263,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (
event.target == this.inputField ||
event.target == this._inputContainer
@@ -4485,7 +4586,7 @@ export class UrlbarInput {
@@ -4485,7 +4588,7 @@ export class UrlbarInput {
}
}
@@ -259,7 +272,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
this.view.autoOpen({ event });
} else {
if (this._untrimOnFocusAfterKeydown) {
@@ -4525,9 +4626,16 @@ export class UrlbarInput {
@@ -4525,9 +4628,16 @@ export class UrlbarInput {
}
_on_mousedown(event) {
@@ -277,7 +290,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
if (
event.target != this.inputField &&
@@ -4538,6 +4646,10 @@ export class UrlbarInput {
@@ -4538,6 +4648,10 @@ export class UrlbarInput {
this.focusedViaMousedown = !this.focused;
this._preventClickSelectsAll = this.focused;
@@ -288,7 +301,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
// Keep the focus status, since the attribute may be changed
// upon calling this.focus().
@@ -4573,7 +4685,7 @@ export class UrlbarInput {
@@ -4573,7 +4687,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.
@@ -297,7 +310,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3
break;
}
@@ -4890,7 +5002,7 @@ export class UrlbarInput {
@@ -4890,7 +5004,7 @@ export class UrlbarInput {
// When we are in actions search mode we can show more results so
// increase the limit.
let maxResults =

View File

@@ -1,17 +1,22 @@
diff --git a/browser/themes/shared/identity-block/identity-block.css b/browser/themes/shared/identity-block/identity-block.css
index 8edca63dc52ec207475ed9965559d28c06e27971..884343473857c6b6256922d47085fac6eabe74fb 100644
index 8edca63dc52ec207475ed9965559d28c06e27971..a5a949be1868af5d0bb04747a9f5b737c00ae49c 100644
--- a/browser/themes/shared/identity-block/identity-block.css
+++ b/browser/themes/shared/identity-block/identity-block.css
@@ -83,7 +83,7 @@
@@ -81,13 +81,6 @@
}
}
#identity-box[pageproxystate="valid"]:is(.notSecureText, .chromeUI, .extensionPage) > .identity-box-button,
#urlbar-label-box {
-#identity-box[pageproxystate="valid"]:is(.notSecureText, .chromeUI, .extensionPage) > .identity-box-button,
-#urlbar-label-box {
- background-color: var(--urlbar-box-bgcolor);
+ background-color: transparent;
color: var(--urlbar-box-text-color);
padding-inline: 8px;
border-radius: var(--urlbar-icon-border-radius);
@@ -178,16 +178,17 @@
- color: var(--urlbar-box-text-color);
- padding-inline: 8px;
- border-radius: var(--urlbar-icon-border-radius);
-}
#urlbar[focused] {
#identity-box[pageproxystate="valid"]:is(.notSecureText, .chromeUI, .extensionPage) > .identity-box-button:not(:hover, [open]),
@@ -178,16 +171,17 @@
}
#identity-icon {

View File

@@ -662,22 +662,6 @@
list-style-image: url('tab-audio-blocked-small.svg') !important;
}
/* reload/stop animation */
#stop-reload-button[animate]
> #reload-button[displaystop]
+ #stop-button
> .toolbarbutton-animatable-box
> .toolbarbutton-animatable-image {
background-image: url('reload-to-stop.svg') !important;
}
#stop-reload-button[animate]
> #reload-button
> .toolbarbutton-animatable-box
> .toolbarbutton-animatable-image {
background-image: url('stop-to-reload.svg') !important;
}
#reader-mode-button > .urlbar-icon,
#zen-site-data-header-reader-mode {
list-style-image: url('reader-mode.svg') !important;
@@ -950,4 +934,5 @@
#zen-copy-url-button image {
list-style-image: url('link.svg');
fill-opacity: 0.7;
}

View File

@@ -111,7 +111,6 @@
* skin/classic/browser/zen-icons/private-window.svg (../shared/zen-icons/lin/private-window.svg)
* skin/classic/browser/zen-icons/privateBrowsing.svg (../shared/zen-icons/lin/privateBrowsing.svg)
* skin/classic/browser/zen-icons/reader-mode.svg (../shared/zen-icons/lin/reader-mode.svg)
* skin/classic/browser/zen-icons/reload-to-stop.svg (../shared/zen-icons/lin/reload-to-stop.svg)
* skin/classic/browser/zen-icons/reload.svg (../shared/zen-icons/lin/reload.svg)
* skin/classic/browser/zen-icons/report.svg (../shared/zen-icons/lin/report.svg)
* skin/classic/browser/zen-icons/save.svg (../shared/zen-icons/lin/save.svg)
@@ -134,7 +133,6 @@
* skin/classic/browser/zen-icons/sparkles.svg (../shared/zen-icons/lin/sparkles.svg)
* skin/classic/browser/zen-icons/spell-check.svg (../shared/zen-icons/lin/spell-check.svg)
* skin/classic/browser/zen-icons/split.svg (../shared/zen-icons/lin/split.svg)
* skin/classic/browser/zen-icons/stop-to-reload.svg (../shared/zen-icons/lin/stop-to-reload.svg)
* skin/classic/browser/zen-icons/tab-audio-blocked-small.svg (../shared/zen-icons/lin/tab-audio-blocked-small.svg)
* skin/classic/browser/zen-icons/tab-audio-muted-small.svg (../shared/zen-icons/lin/tab-audio-muted-small.svg)
* skin/classic/browser/zen-icons/tab-audio-playing-small.svg (../shared/zen-icons/lin/tab-audio-playing-small.svg)
@@ -265,7 +263,6 @@
* skin/classic/browser/zen-icons/private-window.svg (../shared/zen-icons/lin/private-window.svg)
* skin/classic/browser/zen-icons/privateBrowsing.svg (../shared/zen-icons/lin/privateBrowsing.svg)
* skin/classic/browser/zen-icons/reader-mode.svg (../shared/zen-icons/lin/reader-mode.svg)
* skin/classic/browser/zen-icons/reload-to-stop.svg (../shared/zen-icons/lin/reload-to-stop.svg)
* skin/classic/browser/zen-icons/reload.svg (../shared/zen-icons/lin/reload.svg)
* skin/classic/browser/zen-icons/report.svg (../shared/zen-icons/lin/report.svg)
* skin/classic/browser/zen-icons/save.svg (../shared/zen-icons/lin/save.svg)
@@ -288,7 +285,6 @@
* skin/classic/browser/zen-icons/sparkles.svg (../shared/zen-icons/lin/sparkles.svg)
* skin/classic/browser/zen-icons/spell-check.svg (../shared/zen-icons/lin/spell-check.svg)
* skin/classic/browser/zen-icons/split.svg (../shared/zen-icons/lin/split.svg)
* skin/classic/browser/zen-icons/stop-to-reload.svg (../shared/zen-icons/lin/stop-to-reload.svg)
* skin/classic/browser/zen-icons/tab-audio-blocked-small.svg (../shared/zen-icons/lin/tab-audio-blocked-small.svg)
* skin/classic/browser/zen-icons/tab-audio-muted-small.svg (../shared/zen-icons/lin/tab-audio-muted-small.svg)
* skin/classic/browser/zen-icons/tab-audio-playing-small.svg (../shared/zen-icons/lin/tab-audio-playing-small.svg)
@@ -419,7 +415,6 @@
* skin/classic/browser/zen-icons/private-window.svg (../shared/zen-icons/lin/private-window.svg)
* skin/classic/browser/zen-icons/privateBrowsing.svg (../shared/zen-icons/lin/privateBrowsing.svg)
* skin/classic/browser/zen-icons/reader-mode.svg (../shared/zen-icons/lin/reader-mode.svg)
* skin/classic/browser/zen-icons/reload-to-stop.svg (../shared/zen-icons/lin/reload-to-stop.svg)
* skin/classic/browser/zen-icons/reload.svg (../shared/zen-icons/lin/reload.svg)
* skin/classic/browser/zen-icons/report.svg (../shared/zen-icons/lin/report.svg)
* skin/classic/browser/zen-icons/save.svg (../shared/zen-icons/lin/save.svg)
@@ -442,7 +437,6 @@
* skin/classic/browser/zen-icons/sparkles.svg (../shared/zen-icons/lin/sparkles.svg)
* skin/classic/browser/zen-icons/spell-check.svg (../shared/zen-icons/lin/spell-check.svg)
* skin/classic/browser/zen-icons/split.svg (../shared/zen-icons/lin/split.svg)
* skin/classic/browser/zen-icons/stop-to-reload.svg (../shared/zen-icons/lin/stop-to-reload.svg)
* skin/classic/browser/zen-icons/tab-audio-blocked-small.svg (../shared/zen-icons/lin/tab-audio-blocked-small.svg)
* skin/classic/browser/zen-icons/tab-audio-muted-small.svg (../shared/zen-icons/lin/tab-audio-muted-small.svg)
* skin/classic/browser/zen-icons/tab-audio-playing-small.svg (../shared/zen-icons/lin/tab-audio-playing-small.svg)

View File

@@ -1,32 +0,0 @@
#filter dumbComments emptyLines substitution
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- do not round the stroke-width -->
<svg xmlns="http://www.w3.org/2000/svg" stroke-width="1.001" stroke="context-fill" stroke-opacity="context-fill-opacity" width="260" height="20" fill="none" stroke-linecap="round" stroke-linejoin="round">
<defs>
<clipPath id="a"><path d="M0 3h6l8 7 5 1v9H0z"/></clipPath>
<clipPath id="b"><path d="M9 0v12l-5 8H0V0z"/></clipPath>
<clipPath id="c"><path d="m5 3 2 4h5V0H5z"/></clipPath>
<clipPath id="d"><path d="m10 8-2 2-5-5 2-2z"/></clipPath>
<clipPath id="e"><path d="m5 3 10 10-2 2L3 5z"/></clipPath>
<clipPath id="f"><path d="m5 3 12 12-2 2L3 5z"/></clipPath>
<clipPath id="g"><path d="m3 1 16 16H3z"/></clipPath>
<clipPath id="h"><path d="M3 3h7l7 7v7H3z"/></clipPath>
<path id="reload" d="M17.48 9.5v.5c0 4.1-3.4 7.5-7.5 7.5s-7.5-3.4-7.5-7.5 3.4-7.5 7.5-7.5c2.8 0 5.2 1.5 6.5 3.8m.02-3.8v4h-4"/>
<path id="close" d="m4.5 4.5 11 11m-11 0 11-11"/>
</defs>
<svg><use href="#reload"/></svg>
<svg x="20"><use href="#reload" transform="rotate(45 10 10)"/></svg>
<svg x="40"><use href="#reload" transform="rotate(125 10 10)"/></svg>
<svg x="60"><use href="#reload" transform="rotate(195 10 10)"/></svg>
<svg x="80"><use href="#reload" transform="rotate(235 10 10)"/></svg>
<svg x="100"><g clip-path="url(#a)"><use href="#reload" transform="rotate(260 10 10)"/></g></svg>
<svg x="120"><g clip-path="url(#b)"><use href="#reload" transform="rotate(280 10 10)"/></g></svg>
<svg x="140"><g clip-path="url(#c)"><use href="#reload" transform="rotate(300 10 10)"/></g><use href="#close" clip-path="url(#d)"/></svg>
<svg x="160"><use href="#close" clip-path="url(#e)"/></svg>
<svg x="180"><use href="#close" clip-path="url(#f)"/></svg>
<svg x="200"><use href="#close" clip-path="url(#g)"/></svg>
<svg x="220"><use href="#close" clip-path="url(#h)"/></svg>
<svg x="240"><use href="#close"/></svg>
</svg>

View File

@@ -1,39 +0,0 @@
#filter dumbComments emptyLines substitution
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- do not round the stroke-width -->
<svg xmlns="http://www.w3.org/2000/svg" stroke-width="1.001" stroke="context-fill" stroke-opacity="context-fill-opacity" fill="none" stroke-linecap="round" stroke-linejoin="round">
<defs>
<clipPath id="a"><path d="m3 6 11 11h3V3H3Z"/></clipPath>
<clipPath id="b"><path d="M5 3 3 5l12 12 2-2L5 3zm10 0-2 2 2 2 2-2-2-2z"/></clipPath>
<clipPath id="c"><path d="m5 3 12 12-2 2L3 5Z"/></clipPath>
<clipPath id="d"><path d="m5 3 7 7-2 2-7-7z"/></clipPath>
<clipPath id="e"><path d="m5 3 2 2-2 2-2-2Z"/></clipPath>
<clipPath id="f"><path d="m16 3-4 6h10Z"/></clipPath>
<clipPath id="g"><path d="m11 11 8 6V4h-4z"/></clipPath>
<clipPath id="h"><path d="m11 11-1 9h9V0l-7 8z"/></clipPath>
<clipPath id="i"><path d="M16 3 3 17v3h16V3Z"/></clipPath>
<clipPath id="j"><path d="m16 3-3 4-13 3v10h19V3Z"/></clipPath>
<clipPath id="k"><path d="m16 3-3 4L0 2v18h20V3Z"/></clipPath>
<clipPath id="l"><path d="m16 3-3 4-8-7H0v20h20V3Z"/></clipPath>
<clipPath id="m"><path d="m16 3-3 4-2-7H0v20h20V3Z"/></clipPath>
<path id="reload" d="M17.48 9.5v.5c0 4.1-3.4 7.5-7.5 7.5s-7.5-3.4-7.5-7.5 3.4-7.5 7.5-7.5c2.8 0 5.2 1.5 6.5 3.8m.02-3.8v4h-4"/>
<path id="close" d="m4.5 4.5 11 11m-11 0 11-11"/>
</defs>
<svg><use href="#close"/></svg>
<svg x="20"><use href="#close" clip-path="url(#a)"/></svg>
<svg x="40"><use href="#close" clip-path="url(#b)"/></svg>
<svg x="60"><g clip-path="url(#f)"><use href="#reload" transform="rotate(40 10 10)"/></g><use href="#close" clip-path="url(#c)"/></svg>
<svg x="80"><g clip-path="url(#g)"><use href="#reload" transform="rotate(80 10 10)"/></g><use href="#close" clip-path="url(#d)"/></svg>
<svg x="100"><g clip-path="url(#h)"><use href="#reload" transform="rotate(120 10 10)"/></g><use href="#close" clip-path="url(#e)"/></svg>
<svg x="120"><g clip-path="url(#i)"><use href="#reload" transform="rotate(160 10 10)"/></g></svg>
<svg x="140"><g clip-path="url(#j)"><use href="#reload" transform="rotate(200 10 10)"/></g></svg>
<svg x="160"><g clip-path="url(#k)"><use href="#reload" transform="rotate(250 10 10)"/></g></svg>
<svg x="180"><g clip-path="url(#l)"><use href="#reload" transform="rotate(270 10 10)"/></g></svg>
<svg x="200"><g clip-path="url(#m)"><use href="#reload" transform="rotate(300 10 10)"/></g></svg>
<svg x="220"><use href="#reload" transform="rotate(335 10 10)"/></svg>
<svg x="240"><use href="#reload" transform="rotate(345 10 10)"/></svg>
<svg x="260"><use href="#reload" transform="rotate(355 10 10)"/></svg>
<svg x="280"><use href="#reload"/></svg>
</svg>

View File

@@ -71,6 +71,7 @@ export var ZenCustomizableUI = new (class {
<toolbarbutton
class="toolbarbutton-1"
command="cmd_toggleCompactModeIgnoreHover"
flex="1"
data-l10n-id="zen-toggle-compact-mode-button" />
</toolbaritem>
<html:div id="zen-sidebar-top-buttons-separator" skipintoolbarset="true" overflows="false"></html:div>

View File

@@ -49,6 +49,7 @@
:root[zen-single-toolbar='true'] & {
transition-delay: 0.2s;
--zen-toolbar-height: 34px;
}
#tabbrowser-tabpanels[has-toolbar-hovered] & {

View File

@@ -114,7 +114,7 @@
border-radius: 0px !important;
}
#urlbar:not([breakout-extend='true']) .urlbar-input-box {
#urlbar .urlbar-input-box {
font-weight: 500;
}
@@ -151,19 +151,35 @@
:root:not([zen-single-toolbar='true'])
#urlbar:not([breakout-extend='true'])
.urlbar-input-container:not([pageproxystate='invalid']) {
flex-direction: row-reverse;
padding: 2px 3px;
gap: 2px;
padding: 2px;
& .urlbar-page-action {
height: 100%;
}
& #zen-copy-url-button {
order: -1;
}
& #identity-box {
order: 999;
margin: 0px !important;
}
}
#zen-copy-url-button[disabled] {
opacity: 0.3;
background: transparent !important;
}
:root[zen-single-toolbar='true'],
#urlbar:is([breakout-extend='true'], [pageproxystate='invalid']) {
#zen-copy-url-button[disabled] {
display: none !important;
}
}
.urlbar-page-action,
#tracking-protection-icon-container {
padding: 0 !important;
@@ -204,7 +220,8 @@
#urlbar[breakout-extend='true'] {
z-index: 2;
& .urlbar-input-container {
:root[zen-single-toolbar='true'] & .urlbar-input-box,
&[zen-floating-urlbar='true'] .urlbar-input-box {
font-weight: 400;
@media (-moz-platform: windows) {
font-weight: 500;
@@ -212,10 +229,15 @@
}
& #identity-box {
margin-right: calc(var(--urlbar-margin-inline) - 1px);
height: 100%;
}
:root:not([zen-single-toolbar='true'])
&:not([zen-floating-urlbar='true'])
#identity-box:not([pageproxystate='invalid']) {
margin-inline-end: 0;
}
& .urlbar-background {
--zen-urlbar-background-base: light-dark(
#fbfbfb,

View File

@@ -202,6 +202,7 @@ var gZenCompactModeManager = {
},
updateCompactModeContext(isSingleToolbar) {
isSingleToolbar ||= this.checkIfIllegalState();
const menuitem = document.getElementById('zen-context-menu-compact-mode-toggle');
const menu = document.getElementById('zen-context-menu-compact-mode');
if (isSingleToolbar) {
@@ -231,6 +232,37 @@ var gZenCompactModeManager = {
this.callAllEventListeners();
},
/* Check for illegal states and fix them
* @returns {boolean} If the context menu should just show the "toggle" item
* instead of a submenu with hide options
*/
checkIfIllegalState() {
// Due to how we layout the sidebar and toolbar, there are some states
// that are not allowed mainly due to the caption buttons not being accessible
// at the top left/right of the window.
const isSidebarExpanded = gZenVerticalTabsManager._prefsSidebarExpanded;
if (isSidebarExpanded) {
// Fast exit if the sidebar is expanded, as we dont have illegal states then
return false;
}
const canHideSidebar = this.canHideSidebar;
const canHideToolbar = this.canHideToolbar;
const isLeftSideButtons = !gZenVerticalTabsManager.isWindowsStyledButtons;
const isRightSidebar = gZenVerticalTabsManager._prefsRightSide;
// on macos: collapsed + left side + only toolbar
// on windows: collapsed + right side + only toolbar
const closelyIllegalState =
(isLeftSideButtons && !isRightSidebar) || (!isLeftSideButtons && isRightSidebar);
if (closelyIllegalState && canHideToolbar && !canHideSidebar) {
// This state is illegal
Services.prefs.setBoolPref('zen.view.compact.hide-tabbar', true);
Services.prefs.setBoolPref('zen.view.compact.hide-toolbar', false);
this.callAllEventListeners();
return true;
}
return closelyIllegalState;
},
callAllEventListeners() {
this._eventListeners.forEach((callback) => callback());
},
@@ -309,6 +341,13 @@ var gZenCompactModeManager = {
);
},
get canHideToolbar() {
return (
Services.prefs.getBoolPref('zen.view.compact.hide-toolbar') &&
!gZenVerticalTabsManager._hasSetSingleToolbar
);
},
animateCompactMode() {
// Get the splitter width before hiding it (we need to hide it before animating on right)
document.documentElement.setAttribute('zen-compact-animating', 'true');
@@ -464,14 +503,17 @@ var gZenCompactModeManager = {
.getElementById('zen-context-menu-compact-mode-toggle')
.setAttribute('checked', this.preference);
const hideTabBar = Services.prefs.getBoolPref('zen.view.compact.hide-tabbar', false);
const hideToolbar = Services.prefs.getBoolPref('zen.view.compact.hide-toolbar', false);
const hideTabBar = this.canHideSidebar;
const hideToolbar = this.canHideToolbar;
const hideBoth = hideTabBar && hideToolbar;
const idName = 'zen-context-menu-compact-mode-hide-';
document.getElementById(idName + 'sidebar').setAttribute('checked', !hideBoth && hideTabBar);
document.getElementById(idName + 'toolbar').setAttribute('checked', !hideBoth && hideToolbar);
document.getElementById(idName + 'both').setAttribute('checked', hideBoth);
const sidebarItem = document.getElementById(idName + 'sidebar');
const toolbarItem = document.getElementById(idName + 'toolbar');
const bothItem = document.getElementById(idName + 'both');
sidebarItem.setAttribute('checked', !hideBoth && hideTabBar);
toolbarItem.setAttribute('checked', !hideBoth && hideToolbar);
bothItem.setAttribute('checked', hideBoth);
},
_removeOpenStateOnUnifiedExtensions() {

View File

@@ -76,21 +76,29 @@ export class nsZenSiteDataPanel {
class="urlbar-page-action"
role="button"
data-l10n-id="zen-urlbar-copy-url-button"
hidden="true">
disabled="true">
<image class="urlbar-icon"/>
</hbox>
`);
container.appendChild(fragment);
container.after(fragment);
const aElement = this.document.getElementById('zen-copy-url-button');
aElement.addEventListener('click', () => {
if (aElement.hasAttribute('disabled')) {
return;
}
this.document.getElementById('cmd_zenCopyCurrentURL').doCommand();
});
this.window.gBrowser.addProgressListener({
onLocationChange: (aWebProgress, aRequest, aLocation) => {
if (aWebProgress.isTopLevel) {
aElement.hidden = !this.#canCopyUrl(aLocation);
const disabled = !this.#canCopyUrl(aLocation);
if (disabled) {
aElement.setAttribute('disabled', true);
} else {
aElement.removeAttribute('disabled');
}
}
},
});
@@ -524,7 +532,11 @@ export class nsZenSiteDataPanel {
break;
}
default: {
const label = event.target.closest('.permission-popup-permission-label-container');
const item = event.target.closest('.permission-popup-permission-item');
if (!item) {
break;
}
const label = item.querySelector('.permission-popup-permission-label-container');
if (label?._permission) {
this.#onPermissionClick(label);
}