diff --git a/buildscript b/buildscript index da700436..1681d06b 160000 --- a/buildscript +++ b/buildscript @@ -1 +1 @@ -Subproject commit da7004360057da8e64f5f66c6bec85d0086e17f2 +Subproject commit 1681d06b0ca7bd4be5c7bded31de523a202d10ab diff --git a/modules/browser.js b/modules/browser.js index 665ac1a5..f1005f44 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -400,9 +400,16 @@ TreeStyleTabBrowser.prototype = { var faviconized = width <= this.MIN_PINNED_TAB_WIDTH; - var inverted = this.position == 'left' && b.getAttribute(this.kINVERT_SCROLLBAR) == 'true'; + /** + * Hacks for Firefox 9 or olders. + * In a box with "direction: rtr", we have to position tabs + * by margin-right, because the basic position becomes + * "top-right" instead of "top-left". + */ + var needToFixOrigin = !this.isGecko10OrLater; + var needToInvertDirection = needToFixOrigin && this.position == 'left' && b.getAttribute(this.kINVERT_SCROLLBAR) == 'true'; var remainder = maxWidth - (maxCol * width); - var shrunkenOffset = ((inverted || this.position == 'right') && tabbarPlaceHolderWidth) ? + var shrunkenOffset = ((needToInvertDirection || this.position == 'right') && tabbarPlaceHolderWidth) ? tabbarWidth - tabbarPlaceHolderWidth : 0 ; @@ -428,23 +435,30 @@ TreeStyleTabBrowser.prototype = { item.className = className; style.width = width+'px'; - if (inverted) { - /** - * In a box with "direction: rtr", we have to position tabs - * by margin-right, because the basic position becomes - * "top-right" instead of "top-left". - */ + if (needToInvertDirection) { let margin = (width * (maxCol - col - 1)) + remainder + shrunkenOffset; style.setProperty('margin-right', margin+'px', 'important'); - style.marginLeft = ''; + style.marginLeft = style.left = style.right = ''; } else { style.setProperty('margin-left', ((width * col) + shrunkenOffset)+'px', 'important'); + if (needToFixOrigin) { + /** + * Hack for Firefox 9 or olders. In "rtl" box, the origin + * is wrongly set to the edge of the root element. So, we + * must not set specific left/right. + */ + style.left = style.right = ''; + } + else { + style.left = '0'; + style.right = 'auto'; + } style.marginRight = ''; } style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important'); - style.top = style.right = style.bottom = style.left = ''; + style.top = style.bottom = ''; if (aJustNow) this.Deferred.next(function() { // "transition" must be cleared after the reflow. @@ -488,7 +502,8 @@ TreeStyleTabBrowser.prototype = { for (var i = 0, count = this.pinnedTabsCount; i < count; i++) { let style = tabbar.childNodes[i].style; - style.width = style.MozMarginStart = style.marginLeft = style.marginRight = style.marginTop = ''; + style.width = style.left = style.right = + style.MozMarginStart = style.marginLeft = style.marginRight = style.marginTop = ''; } }, diff --git a/modules/utils.js b/modules/utils.js index e2b94942..737d2f2e 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -318,10 +318,19 @@ var TreeStyleTabUtils = { }, _Comparator : null, - get isGecko2() + get isGecko10OrLater() + { + return this.Comparator.compare(this.XULAppInfo.version, '10.0a') > 0; + }, + + get isGecko2OrLater() { return this.Comparator.compare(this.XULAppInfo.version, '4.0b5') > 0; }, + get isGecko2() // for backward compatibility + { + return this.isGecko2OrLater + }, get treeBundle() { return stringBundle.get('chrome://treestyletab/locale/treestyletab.properties');