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