getTabByIdの最適化を再導入

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6338 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-04 02:43:12 +00:00
parent 0a46d3bc4b
commit 8e9a74581d

View File

@ -128,23 +128,28 @@ TreeStyleTabBrowser.prototype = {
return false; return false;
}, },
// getTabById : function TSTBrowser_getTabById(aId, aTabBrowserChildren) getTabById : function TSTBrowser_getTabById(aId, aTabBrowserChildren) /* PUBLIC API */
// { {
// if (!aId) return null; if (aTabBrowserChildren && !(aTabBrowserChildren instanceof Ci.nsIDOMNode))
// aTabBrowserChildren = null;
// if (!aTabBrowserChildren)
// return aId in this._tabsCache ? this._tabsCache[aId] : null ;
//
// var b = this.getTabBrowserFromChild(aTabBrowserChildren);
// return b ? b.treeStyleTab.getTabById(aId) : null ;
// },
// getParentTab : function TSTBrowser_getParentTab(aTab) /* PUBLIC API */ if (aTabBrowserChildren) {
// { var b = this.getTabBrowserFromChild(aTabBrowserChildren);
// if (!aTab) return null; if (!b)
// var b = this.getTabBrowserFromChild(aTab); return null;
// return b.treeStyleTab.getTabById(aTab.getAttribute(this.kPARENT)); if (b != this.mTabBrowser)
// }, return b.treeStyleTab.getTabById(aId);
}
return this._tabsCache[aId] || null;
},
getParentTab : function TSTBrowser_getParentTab(aTab) /* PUBLIC API */
{
if (!aTab) return null;
var b = this.getTabBrowserFromChild(aTab);
return b.treeStyleTab.getTabById(aTab.getAttribute(this.kPARENT));
},
// getParentTab : function TSTBrowser_getParentTab(aTab) /* PUBLIC API */ // getParentTab : function TSTBrowser_getParentTab(aTab) /* PUBLIC API */
// { // {
@ -181,7 +186,7 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser; var b = this.mTabBrowser;
// this._tabsCache = {}; this._tabsCache = {};
this.internallyTabMovingCount = 0; this.internallyTabMovingCount = 0;
this.subTreeMovingCount = 0; this.subTreeMovingCount = 0;
@ -684,12 +689,12 @@ TreeStyleTabBrowser.prototype = {
window.setTimeout(function(aSelf) { window.setTimeout(function(aSelf) {
if (!aSelf.getTabValue(aTab, aSelf.kID)) { if (!aSelf.getTabValue(aTab, aSelf.kID)) {
aSelf.setTabValue(aTab, aSelf.kID, id); aSelf.setTabValue(aTab, aSelf.kID, id);
// if (!(id in aSelf._tabsCache)) if (!(id in aSelf._tabsCache))
// aSelf._tabsCache[id] = aTab; aSelf._tabsCache[id] = aTab;
} }
}, 0, this); }, 0, this);
// if (!(id in this._tabsCache)) if (!(id in this._tabsCache))
// this._tabsCache[id] = aTab; this._tabsCache[id] = aTab;
} }
aTab.__treestyletab__linkedTabBrowser = this.mTabBrowser; aTab.__treestyletab__linkedTabBrowser = this.mTabBrowser;
@ -1254,9 +1259,9 @@ TreeStyleTabBrowser.prototype = {
destroyTab : function TSTBrowser_destroyTab(aTab) destroyTab : function TSTBrowser_destroyTab(aTab)
{ {
// var id = aTab.getAttribute(this.kID); var id = aTab.getAttribute(this.kID);
// if (id in this._tabsCache) if (id in this._tabsCache)
// delete this._tabsCache[id]; delete this._tabsCache[id];
// delete aTab.__treestyletab__parentTab; // delete aTab.__treestyletab__parentTab;
// delete aTab.__treestyletab__childTabs; // delete aTab.__treestyletab__childTabs;
@ -2126,7 +2131,7 @@ TreeStyleTabBrowser.prototype = {
this.deleteTabValue(tab, this.kCLOSED_SET_ID); this.deleteTabValue(tab, this.kCLOSED_SET_ID);
this.setTabValue(tab, this.kID, id); this.setTabValue(tab, this.kID, id);
// this._tabsCache[id] = tab; this._tabsCache[id] = tab;
if (closeSetId) if (closeSetId)
this.restoreClosedSet(closeSetId, tab); this.restoreClosedSet(closeSetId, tab);