Bug 1921951 - Added support for vertical tabbar scrolling r=tabbrowser-reviewers,dao

Differential Revision: https://phabricator.services.mozilla.com/D233205
This commit is contained in:
Mauro B
2025-01-03 23:24:54 +00:00
parent 89c5cbc127
commit 1cae811100

View File

@@ -2772,12 +2772,14 @@
selectedTab = { selectedTab = {
left: selectedTab.left, left: selectedTab.left,
right: selectedTab.right, right: selectedTab.right,
top: selectedTab.top,
bottom: selectedTab.bottom
}; };
} }
return [ return [
this._lastTabToScrollIntoView, this._lastTabToScrollIntoView,
this.arrowScrollbox.scrollClientRect, this.arrowScrollbox.scrollClientRect,
{ left: lastTabRect.left, right: lastTabRect.right }, lastTabRect,
selectedTab, selectedTab,
]; ];
}) })
@@ -2794,8 +2796,13 @@
delete this._lastTabToScrollIntoView; delete this._lastTabToScrollIntoView;
// Is the new tab already completely visible? // Is the new tab already completely visible?
if ( if (
this.verticalMode ? (
scrollRect.top <= tabRect.top &&
tabRect.bottom <= scrollRect.bottom
) : (
scrollRect.left <= tabRect.left && scrollRect.left <= tabRect.left &&
tabRect.right <= scrollRect.right tabRect.right <= scrollRect.right
)
) { ) {
return; return;
} }
@@ -2804,19 +2811,30 @@
// Can we make both the new tab and the selected tab completely visible? // Can we make both the new tab and the selected tab completely visible?
if ( if (
!selectedRect || !selectedRect ||
this.verticalMode ? (
Math.max(
tabRect.bottom - selectedRect.top,
selectedRect.bottom - tabRect.top
) <= scrollRect.height
) : (
Math.max( Math.max(
tabRect.right - selectedRect.left, tabRect.right - selectedRect.left,
selectedRect.right - tabRect.left selectedRect.right - tabRect.left
) <= scrollRect.width ) <= scrollRect.width
)
) { ) {
this.arrowScrollbox.ensureElementIsVisible(tabToScrollIntoView); this.arrowScrollbox.ensureElementIsVisible(tabToScrollIntoView);
return; return;
} }
this.arrowScrollbox.scrollByPixels( this.arrowScrollbox.scrollByPixels(
this.verticalMode ? (
tabRect.top - selectedRect.top
) : (
this.#rtlMode this.#rtlMode
? selectedRect.right - scrollRect.right ? selectedRect.right - scrollRect.right
: selectedRect.left - scrollRect.left : selectedRect.left - scrollRect.left
)
); );
} }