From 585ab07c4896f69c970752b4e0ea0ed4d799c21f Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Fri, 13 Jan 2012 12:16:35 +0900 Subject: [PATCH] suppress unexpected jumping on the tab bar after new child tabs are opened --- content/treestyletab/windowHelper.js | 6 +- modules/browser.js | 100 +++++++++++++++++---------- 2 files changed, 67 insertions(+), 39 deletions(-) diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index 627e92bd..8ad8da84 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -612,7 +612,9 @@ var TreeStyleTabWindowHelper = { '{', .toString() ).replace( /\.screenX/g, '[treeStyleTab.screenPositionProp]' @@ -663,6 +665,8 @@ var TreeStyleTabWindowHelper = { '{', = aDuration) { - scrollBoxObject.scrollTo(aEndX, aEndY); + if (aTime >= aDuration || this.cancelingPerformingAutoScroll) { + if (!this.cancelingPerformingAutoScroll) { + scrollBoxObject.scrollTo(aEndX, aEndY); - /** - * When there is any expanding tab, we have to retry to scroll. - * if the scroll box was expanded. - */ - let oldSize = self._getMaxScrollSize(scrollBoxObject); - self.Deferred.next(function() { - let newSize = self._getMaxScrollSize(scrollBoxObject); - let lastTab = self.getLastVisibleTab(self.mTabBrowser); - if ( - // scroll size can be expanded by expanding tabs. - oldSize[0] < newSize[0] || oldSize[1] < newSize[1] || - // there are still animating tabs - self.getXOffsetOfTab(lastTab) || self.getYOffsetOfTab(lastTab) || - self.evaluateXPath( - 'child::xul:tab[@'+self.kCOLLAPSING_PHASE+'="'+self.kCOLLAPSING_PHASE_TO_BE_EXPANDED+'"]', - self.mTabBrowser.mTabContainer, - Ci.nsIDOMXPathResult.BOOLEAN_TYPE - ).booleanValue - ) - self.smoothScrollTo(aEndX, aEndY, parseInt(aDuration * 0.5)); - self = null; - scrollBoxObject = null; - }); + /** + * When there is any expanding tab, we have to retry to scroll. + * if the scroll box was expanded. + */ + let oldSize = self._getMaxScrollSize(scrollBoxObject); + self.Deferred.next(function() { + let newSize = self._getMaxScrollSize(scrollBoxObject); + let lastTab = self.getLastVisibleTab(self.mTabBrowser); + if ( + // scroll size can be expanded by expanding tabs. + oldSize[0] < newSize[0] || oldSize[1] < newSize[1] || + // there are still animating tabs + self.getXOffsetOfTab(lastTab) || self.getYOffsetOfTab(lastTab) || + self.evaluateXPath( + 'child::xul:tab[@'+self.kCOLLAPSING_PHASE+'="'+self.kCOLLAPSING_PHASE_TO_BE_EXPANDED+'"]', + self.mTabBrowser.mTabContainer, + Ci.nsIDOMXPathResult.BOOLEAN_TYPE + ).booleanValue + ) + self.smoothScrollTo(aEndX, aEndY, parseInt(aDuration * 0.5)); + self = null; + scrollBoxObject = null; + }); + } b = null; x = null;