Implement sidebar splitter and overflow handling; enhance customizable UI features

This commit is contained in:
mr. M
2025-01-18 10:25:13 +01:00
parent 351cc884ec
commit db2673cf27
6 changed files with 122 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs
index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..b161c73fe690c172a9be266894f72427b1d934e3 100644
index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..5b6d9e858ae1e55158eefc50d6aac67763ef7e00 100644
--- a/browser/components/customizableui/CustomizableUI.sys.mjs
+++ b/browser/components/customizableui/CustomizableUI.sys.mjs
@@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
@@ -72,7 +72,33 @@ index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..b161c73fe690c172a9be266894f72427
// For toolbars that need it, mark as dirty.
let defaultPlacements = areaProperties.get("defaultPlacements");
if (
@@ -3609,7 +3608,7 @@ var CustomizableUIInternal = {
@@ -1540,7 +1539,7 @@ var CustomizableUIInternal = {
lazy.log.info(
"Widget " + aWidgetId + " not found, unable to remove from " + aArea
);
- continue;
+ // continue;
}
this.notifyDOMChange(widgetNode, null, container, true, () => {
@@ -1550,7 +1549,7 @@ var CustomizableUIInternal = {
// We also need to remove the panel context menu if it's there:
this.ensureButtonContextMenu(widgetNode);
if (gPalette.has(aWidgetId) || this.isSpecialWidget(aWidgetId)) {
- container.removeChild(widgetNode);
+ widgetNode.remove();
} else {
window.gNavToolbox.palette.appendChild(widgetNode);
}
@@ -2654,7 +2653,6 @@ var CustomizableUIInternal = {
if (!this.isWidgetRemovable(aWidgetId)) {
return;
}
-
let placements = gPlacements.get(oldPlacement.area);
let position = placements.indexOf(aWidgetId);
if (position != -1) {
@@ -3609,7 +3607,7 @@ var CustomizableUIInternal = {
}
},
@@ -81,7 +107,7 @@ index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..b161c73fe690c172a9be266894f72427
for (let [areaId, areaNodes] of gBuildAreas) {
let placements = gPlacements.get(areaId);
let isFirstChangedToolbar = true;
@@ -3620,7 +3619,7 @@ var CustomizableUIInternal = {
@@ -3620,7 +3618,7 @@ var CustomizableUIInternal = {
if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) {
let defaultCollapsed = area.get("defaultCollapsed");
let win = areaNode.ownerGlobal;
@@ -90,7 +116,7 @@ index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..b161c73fe690c172a9be266894f72427
win.setToolbarVisibility(
areaNode,
typeof defaultCollapsed == "string"
@@ -4583,6 +4582,7 @@ export var CustomizableUI = {
@@ -4583,6 +4581,7 @@ export var CustomizableUI = {
unregisterArea(aName, aDestroyPlacements) {
CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements);
},
@@ -98,3 +124,22 @@ index b953d7d2c8fa7fe2d320bd7cb7af9aeeef0abc86..b161c73fe690c172a9be266894f72427
/**
* Add a widget to an area.
* If the area to which you try to add is not known to CustomizableUI,
@@ -6404,7 +6403,8 @@ class OverflowableToolbar {
this.#target
);
totalAvailWidth =
- getInlineSize(this.#toolbar) -
+ (parseInt(this.#toolbar.closest("#navigator-toolbox")?.getAttribute("width")) ||
+ getInlineSize(this.#toolbar)) -
parseFloat(style.paddingLeft) -
parseFloat(style.paddingRight) -
toolbarChildrenWidth;
@@ -6516,7 +6516,7 @@ class OverflowableToolbar {
}
}
if (!inserted) {
- this.#target.appendChild(child);
+ win.gZenVerticalTabsManager.appendCustomizableItem(this.#target, child, gPlacements.get(this.#toolbar.id));
}
child.removeAttribute("cui-anchorid");
child.removeAttribute("overflowedItem");