Bug 1696438 - Fix pinned tab positioning. r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D110909
This commit is contained in:
Dão Gottwald 2021-04-06 14:18:18 +00:00
Родитель 08e2af1cf7
Коммит 85eda6a287
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -1328,7 +1328,7 @@
_positionPinnedTabs() {
let tabs = this._getVisibleTabs();
let numPinned = tabs.filter(t => t.pinned).length;
let numPinned = gBrowser._numPinnedTabs;
let doPosition =
this.getAttribute("overflow") == "true" &&
tabs.length > numPinned &&
@ -1343,13 +1343,15 @@
let uiDensity = document.documentElement.getAttribute("uidensity");
if (!layoutData || layoutData.uiDensity != uiDensity) {
let arrowScrollbox = this.arrowScrollbox;
let firstTab = tabs[0];
let firstTabCS = getComputedStyle(firstTab);
layoutData = this._pinnedTabsLayoutCache = {
uiDensity,
pinnedTabWidth: parseFloat(firstTabCS.width),
scrollButtonWidth: arrowScrollbox._scrollButtonDown.getBoundingClientRect()
.width,
pinnedTabWidth: tabs[0].getBoundingClientRect().width,
scrollStartOffset:
arrowScrollbox._scrollButtonDown.getBoundingClientRect().width +
parseFloat(
getComputedStyle(this.arrowScrollbox.scrollbox)
.paddingInlineStart
),
};
}
@ -1359,7 +1361,7 @@
width += layoutData.pinnedTabWidth;
tab.style.setProperty(
"margin-inline-start",
-(width + layoutData.scrollButtonWidth) + "px",
-(width + layoutData.scrollStartOffset) + "px",
"important"
);
tab._pinnedUnscrollable = true;