Skip to content

Commit 351c8b3

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 c49faab.
1 parent 29b8d9f commit 351c8b3

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
@@ -1510,10 +1510,7 @@ var SidebarController = {
15101510
);
15111511
this._panelResizeObserver.observe(this._box);
15121512

1513-
this._launcherDropHandler = () => {
1514-
this._state.launcherDragActive = false;
1515-
this.updatePinnedTabsHeightOnResize();
1516-
};
1513+
this._launcherDropHandler = () => (this._state.launcherDragActive = false);
15171514
this._launcherSplitter.addEventListener(
15181515
"command",
15191516
this._launcherDropHandler
@@ -1537,19 +1534,15 @@ var SidebarController = {
15371534
}
15381535
});
15391536

1540-
this._itemsWrapperResizeObserver = new ResizeObserver(async ([entry]) => {
1537+
this._itemsWrapperResizeObserver = new ResizeObserver(async () => {
15411538
await window.promiseDocumentFlushed(() => {
1539+
// Adjust pinned tabs container height if needed
15421540
requestAnimationFrame(() => {
1541+
// If we are currently moving tabs, don't resize
15431542
if (this._pinnedTabsContainer.hasAttribute("dragActive")) {
15441543
return;
15451544
}
1546-
// Only respond to WIDTH changes (sidebar being resized wider/narrower).
1547-
// Ignoring height changes prevents an infinite resize loop.
1548-
const newWidth = entry.contentBoxSize[0].inlineSize;
1549-
if (newWidth === this._pinnedTabsItemsWrapperWidth) {
1550-
return;
1551-
}
1552-
this._pinnedTabsItemsWrapperWidth = newWidth;
1545+
15531546
this.updatePinnedTabsHeightOnResize();
15541547
});
15551548
});
@@ -1604,32 +1597,17 @@ var SidebarController = {
16041597
},
16051598

16061599
updatePinnedTabsHeightOnResize() {
1607-
// Skip during sidebar width drag to prevent unpinned tabs from jumping.
1608-
// The drop handler calls this function once cleanly after drag ends.
1609-
if (this.isLauncherDragging) {
1610-
return;
1611-
}
1612-
1613-
const preferredHeight = this._state.launcherExpanded
1614-
? this._state.expandedPinnedTabsHeight
1615-
: this._state.collapsedPinnedTabsHeight;
1616-
1617-
if (!preferredHeight || !this._pinnedTabsContainer.childElementCount) {
1618-
return;
1619-
}
1620-
1621-
if (this.isLauncherDragging) {
1622-
// Clear height during drag so we can measure the natural content height accurately
1623-
this._pinnedTabsContainer.style.height = "";
1624-
}
1625-
16261600
let itemsWrapperHeight = window.windowUtils.getBoundsWithoutFlushing(
16271601
this._pinnedTabsItemsWrapper
16281602
).height;
1629-
1630-
// Clamp for display only — never overwrite the user's saved preference
1631-
const clampedHeight = Math.min(preferredHeight, itemsWrapperHeight);
1632-
this._pinnedTabsContainer.style.height = `${clampedHeight}px`;
1603+
if (this._state.pinnedTabsHeight > itemsWrapperHeight) {
1604+
this._state.pinnedTabsHeight = itemsWrapperHeight;
1605+
if (this._state.launcherExpanded) {
1606+
this._state.expandedPinnedTabsHeight = this._state.pinnedTabsHeight;
1607+
} else {
1608+
this._state.collapsedPinnedTabsHeight = this._state.pinnedTabsHeight;
1609+
}
1610+
}
16331611
},
16341612

16351613
/**

0 commit comments

Comments
 (0)