別メソッドに分離

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5673 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-12-26 08:03:35 +00:00
parent 5aac532c80
commit c5e4858203
2 changed files with 19 additions and 15 deletions

View File

@ -1323,19 +1323,7 @@ catch(e) {
event.initEvent('TreeStyleTabSubtreeClosing', true, true);
event.parent = aParentTab;
event.tabs = aClosedTabs;
if (!event.getPreventDefault) {
// getPreventDefault is available on any event on Gecko 1.9.2 or later.
// on Gecko 1.9.1 or before, UIEvents only have the method...
event.__original__preventDefault = event.preventDefault;
event.__canceled = false;
event.preventDefault = function() {
this.__original__preventDefault();
this.__canceled = true;
};
event.getPreventDefault = function() {
return this.__canceled;
};
}
this.ensureEventCancelable(event);
this.getTabBrowserFromChild(aParentTab).dispatchEvent(event);
return !event.getPreventDefault();
},

View File

@ -280,7 +280,7 @@ var TreeStyleTabUtils = {
return boxObject.getBoxObjectFor(aNode);
},
evalInSandbox : function TSTUtils_evalInSandbox(aCode, aOwner)
evalInSandbox : function TSTUtils_evalInSandbox(aCode, aOwner)
{
try {
var sandbox = new Components.utils.Sandbox(aOwner || 'about:blank');
@ -379,6 +379,22 @@ var TreeStyleTabUtils = {
// event
ensureEventCancelable : function(aEvent)
{
if (aEvent.getPreventDefault) return;
// getPreventDefault is available on any event on Gecko 1.9.2 or later.
// on Gecko 1.9.1 or before, UIEvents only have the method...
aEvent.__original__preventDefault = aEvent.preventDefault;
aEvent.__canceled = false;
aEvent.preventDefault = function() {
this.__original__preventDefault();
this.__canceled = true;
};
aEvent.getPreventDefault = function() {
return this.__canceled;
};
},
isNewTabAction : function TSTUtils_isNewTabAction(aEvent)
{
return aEvent.button == 1 || (aEvent.button == 0 && this.isAccelKeyPressed(aEvent));
@ -1494,7 +1510,7 @@ var TreeStyleTabUtils = {
_tabbarPositionHistory : [],
_tabbarPositionHistoryIndex : -1,
kMAX_TABBAR_POSITION_HISTORY : 999,
kMAX_TABBAR_POSITION_HISTORY : 999,
/* Pref Listener */