mirror of
https://github.com/zen-browser/desktop.git
synced 2026-05-20 12:01:27 +00:00
no-bug: Make addons appear on the urlbar (gh-13535)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs
|
||||
index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f535e9d9e 100644
|
||||
index db617c65b89643015d91b0f6a20eab7d7a1b598f..1511b785a45ebd084de13b091f56a59e7e737b26 100644
|
||||
--- a/browser/components/customizableui/CustomizableUI.sys.mjs
|
||||
+++ b/browser/components/customizableui/CustomizableUI.sys.mjs
|
||||
@@ -14,6 +14,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
@@ -186,11 +186,33 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
});
|
||||
|
||||
lazy.log.debug(
|
||||
@@ -7933,7 +7934,14 @@ class OverflowableToolbar {
|
||||
@@ -7933,7 +7934,36 @@ class OverflowableToolbar {
|
||||
Math.max(targetWidth, targetChildrenWidth)
|
||||
);
|
||||
totalAvailWidth = Math.ceil(totalAvailWidth);
|
||||
- let isOverflowing = targetContentWidth > totalAvailWidth;
|
||||
+ if (this.#target.id == 'nav-bar-customization-target' &&
|
||||
+ win.gZenVerticalTabsManager._hasSetSingleToolbar &&
|
||||
+ Services.prefs.getBoolPref("zen.view.overflow-webext-toolbar", true)) {
|
||||
+ const availSelectors = ":is(#page-action-buttons, #zen-copy-url-button, .unified-extensions-item)";
|
||||
+ const width = [
|
||||
+ ...win.gURLBar._inputContainer.querySelectorAll(availSelectors),
|
||||
+ ...win.document.getElementById("zen-overflow-extensions-list").querySelectorAll(availSelectors)
|
||||
+ ].length * 26;
|
||||
+ const urlbarWidth = win.document.getElementById("urlbar-container").getBoundingClientRect().width;
|
||||
+ let overflowing = width > urlbarWidth * 0.5;
|
||||
+ let wasOverflowing = win.gURLBar._isOverflowingItems;
|
||||
+ win.gURLBar._isOverflowingItems = overflowing;
|
||||
+ if (wasOverflowing !== overflowing) {
|
||||
+ const items = gPlacements.get("nav-bar");
|
||||
+ for (let item of items) {
|
||||
+ let [, node] = CustomizableUIInternal.getWidgetNode(item, win);
|
||||
+ if (node?.hasAttribute("data-extensionid")) {
|
||||
+ win.gZenVerticalTabsManager.appendCustomizableItem(win.document.getElementById("zen-sidebar-top-buttons-customization-target"), node);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (win.gZenVerticalTabsManager._hasSetSingleToolbar && this.#toolbar.id == 'nav-bar') return { isOverflowing: false, targetContentWidth, totalAvailWidth };
|
||||
+ let isOverflowing = targetContentWidth + (win.gZenVerticalTabsManager._hasSetSingleToolbar ? 0.1 : 0) > totalAvailWidth;
|
||||
+ if (win.gZenVerticalTabsManager._hasSetSingleToolbar &&
|
||||
@@ -202,7 +224,7 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
return { isOverflowing, targetContentWidth, totalAvailWidth };
|
||||
}
|
||||
|
||||
@@ -7994,7 +8002,11 @@ class OverflowableToolbar {
|
||||
@@ -7994,7 +8024,11 @@ class OverflowableToolbar {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +237,7 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
lazy.log.debug(
|
||||
`Need ${minSize} but width is ${totalAvailWidth} so bailing`
|
||||
);
|
||||
@@ -8027,7 +8039,7 @@ class OverflowableToolbar {
|
||||
@@ -8027,7 +8061,7 @@ class OverflowableToolbar {
|
||||
}
|
||||
}
|
||||
if (!inserted) {
|
||||
@@ -224,7 +246,7 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
}
|
||||
child.removeAttribute("cui-anchorid");
|
||||
child.removeAttribute("overflowedItem");
|
||||
@@ -8153,6 +8165,9 @@ class OverflowableToolbar {
|
||||
@@ -8153,6 +8187,9 @@ class OverflowableToolbar {
|
||||
* if no such list exists.
|
||||
*/
|
||||
get #webExtList() {
|
||||
@@ -234,7 +256,7 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
if (!this.#webExtListRef) {
|
||||
let targetID = this.#toolbar.getAttribute("addon-webext-overflowtarget");
|
||||
if (!targetID) {
|
||||
@@ -8164,6 +8179,9 @@ class OverflowableToolbar {
|
||||
@@ -8164,6 +8201,9 @@ class OverflowableToolbar {
|
||||
let win = this.#toolbar.ownerGlobal;
|
||||
let { panel } = win.gUnifiedExtensions;
|
||||
this.#webExtListRef = panel.querySelector(`#${targetID}`);
|
||||
@@ -244,7 +266,7 @@ index db617c65b89643015d91b0f6a20eab7d7a1b598f..9acef640800bdc75f477a8e14e73f08f
|
||||
}
|
||||
return this.#webExtListRef;
|
||||
}
|
||||
@@ -8372,7 +8390,7 @@ class OverflowableToolbar {
|
||||
@@ -8372,7 +8412,7 @@ class OverflowableToolbar {
|
||||
break;
|
||||
}
|
||||
case "mousedown": {
|
||||
|
||||
Reference in New Issue
Block a user