diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 0e81192a72f..68797d1a5af 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -2782,12 +2782,20 @@ var scrollButtonWidth = (this.getAttribute("overflow") != "true" || pinnedOnly) ? 0 : this.mTabstrip._scrollButtonDown.scrollWidth; + var paddingStart = this.mTabstrip.scrollboxPaddingStart; + for (var i = this.tabbrowser._numPinnedTabs - 1; i >= 0; i--) { let tab = this.childNodes[i]; width += pinnedOnly ? 0 : tab.scrollWidth; - tab.style.MozMarginStart = - (width + scrollButtonWidth) + "px"; + if (this.getAttribute("overflow") != "true") + tab.style.MozMarginStart = - (width + scrollButtonWidth) + "px"; + else + tab.style.MozMarginStart = - (width + scrollButtonWidth + paddingStart) + "px"; } - this.style.MozMarginStart = width + "px"; + if (width == 0 || this.getAttribute("overflow") != "true") + this.style.MozMarginStart = width + "px"; + else + this.style.MozMarginStart = width + paddingStart + "px"; this.mTabstrip.ensureElementIsVisible(this.selectedItem, false); ]]> diff --git a/browser/base/content/test/browser_overflowScroll.js b/browser/base/content/test/browser_overflowScroll.js index fc899c123b3..3ce914eff84 100644 --- a/browser/base/content/test/browser_overflowScroll.js +++ b/browser/base/content/test/browser_overflowScroll.js @@ -46,14 +46,16 @@ function runOverflowTests(aEvent) { var element; gBrowser.selectedTab = firstScrollable(); - isLeft(firstScrollable(), "Selecting the first tab scrolls it into view"); + ok(left(scrollbox) <= left(firstScrollable()), "Selecting the first tab scrolls it into view " + + "(" + left(scrollbox) + " <= " + left(firstScrollable()) + ")"); element = nextRightElement(); EventUtils.synthesizeMouse(downButton, 1, 1, {}); isRight(element, "Scrolled one tab to the right with a single click"); gBrowser.selectedTab = tabs[tabs.length - 1]; - isRight(gBrowser.selectedTab, "Selecting the last tab scrolls it into view"); + ok(right(gBrowser.selectedTab) <= right(scrollbox), "Selecting the last tab scrolls it into view " + + "(" + right(gBrowser.selectedTab) + " <= " + right(scrollbox) + ")"); element = nextLeftElement(); EventUtils.synthesizeMouse(upButton, 1, 1, {}); @@ -64,11 +66,13 @@ function runOverflowTests(aEvent) { isLeft(element, "Scrolled one page of tabs with a double click"); EventUtils.synthesizeMouse(upButton, 1, 1, {clickCount: 3}); - isLeft(firstScrollable(), "Scrolled to the start with a triple click"); + var firstScrollableLeft = left(firstScrollable()); + ok(left(scrollbox) <= firstScrollableLeft, "Scrolled to the start with a triple click " + + "(" + left(scrollbox) + " <= " + firstScrollableLeft + ")"); for (var i = 2; i; i--) EventUtils.synthesizeMouseScroll(scrollbox, 1, 1, {axis: "horizontal", delta: -1}); - isLeft(firstScrollable(), "Remained at the start with the mouse wheel"); + is(left(firstScrollable()), firstScrollableLeft, "Remained at the start with the mouse wheel"); element = nextRightElement(); EventUtils.synthesizeMouseScroll(scrollbox, 1, 1, {axis: "horizontal", delta: 1}); diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml index e9b605d0f9f..466019a6033 100644 --- a/toolkit/content/widgets/scrollbox.xml +++ b/toolkit/content/widgets/scrollbox.xml @@ -26,7 +26,10 @@ collapsed="true" xbl:inherits="orient" oncommand="_autorepeatbuttonScroll(event);"/> - + - + + + + + + = (vertical ? scrollContentRect.bottom : scrollContentRect.right)) { + elementEnd = vertical ? scrollPaddingRect.bottom : scrollPaddingRect.right; + } + var amountToScroll; if (elementStart < containerStart) { @@ -543,7 +582,10 @@ onmouseup="if (event.button == 0) _stopScroll();" onmouseover="_continueScroll(-1);" onmouseout="_pauseScroll();"/> - +