3.7a4preでタブバーの空白領域上でのダブルクリックが認識されない問題に対応

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6447 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-25 10:53:39 +00:00
parent 4071e166ca
commit 8120ddb084
2 changed files with 53 additions and 34 deletions

View File

@ -350,6 +350,7 @@ var TreeStyleTabService = {
aObserver.addEventListener('dragover', this, true);
aObserver.addEventListener('dragleave', this, true);
aObserver.addEventListener('drop', this, true);
aObserver.addEventListener('dragend', this, true);
}
var canDropFunctionName = '_setEffectAllowedForDataTransfer' in aObserver ?
@ -505,6 +506,28 @@ var TreeStyleTabService = {
)
);
}
if ('_onDragEnd' in b) { // Firefox 3.6 or older
eval('b._onDragEnd = '+b._onDragEnd.toSource().replace(
/([^\{\}\(\);]*this\.replaceTabWithWindow\()/,
'if (this.treeStyleTab.isDraggingAllTabs(draggedTab)) return; $1'
).replace(
'{',
'{ var treeStyleTab = this.treeStyleTab;'
).replace(
/window\.screenX/g, 'gBrowser.boxObject.screenX'
).replace(
/window\.outerWidth/g, 'gBrowser.boxObject.width'
).replace(
/\.screenX/g, '[treeStyleTab.positionProp]'
).replace(
/\.width/g, '[treeStyleTab.sizeProp]'
).replace(
/\.screenY/g, '[treeStyleTab.invertedPositionProp]'
).replace(
/\.height/g, '[treeStyleTab.invertedSizeProp]'
));
}
},
destroyTabDNDObserver : function TSTService_destroyTabDNDObserver(aObserver)
{
@ -515,6 +538,7 @@ var TreeStyleTabService = {
aObserver.removeEventListener('dragover', this, true);
aObserver.removeEventListener('dragleave', this, true);
aObserver.removeEventListener('drop', this, true);
aObserver.removeEventListener('dragend', this, true);
}
},
@ -764,6 +788,15 @@ catch(e) {
aEvent.stopPropagation();
}
},
onTabDNDObserverDragEnd : function TSTService_onTabDNDObserverDragEnd(aEvent)
{
var tabbar = aEvent.currentTarget;
var b = tabbar.tabbrowser;
var sv = b.treeStyleTab;
var dt = aEvent.dataTransfer;
},
overrideGlobalFunctions : function TSTService_overrideGlobalFunctions()
{
@ -1215,6 +1248,7 @@ catch(e) {
case 'dragover': return this.onTabDNDObserverDragOver(aEvent);
case 'dragleave': return this.onTabDNDObserverDragLeave(aEvent);
case 'drop': return this.onTabDNDObserverDrop(aEvent);
case 'dragend': return this.onTabDNDObserverDragEnd(aEvent);
}
},

View File

@ -421,8 +421,7 @@ TreeStyleTabBrowser.prototype = {
)
);
/*
if ('' in b) { // Firefox 3.7-
if (b.tabContainer.tabbrowser == b) { // Firefox 3.7-
eval('b._handleKeyEvent = '+
b._handleKeyEvent.toSource().replace(
'this.moveTabOver(aEvent);',
@ -451,7 +450,7 @@ TreeStyleTabBrowser.prototype = {
)
);
}
else */if ('_keyEventHandler' in b) { // Firefox 3.6 or older
else if ('_keyEventHandler' in b) { // Firefox 3.6 or older
eval('b._keyEventHandler.handleEvent = '+
b._keyEventHandler.handleEvent.toSource().replace(
'this.tabbrowser.moveTabOver(aEvent);',
@ -516,37 +515,6 @@ TreeStyleTabBrowser.prototype = {
)
);
if ('onTabBarDblClick' in b) { // Firefox 3.6 or older
eval('b.onTabBarDblClick = '+
b.onTabBarDblClick.toSource().replace(
'aEvent.originalTarget.localName == "box"',
'/^(box|(arrow)?scrollbox|tabs)$/.test(aEvent.originalTarget.localName)'
)
);
}
if ('_onDragEnd' in b) {
eval('b._onDragEnd = '+b._onDragEnd.toSource().replace(
/([^\{\}\(\);]*this\.replaceTabWithWindow\()/,
'if (this.treeStyleTab.isDraggingAllTabs(draggedTab)) return; $1'
).replace(
'{',
'{ var treeStyleTab = this.treeStyleTab;'
).replace(
/window\.screenX/g, 'gBrowser.boxObject.screenX'
).replace(
/window\.outerWidth/g, 'gBrowser.boxObject.width'
).replace(
/\.screenX/g, '[treeStyleTab.positionProp]'
).replace(
/\.width/g, '[treeStyleTab.sizeProp]'
).replace(
/\.screenY/g, '[treeStyleTab.invertedPositionProp]'
).replace(
/\.height/g, '[treeStyleTab.invertedSizeProp]'
));
}
if ('_beginRemoveTab' in b) {
eval('b._beginRemoveTab = '+
b._beginRemoveTab.toSource().replace(
@ -2582,6 +2550,23 @@ TreeStyleTabBrowser.prototype = {
return this.resetTabbarSize();
default:
if (this.isVertical &&
/^(?:(?:arrow)?scrollbox|tabs)$/.test(aEvent.originalTarget.localName)) {
// re-send dblclick event from the inner-box of the scrollbox,
// because Firefox's event listener (to open new tabs) handles
// events only from the box.
let box = this.mTabBrowser.tabContainer.mTabstrip;
if (box && box._scrollbox) box = box._scrollbox;
if (box) box = document.getAnonymousNodes(box)[0];
if (box && box.localName == 'box') {
let event = document.createEvent('MouseEvents');
event.initMouseEvent('dblclick', true, true, window, aEvent.detail, aEvent.screenX, aEvent.screenY, aEvent.x, aEvent.y, aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey, aEvent.metaKey, aEvent.button, null);
box.dispatchEvent(event);
}
aEvent.preventDefault();
aEvent.stopPropagation();
return;
}
let tab = this.getTabFromEvent(aEvent);
if (tab &&
this.hasChildTabs(tab) &&