diff --git a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch index 6625364c3..be5a545f9 100644 --- a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch +++ b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs -index d9a059f608779fea7cd8c595a432f6fe95183e0c..97fbe5f7ac2c5bf18526528a8f50dcf4466fcafd 100644 +index d9a059f608779fea7cd8c595a432f6fe95183e0c..09a7c4045afd0b96027d0bbbad22e02e52fd7b22 100644 --- a/browser/components/customizableui/CustomizableUI.sys.mjs +++ b/browser/components/customizableui/CustomizableUI.sys.mjs @@ -14,6 +14,7 @@ ChromeUtils.defineESModuleGetters(lazy, { @@ -153,6 +153,15 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..97fbe5f7ac2c5bf18526528a8f50dcf4 /** * Add a widget to an area. * If the area to which you try to add is not known to CustomizableUI, +@@ -7866,7 +7866,7 @@ class OverflowableToolbar { + ) { + continue; + } +- sum += parseFloat(style.marginLeft) + parseFloat(style.marginRight); ++ sum += parseFloat(style.marginLeft) + Math.max(0, parseFloat(style.marginRight)); + if (child != aExceptChild) { + sum += getInlineSize(child); + } @@ -7890,11 +7890,11 @@ class OverflowableToolbar { parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) - diff --git a/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch b/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch index 944fd80e1..9e15ed0fb 100644 --- a/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch +++ b/src/browser/components/urlbar/UrlbarInput-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs -index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2b69f0cf7 100644 +index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..ea4f649026077fb6ce9d02b5fe3785c3a28e1f97 100644 --- a/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs @@ -76,6 +76,13 @@ ChromeUtils.defineLazyGetter(lazy, "logger", () => @@ -75,7 +75,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 } if (isCanonized) { -@@ -2298,6 +2330,17 @@ export class UrlbarInput { +@@ -2298,6 +2330,32 @@ export class UrlbarInput { await this.#updateLayoutBreakoutDimensions(); } @@ -89,11 +89,26 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 + } + return lazy.ZEN_URLBAR_BEHAVIOR; + } ++ ++ get zenStrippedURI() { ++ let strippedURI = null; ++ ++ // Error check occurs during isClipboardURIValid ++ let uri = this.window.gBrowser.currentURI; ++ try { ++ strippedURI = lazy.QueryStringStripper.stripForCopyOrShare(uri); ++ } catch (e) { ++ console.warn(`stripForCopyOrShare: ${e.message}`); ++ return [uri, lazy.ClipboardHelper]; ++ } ++ ++ return [strippedURI ? this.makeURIReadable(strippedURI) : uri, lazy.ClipboardHelper]; ++ } + startLayoutExtend() { if (!this.#allowBreakout || this.hasAttribute("breakout-extend")) { // Do not expand if the Urlbar does not support being expanded or it is -@@ -2312,6 +2355,12 @@ export class UrlbarInput { +@@ -2312,6 +2370,12 @@ export class UrlbarInput { this.setAttribute("breakout-extend", "true"); @@ -106,7 +121,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 // 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")) { -@@ -2331,6 +2380,24 @@ export class UrlbarInput { +@@ -2331,6 +2395,24 @@ export class UrlbarInput { return; } @@ -131,7 +146,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 this.removeAttribute("breakout-extend"); this.#updateTextboxPosition(); } -@@ -2660,7 +2727,7 @@ export class UrlbarInput { +@@ -2660,7 +2742,7 @@ export class UrlbarInput { this.textbox.parentNode.style.setProperty( "--urlbar-container-height", @@ -140,7 +155,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 ); this.textbox.style.setProperty( "--urlbar-height", -@@ -3093,6 +3160,7 @@ export class UrlbarInput { +@@ -3093,6 +3175,7 @@ export class UrlbarInput { } _toggleActionOverride(event) { @@ -148,7 +163,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if ( event.keyCode == KeyEvent.DOM_VK_SHIFT || event.keyCode == KeyEvent.DOM_VK_ALT || -@@ -3197,7 +3265,7 @@ export class UrlbarInput { +@@ -3197,7 +3280,7 @@ export class UrlbarInput { return val; } let trimmedValue = lazy.UrlbarPrefs.get("trimURLs") @@ -157,7 +172,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 : val; // Only trim value if the directionality doesn't change to RTL and we're not // showing a strikeout https protocol. -@@ -3501,6 +3569,7 @@ export class UrlbarInput { +@@ -3501,6 +3584,7 @@ export class UrlbarInput { resultDetails = null, browser = this.window.gBrowser.selectedBrowser ) { @@ -165,7 +180,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if (this.isAddressbar) { this.#prepareAddressbarLoad( url, -@@ -3608,6 +3677,10 @@ export class UrlbarInput { +@@ -3608,6 +3692,10 @@ export class UrlbarInput { } reuseEmpty = true; } @@ -176,7 +191,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if ( where == "tab" && reuseEmpty && -@@ -3615,6 +3688,9 @@ export class UrlbarInput { +@@ -3615,6 +3703,9 @@ export class UrlbarInput { ) { where = "current"; } @@ -186,7 +201,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 return where; } -@@ -3872,6 +3948,7 @@ export class UrlbarInput { +@@ -3872,6 +3963,7 @@ export class UrlbarInput { this.setResultForCurrentValue(null); this.handleCommand(); this.controller.clearLastQueryContextCache(); @@ -194,7 +209,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 this._suppressStartQuery = false; }); -@@ -3879,7 +3956,6 @@ export class UrlbarInput { +@@ -3879,7 +3971,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. @@ -202,7 +217,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 let controller = this.document.commandDispatcher.getControllerForCommand("cmd_paste"); -@@ -3991,7 +4067,11 @@ export class UrlbarInput { +@@ -3991,7 +4082,11 @@ export class UrlbarInput { if (!engineName && !source && !this.hasAttribute("searchmode")) { return; } @@ -215,7 +230,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if (this._searchModeIndicatorTitle) { this._searchModeIndicatorTitle.textContent = ""; this._searchModeIndicatorTitle.removeAttribute("data-l10n-id"); -@@ -4302,6 +4382,7 @@ export class UrlbarInput { +@@ -4302,6 +4397,7 @@ export class UrlbarInput { this.document.l10n.setAttributes( this.inputField, @@ -223,7 +238,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 l10nId, l10nId == "urlbar-placeholder-with-name" ? { name } : undefined ); -@@ -4413,6 +4494,11 @@ export class UrlbarInput { +@@ -4413,6 +4509,11 @@ export class UrlbarInput { } _on_click(event) { @@ -235,7 +250,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if ( event.target == this.inputField || event.target == this._inputContainer -@@ -4485,7 +4571,7 @@ export class UrlbarInput { +@@ -4485,7 +4586,7 @@ export class UrlbarInput { } } @@ -244,7 +259,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 this.view.autoOpen({ event }); } else { if (this._untrimOnFocusAfterKeydown) { -@@ -4525,9 +4611,16 @@ export class UrlbarInput { +@@ -4525,9 +4626,16 @@ export class UrlbarInput { } _on_mousedown(event) { @@ -262,7 +277,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 if ( event.target != this.inputField && -@@ -4538,6 +4631,10 @@ export class UrlbarInput { +@@ -4538,6 +4646,10 @@ export class UrlbarInput { this.focusedViaMousedown = !this.focused; this._preventClickSelectsAll = this.focused; @@ -273,7 +288,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 // Keep the focus status, since the attribute may be changed // upon calling this.focus(). -@@ -4573,7 +4670,7 @@ export class UrlbarInput { +@@ -4573,7 +4685,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. @@ -282,7 +297,7 @@ index afc7a6c6ddbf4cf5a5b27c0bd60577b833c63093..a2494f2c0f3e4fc50cbe2fe3bf6e2bd2 break; } -@@ -4890,7 +4987,7 @@ export class UrlbarInput { +@@ -4890,7 +5002,7 @@ export class UrlbarInput { // When we are in actions search mode we can show more results so // increase the limit. let maxResults = diff --git a/src/zen/common/ZenCommonUtils.mjs b/src/zen/common/ZenCommonUtils.mjs index e35178936..4f2058fc9 100644 --- a/src/zen/common/ZenCommonUtils.mjs +++ b/src/zen/common/ZenCommonUtils.mjs @@ -68,58 +68,36 @@ class nsZenPreloadedFeature { var gZenCommonActions = { copyCurrentURLToClipboard() { - const currentUrl = gBrowser.currentURI.spec; - if (currentUrl) { - let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString); - str.data = currentUrl; - let transferable = Cc['@mozilla.org/widget/transferable;1'].createInstance( - Ci.nsITransferable - ); - transferable.init(window.docShell.QueryInterface(Ci.nsILoadContext)); - transferable.addDataFlavor('text/plain'); - transferable.setTransferData('text/plain', str); - Services.clipboard.setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); - let button; - if ( - Services.zen.canShare() && - (currentUrl.startsWith('http://') || currentUrl.startsWith('https://')) - ) { - button = { - id: 'zen-copy-current-url-button', - command: (event) => { - const buttonRect = event.target.getBoundingClientRect(); - Services.zen.share( - Services.io.newURI(currentUrl), - '', - '', - buttonRect.left, - window.innerHeight - buttonRect.bottom, - buttonRect.width, - buttonRect.height - ); - }, - }; - } - gZenUIManager.showToast('zen-copy-current-url-confirmation', { button, timeout: 3000 }); + const [currentUrl, ClipboardHelper] = gURLBar.zenStrippedURI; + const displaySpec = currentUrl.displaySpec; + ClipboardHelper.copyString(displaySpec); + let button; + if (Services.zen.canShare() && displaySpec.startsWith('http')) { + button = { + id: 'zen-copy-current-url-button', + command: (event) => { + const buttonRect = event.target.getBoundingClientRect(); + Services.zen.share( + currentUrl, + '', + '', + buttonRect.left, + window.innerHeight - buttonRect.bottom, + buttonRect.width, + buttonRect.height + ); + }, + }; } + gZenUIManager.showToast('zen-copy-current-url-confirmation', { button, timeout: 3000 }); }, copyCurrentURLAsMarkdownToClipboard() { - const currentUrl = gBrowser.currentURI.spec; + const [currentUrl, ClipboardHelper] = gURLBar.zenStrippedURI; const tabTitle = gBrowser.selectedTab.label; - if (currentUrl && tabTitle) { - const markdownLink = `[${tabTitle}](${currentUrl})`; - let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString); - str.data = markdownLink; - let transferable = Cc['@mozilla.org/widget/transferable;1'].createInstance( - Ci.nsITransferable - ); - transferable.init(window.docShell.QueryInterface(Ci.nsILoadContext)); - transferable.addDataFlavor('text/plain'); - transferable.setTransferData('text/plain', str); - Services.clipboard.setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard); - gZenUIManager.showToast('zen-copy-current-url-confirmation'); - } + const markdownLink = `[${tabTitle}](${currentUrl.displaySpec})`; + ClipboardHelper.copyString(markdownLink); + gZenUIManager.showToast('zen-copy-current-url-confirmation', { timeout: 3000 }); }, throttle(f, delay) { diff --git a/src/zen/common/styles/zen-browser-ui.css b/src/zen/common/styles/zen-browser-ui.css index c85a3c78d..2ecf54fab 100644 --- a/src/zen/common/styles/zen-browser-ui.css +++ b/src/zen/common/styles/zen-browser-ui.css @@ -336,6 +336,10 @@ #zen-appcontent-navbar-wrapper #zen-sidebar-top-buttons { max-width: fit-content; :root[zen-right-side='true'] & { - order: 999; + order: 1; } } + +:root[zen-right-side='true'] #zen-appcontent-navbar-wrapper #PanelUI-button { + order: 2; +} diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index 925b25a01..90901c862 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -116,6 +116,9 @@ & #zen-sidebar-top-buttons { margin: var(--zen-toolbox-padding) 0 calc(var(--zen-toolbox-padding) / 2) 0; + :root[zen-right-side='true']:not([zen-window-buttons-reversed='true']) & { + margin-top: 0; + } } & #PanelUI-menu-button { diff --git a/src/zen/urlbar/ZenSiteDataPanel.sys.mjs b/src/zen/urlbar/ZenSiteDataPanel.sys.mjs index 48cf7aebb..ec2bda8c1 100644 --- a/src/zen/urlbar/ZenSiteDataPanel.sys.mjs +++ b/src/zen/urlbar/ZenSiteDataPanel.sys.mjs @@ -337,7 +337,7 @@ export class nsZenSiteDataPanel { } separator.hidden = !settingElements.length || !crossSiteCookieElements.length; - section.hidden = list.childElementCount == 0; + section.hidden = list.childElementCount < 2; // only the separator } #getPermissionStateLabelId(permission) {