Tab Utilitiesがタブのpinnedプロパティを提供しないので、Tab Utilitiesに合わせるようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7161 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
135d1e41d7
commit
3375f59bae
@ -128,7 +128,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
isTabInViewport : function TSTBrowser_isTabInViewport(aTab)
|
isTabInViewport : function TSTBrowser_isTabInViewport(aTab)
|
||||||
{
|
{
|
||||||
if (!aTab) return false;
|
if (!aTab) return false;
|
||||||
if (aTab.pinned) return true;
|
if (aTab.getAttribute('pinned') == 'true')
|
||||||
|
return true;
|
||||||
var tabBox = aTab.boxObject;
|
var tabBox = aTab.boxObject;
|
||||||
var barBox = this.scrollBox.boxObject;
|
var barBox = this.scrollBox.boxObject;
|
||||||
var xOffset = this.getXOffsetOfTab(aTab);
|
var xOffset = this.getXOffsetOfTab(aTab);
|
||||||
@ -269,6 +270,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mTabContainer.addEventListener('SSTabRestoring', this, true);
|
b.mTabContainer.addEventListener('SSTabRestoring', this, true);
|
||||||
b.mTabContainer.addEventListener('SSTabRestored', this, true);
|
b.mTabContainer.addEventListener('SSTabRestored', this, true);
|
||||||
b.mTabContainer.addEventListener('transitionend', this, true);
|
b.mTabContainer.addEventListener('transitionend', this, true);
|
||||||
|
b.mTabContainer.addEventListener('DOMAttrModified', this, true);
|
||||||
b.mTabContainer.addEventListener('mouseover', this, true);
|
b.mTabContainer.addEventListener('mouseover', this, true);
|
||||||
b.mTabContainer.addEventListener('mouseout', this, true);
|
b.mTabContainer.addEventListener('mouseout', this, true);
|
||||||
b.mTabContainer.addEventListener('dblclick', this, true);
|
b.mTabContainer.addEventListener('dblclick', this, true);
|
||||||
@ -461,28 +463,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.pinTab) {
|
|
||||||
eval('b.pinTab = '+
|
|
||||||
b.pinTab.toSource().replace(
|
|
||||||
'this.moveTabTo(',
|
|
||||||
<![CDATA[
|
|
||||||
this.treeStyleTab.onPinTab(aTab);
|
|
||||||
$&]]>.toString()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.unpinTab) {
|
|
||||||
eval('b.unpinTab = '+
|
|
||||||
b.unpinTab.toSource().replace(
|
|
||||||
'this.tabContainer._positionPinnedTabs',
|
|
||||||
<![CDATA[
|
|
||||||
this.treeStyleTab.onUnpinTab(aTab);
|
|
||||||
$&]]>.toString()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeStyleTabService.updateTabDNDObserver(b);
|
TreeStyleTabService.updateTabDNDObserver(b);
|
||||||
|
|
||||||
if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 4.0 or later
|
if (b.tabContainer && '_getDropIndex' in b.tabContainer) { // Firefox 4.0 or later
|
||||||
@ -1519,6 +1499,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mTabContainer.removeEventListener('SSTabRestoring', this, true);
|
b.mTabContainer.removeEventListener('SSTabRestoring', this, true);
|
||||||
b.mTabContainer.removeEventListener('SSTabRestored', this, true);
|
b.mTabContainer.removeEventListener('SSTabRestored', this, true);
|
||||||
b.mTabContainer.removeEventListener('transitionend', this, true);
|
b.mTabContainer.removeEventListener('transitionend', this, true);
|
||||||
|
b.mTabContainer.removeEventListener('DOMAttrModified', this, true);
|
||||||
b.mTabContainer.removeEventListener('mouseover', this, true);
|
b.mTabContainer.removeEventListener('mouseover', this, true);
|
||||||
b.mTabContainer.removeEventListener('mouseout', this, true);
|
b.mTabContainer.removeEventListener('mouseout', this, true);
|
||||||
b.mTabContainer.removeEventListener('dblclick', this, true);
|
b.mTabContainer.removeEventListener('dblclick', this, true);
|
||||||
@ -1868,6 +1849,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
case 'transitionend':
|
case 'transitionend':
|
||||||
return this.onTabAnimationEnd(aEvent);
|
return this.onTabAnimationEnd(aEvent);
|
||||||
|
|
||||||
|
case 'DOMAttrModified':
|
||||||
|
return this.onDOMAttrModified(aEvent);
|
||||||
|
|
||||||
case 'select':
|
case 'select':
|
||||||
return this.onTabSelect(aEvent);
|
return this.onTabSelect(aEvent);
|
||||||
|
|
||||||
@ -2798,6 +2782,27 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b._endRemoveTab(tab);
|
b._endRemoveTab(tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onDOMAttrModified : function TSTBrowser_onDOMAttrModified(aEvent)
|
||||||
|
{
|
||||||
|
switch (aEvent.attrName)
|
||||||
|
{
|
||||||
|
case 'pinned':
|
||||||
|
let (tab = aEvent.originalTarget) {
|
||||||
|
if (tab.localName != 'tab')
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (aEvent.newValue == 'true')
|
||||||
|
this.onPinTab(tab);
|
||||||
|
else
|
||||||
|
this.onUnpinTab(tab);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onTabSelect : function TSTBrowser_onTabSelect(aEvent)
|
onTabSelect : function TSTBrowser_onTabSelect(aEvent)
|
||||||
{
|
{
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
@ -3307,8 +3312,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
info.target = tab;
|
info.target = tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
var positionProp = this.isVertical && tab.pinned ? this.invertedPositionProp : this.positionProp ;
|
var positionProp = this.isVertical && tab.getAttribute('pinned') == 'true' ? this.invertedPositionProp : this.positionProp ;
|
||||||
var sizeProp = this.isVertical && tab.pinned ? this.invertedSizeProp : this.sizeProp ;
|
var sizeProp = this.isVertical && tab.getAttribute('pinned') == 'true' ? this.invertedSizeProp : this.sizeProp ;
|
||||||
var boxPos = tab.boxObject[positionProp];
|
var boxPos = tab.boxObject[positionProp];
|
||||||
var boxUnit = Math.round(tab.boxObject[sizeProp] / 3);
|
var boxUnit = Math.round(tab.boxObject[sizeProp] / 3);
|
||||||
if (aEvent[positionProp] < boxPos + boxUnit) {
|
if (aEvent[positionProp] < boxPos + boxUnit) {
|
||||||
@ -3738,8 +3743,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
!aParent ||
|
!aParent ||
|
||||||
aChild == aParent ||
|
aChild == aParent ||
|
||||||
(currentParent = this.getParentTab(aChild)) == aParent ||
|
(currentParent = this.getParentTab(aChild)) == aParent ||
|
||||||
aChild.pinned ||
|
aChild.getAttribute('pinned') == 'true' ||
|
||||||
aParent.pinned
|
aParent.getAttribute('pinned') == 'true'
|
||||||
) {
|
) {
|
||||||
this.fireAttachedEvent(aChild, aParent);
|
this.fireAttachedEvent(aChild, aParent);
|
||||||
return;
|
return;
|
||||||
|
@ -1142,10 +1142,7 @@ var TreeStyleTabUtils = {
|
|||||||
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
||||||
|
|
||||||
var parentTab = this.getTabFromFrame(frame, ownerBrowser);
|
var parentTab = this.getTabFromFrame(frame, ownerBrowser);
|
||||||
if (
|
if (parentTab.getAttribute('pinned') == 'true')
|
||||||
parentTab.pinned || // Firefox 4.0
|
|
||||||
parentTab.getAttribute('pinned') == 'true' // Tab Utilities
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ownerBrowser.treeStyleTab.ensureTabInitialized(parentTab);
|
ownerBrowser.treeStyleTab.ensureTabInitialized(parentTab);
|
||||||
|
Loading…
Reference in New Issue
Block a user