feat: Always show the remaining overflowed button if only one is left, b=no-bug, c=common

This commit is contained in:
mr. m
2025-10-14 20:55:27 +02:00
parent ad539cd509
commit 5ad5341f5b
3 changed files with 21 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs
index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb074aa94d 100644
index d9a059f608779fea7cd8c595a432f6fe95183e0c..7f6493ced4abb1f6ba54242b8ee213a74f01aea5 100644
--- a/browser/components/customizableui/CustomizableUI.sys.mjs
+++ b/browser/components/customizableui/CustomizableUI.sys.mjs
@@ -14,6 +14,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
@@ -127,15 +127,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
this.notifyDOMChange(aNode, aNextNode, aContainer, false, () => {
this.setLocationAttributes(aNode, aAreaId);
aContainer.insertBefore(aNode, aNextNode);
@@ -3306,7 +3305,6 @@ var CustomizableUIInternal = {
if (!this.isWidgetRemovable(aWidgetId)) {
return;
}
-
let placements = gPlacements.get(oldPlacement.area);
let position = placements.indexOf(aWidgetId);
if (position != -1) {
@@ -4541,7 +4539,7 @@ var CustomizableUIInternal = {
@@ -4541,7 +4540,7 @@ var CustomizableUIInternal = {
* For all registered areas, builds those areas to reflect the current
* placement state of all widgets.
*/
@@ -144,7 +136,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
for (let [areaId, areaNodes] of gBuildAreas) {
let placements = gPlacements.get(areaId);
let isFirstChangedToolbar = true;
@@ -4552,7 +4550,7 @@ var CustomizableUIInternal = {
@@ -4552,7 +4551,7 @@ var CustomizableUIInternal = {
if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) {
let defaultCollapsed = area.get("defaultCollapsed");
let win = areaNode.ownerGlobal;
@@ -153,7 +145,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
win.setToolbarVisibility(
areaNode,
typeof defaultCollapsed == "string"
@@ -5843,6 +5841,7 @@ export var CustomizableUI = {
@@ -5843,6 +5842,7 @@ export var CustomizableUI = {
unregisterArea(aName, aDestroyPlacements) {
CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements);
},
@@ -161,7 +153,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
/**
* Add a widget to an area.
* If the area to which you try to add is not known to CustomizableUI,
@@ -7890,11 +7889,11 @@ class OverflowableToolbar {
@@ -7890,11 +7890,11 @@ class OverflowableToolbar {
parseFloat(style.paddingLeft) -
parseFloat(style.paddingRight) -
toolbarChildrenWidth;
@@ -175,7 +167,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
});
lazy.log.debug(
@@ -7909,7 +7908,8 @@ class OverflowableToolbar {
@@ -7909,7 +7909,8 @@ class OverflowableToolbar {
Math.max(targetWidth, targetChildrenWidth)
);
totalAvailWidth = Math.ceil(totalAvailWidth);
@@ -185,7 +177,17 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
return { isOverflowing, targetContentWidth, totalAvailWidth };
}
@@ -8003,7 +8003,7 @@ class OverflowableToolbar {
@@ -7970,7 +7971,8 @@ class OverflowableToolbar {
return;
}
}
- if (totalAvailWidth <= minSize) {
+ let isLastItem = win.gZenVerticalTabsManager._hasSetSingleToolbar && this.#target.id == 'zen-sidebar-top-buttons-customization-target' && this.#overflowedInfo.size == 1;
+ if (totalAvailWidth <= minSize && !isLastItem) {
lazy.log.debug(
`Need ${minSize} but width is ${totalAvailWidth} so bailing`
);
@@ -8003,7 +8005,7 @@ class OverflowableToolbar {
}
}
if (!inserted) {
@@ -194,7 +196,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..a3c18551e3b24ee86a4373cbbc4f2cdb
}
child.removeAttribute("cui-anchorid");
child.removeAttribute("overflowedItem");
@@ -8348,7 +8348,7 @@ class OverflowableToolbar {
@@ -8348,7 +8350,7 @@ class OverflowableToolbar {
break;
}
case "mousedown": {

View File

@@ -37,7 +37,7 @@ export var ZenCustomizableUI = new (class {
}
#addSidebarButtons(window) {
const kDefaultSidebarWidth = '210px';
const kDefaultSidebarWidth = '215px';
const toolbox = window.gNavToolbox;
// Set a splitter to navigator-toolbox

View File

@@ -19,7 +19,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.16.3b",
"displayVersion": "1.17b",
"github": {
"repo": "zen-browser/desktop"
},
@@ -39,7 +39,7 @@
"brandShortName": "Twilight",
"brandFullName": "Zen Twilight",
"release": {
"displayVersion": "1.17t",
"displayVersion": "1.18t",
"github": {
"repo": "zen-browser/desktop"
}