高速化実験
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6332 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
71bab7ba35
commit
bc5091bd49
@ -127,6 +127,44 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
{
|
{
|
||||||
return false;
|
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 */
|
/* initialize */
|
||||||
|
|
||||||
@ -136,6 +174,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
|
|
||||||
|
// this._tabsCache = {};
|
||||||
|
|
||||||
this.internallyTabMovingCount = 0;
|
this.internallyTabMovingCount = 0;
|
||||||
this.subTreeMovingCount = 0;
|
this.subTreeMovingCount = 0;
|
||||||
this.subTreeChildrenMovingCount = 0;
|
this.subTreeChildrenMovingCount = 0;
|
||||||
@ -636,9 +676,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
aTab.setAttribute(this.kID, id);
|
aTab.setAttribute(this.kID, id);
|
||||||
aTab.setAttribute(this.kSUBTREE_COLLAPSED, true);
|
aTab.setAttribute(this.kSUBTREE_COLLAPSED, true);
|
||||||
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))
|
||||||
|
// aSelf._tabsCache[id] = aTab;
|
||||||
|
}
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
|
// if (!(id in this._tabsCache))
|
||||||
|
// this._tabsCache[id] = aTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
aTab.__treestyletab__linkedTabBrowser = this.mTabBrowser;
|
aTab.__treestyletab__linkedTabBrowser = this.mTabBrowser;
|
||||||
@ -1203,6 +1248,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
destroyTab : function TSTBrowser_destroyTab(aTab)
|
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;
|
delete aTab.__treestyletab__linkedTabBrowser;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2068,6 +2119,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;
|
||||||
|
|
||||||
if (closeSetId)
|
if (closeSetId)
|
||||||
this.restoreClosedSet(closeSetId, tab);
|
this.restoreClosedSet(closeSetId, tab);
|
||||||
@ -2236,7 +2288,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
},
|
},
|
||||||
_clearRedirectionTableTimer : null,
|
_clearRedirectionTableTimer : null,
|
||||||
|
|
||||||
restoreClosedSet : function TSTBrowser_restoreClosedSet(aId, aRestoredTab)
|
restoreClosedSet : function TSTBrowser_restoreClosedSet(aId, aRestoredTab)
|
||||||
{
|
{
|
||||||
var behavior = this.undoCloseTabSetBehavior(0, true);
|
var behavior = this.undoCloseTabSetBehavior(0, true);
|
||||||
if (
|
if (
|
||||||
@ -3221,7 +3273,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setTabValue(aParent, this.kCHILDREN, children.join('|'));
|
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));
|
this.setTabValue(aChild, this.kPARENT, aParent.getAttribute(this.kID));
|
||||||
|
// aChild.__treestyletab__parentTab = aParent;
|
||||||
|
|
||||||
this.updateTabsCount(aParent);
|
this.updateTabsCount(aParent);
|
||||||
if (shouldInheritIndent && !aInfo.dontUpdateIndent)
|
if (shouldInheritIndent && !aInfo.dontUpdateIndent)
|
||||||
this.inheritTabIndent(aChild, aParent);
|
this.inheritTabIndent(aChild, aParent);
|
||||||
@ -3294,18 +3351,39 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (!parentTab) return;
|
if (!parentTab) return;
|
||||||
|
|
||||||
var id = aChild.getAttribute(this.kID);
|
var id = aChild.getAttribute(this.kID);
|
||||||
this.setTabValue(
|
|
||||||
parentTab,
|
// if (parentTab.__treestyletab__childTabs) {
|
||||||
this.kCHILDREN,
|
// parentTab.__treestyletab__childTabs = parentTab.__treestyletab__childTabs.filter(function(aTab) { /r/eturn aTab.parentNode; });
|
||||||
parentTab.getAttribute(this.kCHILDREN)
|
// let index = parentTab.__treestyletab__childTabs.indexOf(aChild);
|
||||||
.split('|')
|
// if (index > -1)
|
||||||
.filter(function(aId) {
|
// parentTab.__treestyletab__childTabs.splice(index, 1);
|
||||||
return this.getTabById(aId) && aId != id;
|
// this.setTabValue(
|
||||||
}, this).join('|')
|
// parentTab,
|
||||||
);
|
// this.kCHILDREN,
|
||||||
|
// parentTab.__treestyletab__childTabs
|
||||||
|
// .map(function(aTab) {
|
||||||
|
// return aTab.getAttribute(this.kID);
|
||||||
|
// }, this).join('|')
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
this.setTabValue(
|
||||||
|
parentTab,
|
||||||
|
this.kCHILDREN,
|
||||||
|
parentTab.getAttribute(this.kCHILDREN)
|
||||||
|
.split('|')
|
||||||
|
.filter(function(aId) {
|
||||||
|
return this.getTabById(aId) && aId != id;
|
||||||
|
}, this).join('|')
|
||||||
|
);
|
||||||
|
// }
|
||||||
|
|
||||||
if (!this.hasChildTabs(parentTab))
|
if (!this.hasChildTabs(parentTab))
|
||||||
this.setTabValue(parentTab, this.kSUBTREE_COLLAPSED, true);
|
this.setTabValue(parentTab, this.kSUBTREE_COLLAPSED, true);
|
||||||
|
|
||||||
this.deleteTabValue(aChild, this.kPARENT);
|
this.deleteTabValue(aChild, this.kPARENT);
|
||||||
|
// delete aChild.__treestyletab__parentTab;
|
||||||
|
|
||||||
this.updateTabsCount(parentTab);
|
this.updateTabsCount(parentTab);
|
||||||
|
|
||||||
if (!aInfo.dontUpdateIndent) {
|
if (!aInfo.dontUpdateIndent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user