Skip to content

Commit 813b2b5

Browse files
committed
Revert "Bug 1977741 - Only update pinned tabs height when sidebar width changes r=nsharpley" for causing bc failures at browser_vertical_tabs.js
This reverts commit e7c1bff.
1 parent f17057d commit 813b2b5

1 file changed

Lines changed: 13 additions & 35 deletions

File tree

browser/components/sidebar/browser-sidebar.js

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,10 +1492,7 @@ var SidebarController = {
14921492
);
14931493
this._panelResizeObserver.observe(this._box);
14941494

1495-
this._launcherDropHandler = () => {
1496-
this._state.launcherDragActive = false;
1497-
this.updatePinnedTabsHeightOnResize();
1498-
};
1495+
this._launcherDropHandler = () => (this._state.launcherDragActive = false);
14991496
this._launcherSplitter.addEventListener(
15001497
"command",
15011498
this._launcherDropHandler
@@ -1519,19 +1516,15 @@ var SidebarController = {
15191516
}
15201517
});
15211518

1522-
this._itemsWrapperResizeObserver = new ResizeObserver(async ([entry]) => {
1519+
this._itemsWrapperResizeObserver = new ResizeObserver(async () => {
15231520
await window.promiseDocumentFlushed(() => {
1521+
// Adjust pinned tabs container height if needed
15241522
requestAnimationFrame(() => {
1523+
// If we are currently moving tabs, don't resize
15251524
if (this._pinnedTabsContainer.hasAttribute("dragActive")) {
15261525
return;
15271526
}
1528-
// Only respond to WIDTH changes (sidebar being resized wider/narrower).
1529-
// Ignoring height changes prevents an infinite resize loop.
1530-
const newWidth = entry.contentBoxSize[0].inlineSize;
1531-
if (newWidth === this._pinnedTabsItemsWrapperWidth) {
1532-
return;
1533-
}
1534-
this._pinnedTabsItemsWrapperWidth = newWidth;
1527+
15351528
this.updatePinnedTabsHeightOnResize();
15361529
});
15371530
});
@@ -1586,32 +1579,17 @@ var SidebarController = {
15861579
},
15871580

15881581
updatePinnedTabsHeightOnResize() {
1589-
// Skip during sidebar width drag to prevent unpinned tabs from jumping.
1590-
// The drop handler calls this function once cleanly after drag ends.
1591-
if (this.isLauncherDragging) {
1592-
return;
1593-
}
1594-
1595-
const preferredHeight = this._state.launcherExpanded
1596-
? this._state.expandedPinnedTabsHeight
1597-
: this._state.collapsedPinnedTabsHeight;
1598-
1599-
if (!preferredHeight) {
1600-
return;
1601-
}
1602-
1603-
if (this.isLauncherDragging) {
1604-
// Clear height during drag so we can measure the natural content height accurately
1605-
this._pinnedTabsContainer.style.height = "";
1606-
}
1607-
16081582
let itemsWrapperHeight = window.windowUtils.getBoundsWithoutFlushing(
16091583
this._pinnedTabsItemsWrapper
16101584
).height;
1611-
1612-
// Clamp for display only — never overwrite the user's saved preference
1613-
const clampedHeight = Math.min(preferredHeight, itemsWrapperHeight);
1614-
this._pinnedTabsContainer.style.height = `${clampedHeight}px`;
1585+
if (this._state.pinnedTabsHeight > itemsWrapperHeight) {
1586+
this._state.pinnedTabsHeight = itemsWrapperHeight;
1587+
if (this._state.launcherExpanded) {
1588+
this._state.expandedPinnedTabsHeight = this._state.pinnedTabsHeight;
1589+
} else {
1590+
this._state.collapsedPinnedTabsHeight = this._state.pinnedTabsHeight;
1591+
}
1592+
}
16151593
},
16161594

16171595
/**

0 commit comments

Comments
 (0)