unpinTab()されたりタブバーの位置が変わったりした時にタブの外観がおかしくなる問題を修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6719 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-06-25 16:14:49 +00:00
parent 10374be191
commit dd260f84f1
2 changed files with 42 additions and 6 deletions

View File

@ -87,7 +87,6 @@ tabbrowser[treestyletab-mode="vertical"] .tabs-stack > *:first-child + * > hbox:
width: 24px !important;
height: 24px !important;
}
.tabbrowser-tabs[treestyletab-mode="vertical"]
.tabbrowser-tab[pinned="true"] .tab-text {
visibility: collapse !important;
}

View File

@ -166,12 +166,14 @@ TreeStyleTabBrowser.prototype = {
var maxRow = Math.ceil(count / maxCol);
var col = 0;
var row = 0;
tabbar.style.MozMarginStart = '';
tabbar.style.marginTop = (height * maxRow)+'px';
for (var i = 0, count; i < count; i++)
for (var i = 0; i < count; i++)
{
let tab = tabbar.childNodes[i];
tab.style.setProperty('margin-left', (width * col)+'px', 'important');
tab.style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important');
let style = tabbar.childNodes[i].style;
style.MozMarginStart = '';
style.setProperty('margin-left', (width * col)+'px', 'important');
style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important');
col++;
if (col >= maxCol) {
col = 0;
@ -182,6 +184,29 @@ TreeStyleTabBrowser.prototype = {
PINNED_TAB_WIDTH : 24,
PINNED_TAB_HEIGHT : 24,
clearPinnedTabsAppearance : function TSTBrowser_clearPinnedTabsAppearance()
{
var b = this.mTabBrowser;
var tabbar = b.tabContainer;
tabbar.style.MozMarginStart = '';
tabbar.style.marginTop = '';
for (var i = 0, count = b._numPinnedTabs; i < count; i++)
{
let style = tabbar.childNodes[i].style;
style.MozMarginStart = '';
style.marginLeft = '';
style.marginTop = '';
}
},
onUnpinTab : function TSTBrowser_onUnpinTab(aTab)
{
if (!this.isVertical)
return;
aTab.style.marginLeft = '';
aTab.style.marginTop = '';
},
/* initialize */
init : function TSTBrowser_init()
@ -416,6 +441,7 @@ TreeStyleTabBrowser.prototype = {
this.tabbrowser.treeStyleTab.positionVerticalPinnedTabs();
}
else {
this.tabbrowser.treeStyleTab.clearPinnedTabsAppearance();
]]>.toString()
).replace(
'this.mTabstrip.ensureElementIsVisible',
@ -424,6 +450,17 @@ TreeStyleTabBrowser.prototype = {
);
}
if (b.unpinTab) {
eval('b.unpinTab = '+
b.unpinTab.toSource().replace(
'this.tabContainer._positionPinnedTabs',
<![CDATA[
this.treeStyleTab.onUnpinTab(aTab);
$&]]>.toString()
)
);
}
TreeStyleTabService.updateTabDNDObserver(b);
if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 3.7 or later