Skip to content

Commit

Permalink
fix: tab resizing issue since v1.24.0 update (closes #348)
Browse files Browse the repository at this point in the history
"When closing a tab, other tabs should not resize until cursor leaves toolbar region"
stopped working since v1.24.0 update
  • Loading branch information
onemen committed Oct 21, 2024
1 parent b0d68fc commit 31128d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
4 changes: 0 additions & 4 deletions addon/chrome/content/overlay/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ so display: none !important; does not hide the button */
flex: 1 1 0% !important;
}

#tabbrowser-tabs[orient="horizontal"]:not([widthFitTitle]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab:not([pinned]) {
box-sizing: content-box;
}

/* we add #TabsToolbar to get higher specificity, in order to override Firefox rule */
#TabsToolbar #tabbrowser-tabs:not([overflow], [hashiddentabs], [showalltabsbutton]) ~ #alltabs-button {
display: none;
Expand Down
4 changes: 0 additions & 4 deletions addon/chrome/content/overlay/browser_before_119.css
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ so display: none !important; does not hide the button */
flex: 1 1 0% !important;
}

#tabbrowser-tabs[orient="horizontal"]:not([widthFitTitle]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab:not([pinned]) {
box-sizing: content-box;
}

/* we add #TabsToolbar to get higher specificity, in order to override Firefox rule */
#TabsToolbar #tabbrowser-tabs:not([overflow="true"], [hashiddentabs], [showalltabsbutton]) ~ #alltabs-button {
display: none;
Expand Down
15 changes: 5 additions & 10 deletions addon/chrome/content/tab/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,21 +638,18 @@ Tabmix.tabsUtils = {
}

const firstNonPinnedTab = gBrowser.tabs[gBrowser._numPinnedTabs];
const padding = firstNonPinnedTab ?
Tabmix.getStyle(firstNonPinnedTab, "paddingLeft") + Tabmix.getStyle(firstNonPinnedTab, "paddingRight") :
4;

/**
* @param {number} stripWidth
* @param {number} buttonWidth
*/
function calcMinWidth(stripWidth, buttonWidth, tabMinWidth = minWidth) {
const widthWithoutButtons = stripWidth - buttonWidth;
const maxTabsInRow = Math.floor(stripWidth / (tabMinWidth + padding));
const isTabsFit = maxTabsInRow * (tabMinWidth + padding) <= widthWithoutButtons;
const maxTabsInRow = Math.floor(stripWidth / tabMinWidth);
const isTabsFit = maxTabsInRow * tabMinWidth <= widthWithoutButtons;
return isTabsFit ?
tabMinWidth :
Math.floor((widthWithoutButtons - 1) / maxTabsInRow) - padding;
Math.floor((widthWithoutButtons - 1) / maxTabsInRow);
}

const tabsButtonWidth = this._newTabButtonWidth(false);
Expand Down Expand Up @@ -907,10 +904,8 @@ Tabmix.tabsUtils = {
const tsbo = this.tabBar.arrowScrollbox.scrollbox;
const tsboBaseWidth = tsbo.getBoundingClientRect().width;
const minWidth = parseFloat(gTMPprefObserver.dynamicRules.width.style.getPropertyValue("min-width"));
const tab = gBrowser.tabs.at(-1);
const padding = tab ? Tabmix.getStyle(tab, "paddingLeft") + Tabmix.getStyle(tab, "paddingRight") : 4;
const maxTabsInRow = Math.floor(tsboBaseWidth / (minWidth + padding));
const newMaxWidth = Math.floor(1000 * tsboBaseWidth / maxTabsInRow) / 1000 - padding;
const maxTabsInRow = Math.floor(tsboBaseWidth / minWidth);
const newMaxWidth = Math.floor(1000 * tsboBaseWidth / maxTabsInRow) / 1000;
if (this._tab_overflow_width !== newMaxWidth) {
this._tab_overflow_width = newMaxWidth;
const root = document.querySelector(":root");
Expand Down

0 comments on commit 31128d3

Please sign in to comment.