less eval: don't overwrite _positionPinnedTabs()
This commit is contained in:
parent
b2a72cdc8d
commit
ee4344164e
@ -335,6 +335,10 @@ tabbrowser[treestyletab-tabbar-autohide-mode="1"][treestyletab-tabbar-autohide="
|
||||
}
|
||||
|
||||
/* pinned tabs on Firefox 4.0 */
|
||||
.tabbrowser-tabs[treestyletab-mode="vertical"] {
|
||||
-moz-margin-start: 0 !important;
|
||||
}
|
||||
|
||||
.tabbrowser-tabs[treestyletab-mode="vertical"]
|
||||
.tabbrowser-tab[pinned="true"] {
|
||||
position: fixed !important;
|
||||
|
@ -201,15 +201,21 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
positionPinnedTabs : function TSTBrowser_positionPinnedTabs(aWidth, aHeight)
|
||||
{
|
||||
if (!this.isVertical)
|
||||
return;
|
||||
|
||||
var b = this.mTabBrowser;
|
||||
var tabbar = b.tabContainer;
|
||||
if (!tabbar || !tabbar._positionPinnedTabs)
|
||||
return;
|
||||
|
||||
if (!this.isVertical) {
|
||||
this.resetPinnedTabs();
|
||||
b.mTabContainer._positionPinnedTabs();
|
||||
return;
|
||||
}
|
||||
|
||||
var count = this.pinnedTabsCount;
|
||||
var width = aWidth || this.PINNED_TAB_DEFAULT_WIDTH;
|
||||
var height = aHeight || this.PINNED_TAB_DEFAULT_HEIGHT;
|
||||
var maxCol = Math.floor(tabbar.boxObject.width / width);
|
||||
var maxCol = Math.floor(this.tabStrip.boxObject.width / width);
|
||||
var maxRow = Math.ceil(count / maxCol);
|
||||
var col = 0;
|
||||
var row = 0;
|
||||
@ -229,6 +235,12 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
}
|
||||
},
|
||||
positionPinnedTabsWithDelay : function TSTBrowser_positionPinnedTabsWithDelay()
|
||||
{
|
||||
window.setTimeout(function(aSelf) {
|
||||
aSelf.positionPinnedTabs();
|
||||
}, 0, this);
|
||||
},
|
||||
PINNED_TAB_DEFAULT_WIDTH : 24,
|
||||
PINNED_TAB_DEFAULT_HEIGHT : 24,
|
||||
|
||||
@ -264,13 +276,16 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.partTab(aTab);
|
||||
|
||||
this.collapseExpandTab(aTab, false);
|
||||
if (this.isVertical) this.positionPinnedTabs();
|
||||
},
|
||||
|
||||
onUnpinTab : function TSTBrowser_onUnpinTab(aTab)
|
||||
{
|
||||
aTab.style.marginLeft = '';
|
||||
aTab.style.marginTop = '';
|
||||
|
||||
this.updateInvertedTabContentsOrder(aTab);
|
||||
if (this.isVertical) this.positionPinnedTabs();
|
||||
},
|
||||
|
||||
updateTabsZIndex : function TSTBrowser_updateTabsZIndex(aStacked)
|
||||
@ -423,24 +438,6 @@ TreeStyleTabBrowser.prototype = {
|
||||
)
|
||||
);
|
||||
|
||||
if (b.mTabContainer._positionPinnedTabs) {
|
||||
eval('b.mTabContainer._positionPinnedTabs = '+
|
||||
b.mTabContainer._positionPinnedTabs.toSource().replace(
|
||||
'{',
|
||||
<![CDATA[{
|
||||
if (this.tabbrowser.treeStyleTab.isVertical) {
|
||||
this.tabbrowser.treeStyleTab.positionPinnedTabs();
|
||||
}
|
||||
else {
|
||||
this.tabbrowser.treeStyleTab.resetPinnedTabs();
|
||||
]]>.toString()
|
||||
).replace(
|
||||
'this.mTabstrip.ensureElementIsVisible',
|
||||
'} $&'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
TreeStyleTabService.updateTabDNDObserver(b);
|
||||
|
||||
if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 4.0 or later
|
||||
@ -1157,9 +1154,6 @@ TreeStyleTabBrowser.prototype = {
|
||||
window.setTimeout(function(aSelf) {
|
||||
aSelf.updateFloatingTabbar(aSelf.kTABBAR_UPDATE_BY_APPEARANCE_CHANGE);
|
||||
aSelf.startRendering();
|
||||
|
||||
if ('_positionPinnedTabs' in b.mTabContainer)
|
||||
b.mTabContainer._positionPinnedTabs();
|
||||
}, 0, this);
|
||||
|
||||
this.allowSubtreeCollapseExpand = this.getTreePref('allowSubtreeCollapseExpand.'+orient) ;
|
||||
@ -1285,8 +1279,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.mTabBrowser.tabContainer.removeAttribute('context');
|
||||
}
|
||||
|
||||
if ('_positionPinnedTabs' in this.mTabBrowser.mTabContainer)
|
||||
this.mTabBrowser.mTabContainer._positionPinnedTabs();
|
||||
this.positionPinnedTabs();
|
||||
},
|
||||
updateFloatingTabbarResizer : function TSTBrowser_updateFloatingTabbarResizer(aSize)
|
||||
{
|
||||
@ -2216,6 +2209,9 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
this.destroyTab(tab);
|
||||
|
||||
if (tab.getAttribute('pinned') == 'true')
|
||||
this.positionPinnedTabsWithDelay();
|
||||
|
||||
if (this.getPref('browser.tabs.autoHide'))
|
||||
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_SHOWHIDE_TABBAR);
|
||||
|
||||
@ -2321,6 +2317,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
else
|
||||
this.deleteTabValue(old, this.kINSERT_BEFORE);
|
||||
|
||||
this.positionPinnedTabsWithDelay();
|
||||
|
||||
if (this.canStackTabs)
|
||||
this.updateTabsZIndex(true);
|
||||
|
||||
@ -3052,6 +3050,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var horizontal = tabs.orient == 'horizontal';
|
||||
if (horizontal) return;
|
||||
aEvent.stopPropagation();
|
||||
this.positionPinnedTabsWithDelay();
|
||||
if (aEvent.detail == 1) return;
|
||||
if (aEvent.type == 'overflow') {
|
||||
tabs.setAttribute('overflow', 'true');
|
||||
|
Loading…
Reference in New Issue
Block a user