From 2ae704347548835c259345165215ff4b9f6add84 Mon Sep 17 00:00:00 2001 From: piro Date: Fri, 22 Feb 2008 07:44:06 +0000 Subject: [PATCH] =?UTF-8?q?Tab=20Mix=20Plus=E3=81=A7=E3=82=BF=E3=83=96?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=92=E8=A4=87=E6=95=B0=E8=A1=8C=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E6=99=82=E3=81=AF?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=83=87=E3=83=B3=E3=83=88=E3=81=AE=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E3=82=92=E5=A4=89=E3=81=88=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= 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@1816 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/hacks.js | 4 +++ content/treestyletab/treestyletabbrowser.js | 35 ++++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index a979b034..9a99cfdb 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -393,6 +393,10 @@ TreeStyleTabService.overrideExtensionsAfterInit = function() { 'tabBarScrollStatus(); $&' ) ); + TreeStyleTabBrowser.prototype.isMultiRow = function() + { + return window.tabscroll == 2; + }; window.setTimeout(function() { // correct broken appearance of the first tab diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 7edb7617..d99e02dd 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -39,9 +39,9 @@ TreeStyleTabBrowser.prototype = { _container : null, /* utils */ - -/* get tab contents */ +/* get tab contents */ + getTabLabel : function(aTab) { var label = document.getAnonymousElementByAttribute(aTab, 'class', 'tab-text-container') || // Tab Mix Plus @@ -57,7 +57,7 @@ TreeStyleTabBrowser.prototype = { }, /* status */ - + get isVertical() { var b = this.mTabBrowser; @@ -76,7 +76,12 @@ TreeStyleTabBrowser.prototype = { tabBox.screenY >= barBox.screenY && tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height); }, - + + isMultiRow : function() + { + return false; + }, + /* initialize */ init : function() @@ -693,7 +698,7 @@ TreeStyleTabBrowser.prototype = { }, /* nsIObserver */ - + domain : 'extensions.treestyletab', observe : function(aSubject, aTopic, aData) @@ -1471,14 +1476,14 @@ TreeStyleTabBrowser.prototype = { }, /* drag and drop */ - isPlatformNotSupported : navigator.platform.indexOf('Mac') != -1, // see bug 136524 + isPlatformNotSupported : navigator.platform.indexOf('Mac') != -1, // see bug 136524 isTimerSupported : navigator.platform.indexOf('Win') == -1, // see bug 232795. autoExpandTimer : null, autoExpandTarget : null, autoExpandedTabs : [], - onDragEnter : function(aEvent, aDragSession) + onDragEnter : function(aEvent, aDragSession) { var tab = aEvent.target; if (tab.localName != 'tab' || @@ -1905,9 +1910,23 @@ TreeStyleTabBrowser.prototype = { var margin = this.levelMargin < 0 ? this.baseLebelMargin : this.levelMargin ; var indent = margin * aLevel; + var multirow = this.isMultiRow(); + var topBottom = this.levelMarginProp.match(/top|bottom/); + var innerBoxes, j; + for (var i = 0, maxi = aTabs.length; i < maxi; i++) { - aTabs[i].setAttribute('style', aTabs[i].getAttribute('style').replace(/margin(-[^:]+):[^;]+;?/g, '')+'; '+aProp+':'+indent+'px !important;'); + if (multirow) { + innerBoxes = document.getAnonymousNodes(aTabs[i]); + for (j = 0, maxj = innerBoxes.length; j < maxj; j++) + { + if (innerBoxes[j].nodeType != Node.ELEMENT_NODE) continue; + innerBoxes[j].setAttribute('style', innerBoxes[j].getAttribute('style').replace(/border-(top|bottom).*:[^;]+;?/g, '')+'; border-'+topBottom+': solid transparent '+(aLevel * 4)+'px !important;'); + } + } + else { + aTabs[i].setAttribute('style', aTabs[i].getAttribute('style').replace(/margin(-[^:]+):[^;]+;?/g, '')+'; '+aProp+':'+indent+'px !important;'); + } aTabs[i].setAttribute(this.kNEST, aLevel); this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp); }