サブツリーを折りたためない設定の時にまで、タブが内部的に折りたたまれた状態として扱われてしまっていたのを修正
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5265 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
7a1e02f50e
commit
ec8cf69153
@ -807,9 +807,24 @@ var TreeStyleTabService = {
|
||||
).singleNodeValue;
|
||||
},
|
||||
|
||||
getTabIndex : function(aTab)
|
||||
{
|
||||
if (!aTab) return -1;
|
||||
return this.evaluateXPath(
|
||||
'count(preceding-sibling::xul:tab)',
|
||||
aTab,
|
||||
XPathResult.NUMBER_TYPE
|
||||
).numberValue;
|
||||
},
|
||||
|
||||
getNextVisibleTab : function(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true')
|
||||
return this.getNextTab(aTab);
|
||||
|
||||
return this.evaluateXPath(
|
||||
'following-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
||||
aTab,
|
||||
@ -820,6 +835,11 @@ var TreeStyleTabService = {
|
||||
getPreviousVisibleTab : function(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true')
|
||||
return this.getPreviousTab(aTab);
|
||||
|
||||
return this.evaluateXPath(
|
||||
'preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")][1]',
|
||||
aTab,
|
||||
@ -830,6 +850,11 @@ var TreeStyleTabService = {
|
||||
getLastVisibleTab : function(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true')
|
||||
return this.getLastTab(aTab);
|
||||
|
||||
return this.evaluateXPath(
|
||||
'child::xul:tab[not(@'+this.kCOLLAPSED+'="true")][last()]',
|
||||
aTab.parentNode,
|
||||
@ -839,6 +864,10 @@ var TreeStyleTabService = {
|
||||
|
||||
getVisibleTabs : function(aTab)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true')
|
||||
return this.getTabs(b);
|
||||
|
||||
var xpathResult = this.evaluateXPath(
|
||||
'child::xul:tab[not(@'+this.kCOLLAPSED+'="true")]',
|
||||
aTab.parentNode
|
||||
@ -848,8 +877,15 @@ var TreeStyleTabService = {
|
||||
|
||||
getVisibleIndex : function(aTab)
|
||||
{
|
||||
if (!aTab || aTab.getAttribute(this.kCOLLAPSED) == 'true') return -1;
|
||||
return this.evaluateXPath(
|
||||
if (!aTab) return -1;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true')
|
||||
return this.getTabIndex(aTab);
|
||||
|
||||
return aTab.getAttribute(this.kCOLLAPSED) == 'true' ?
|
||||
-1 :
|
||||
this.evaluateXPath(
|
||||
'count(preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")])',
|
||||
aTab,
|
||||
XPathResult.NUMBER_TYPE
|
||||
@ -868,6 +904,28 @@ var TreeStyleTabService = {
|
||||
);
|
||||
},
|
||||
|
||||
isCollapsed : function(aTab) /* PUBLIC API */
|
||||
{
|
||||
if (!aTab) return false;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) == 'true')
|
||||
return false;
|
||||
|
||||
return aTab.getAttribute(this.kCOLLAPSED) == 'true';
|
||||
},
|
||||
|
||||
isSubtreeCollapsed : function(aTab) /* PUBLIC API */
|
||||
{
|
||||
if (!aTab) return false;
|
||||
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) == 'true')
|
||||
return false;
|
||||
|
||||
return aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true';
|
||||
},
|
||||
|
||||
getParentTab : function(aTab) /* PUBLIC API */
|
||||
{
|
||||
if (!aTab) return null;
|
||||
@ -1064,16 +1122,26 @@ var TreeStyleTabService = {
|
||||
|
||||
getXOffsetOfTab : function(aTab)
|
||||
{
|
||||
var extraCondition = '';
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) == 'true')
|
||||
extraCondition = '[not(@'+this.kCOLLAPSED+'="true")]';
|
||||
|
||||
return this.evaluateXPath(
|
||||
'sum((self::* | preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")])/attribute::'+this.kX_OFFSET+')',
|
||||
'sum((self::* | preceding-sibling::xul:tab'+extraCondition+')/attribute::'+this.kX_OFFSET+')',
|
||||
aTab,
|
||||
XPathResult.NUMBER_TYPE
|
||||
).numberValue;
|
||||
},
|
||||
getYOffsetOfTab : function(aTab)
|
||||
{
|
||||
var extraCondition = '';
|
||||
var b = this.getTabBrowserFromChild(aTab) || this.browser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) == 'true')
|
||||
extraCondition = '[not(@'+this.kCOLLAPSED+'="true")]';
|
||||
|
||||
return this.evaluateXPath(
|
||||
'sum((self::* | preceding-sibling::xul:tab[not(@'+this.kCOLLAPSED+'="true")])/attribute::'+this.kY_OFFSET+')',
|
||||
'sum((self::* | preceding-sibling::xul:tab'+extraCondition+')/attribute::'+this.kY_OFFSET+')',
|
||||
aTab,
|
||||
XPathResult.NUMBER_TYPE
|
||||
).numberValue;
|
||||
@ -1517,7 +1585,7 @@ try{
|
||||
return true;
|
||||
|
||||
tab = TSTTabBrowser.treeStyleTab.getTabFromEvent(aEvent);
|
||||
if (tab && tab.getAttribute(TreeStyleTabService.kCOLLAPSED) == 'true')
|
||||
if (TreeStyleTabService.isCollapsed(tab))
|
||||
return false;
|
||||
|
||||
var info = TSTTabBrowser.treeStyleTab.getDropAction(aEvent, TST_DRAGSESSION);
|
||||
@ -2208,7 +2276,7 @@ catch(e) {
|
||||
if (this._tabShouldBeExpandedAfterKeyReleased) {
|
||||
let tab = this._tabShouldBeExpandedAfterKeyReleased;
|
||||
if (this.hasChildTabs(tab) &&
|
||||
(tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true')) {
|
||||
this.isSubtreeCollapsed(tab)) {
|
||||
this.getTabBrowserFromChild(tab)
|
||||
.treeStyleTab
|
||||
.collapseExpandTreesIntelligentlyFor(tab);
|
||||
@ -2310,7 +2378,7 @@ catch(e) {
|
||||
handleTooltip : function(aEvent, aTab)
|
||||
{
|
||||
var label;
|
||||
var collapsed = aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true';
|
||||
var collapsed = this.isSubtreeCollapsed(aTab);
|
||||
|
||||
var base = parseInt(aTab.getAttribute(this.kNEST) || 0);
|
||||
var descendant = this.getDescendantTabs(aTab);
|
||||
|
@ -223,7 +223,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
<![CDATA[$&
|
||||
var treeStyleTab = TreeStyleTabService.getTabBrowserFromChild(this).treeStyleTab;
|
||||
treeStyleTab._focusChangedByShortcut = TreeStyleTabService.accelKeyPressed;
|
||||
if (treeStyleTab.getTreePref('focusMode') == treeStyleTab.kFOCUS_VISIBLE) {
|
||||
if (treeStyleTab.browser.getAttribute(treeStyleTab.kALLOW_COLLAPSE) == 'true' &&
|
||||
treeStyleTab.getTreePref('focusMode') == treeStyleTab.kFOCUS_VISIBLE) {
|
||||
(function(aDir, aWrap, aSelf) {
|
||||
var nextTab = (aDir < 0) ? treeStyleTab.getPreviousVisibleTab(aSelf.selectedItem) : treeStyleTab.getNextVisibleTab(aSelf.selectedItem) ;
|
||||
if (!nextTab && aWrap) {
|
||||
@ -1440,7 +1441,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
if (
|
||||
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_CLOSE ||
|
||||
tab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true'
|
||||
this.isSubtreeCollapsed(tab)
|
||||
) {
|
||||
this.getDescendantTabs(tab).reverse().forEach(function(aTab) {
|
||||
b.removeTab(aTab);
|
||||
@ -2023,7 +2024,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var b = this.mTabBrowser;
|
||||
var tab = b.selectedTab
|
||||
|
||||
if (tab.getAttribute(this.kCOLLAPSED) == 'true') {
|
||||
if (this.isCollapsed(tab)) {
|
||||
if (this.getTreePref('autoExpandSubTreeOnCollapsedChildFocused')) {
|
||||
var parentTab = tab;
|
||||
while (parentTab = this.getParentTab(parentTab))
|
||||
@ -2043,7 +2044,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.getTreePref('autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove')
|
||||
)
|
||||
) {
|
||||
if (!this.hasChildTabs(tab) || (tab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true'))
|
||||
if (!this.hasChildTabs(tab) || !this.isSubtreeCollapsed(tab))
|
||||
tab = null;
|
||||
|
||||
if (
|
||||
@ -2217,7 +2218,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
).singleNodeValue;
|
||||
let collapseItem = items[this.kMENUITEM_COLLAPSE];
|
||||
let expanndItem = items[this.kMENUITEM_EXPAND];
|
||||
if (this.evaluateXPath(
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) == 'true' &&
|
||||
this.evaluateXPath(
|
||||
'child::xul:tab[@'+this.kCHILDREN+']',
|
||||
b.mTabContainer
|
||||
).snapshotLength) {
|
||||
@ -2859,11 +2861,11 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.collapseExpandTab(aChild, true, aInfo.dontAnimate);
|
||||
}
|
||||
|
||||
if (aParent.getAttribute(this.kCOLLAPSED) == 'true')
|
||||
if (this.isCollapsed(aParent))
|
||||
this.collapseExpandTab(aChild, true, aInfo.dontAnimate);
|
||||
}
|
||||
else if (this.shouldTabAutoExpanded(aParent) ||
|
||||
aParent.getAttribute(this.kCOLLAPSED) == 'true') {
|
||||
this.isCollapsed(aParent)) {
|
||||
this.collapseExpandTab(aChild, true, aInfo.dontAnimate);
|
||||
}
|
||||
|
||||
@ -2882,7 +2884,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
shouldTabAutoExpanded : function(aTab)
|
||||
{
|
||||
return this.hasChildTabs(aTab) &&
|
||||
aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true';
|
||||
this.isSubtreeCollapsed(aTab);
|
||||
},
|
||||
|
||||
partTab : function(aChild, aInfo) /* PUBLIC API */
|
||||
@ -3017,7 +3019,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
aJustNow ||
|
||||
this.indentDuration < 1 ||
|
||||
!aProp ||
|
||||
(aTab.getAttribute(this.kCOLLAPSED) == 'true')
|
||||
this.isCollapsed(aTab)
|
||||
) {
|
||||
aTab.setAttribute(
|
||||
'style',
|
||||
@ -3222,7 +3224,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
{
|
||||
if (!aTab) return;
|
||||
|
||||
if ((aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true') == aCollapse) return;
|
||||
if (this.isSubtreeCollapsed(aTab) == aCollapse) return;
|
||||
|
||||
var b = this.mTabBrowser;
|
||||
this.doingCollapseExpand = true;
|
||||
@ -3256,7 +3258,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var parent;
|
||||
if (aCollapse && aTab == b.selectedTab && (parent = this.getParentTab(aTab))) {
|
||||
var newSelection = parent;
|
||||
while (parent.getAttribute(this.kCOLLAPSED) == 'true')
|
||||
while (this.isCollapsed(parent))
|
||||
{
|
||||
parent = this.getParentTab(parent);
|
||||
if (!parent) break;
|
||||
@ -3265,7 +3267,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
b.selectedTab = newSelection;
|
||||
}
|
||||
|
||||
if (aTab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true') {
|
||||
if (!this.isSubtreeCollapsed(aTab)) {
|
||||
this.getChildTabs(aTab).forEach(function(aTab) {
|
||||
this.collapseExpandTab(aTab, aCollapse, aJustNow);
|
||||
}, this);
|
||||
@ -3422,6 +3424,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (!aTab || this.doingCollapseExpand) return;
|
||||
|
||||
var b = this.mTabBrowser;
|
||||
if (b.getAttribute(this.kALLOW_COLLAPSE) != 'true') return;
|
||||
|
||||
var sameParentTab = this.getParentTab(aTab);
|
||||
var expandedParentTabs = [
|
||||
aTab.getAttribute(this.kID)
|
||||
@ -3447,7 +3451,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
parentTab = this.getParentTab(collapseTab);
|
||||
if (parentTab) {
|
||||
dontCollapse = true;
|
||||
if (parentTab.getAttribute(this.kSUBTREE_COLLAPSED) != 'true') {
|
||||
if (!this.isSubtreeCollapsed(parentTab)) {
|
||||
do {
|
||||
if (expandedParentTabs.indexOf(parentTab.getAttribute(this.kID)) < 0)
|
||||
continue;
|
||||
@ -3603,7 +3607,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var lastVisible = aTab;
|
||||
for (var i = descendant.length-1; i > -1; i--)
|
||||
{
|
||||
if (descendant[i].getAttribute(this.kCOLLAPSED) == 'true') continue;
|
||||
if (this.isCollapsed(descendant[i])) continue;
|
||||
lastVisible = descendant[i];
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user