高速化実験

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6332 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-03 13:30:49 +00:00
parent 71bab7ba35
commit bc5091bd49

View File

@ -128,6 +128,44 @@ TreeStyleTabBrowser.prototype = {
return false;
},
// getTabById : function TSTBrowser_getTabById(aId, aTabBrowserChildren)
// {
// if (!aId) return null;
// if (!aTabBrowserChildren)
// return aId in this._tabsCache ? this._tabsCache[aId] : null ;
//
// if (aTabBrowserChildren.__treestyletab__linkedTabBrowser)
// return aTabBrowserChildren.__treestyletab__linkedTabBrowser.treeStyleTab.getTabById(aId);
//
// return this.utils.getTabById(aId, aTabBrowserChildren);
// },
// getParentTab : function TSTBrowser_getParentTab(aTab) /* PUBLIC API */
// {
// if (!aTab) return null;
// return aTab.__treestyletab__parentTab;
// },
// getChildTabs : function TSTBrowser_getChildTabs(aTab, aAllTabsArray) /* PUBLIC API */
// {
// var tabs = [];
// if (!aTab) return tabs;
//
// var children = aTab.__treestyletab__childTabs;
// if (!children || !children.length) return tabs;
//
// if (aAllTabsArray) tabs = aAllTabsArray;
//
// for (var child in children)
// {
// tabs.push(child);
// if (aAllTabsArray)
// this.getChildTabs(child, tabs);
// }
//
// return tabs;
// },
/* initialize */
init : function TSTBrowser_init()
@ -136,6 +174,8 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser;
// this._tabsCache = {};
this.internallyTabMovingCount = 0;
this.subTreeMovingCount = 0;
this.subTreeChildrenMovingCount = 0;
@ -636,9 +676,14 @@ TreeStyleTabBrowser.prototype = {
aTab.setAttribute(this.kID, id);
aTab.setAttribute(this.kSUBTREE_COLLAPSED, true);
window.setTimeout(function(aSelf) {
if (!aSelf.getTabValue(aTab, aSelf.kID))
if (!aSelf.getTabValue(aTab, aSelf.kID)) {
aSelf.setTabValue(aTab, aSelf.kID, id);
// if (!(id in aSelf._tabsCache))
// aSelf._tabsCache[id] = aTab;
}
}, 0, this);
// if (!(id in this._tabsCache))
// this._tabsCache[id] = aTab;
}
aTab.__treestyletab__linkedTabBrowser = this.mTabBrowser;
@ -1203,6 +1248,12 @@ TreeStyleTabBrowser.prototype = {
destroyTab : function TSTBrowser_destroyTab(aTab)
{
// var id = aTab.getAttribute(this.kID);
// if (id in this._tabsCache)
// delete this._tabsCache[id];
// delete aTab.__treestyletab__parentTab;
// delete aTab.__treestyletab__childTabs;
delete aTab.__treestyletab__linkedTabBrowser;
},
@ -2068,6 +2119,7 @@ TreeStyleTabBrowser.prototype = {
this.deleteTabValue(tab, this.kCLOSED_SET_ID);
this.setTabValue(tab, this.kID, id);
// this._tabsCache[id] = tab;
if (closeSetId)
this.restoreClosedSet(closeSetId, tab);
@ -3221,7 +3273,12 @@ TreeStyleTabBrowser.prototype = {
}
this.setTabValue(aParent, this.kCHILDREN, children.join('|'));
// aParent.__treestyletab__childTabs = children.map(this.getTabById, this)
// .filter(function(aTab) { return aTab; });
this.setTabValue(aChild, this.kPARENT, aParent.getAttribute(this.kID));
// aChild.__treestyletab__parentTab = aParent;
this.updateTabsCount(aParent);
if (shouldInheritIndent && !aInfo.dontUpdateIndent)
this.inheritTabIndent(aChild, aParent);
@ -3294,6 +3351,22 @@ TreeStyleTabBrowser.prototype = {
if (!parentTab) return;
var id = aChild.getAttribute(this.kID);
// if (parentTab.__treestyletab__childTabs) {
// parentTab.__treestyletab__childTabs = parentTab.__treestyletab__childTabs.filter(function(aTab) { /r/eturn aTab.parentNode; });
// let index = parentTab.__treestyletab__childTabs.indexOf(aChild);
// if (index > -1)
// parentTab.__treestyletab__childTabs.splice(index, 1);
// this.setTabValue(
// parentTab,
// this.kCHILDREN,
// parentTab.__treestyletab__childTabs
// .map(function(aTab) {
// return aTab.getAttribute(this.kID);
// }, this).join('|')
// );
// }
// else {
this.setTabValue(
parentTab,
this.kCHILDREN,
@ -3303,9 +3376,14 @@ TreeStyleTabBrowser.prototype = {
return this.getTabById(aId) && aId != id;
}, this).join('|')
);
// }
if (!this.hasChildTabs(parentTab))
this.setTabValue(parentTab, this.kSUBTREE_COLLAPSED, true);
this.deleteTabValue(aChild, this.kPARENT);
// delete aChild.__treestyletab__parentTab;
this.updateTabsCount(parentTab);
if (!aInfo.dontUpdateIndent) {