fix mispositioned pinned tabs on Gecko 10.0a
This commit is contained in:
parent
a2537eb052
commit
d80d323aa1
@ -1 +1 @@
|
|||||||
Subproject commit da7004360057da8e64f5f66c6bec85d0086e17f2
|
Subproject commit 1681d06b0ca7bd4be5c7bded31de523a202d10ab
|
@ -400,9 +400,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var faviconized = width <= this.MIN_PINNED_TAB_WIDTH;
|
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 remainder = maxWidth - (maxCol * width);
|
||||||
var shrunkenOffset = ((inverted || this.position == 'right') && tabbarPlaceHolderWidth) ?
|
var shrunkenOffset = ((needToInvertDirection || this.position == 'right') && tabbarPlaceHolderWidth) ?
|
||||||
tabbarWidth - tabbarPlaceHolderWidth :
|
tabbarWidth - tabbarPlaceHolderWidth :
|
||||||
0 ;
|
0 ;
|
||||||
|
|
||||||
@ -428,23 +435,30 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
item.className = className;
|
item.className = className;
|
||||||
|
|
||||||
style.width = width+'px';
|
style.width = width+'px';
|
||||||
if (inverted) {
|
if (needToInvertDirection) {
|
||||||
/**
|
|
||||||
* 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".
|
|
||||||
*/
|
|
||||||
let margin = (width * (maxCol - col - 1)) + remainder + shrunkenOffset;
|
let margin = (width * (maxCol - col - 1)) + remainder + shrunkenOffset;
|
||||||
style.setProperty('margin-right', margin+'px', 'important');
|
style.setProperty('margin-right', margin+'px', 'important');
|
||||||
style.marginLeft = '';
|
style.marginLeft = style.left = style.right = '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
style.setProperty('margin-left', ((width * col) + shrunkenOffset)+'px', 'important');
|
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.marginRight = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important');
|
style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important');
|
||||||
style.top = style.right = style.bottom = style.left = '';
|
style.top = style.bottom = '';
|
||||||
|
|
||||||
if (aJustNow)
|
if (aJustNow)
|
||||||
this.Deferred.next(function() { // "transition" must be cleared after the reflow.
|
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++)
|
for (var i = 0, count = this.pinnedTabsCount; i < count; i++)
|
||||||
{
|
{
|
||||||
let style = tabbar.childNodes[i].style;
|
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 = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -318,10 +318,19 @@ var TreeStyleTabUtils = {
|
|||||||
},
|
},
|
||||||
_Comparator : null,
|
_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;
|
return this.Comparator.compare(this.XULAppInfo.version, '4.0b5') > 0;
|
||||||
},
|
},
|
||||||
|
get isGecko2() // for backward compatibility
|
||||||
|
{
|
||||||
|
return this.isGecko2OrLater
|
||||||
|
},
|
||||||
|
|
||||||
get treeBundle() {
|
get treeBundle() {
|
||||||
return stringBundle.get('chrome://treestyletab/locale/treestyletab.properties');
|
return stringBundle.get('chrome://treestyletab/locale/treestyletab.properties');
|
||||||
|
Loading…
Reference in New Issue
Block a user