mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-23 07:45:36 +00:00
refactor: enhance CustomizableUI to support vertical tabs in the navbar
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 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb40339488d 100644
|
||||
index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..24dc9acd733ae401f8cdfb2351a7275d16ee46c8 100644
|
||||
--- a/browser/components/customizableui/CustomizableUI.sys.mjs
|
||||
+++ b/browser/components/customizableui/CustomizableUI.sys.mjs
|
||||
@@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
@@ -110,7 +110,18 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
// Handle initial state of vertical tabs.
|
||||
if (isVerticalTabs) {
|
||||
// Show the vertical tabs toolbar
|
||||
@@ -2744,7 +2743,6 @@ var CustomizableUIInternal = {
|
||||
@@ -1873,6 +1872,10 @@ var CustomizableUIInternal = {
|
||||
},
|
||||
|
||||
insertWidgetBefore(aNode, aNextNode, aContainer, aArea) {
|
||||
+ if (aArea === CustomizableUI.AREA_NAVBAR && aNode.ownerGlobal.gZenVerticalTabsManager._hasSetSingleToolbar) {
|
||||
+ aContainer = aNode.ownerDocument.getElementById("zen-sidebar-top-buttons-customization-target");
|
||||
+ aArea = "zen-sidebar-top-buttons";
|
||||
+ }
|
||||
this.notifyDOMChange(aNode, aNextNode, aContainer, false, () => {
|
||||
this.setLocationAttributes(aNode, aArea);
|
||||
aContainer.insertBefore(aNode, aNextNode);
|
||||
@@ -2744,7 +2747,6 @@ var CustomizableUIInternal = {
|
||||
if (!this.isWidgetRemovable(aWidgetId)) {
|
||||
return;
|
||||
}
|
||||
@@ -118,7 +129,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
let placements = gPlacements.get(oldPlacement.area);
|
||||
let position = placements.indexOf(aWidgetId);
|
||||
if (position != -1) {
|
||||
@@ -3735,7 +3733,7 @@ var CustomizableUIInternal = {
|
||||
@@ -3735,7 +3737,7 @@ var CustomizableUIInternal = {
|
||||
}
|
||||
},
|
||||
|
||||
@@ -127,7 +138,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
for (let [areaId, areaNodes] of gBuildAreas) {
|
||||
let placements = gPlacements.get(areaId);
|
||||
let isFirstChangedToolbar = true;
|
||||
@@ -3746,7 +3744,7 @@ var CustomizableUIInternal = {
|
||||
@@ -3746,7 +3748,7 @@ var CustomizableUIInternal = {
|
||||
if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) {
|
||||
let defaultCollapsed = area.get("defaultCollapsed");
|
||||
let win = areaNode.ownerGlobal;
|
||||
@@ -136,7 +147,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
win.setToolbarVisibility(
|
||||
areaNode,
|
||||
typeof defaultCollapsed == "string"
|
||||
@@ -4923,6 +4921,7 @@ export var CustomizableUI = {
|
||||
@@ -4923,6 +4925,7 @@ export var CustomizableUI = {
|
||||
unregisterArea(aName, aDestroyPlacements) {
|
||||
CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements);
|
||||
},
|
||||
@@ -144,7 +155,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
/**
|
||||
* Add a widget to an area.
|
||||
* If the area to which you try to add is not known to CustomizableUI,
|
||||
@@ -6916,11 +6915,11 @@ class OverflowableToolbar {
|
||||
@@ -6916,11 +6919,11 @@ class OverflowableToolbar {
|
||||
parseFloat(style.paddingLeft) -
|
||||
parseFloat(style.paddingRight) -
|
||||
toolbarChildrenWidth;
|
||||
@@ -158,7 +169,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
});
|
||||
|
||||
lazy.log.debug(
|
||||
@@ -6930,7 +6929,8 @@ class OverflowableToolbar {
|
||||
@@ -6930,7 +6933,8 @@ class OverflowableToolbar {
|
||||
// If the target has min-width: 0, their children might actually overflow
|
||||
// it, so check for both cases explicitly.
|
||||
let targetContentWidth = Math.max(targetWidth, targetChildrenWidth);
|
||||
@@ -168,7 +179,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
return { isOverflowing, targetContentWidth, totalAvailWidth };
|
||||
}
|
||||
|
||||
@@ -7024,7 +7024,7 @@ class OverflowableToolbar {
|
||||
@@ -7024,7 +7028,7 @@ class OverflowableToolbar {
|
||||
}
|
||||
}
|
||||
if (!inserted) {
|
||||
@@ -177,7 +188,7 @@ index 9392b42a1de7310719a6cc8aaf11bd857e8fa69a..20248e5c0e38d4de3349687157b6aeb4
|
||||
}
|
||||
child.removeAttribute("cui-anchorid");
|
||||
child.removeAttribute("overflowedItem");
|
||||
@@ -7186,6 +7186,9 @@ class OverflowableToolbar {
|
||||
@@ -7186,6 +7190,9 @@ class OverflowableToolbar {
|
||||
* @param {MouseEvent} aEvent the click event.
|
||||
*/
|
||||
#onClickDefaultListButton(aEvent) {
|
||||
|
||||
Reference in New Issue
Block a user