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

View File

@ -166,12 +166,14 @@ TreeStyleTabBrowser.prototype = {
var maxRow = Math.ceil(count / maxCol); var maxRow = Math.ceil(count / maxCol);
var col = 0; var col = 0;
var row = 0; var row = 0;
tabbar.style.MozMarginStart = '';
tabbar.style.marginTop = (height * maxRow)+'px'; 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]; let style = tabbar.childNodes[i].style;
tab.style.setProperty('margin-left', (width * col)+'px', 'important'); style.MozMarginStart = '';
tab.style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important'); style.setProperty('margin-left', (width * col)+'px', 'important');
style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important');
col++; col++;
if (col >= maxCol) { if (col >= maxCol) {
col = 0; col = 0;
@ -181,6 +183,29 @@ TreeStyleTabBrowser.prototype = {
}, },
PINNED_TAB_WIDTH : 24, PINNED_TAB_WIDTH : 24,
PINNED_TAB_HEIGHT : 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 */ /* initialize */
@ -416,6 +441,7 @@ TreeStyleTabBrowser.prototype = {
this.tabbrowser.treeStyleTab.positionVerticalPinnedTabs(); this.tabbrowser.treeStyleTab.positionVerticalPinnedTabs();
} }
else { else {
this.tabbrowser.treeStyleTab.clearPinnedTabsAppearance();
]]>.toString() ]]>.toString()
).replace( ).replace(
'this.mTabstrip.ensureElementIsVisible', '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); TreeStyleTabService.updateTabDNDObserver(b);
if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 3.7 or later if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 3.7 or later