タブバーが自動で折り畳まれた時に、タブバーが溢れた時と同じ処理が走ってしまっていたのを修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3875 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-03-24 17:44:30 +00:00
parent 8b6f89175c
commit d8ef4006cb

View File

@ -211,7 +211,7 @@ TreeStyleTabBrowser.prototype = {
'child::xul:tab[not(@'+TreeStyleTabService.kCOLLAPSED+'="true")]['+ 'child::xul:tab[not(@'+TreeStyleTabService.kCOLLAPSED+'="true")]['+
(aDir < 0 ? 'last()' : '1' )+ (aDir < 0 ? 'last()' : '1' )+
']', ']',
aSelf, aSelf,
XPathResult.FIRST_ORDERED_NODE_TYPE XPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue; ).singleNodeValue;
} }
@ -1143,51 +1143,50 @@ TreeStyleTabBrowser.prototype = {
case 'mousedown': case 'mousedown':
if (aEvent.currentTarget == this.mTabBrowser.mTabContainer) { if (aEvent.currentTarget == this.mTabBrowser.mTabContainer) {
this.onTabMouseDown(aEvent); this.onTabMouseDown(aEvent);
return;
} }
else { if (
if ( !this.tabbarResizing &&
!this.tabbarResizing && (
( aEvent.originalTarget.getAttribute('class') == this.kSPLITTER ||
aEvent.originalTarget.getAttribute('class') == this.kSPLITTER || aEvent.originalTarget.parentNode.getAttribute('class') == this.kSPLITTER
aEvent.originalTarget.parentNode.getAttribute('class') == this.kSPLITTER )
) ) {
) { this.tabbarResizing = true;
this.tabbarResizing = true; this.clearTabbarCanvas();
this.clearTabbarCanvas(); this.mTabBrowser.setAttribute(this.kRESIZING, true);
this.mTabBrowser.setAttribute(this.kRESIZING, true); if (this.isGecko19) {
if (this.isGecko19) { /* canvas
/* canvas まだ内部的にcanvasの大きさが残ったままなのでその大きさ以下に
まだ内部的にcanvasの大きさが残ったままなのでその大きさ以下に タブバーの幅を縮められなくなる手動でイベントを再送してやると
タブバーの幅を縮められなくなる手動でイベントを再送してやると この問題を防ぐことができる */
この問題を防ぐことができる */ aEvent.preventDefault();
aEvent.preventDefault(); aEvent.stopPropagation();
aEvent.stopPropagation(); var flags = 0;
var flags = 0; const nsIDOMNSEvent = Components.interfaces.nsIDOMNSEvent;
const nsIDOMNSEvent = Components.interfaces.nsIDOMNSEvent; if (aEvent.altKey) flags |= nsIDOMNSEvent.ALT_MASK;
if (aEvent.altKey) flags |= nsIDOMNSEvent.ALT_MASK; if (aEvent.ctrlKey) flags |= nsIDOMNSEvent.CONTROL_MASK;
if (aEvent.ctrlKey) flags |= nsIDOMNSEvent.CONTROL_MASK; if (aEvent.shiftKey) flags |= nsIDOMNSEvent.SHIFT_MASK;
if (aEvent.shiftKey) flags |= nsIDOMNSEvent.SHIFT_MASK; if (aEvent.metaKey) flags |= nsIDOMNSEvent.META_MASK;
if (aEvent.metaKey) flags |= nsIDOMNSEvent.META_MASK; window.setTimeout(function(aX, aY, aButton, aDetail) {
window.setTimeout(function(aX, aY, aButton, aDetail) { window
window .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindowUtils)
.getInterface(Components.interfaces.nsIDOMWindowUtils) .sendMouseEvent('mousedown', aX, aY, aButton, aDetail, flags);
.sendMouseEvent('mousedown', aX, aY, aButton, aDetail, flags); }, 0, aEvent.clientX, aEvent.clientY, aEvent.button, aEvent.detail);
}, 0, aEvent.clientX, aEvent.clientY, aEvent.button, aEvent.detail);
}
} }
this.cancelShowHideTabbarOnMousemove();
if (
this.autoHideEnabled &&
this.autoHideShown &&
(
aEvent.originalTarget.ownerDocument != document ||
!this.getTabBrowserFromChild(aEvent.originalTarget)
)
)
this.hideTabbar();
this.lastMouseDownTarget = aEvent.originalTarget.localName;
} }
this.cancelShowHideTabbarOnMousemove();
if (
this.autoHideEnabled &&
this.autoHideShown &&
(
aEvent.originalTarget.ownerDocument != document ||
!this.getTabBrowserFromChild(aEvent.originalTarget)
)
)
this.hideTabbar();
this.lastMouseDownTarget = aEvent.originalTarget.localName;
return; return;
case 'mouseup': case 'mouseup':
@ -1258,27 +1257,11 @@ TreeStyleTabBrowser.prototype = {
return; return;
case 'popupshowing': case 'popupshowing':
if (aEvent.target != aEvent.currentTarget) return; this.onPopupShowing(aEvent);
switch (aEvent.target.getAttribute('anonid'))
{
case 'tabContextMenu':
this.tabContextMenuShown = true;
this.initTabContextMenu(aEvent);
break;
case 'alltabs-popup':
this.initAllTabsPopup(aEvent);
break;
}
return; return;
case 'popuphiding': case 'popuphiding':
if (aEvent.target != aEvent.currentTarget) return; this.onPopupHiding(aEvent);
switch (aEvent.target.getAttribute('anonid'))
{
case 'tabContextMenu':
this.tabContextMenuShown = false;
break;
}
return; return;
case 'dragenter': case 'dragenter':
@ -1311,18 +1294,7 @@ TreeStyleTabBrowser.prototype = {
case 'overflow': case 'overflow':
case 'underflow': case 'underflow':
var box = aEvent.currentTarget; this.onTabbarOverflow(aEvent);
var tabs = this.mTabBrowser.mTabContainer;
var horizontal = tabs.orient == 'horizontal';
if (horizontal) return;
aEvent.stopPropagation();
if (aEvent.type == 'overflow') {
tabs.setAttribute('overflow', 'true');
box.scrollBoxObject.ensureElementIsVisible(tabs.selectedItem);
}
else {
tabs.removeAttribute('overflow');
}
return; return;
} }
}, },
@ -1771,10 +1743,10 @@ TreeStyleTabBrowser.prototype = {
}, },
getTabFromTabbarEvent : function(aEvent) getTabFromTabbarEvent : function(aEvent)
{ {
if ( if (
!this.shouldDetectClickOnIndentSpaces || !this.shouldDetectClickOnIndentSpaces ||
this.isEventFiredOnClickable(aEvent) this.isEventFiredOnClickable(aEvent)
) )
return null; return null;
var tab = null; var tab = null;
@ -1800,6 +1772,38 @@ TreeStyleTabBrowser.prototype = {
this.getTabFromEvent(aEvent).__treestyletab__preventSelect = true; this.getTabFromEvent(aEvent).__treestyletab__preventSelect = true;
}, },
onTabbarOverflow : function(aEvent)
{
var box = aEvent.currentTarget;
var tabs = this.mTabBrowser.mTabContainer;
var horizontal = tabs.orient == 'horizontal';
if (horizontal) return;
aEvent.stopPropagation();
if (aEvent.detail == 1) return;
if (aEvent.type == 'overflow') {
tabs.setAttribute('overflow', 'true');
box.scrollBoxObject.ensureElementIsVisible(tabs.selectedItem);
}
else {
tabs.removeAttribute('overflow');
}
},
onPopupShowing : function(aEvent)
{
if (aEvent.target != aEvent.currentTarget) return;
switch (aEvent.target.getAttribute('anonid'))
{
case 'tabContextMenu':
this.tabContextMenuShown = true;
this.initTabContextMenu(aEvent);
break;
case 'alltabs-popup':
this.initAllTabsPopup(aEvent);
break;
}
},
initTabContextMenu : function(aEvent) initTabContextMenu : function(aEvent)
{ {
var b = this.mTabBrowser; var b = this.mTabBrowser;
@ -1981,6 +1985,17 @@ TreeStyleTabBrowser.prototype = {
} }
}, },
onPopupHiding : function(aEvent)
{
if (aEvent.target != aEvent.currentTarget) return;
switch (aEvent.target.getAttribute('anonid'))
{
case 'tabContextMenu':
this.tabContextMenuShown = false;
break;
}
},
/* drag and drop */ /* drag and drop */
isPlatformNotSupported : /* !this.isGecko19 && */ navigator.platform.indexOf('Mac') != -1, // see bug 136524 isPlatformNotSupported : /* !this.isGecko19 && */ navigator.platform.indexOf('Mac') != -1, // see bug 136524
isTimerSupported : /* this.isGecko19 || */ navigator.platform.indexOf('Win') == -1, // see bug 232795. isTimerSupported : /* this.isGecko19 || */ navigator.platform.indexOf('Win') == -1, // see bug 232795.