From 4b73c3c320850f5b98047fc1256a372acaf25472 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 25 Mar 2010 10:04:47 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=90=E3=83=BC=E3=81=8C?= =?UTF-8?q?=E3=81=82=E3=81=A3=E3=81=9F=E4=BD=8D=E7=BD=AE=E3=81=AB=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E3=81=8C=E3=81=A7=E3=81=8D=E3=81=A6=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=86=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6444 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 2 +- content/treestyletab/treestyletabbrowser.js | 37 ++++++++++++++++--- .../treestyletabbrowser_autoHide.js | 10 ++--- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 3b02e97b..37da3691 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1364,7 +1364,7 @@ catch(e) { aSelf.setTreePref('tabbar.width', box.width); } } - b.treeStyleTab.updateTabbarSize(); + b.treeStyleTab.updateFloatingTabbar(); b.treeStyleTab.clickedOnTabbarResizerGrippy = false; }, 10, this); }, diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 95d2341d..e9b48dad 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1059,7 +1059,6 @@ TreeStyleTabBrowser.prototype = { this.updateTabbarState(); window.setTimeout(function(aSelf, aTabBrowser, aSplitter, aToggler) { delayedPostProcess(aSelf, aTabBrowser, aSplitter, aToggler); - aSelf.updateTabbarSize(); aSelf.updateTabbarOverflow(); delayedPostProcess = null; aSelf.mTabBrowser.style.visibility = ''; @@ -1146,25 +1145,30 @@ TreeStyleTabBrowser.prototype = { } } - this.updateTabbarSize(); + window.setTimeout(function(aSelf) { + aSelf.updateFloatingTabbar(); + aSelf.startRendering(); + }, 0, this); this.setTabbrowserAttribute(this.kINDENTED, this.getTreePref('enableSubtreeIndent.'+orient) ? 'true' : null , b); this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, this.getTreePref('allowSubtreeCollapseExpand.'+orient) ? 'true' : null , b); this.setTabbrowserAttribute(this.kHIDE_ALLTABS, this.getTreePref('tabbar.hideAlltabsButton.'+orient) ? 'true' : null , b); - this.startRendering(); this.updateAllTabsIndent(); }, - updateTabbarSize : function TSTBrowser_updateTabbarSize() + updateFloatingTabbar : function TSTBrowser_updateFloatingTabbar() { var placeholder = this.placeholder; if (!placeholder) return; var strip = this.tabStrip; var tabContainer = this.mTabBrowser.tabContainer; + var positioned = false; if (this.currentTabbarPosition != 'top' || this.mTabBrowser.getAttribute(this.kFIXED) != 'true') { + positioned = true; + let box = placeholder.boxObject; let root = document.documentElement.boxObject; strip.style.top = (box.screenY - root.screenY)+'px'; @@ -1175,6 +1179,27 @@ TreeStyleTabBrowser.prototype = { tabContainer.collapsed = (this.splitter && this.splitter.getAttribute('state') == 'collapsed'); } + + var toolbox = strip.parentNode; + if (toolbox.localName != 'toolbox') + return; + + // hack to reset the height of the toolbox + var height = 0; + Array.slice(toolbox.childNodes).forEach(function(aNode) { + if (aNode.nodeType == Node.ELEMENT_NODE && (aNode != strip || !positioned)) + height += aNode.boxObject.height; + }); + if (height != toolbox.boxObject.height) { + this.stopRendering(); + // "height" attribute of the toolbar prevents rendering of the toolbox with its correct height. + strip.removeAttribute('height'); + toolbox.setAttribute('height', height); + window.setTimeout(function(aSelf) { + toolbox.removeAttribute('height'); + aSelf.startRendering(); + }, 0, this); + } }, updateTabbarOverflow : function TSTBrowser_updateTabbarOverflow() @@ -1452,7 +1477,7 @@ TreeStyleTabBrowser.prototype = { this.placeholder.removeAttribute('width'); this.placeholder.setAttribute('width', this.autoHide.widthFromMode); } - this.updateTabbarSize(); + this.updateFloatingTabbar(); } this.checkTabsIndentOverflow(); break; @@ -2591,7 +2616,7 @@ TreeStyleTabBrowser.prototype = { ) return; - this.updateTabbarSize(); + this.updateFloatingTabbar(); }, onPopupShowing : function TSTBrowser_onPopupShowing(aEvent) diff --git a/content/treestyletab/treestyletabbrowser_autoHide.js b/content/treestyletab/treestyletabbrowser_autoHide.js index 68b132d2..453b62c8 100644 --- a/content/treestyletab/treestyletabbrowser_autoHide.js +++ b/content/treestyletab/treestyletabbrowser_autoHide.js @@ -492,10 +492,9 @@ TreeStyleTabBrowserAutoHide.prototype = { case this.kMODE_SHRINK: if (pos == 'left' || pos == 'right') { sv.tabStrip.width = this.getTreePref('tabbar.width'); - if (sv.placeholder) { + if (sv.placeholder) sv.placeholder.width = sv.tabStrip.width; - sv.updateTabbarSize(); - } + sv.updateFloatingTabbar(); } break; } @@ -527,10 +526,9 @@ TreeStyleTabBrowserAutoHide.prototype = { sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN, b); if (pos == 'left' || pos == 'right') { sv.tabStrip.width = this.getTreePref('tabbar.shrunkenWidth'); - if (sv.placeholder) { + if (sv.placeholder) sv.placeholder.width = sv.tabStrip.width; - sv.updateTabbarSize(); - } + sv.updateFloatingTabbar(); } break; }