2009-09-03 02:24:06 -04:00
|
|
|
|
function TreeStyleTabBrowserAutoHide(aOwner)
|
|
|
|
|
{
|
|
|
|
|
this.mOwner = aOwner;
|
|
|
|
|
this.init();
|
|
|
|
|
}
|
|
|
|
|
TreeStyleTabBrowserAutoHide.prototype = {
|
2010-07-29 22:39:51 -04:00
|
|
|
|
__proto__ : TreeStyleTabService,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
kMODE : 'treestyletab-tabbar-autohide-mode',
|
|
|
|
|
kMODE_DISABLED : 0,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
kMODE_HIDE : 1,
|
|
|
|
|
kMODE_SHRINK : 2,
|
|
|
|
|
|
2009-09-03 22:11:51 -04:00
|
|
|
|
kAUTOHIDE : 'treestyletab-tabbar-autohide',
|
|
|
|
|
|
2009-12-17 21:56:45 -05:00
|
|
|
|
kSTATE : 'treestyletab-tabbar-autohide-state',
|
|
|
|
|
kSTATE_HIDDEN : 'hidden',
|
|
|
|
|
kSTATE_EXPANDED : 'expanded',
|
|
|
|
|
kSTATE_SHRUNKEN : 'shrunken',
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
kSHOWN_BY_UNKNOWN : 0,
|
|
|
|
|
kSHOWN_BY_SHORTCUT : 1 << 0,
|
|
|
|
|
kSHOWN_BY_MOUSEMOVE : 1 << 1,
|
|
|
|
|
kSHOWN_BY_FEEDBACK : 1 << 2,
|
|
|
|
|
kKEEP_SHOWN_ON_MOUSEOVER : (1 << 0) | (1 << 1) | (1 << 2),
|
2009-09-03 04:52:07 -04:00
|
|
|
|
|
|
|
|
|
kTRANSPARENT : 'treestyletab-tabbar-transparent',
|
|
|
|
|
kTRANSPARENT_NONE : 0,
|
|
|
|
|
kTRANSPARENT_PART : 1,
|
|
|
|
|
kTRANSPARENT_FULL : 2,
|
|
|
|
|
kTRANSPARENT_STYLE : ['none', 'part', 'full'],
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-09-09 22:17:00 -04:00
|
|
|
|
emulatedTransparency : TreeStyleTabService.Comparator.compare(TreeStyleTabService.XULAppInfo.version, '4.0b5') < 0,
|
|
|
|
|
|
2010-02-03 11:31:50 -05:00
|
|
|
|
get mode() /* PUBLIC API */
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var mode = this.mOwner.browser.getAttribute(this.kMODE);
|
|
|
|
|
return mode ? parseInt(mode) : this.kMODE_DISABLED ;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
set mode(aValue)
|
|
|
|
|
{
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.setAttribute(this.kMODE, aValue);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return aValue;
|
|
|
|
|
},
|
2009-12-17 22:20:35 -05:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
getMode : function TSTAutoHide_getMode(aTabBrowser)
|
|
|
|
|
{
|
|
|
|
|
var b = aTabBrowser || this.mOwner.browser;
|
|
|
|
|
var mode = b.getAttribute(this.kMODE);
|
|
|
|
|
return mode ? parseInt(mode) : this.kMODE_DISABLED ;
|
|
|
|
|
},
|
|
|
|
|
getModeForNormal : function TSTAutoHide_getModeForNormal(aTabBrowser)
|
|
|
|
|
{
|
|
|
|
|
var b = aTabBrowser || this.mOwner.browser;
|
2010-05-08 04:30:39 -04:00
|
|
|
|
return parseInt(b.getAttribute(this.kMODE+'-normal') || this.getTreePref('tabbar.autoHide.mode'));
|
2010-05-08 03:15:38 -04:00
|
|
|
|
},
|
2010-05-08 04:30:39 -04:00
|
|
|
|
getModeForFullScreen : function TSTAutoHide_getModeForFullScreen(aTabBrowser)
|
2010-05-08 03:15:38 -04:00
|
|
|
|
{
|
|
|
|
|
var b = aTabBrowser || this.mOwner.browser;
|
2010-05-08 04:30:39 -04:00
|
|
|
|
return parseInt(b.getAttribute(this.kMODE+'-fullscreen') || this.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
2010-05-08 03:15:38 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-17 22:20:35 -05:00
|
|
|
|
get state()
|
|
|
|
|
{
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return this.mOwner.browser.getAttribute(this.kSTATE) || this.kSTATE_EXPANDED;
|
2009-12-17 22:20:35 -05:00
|
|
|
|
},
|
|
|
|
|
get expanded()
|
|
|
|
|
{
|
|
|
|
|
return this.state == this.kSTATE_EXPANDED;
|
|
|
|
|
},
|
|
|
|
|
get shrunken()
|
|
|
|
|
{
|
|
|
|
|
return this.state == this.kSTATE_SHRUNKEN;
|
|
|
|
|
},
|
|
|
|
|
get hidden()
|
|
|
|
|
{
|
|
|
|
|
return this.state == this.kSTATE_HIDDEN;
|
|
|
|
|
},
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
updateMode : function TSTAutoHide_updateMode()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
this.end();
|
|
|
|
|
// update internal property after the appearance of the tab bar is updated.
|
|
|
|
|
window.setTimeout(function(aSelf) {
|
2010-05-08 03:15:38 -04:00
|
|
|
|
aSelf.mode = (window.fullScreen && aSelf.getPref('browser.fullscreen.autohide')) ?
|
2010-05-08 04:30:39 -04:00
|
|
|
|
aSelf.getModeForFullScreen() :
|
2010-05-08 03:15:38 -04:00
|
|
|
|
aSelf.getModeForNormal() ;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
if (aSelf.mode != aSelf.kMODE_DISABLED)
|
|
|
|
|
aSelf.start();
|
|
|
|
|
}, 0, this);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
togglerSize : 0,
|
|
|
|
|
sensitiveArea : 7,
|
|
|
|
|
|
|
|
|
|
get XOffset()
|
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
switch (this.mode)
|
|
|
|
|
{
|
2010-03-31 05:34:51 -04:00
|
|
|
|
case this.kMODE_DISABLED:
|
|
|
|
|
return 0;
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
case this.kMODE_HIDE:
|
2009-09-03 04:18:41 -04:00
|
|
|
|
let offset = this.width + this.splitterWidth;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
if (sv.currentTabbarPosition == 'left') {
|
2009-09-03 02:24:06 -04:00
|
|
|
|
offset -= this.togglerSize;
|
|
|
|
|
}
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case this.kMODE_SHRINK:
|
|
|
|
|
return this.getTreePref('tabbar.width')
|
2010-03-31 04:35:29 -04:00
|
|
|
|
- this.getTreePref('tabbar.shrunkenWidth');
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
get YOffset()
|
|
|
|
|
{
|
2009-09-03 04:18:41 -04:00
|
|
|
|
return this.height;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
2010-03-31 04:35:29 -04:00
|
|
|
|
extraXOffset : 0,
|
|
|
|
|
extraYOffset : 0,
|
|
|
|
|
|
|
|
|
|
get currentXOffset()
|
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
return (
|
2010-05-08 01:37:41 -04:00
|
|
|
|
sv.currentTabbarPosition == 'left' &&
|
2010-03-31 04:35:29 -04:00
|
|
|
|
this.mode != this.kMODE_DISABLED &&
|
|
|
|
|
this.expanded
|
|
|
|
|
) ? this.XOffset : 0 ;
|
|
|
|
|
},
|
|
|
|
|
get currentYOffset()
|
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
return (
|
2010-05-08 01:37:41 -04:00
|
|
|
|
sv.currentTabbarPosition == 'top' &&
|
2010-03-31 04:35:29 -04:00
|
|
|
|
this.mode != this.kMODE_DISABLED &&
|
|
|
|
|
this.expanded
|
|
|
|
|
) ? this.YOffset : 0 ;
|
|
|
|
|
},
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
start : function TSTAutoHide_start()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (this.enabled) return;
|
|
|
|
|
this.enabled = true;
|
|
|
|
|
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
sv.browser.addEventListener('mousedown', this, true);
|
|
|
|
|
sv.browser.addEventListener('mouseup', this, true);
|
2010-03-25 23:17:16 -04:00
|
|
|
|
if (sv.isFloating) {
|
2010-03-24 14:55:34 -04:00
|
|
|
|
sv.tabStrip.addEventListener('mousedown', this, true);
|
|
|
|
|
sv.tabStrip.addEventListener('mouseup', this, true);
|
|
|
|
|
}
|
2009-12-24 10:01:23 -05:00
|
|
|
|
window.addEventListener('resize', this, true);
|
2010-05-08 03:15:38 -04:00
|
|
|
|
sv.browser.addEventListener('load', this, true);
|
|
|
|
|
sv.browser.mPanelContainer.addEventListener('scroll', this, true);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
if (this.shouldListenMouseMove)
|
|
|
|
|
this.startListenMouseMove();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
if (sv.browser == gBrowser && sv.shouldListenKeyEventsForAutoHide)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
TreeStyleTabService.startListenKeyEventsFor(sv.LISTEN_FOR_AUTOHIDE);
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.clearBG();
|
|
|
|
|
this.updateTransparency();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideInternal();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
end : function TSTAutoHide_end()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (!this.enabled) return;
|
|
|
|
|
this.enabled = false;
|
|
|
|
|
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (!this.expanded)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideInternal();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
sv.browser.removeEventListener('mousedown', this, true);
|
|
|
|
|
sv.browser.removeEventListener('mouseup', this, true);
|
2010-03-25 23:17:16 -04:00
|
|
|
|
if (sv.isFloating) {
|
2010-03-24 14:55:34 -04:00
|
|
|
|
sv.tabStrip.removeEventListener('mousedown', this, true);
|
|
|
|
|
sv.tabStrip.removeEventListener('mouseup', this, true);
|
|
|
|
|
}
|
2009-12-24 10:01:23 -05:00
|
|
|
|
window.removeEventListener('resize', this, true);
|
2010-05-08 03:15:38 -04:00
|
|
|
|
sv.browser.removeEventListener('load', this, true);
|
|
|
|
|
sv.browser.mPanelContainer.removeEventListener('scroll', this, true);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.endListenMouseMove();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
if (sv.browser == gBrowser)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
TreeStyleTabService.endListenKeyEventsFor(sv.LISTEN_FOR_AUTOHIDE);
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.clearBG();
|
|
|
|
|
this.updateTransparency();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
sv.container.style.margin = 0;
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.removeTabbrowserAttribute(this.kAUTOHIDE);
|
|
|
|
|
sv.removeTabbrowserAttribute(this.kSTATE);
|
|
|
|
|
sv.removeTabbrowserAttribute(this.kTRANSPARENT);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// fullscreen
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
startForFullScreen : function TSTAutoHide_startForFullScreen()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mode = this.getMode();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.end();
|
|
|
|
|
this.mode = this.getPref('browser.fullscreen.autohide') ?
|
2010-05-08 04:30:39 -04:00
|
|
|
|
this.getModeForFullScreen() :
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.kMODE_DISABLED ;
|
|
|
|
|
if (this.mode != this.kMODE_DISABLED) {
|
|
|
|
|
this.start();
|
2010-03-31 05:34:51 -04:00
|
|
|
|
this.mOwner.removeTabbrowserAttribute('moz-collapsed');
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
endForFullScreen : function TSTAutoHide_endForFullScreen()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-05-08 04:30:39 -04:00
|
|
|
|
this.mode = this.getModeForFullScreen();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.end();
|
|
|
|
|
this.mode = this.getTreePref('tabbar.autoHide.mode');
|
|
|
|
|
this.mOwner.checkTabsIndentOverflow();
|
|
|
|
|
if (this.mode != this.kMODE_DISABLED)
|
|
|
|
|
this.start();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// mousemove
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
startListenMouseMove : function TSTAutoHide_startListenMouseMove()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (this.mouseMoveListening) return;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.addEventListener('mousemove', this, true);
|
2010-03-25 23:17:16 -04:00
|
|
|
|
if (this.mOwner.isFloating)
|
2010-03-24 14:55:34 -04:00
|
|
|
|
this.mOwner.tabStrip.addEventListener('mousemove', this, true);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.mouseMoveListening = true;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
endListenMouseMove : function TSTAutoHide_endListenMouseMove()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (!this.mouseMoveListening) return;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.removeEventListener('mousemove', this, true);
|
2010-03-25 23:17:16 -04:00
|
|
|
|
if (this.mOwner.isFloating)
|
2010-03-24 14:55:34 -04:00
|
|
|
|
this.mOwner.tabStrip.removeEventListener('mousemove', this, true);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.mouseMoveListening = false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
get shouldListenMouseMove()
|
|
|
|
|
{
|
|
|
|
|
return this.getTreePref('tabbar.autoShow.mousemove') ||
|
|
|
|
|
this.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
|
|
|
|
this.getTreePref('tabbar.autoShow.tabSwitch') ||
|
|
|
|
|
this.getTreePref('tabbar.autoShow.feedback');
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
showHideOnMousemove : function TSTAutoHide_showHideOnMousemove(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if ('gestureInProgress' in window && window.gestureInProgress) return;
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.cancelShowHideOnMousemove();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var box = b.mCurrentBrowser.boxObject;
|
|
|
|
|
|
2010-09-09 22:39:39 -04:00
|
|
|
|
if (!this.emulatedTransparency && this.expanded) { // Firefox 4.0-
|
|
|
|
|
box = {
|
|
|
|
|
screenX : box.screenX + this.XOffset,
|
|
|
|
|
screenY : box.screenY,
|
|
|
|
|
width : box.width - this.XOffset,
|
|
|
|
|
height : box.height
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var sensitiveArea = this.sensitiveArea;
|
|
|
|
|
/* For resizing of shrunken tab bar and clicking closeboxes,
|
|
|
|
|
we have to shrink sensitive area a little. */
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.shrunken) {
|
2009-09-03 02:24:06 -04:00
|
|
|
|
sensitiveArea = 0;
|
|
|
|
|
if (pos != 'right' || b.getAttribute(this.kTAB_INVERTED) == 'true')
|
|
|
|
|
sensitiveArea -= 20;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var shouldKeepShown = (
|
|
|
|
|
pos == 'left' ?
|
|
|
|
|
(aEvent.screenX <= box.screenX + sensitiveArea) :
|
|
|
|
|
pos == 'right' ?
|
|
|
|
|
(aEvent.screenX >= box.screenX + box.width - sensitiveArea) :
|
|
|
|
|
pos == 'bottom' ?
|
|
|
|
|
(aEvent.screenY >= box.screenY + box.height - sensitiveArea) :
|
|
|
|
|
(aEvent.screenY <= box.screenY + sensitiveArea)
|
|
|
|
|
);
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded) {
|
2009-09-03 02:24:06 -04:00
|
|
|
|
if (
|
|
|
|
|
shouldKeepShown &&
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideReason & this.kKEEP_SHOWN_ON_MOUSEOVER &&
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.getTreePref('tabbar.autoShow.keepShownOnMouseover')
|
|
|
|
|
) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideReason = this.kSHOWN_BY_MOUSEMOVE;
|
2009-09-03 03:25:37 -04:00
|
|
|
|
this.cancelDelayedShowForShortcut();
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.cancelHideForFeedback();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
else if (
|
|
|
|
|
!shouldKeepShown &&
|
|
|
|
|
this.getTreePref('tabbar.autoShow.mousemove')
|
|
|
|
|
) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideOnMousemoveTimer = window.setTimeout(
|
2009-09-03 02:24:06 -04:00
|
|
|
|
function(aSelf) {
|
2009-09-03 03:25:37 -04:00
|
|
|
|
aSelf.cancelDelayedShowForShortcut();
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (aSelf.showHideReason == aSelf.kSHOWN_BY_MOUSEMOVE)
|
|
|
|
|
aSelf.hide(aSelf.kSHOWN_BY_MOUSEMOVE);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
this.getTreePref('tabbar.autoHide.delay'),
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (
|
|
|
|
|
pos == 'left' ?
|
|
|
|
|
(aEvent.screenX <= box.screenX + sensitiveArea) :
|
|
|
|
|
pos == 'right' ?
|
|
|
|
|
(aEvent.screenX >= box.screenX + box.width - sensitiveArea) :
|
|
|
|
|
pos == 'bottom' ?
|
|
|
|
|
(aEvent.screenY >= box.screenY + box.height - sensitiveArea) :
|
|
|
|
|
(aEvent.screenY <= box.screenY + sensitiveArea)
|
|
|
|
|
) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideOnMousemoveTimer = window.setTimeout(
|
2009-09-03 02:24:06 -04:00
|
|
|
|
function(aSelf) {
|
2009-09-03 03:25:37 -04:00
|
|
|
|
aSelf.cancelDelayedShowForShortcut();
|
2009-09-03 04:18:41 -04:00
|
|
|
|
aSelf.cancelHideForFeedback();
|
|
|
|
|
aSelf.show(aSelf.kSHOWN_BY_MOUSEMOVE);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
this.getTreePref('tabbar.autoHide.delay'),
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = null;
|
|
|
|
|
pos = null
|
|
|
|
|
box = null;
|
|
|
|
|
sensitiveArea = null;
|
|
|
|
|
shouldKeepShown = null;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
cancelShowHideOnMousemove : function TSTAutoHide_cancelShowHideOnMousemove()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (this.showHideOnMousemoveTimer) {
|
|
|
|
|
window.clearTimeout(this.showHideOnMousemoveTimer);
|
|
|
|
|
this.showHideOnMousemoveTimer = null;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// feedback
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
showForFeedback : function TSTAutoHide_showForFeedback()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (!this.enabled ||
|
|
|
|
|
!this.getTreePref('tabbar.autoShow.feedback'))
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (this.delayedShowForFeedbackTimer) {
|
|
|
|
|
window.clearTimeout(this.delayedShowForFeedbackTimer);
|
|
|
|
|
this.delayedShowForFeedbackTimer = null;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.cancelHideForFeedback();
|
|
|
|
|
this.delayedShowForFeedbackTimer = window.setTimeout(
|
2009-09-03 02:24:06 -04:00
|
|
|
|
function(aSelf) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
aSelf.delayedShowForFeedbackTimer = null;
|
|
|
|
|
aSelf.delayedShowForFeedback();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
100,
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
delayedShowForFeedback : function TSTAutoHide_delayedShowForFeedback()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.show(this.kSHOWN_BY_FEEDBACK);
|
|
|
|
|
this.cancelHideForFeedback();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.delayedHideTabbarForFeedbackTimer = window.setTimeout(
|
|
|
|
|
function(aSelf) {
|
|
|
|
|
aSelf.delayedHideTabbarForFeedbackTimer = null;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (aSelf.showHideReason == aSelf.kSHOWN_BY_FEEDBACK)
|
|
|
|
|
aSelf.hide();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
this.getTreePref('tabbar.autoShow.feedback.delay'),
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
cancelHideForFeedback : function TSTAutoHide_cancelHideForFeedback()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (this.delayedHideTabbarForFeedbackTimer) {
|
|
|
|
|
window.clearTimeout(this.delayedHideTabbarForFeedbackTimer);
|
|
|
|
|
this.delayedHideTabbarForFeedbackTimer = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
setWidth : function TSTAutoHide_setWidth(aWidth, aForceExpanded)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (aForceExpanded ||
|
2009-12-17 22:20:35 -05:00
|
|
|
|
this.expanded ||
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.mode != this.kMODE_SHRINK)
|
2010-04-22 04:12:31 -04:00
|
|
|
|
this.setTreePref('tabbar.width', this.mOwner.maxTabbarWidth(aWidth));
|
2009-09-03 02:24:06 -04:00
|
|
|
|
else
|
2010-04-22 04:12:31 -04:00
|
|
|
|
this.setTreePref('tabbar.shrunkenWidth', this.mOwner.maxTabbarWidth(aWidth));
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
updateMenuItem : function TSTAutoHide_updateMenuItem(aNode)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (this.mode != this.kMODE_DISABLED)
|
|
|
|
|
aNode.setAttribute('checked', true);
|
|
|
|
|
else
|
|
|
|
|
aNode.removeAttribute('checked');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// show/hide tabbar
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
get width()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded) {
|
2010-03-31 04:35:29 -04:00
|
|
|
|
this._width = this.mOwner.tabStrip.boxObject.width || this._width;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
return this._width;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
2009-09-03 04:18:41 -04:00
|
|
|
|
set width(aNewWidth)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this._width = aNewWidth;
|
|
|
|
|
return this._width;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
2009-09-03 04:18:41 -04:00
|
|
|
|
_width : 0,
|
2009-09-03 03:25:37 -04:00
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
get widthFromMode()
|
2009-09-03 03:25:37 -04:00
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
return (this.shrunken) ?
|
2009-09-03 03:25:37 -04:00
|
|
|
|
this.getTreePref('tabbar.shrunkenWidth') :
|
|
|
|
|
this.getTreePref('tabbar.width') ;
|
|
|
|
|
},
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
get height()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded) {
|
2010-03-23 09:33:00 -04:00
|
|
|
|
this._height = this.mOwner.tabStrip.boxObject.height;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
return this._height;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
2009-09-03 04:18:41 -04:00
|
|
|
|
set height(aNewHeight)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this._height = aNewHeight;
|
|
|
|
|
return this._height;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
2009-09-03 04:18:41 -04:00
|
|
|
|
_height : 0,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
get splitterWidth()
|
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded) {
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var splitter = document.getAnonymousElementByAttribute(this.mOwner.browser, 'class', this.kSPLITTER);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this._splitterWidth = (splitter ? splitter.boxObject.width : 0 );
|
|
|
|
|
}
|
|
|
|
|
return this._splitterWidth;
|
|
|
|
|
},
|
|
|
|
|
set splitterWidth(aNewWidth)
|
|
|
|
|
{
|
|
|
|
|
this._splitterWidth = aNewWidth;
|
|
|
|
|
return this._splitterWidth;
|
|
|
|
|
},
|
|
|
|
|
_splitterWidth : 0,
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
showHideInternal : function TSTAutoHide_showHideInternal(aReason)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-09-09 22:39:39 -04:00
|
|
|
|
if (this.emulatedTransparency)
|
|
|
|
|
this.stopRendering();
|
2009-12-17 04:37:25 -05:00
|
|
|
|
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded) { // to be hidden or shrunken
|
2009-12-17 04:37:25 -05:00
|
|
|
|
this.onHiding();
|
|
|
|
|
this.showHideReason = aReason || this.kSHOWN_BY_UNKNOWN;
|
2010-07-01 22:47:12 -04:00
|
|
|
|
this.resetContentAreas();
|
2009-12-17 04:37:25 -05:00
|
|
|
|
}
|
|
|
|
|
else { // to be shown or expanded
|
|
|
|
|
this.onShowing();
|
|
|
|
|
this.showHideReason = aReason || this.kSHOWN_BY_UNKNOWN;
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-17 04:37:25 -05:00
|
|
|
|
this.fireStateChangingEvent();
|
|
|
|
|
|
2010-03-31 14:24:23 -04:00
|
|
|
|
if (this.expanded) {
|
|
|
|
|
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show');
|
|
|
|
|
this.redrawContentArea();
|
|
|
|
|
}
|
|
|
|
|
b.mTabContainer.adjustTabstrip();
|
|
|
|
|
sv.checkTabsIndentOverflow();
|
|
|
|
|
|
2009-12-17 04:37:25 -05:00
|
|
|
|
window.setTimeout(function(aSelf) {
|
|
|
|
|
aSelf.redrawContentArea();
|
|
|
|
|
aSelf.fireStateChangeEvent();
|
2010-09-09 22:39:39 -04:00
|
|
|
|
if (aSelf.emulatedTransparency)
|
|
|
|
|
aSelf.startRendering();
|
2009-12-17 04:37:25 -05:00
|
|
|
|
}, 0, this);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2010-02-03 11:31:50 -05:00
|
|
|
|
show : function TSTAutoHide_show(aReason) /* PUBLIC API */
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (!this.expanded)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideInternal(aReason);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2010-02-03 11:31:50 -05:00
|
|
|
|
hide : function TSTAutoHide_hide(aReason) /* PUBLIC API */
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.expanded)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideInternal(aReason);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onShowing : function TSTAutoHide_onShowing()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2010-09-09 22:39:39 -04:00
|
|
|
|
if (this.emulatedTransparency) { // -Firefox 3.6
|
|
|
|
|
switch (pos)
|
|
|
|
|
{
|
|
|
|
|
case 'left':
|
|
|
|
|
sv.container.style.marginRight = '-'+this.XOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
case 'right':
|
|
|
|
|
sv.container.style.marginLeft = '-'+this.XOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
case 'bottom':
|
|
|
|
|
sv.container.style.marginTop = '-'+this.YOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sv.container.style.marginBottom = '-'+this.YOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_EXPANDED);
|
2009-12-17 21:56:45 -05:00
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
switch (this.mode)
|
|
|
|
|
{
|
2010-03-31 05:34:51 -04:00
|
|
|
|
case this.kMODE_DISABLED:
|
2009-09-03 02:24:06 -04:00
|
|
|
|
case this.kMODE_HIDE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case this.kMODE_SHRINK:
|
2010-09-09 22:39:39 -04:00
|
|
|
|
if (pos == 'left' || pos == 'right') {
|
|
|
|
|
let width = sv.maxTabbarWidth(this.getTreePref('tabbar.width'));
|
|
|
|
|
if (this.emulatedTransparency) // -Firefox 3.6
|
|
|
|
|
sv.setTabStripAttribute('width', width);
|
|
|
|
|
else // Firefox 4.0-
|
|
|
|
|
sv.updateFloatingTabbar(width, 0, true);
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onHiding : function TSTAutoHide_onHiding()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-03-25 23:17:16 -04:00
|
|
|
|
var box = (sv.tabStripPlaceHolder || sv.tabStrip).boxObject;
|
2010-03-24 14:55:34 -04:00
|
|
|
|
|
|
|
|
|
this.tabbarHeight = box.height;
|
2010-03-31 04:35:29 -04:00
|
|
|
|
this.width = box.width || this.width;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var splitter = document.getAnonymousElementByAttribute(b, 'class', sv.kSPLITTER);
|
|
|
|
|
this.splitterWidth = (splitter ? splitter.boxObject.width : 0 );
|
2010-09-09 22:39:39 -04:00
|
|
|
|
|
|
|
|
|
if (this.emulatedTransparency) { // -Firefox 3.6
|
|
|
|
|
sv.container.style.margin = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
switch (this.mode)
|
|
|
|
|
{
|
2010-03-31 05:34:51 -04:00
|
|
|
|
case this.kMODE_DISABLED:
|
2009-09-03 02:24:06 -04:00
|
|
|
|
case this.kMODE_HIDE:
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'hidden');
|
|
|
|
|
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_HIDDEN);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case this.kMODE_SHRINK:
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show');
|
|
|
|
|
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN);
|
2010-03-24 14:55:34 -04:00
|
|
|
|
if (pos == 'left' || pos == 'right') {
|
2010-03-25 23:17:16 -04:00
|
|
|
|
sv.setTabStripAttribute('width', this.getTreePref('tabbar.shrunkenWidth'));
|
2010-09-09 22:39:39 -04:00
|
|
|
|
sv.updateFloatingTabbar(0, 0, true);
|
2010-03-24 14:55:34 -04:00
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
fireStateChangingEvent : function TSTAutoHide_fireStateChangingEvent()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
/* PUBLIC API */
|
|
|
|
|
var event = document.createEvent('Events');
|
2009-12-25 22:55:02 -05:00
|
|
|
|
event.initEvent('TreeStyleTabAutoHideStateChanging', true, false);
|
2009-12-17 22:20:35 -05:00
|
|
|
|
event.shown = this.expanded;
|
|
|
|
|
event.state = this.state;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.dispatchEvent(event);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
fireStateChangeEvent : function TSTAutoHide_fireStateChangeEvent()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
/* PUBLIC API */
|
|
|
|
|
var event = document.createEvent('Events');
|
2009-12-25 22:55:02 -05:00
|
|
|
|
event.initEvent('TreeStyleTabAutoHideStateChange', true, false);
|
2009-12-17 22:20:35 -05:00
|
|
|
|
event.shown = this.expanded;
|
|
|
|
|
event.state = this.state;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
event.xOffset = this.XOffset;
|
|
|
|
|
event.yOffset = this.YOffset;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.dispatchEvent(event);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
redrawContentArea : function TSTAutoHide_redrawContentArea()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
if (!this.emulatedTransparency)
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
try {
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var v = sv.browser.markupDocumentViewer;
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.shouldRedraw) {
|
2010-05-08 03:15:38 -04:00
|
|
|
|
if (sv.browser.hasAttribute(this.kTRANSPARENT) &&
|
|
|
|
|
sv.browser.getAttribute(this.kTRANSPARENT) != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE])
|
2009-12-24 10:01:23 -05:00
|
|
|
|
this.drawBG();
|
|
|
|
|
else
|
|
|
|
|
this.clearBG();
|
|
|
|
|
|
2010-03-31 04:35:29 -04:00
|
|
|
|
v.move(window.outerWidth, window.outerHeight);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
v.move(
|
|
|
|
|
(
|
|
|
|
|
pos == 'left' ? -this.XOffset :
|
|
|
|
|
pos == 'right' ? this.XOffset :
|
|
|
|
|
0
|
2010-03-31 04:35:29 -04:00
|
|
|
|
) - this.extraXOffset,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
(
|
|
|
|
|
pos == 'top' ? -this.YOffset :
|
|
|
|
|
pos == 'bottom' ? this.YOffset :
|
|
|
|
|
0
|
2010-03-31 04:35:29 -04:00
|
|
|
|
) - this.extraYOffset
|
2009-09-03 02:24:06 -04:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2009-12-24 10:01:23 -05:00
|
|
|
|
this.clearBG();
|
2010-03-31 04:35:29 -04:00
|
|
|
|
v.move(window.outerWidth, window.outerHeight);
|
|
|
|
|
v.move(-this.extraXOffset, -this.extraYOffset);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(e) {
|
2010-03-24 15:23:21 -04:00
|
|
|
|
dump(e);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
2010-03-31 04:35:29 -04:00
|
|
|
|
redrawContentAreaWithDelay : function TSTAutoHide_redrawContentAreaWithDelay()
|
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
if (!this.emulatedTransparency)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-03-31 04:35:29 -04:00
|
|
|
|
window.setTimeout(function(aSelf) {
|
|
|
|
|
aSelf.redrawContentArea();
|
|
|
|
|
}, 0, this);
|
|
|
|
|
},
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-07-01 22:47:12 -04:00
|
|
|
|
resetContentAreas : function TSTAutoHide_resetContentAreas()
|
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
if (!this.emulatedTransparency)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-07-01 22:47:12 -04:00
|
|
|
|
this.mOwner.getTabsArray(this.mOwner.browser).forEach(function(aTab) {
|
|
|
|
|
try {
|
|
|
|
|
aTab.linkedBrowser.markupDocumentViewer.move(0, 0);
|
|
|
|
|
}
|
|
|
|
|
catch(e) {
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-17 04:37:25 -05:00
|
|
|
|
get shouldRedraw()
|
2009-09-08 21:55:48 -04:00
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
return this.emulatedTransparency && this.enabled && this.expanded;
|
2009-09-08 21:55:48 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
drawBG : function TSTAutoHide_drawBG()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
if (!this.emulatedTransparency)
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (!this.tabbarCanvas || this.isResizing) return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-24 10:01:23 -05:00
|
|
|
|
this.tabbarCanvas.style.width = (this.tabbarCanvas.width = 1)+'px';
|
|
|
|
|
this.tabbarCanvas.style.height = (this.tabbarCanvas.height = 1)+'px';
|
|
|
|
|
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var frame = sv.browser.contentWindow;
|
|
|
|
|
var tabContainerBox = sv.browser.mTabContainer.boxObject;
|
|
|
|
|
var browserBox = sv.browser.mCurrentBrowser.boxObject;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var contentBox = sv.getBoxObjectFor(frame.document.documentElement);
|
|
|
|
|
|
2009-12-17 04:37:25 -05:00
|
|
|
|
var zoom = this.getZoomForFrame(frame);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
var x = (pos == 'right') ? browserBox.width - this.XOffset : 0 ;
|
|
|
|
|
var y = (pos == 'bottom') ? browserBox.height - this.YOffset : 0 ;
|
|
|
|
|
if (pos == 'left' && this.mode == this.kMODE_HIDE)
|
|
|
|
|
x -= this.togglerSize;
|
2010-03-31 04:35:29 -04:00
|
|
|
|
x += this.extraXOffset;
|
|
|
|
|
y += this.extraYOffset;
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var xOffset = (zoom == 1 && (pos == 'top' || pos == 'bottom')) ?
|
2010-03-31 04:35:29 -04:00
|
|
|
|
Math.max(0, contentBox.screenX + frame.scrollX - browserBox.screenX) :
|
2009-09-03 02:24:06 -04:00
|
|
|
|
0 ;
|
|
|
|
|
var yOffset = (zoom == 1 && (pos == 'left' || pos == 'right')) ?
|
2010-03-31 04:35:29 -04:00
|
|
|
|
Math.max(0, contentBox.screenY + frame.scrollY - browserBox.screenY) :
|
2009-09-03 02:24:06 -04:00
|
|
|
|
0 ;
|
2010-03-31 04:35:29 -04:00
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var w = tabContainerBox.width - xOffset;
|
|
|
|
|
var h = tabContainerBox.height - yOffset;
|
2010-03-31 04:35:29 -04:00
|
|
|
|
w -= this.extraXOffset;
|
|
|
|
|
h -= this.extraYOffset;
|
2009-12-17 00:55:45 -05:00
|
|
|
|
|
|
|
|
|
var canvasXOffset = 0;
|
|
|
|
|
var canvasYOffset = 0;
|
2009-12-16 21:29:20 -05:00
|
|
|
|
if (pos == 'top' || pos == 'bottom')
|
2010-05-08 03:15:38 -04:00
|
|
|
|
canvasXOffset = tabContainerBox.screenX - sv.browser.boxObject.screenX;
|
2009-12-16 21:29:20 -05:00
|
|
|
|
else
|
2010-05-08 03:15:38 -04:00
|
|
|
|
canvasYOffset = tabContainerBox.screenY - sv.browser.boxObject.screenY;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
for (let node = this.tabbarCanvas;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
node != sv.browser.mTabBox;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
node = node.parentNode)
|
|
|
|
|
{
|
|
|
|
|
let style = window.getComputedStyle(node, null);
|
|
|
|
|
'border-left-width,border-right-width,margin-left,margin-right,padding-left,padding-right'
|
|
|
|
|
.split(',').forEach(function(aProperty) {
|
|
|
|
|
let value = sv.getPropertyPixelValue(style, aProperty);
|
|
|
|
|
w -= value;
|
|
|
|
|
if (aProperty.indexOf('left') < -1) x += value;
|
|
|
|
|
}, this);
|
|
|
|
|
'border-top-width,border-bottom-width,margin-top,margin-bottom,padding-left,padding-right'
|
|
|
|
|
.split(',').forEach(function(aProperty) {
|
|
|
|
|
let value = sv.getPropertyPixelValue(style, aProperty);
|
|
|
|
|
h -= value;
|
|
|
|
|
if (aProperty.indexOf('top') < -1) y += value;
|
|
|
|
|
}, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// zero width (heigh) canvas becomes wrongly size!!
|
|
|
|
|
w = Math.max(1, w);
|
|
|
|
|
h = Math.max(1, h);
|
|
|
|
|
|
|
|
|
|
this.tabbarCanvas.style.display = 'inline';
|
2009-12-17 00:55:45 -05:00
|
|
|
|
this.tabbarCanvas.style.margin = (yOffset)+'px 0 0 '+(xOffset)+'px';
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.tabbarCanvas.style.width = (this.tabbarCanvas.width = w)+'px';
|
|
|
|
|
this.tabbarCanvas.style.height = (this.tabbarCanvas.height = h)+'px';
|
2010-03-31 04:35:29 -04:00
|
|
|
|
|
|
|
|
|
w += this.extraXOffset;
|
|
|
|
|
h += this.extraYOffset;
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var ctx = this.tabbarCanvas.getContext('2d');
|
|
|
|
|
ctx.clearRect(0, 0, w, h);
|
|
|
|
|
ctx.save();
|
|
|
|
|
if (this.mode == this.kMODE_SHRINK) {
|
|
|
|
|
var offset = this.getTreePref('tabbar.shrunkenWidth') + this.splitterWidth;
|
|
|
|
|
if (pos == 'left')
|
|
|
|
|
ctx.translate(offset, 0);
|
|
|
|
|
else
|
|
|
|
|
x += this.splitterWidth;
|
|
|
|
|
w -= offset;
|
|
|
|
|
}
|
|
|
|
|
ctx.globalAlpha = 1;
|
|
|
|
|
if (pos == 'left' || pos == 'right') {
|
|
|
|
|
ctx.fillStyle = this.splitterBorderColor;
|
|
|
|
|
ctx.fillRect((pos == 'left' ? -1 : w+1 ), 0, 1, h);
|
|
|
|
|
}
|
|
|
|
|
ctx.save();
|
|
|
|
|
ctx.scale(zoom, zoom);
|
|
|
|
|
ctx.drawWindow(
|
|
|
|
|
frame,
|
2009-12-17 00:55:45 -05:00
|
|
|
|
(x / zoom)+frame.scrollX+canvasXOffset,
|
|
|
|
|
(y / zoom)+frame.scrollY+canvasYOffset,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
w / zoom,
|
|
|
|
|
h / zoom,
|
|
|
|
|
'-moz-field'
|
|
|
|
|
);
|
|
|
|
|
ctx.restore();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
if (sv.browser.getAttribute(this.kTRANSPARENT) != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_FULL]) {
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var alpha = Number(this.getTreePref('tabbar.transparent.partialTransparency'));
|
|
|
|
|
if (isNaN(alpha)) alpha = 0.25;
|
|
|
|
|
ctx.globalAlpha = alpha;
|
|
|
|
|
ctx.fillStyle = 'black';
|
|
|
|
|
ctx.fillRect(0, 0, w, h);
|
|
|
|
|
}
|
|
|
|
|
ctx.restore();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
get splitterBorderColor()
|
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
var borderNode = this.getTreePref(
|
|
|
|
|
sv.isVertical ?
|
|
|
|
|
'tabbar.fixed.vertical' :
|
|
|
|
|
'tabbar.fixed.horizontal'
|
|
|
|
|
) ?
|
2010-03-23 09:33:00 -04:00
|
|
|
|
sv.tabStrip :
|
2010-05-08 03:15:38 -04:00
|
|
|
|
document.getAnonymousElementByAttribute(sv.browser, 'class', sv.kSPLITTER) ;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var prop = pos == 'left' ? 'right' :
|
|
|
|
|
pos == 'right' ? 'left' :
|
|
|
|
|
pos == 'top' ? 'bottom' :
|
|
|
|
|
'top' ;
|
|
|
|
|
|
|
|
|
|
var borderColor = window.getComputedStyle(borderNode, null).getPropertyValue('-moz-border-'+prop+'-colors');
|
|
|
|
|
if (borderColor == 'none')
|
|
|
|
|
borderRight = window.getComputedStyle(borderNode, null).getPropertyValue('border-'+prop+'-color');
|
|
|
|
|
|
|
|
|
|
/rgba?\(([^,]+),([^,]+),([^,]+)(,.*)?\)/.test(borderColor);
|
|
|
|
|
|
|
|
|
|
return 'rgb('+[
|
|
|
|
|
parseInt(parseInt(RegExp.$1) * 0.8),
|
|
|
|
|
parseInt(parseInt(RegExp.$2) * 0.8),
|
|
|
|
|
parseInt(parseInt(RegExp.$3) * 0.8)
|
|
|
|
|
].join(',')+')';
|
|
|
|
|
},
|
2009-12-17 04:37:25 -05:00
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
getZoomForFrame : function TSTAutoHide_getZoomForFrame(aFrame)
|
2009-12-17 04:37:25 -05:00
|
|
|
|
{
|
2009-12-21 05:07:39 -05:00
|
|
|
|
var zoom = aFrame
|
|
|
|
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
|
|
|
|
.QueryInterface(Components.interfaces.nsIDocShell)
|
|
|
|
|
.contentViewer
|
|
|
|
|
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer)
|
|
|
|
|
.fullZoom;
|
2009-12-17 04:37:25 -05:00
|
|
|
|
return (zoom * 1000 % 1) ? zoom+0.025 : zoom ;
|
|
|
|
|
},
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
clearBG : function TSTAutoHide_clearBG()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2010-09-09 22:17:00 -04:00
|
|
|
|
if (!this.emulatedTransparency || !this.tabbarCanvas)
|
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
this.tabbarCanvas.style.display = 'none';
|
|
|
|
|
this.tabbarCanvas.style.margin = 0;
|
|
|
|
|
// zero width (heigh) canvas becomes wrongly size!!
|
|
|
|
|
this.tabbarCanvas.style.width = this.tabbarCanvas.style.height = '1px';
|
|
|
|
|
this.tabbarCanvas.width = this.tabbarCanvas.height = 1;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
updateTransparency : function TSTAutoHide_updateTransparency()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
var pos = sv.currentTabbarPosition;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
var style = this.kTRANSPARENT_STYLE[
|
|
|
|
|
Math.max(
|
|
|
|
|
this.kTRANSPARENT_NONE,
|
|
|
|
|
Math.min(
|
|
|
|
|
this.kTRANSPARENT_FULL,
|
|
|
|
|
this.getTreePref('tabbar.transparent.style')
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
];
|
|
|
|
|
if (pos != 'top' &&
|
|
|
|
|
this.mode != this.kMODE_DISABLED &&
|
2010-03-24 14:36:54 -04:00
|
|
|
|
style != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE]) {
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.setTabbrowserAttribute(this.kTRANSPARENT, style);
|
2010-03-24 14:36:54 -04:00
|
|
|
|
}
|
|
|
|
|
else {
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.removeTabbrowserAttribute(this.kTRANSPARENT);
|
2010-03-24 14:36:54 -04:00
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// event handling
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
observe : function TSTAutoHide_observe(aSubject, aTopic, aData)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
switch (aTopic)
|
|
|
|
|
{
|
|
|
|
|
case 'nsPref:changed':
|
|
|
|
|
this.onPrefChange(aData);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
domains : [
|
|
|
|
|
'extensions.treestyletab.',
|
|
|
|
|
'browser.fullscreen.autohide'
|
|
|
|
|
],
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onPrefChange : function TSTAutoHide_onPrefChange(aPrefName)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var value = this.getPref(aPrefName);
|
|
|
|
|
switch (aPrefName)
|
|
|
|
|
{
|
|
|
|
|
case 'extensions.treestyletab.tabbar.autoHide.mode':
|
2010-05-08 04:30:39 -04:00
|
|
|
|
if (!this.shouldApplyNewPref) return;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.setAttribute(this.kMODE+'-normal', value);
|
|
|
|
|
this.updateMode();
|
|
|
|
|
return;
|
|
|
|
|
|
2010-03-31 05:34:51 -04:00
|
|
|
|
case 'extensions.treestyletab.tabbar.autoHide.mode.fullscreen':
|
2010-05-08 04:30:39 -04:00
|
|
|
|
if (!this.shouldApplyNewPref) return;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.setAttribute(this.kMODE+'-fullscreen', value);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.updateMode();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
case 'extensions.treestyletab.tabbar.autoShow.mousemove':
|
|
|
|
|
case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown':
|
|
|
|
|
case 'extensions.treestyletab.tabbar.autoShow.feedback':
|
|
|
|
|
if (this.enabled && this.shouldListenMouseMove)
|
|
|
|
|
this.startListenMouseMove();
|
|
|
|
|
else
|
|
|
|
|
this.endListenMouseMove();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
case 'extensions.treestyletab.tabbar.autoHide.area':
|
|
|
|
|
this.sensitiveArea = value;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
case 'extensions.treestyletab.tabbar.transparent.style':
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.updateTransparency();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
case 'extensions.treestyletab.tabbar.togglerSize':
|
|
|
|
|
this.togglerSize = value;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var toggler = document.getAnonymousElementByAttribute(this.mOwner.browser, 'class', this.kTABBAR_TOGGLER);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
toggler.style.minWidth = toggler.style.minHeight = value+'px';
|
|
|
|
|
if (this.togglerSize <= 0)
|
|
|
|
|
toggler.setAttribute('collapsed', true);
|
|
|
|
|
else
|
|
|
|
|
toggler.removeAttribute('collapsed');
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
case 'browser.fullscreen.autohide':
|
|
|
|
|
if (!window.fullScreen) return;
|
|
|
|
|
this.end();
|
|
|
|
|
this.mode = value ?
|
2010-05-08 04:30:39 -04:00
|
|
|
|
this.getModeForFullScreen() :
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.kMODE_DISABLED ;
|
|
|
|
|
if (this.mode != this.kMODE_DISABLED)
|
|
|
|
|
this.start();
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
|
|
|
|
default:
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
handleEvent : function TSTAutoHide_handleEvent(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
switch (aEvent.type)
|
|
|
|
|
{
|
|
|
|
|
case 'mousedown':
|
|
|
|
|
this.onMouseDown(aEvent);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'mouseup':
|
|
|
|
|
this.onMouseUp(aEvent);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'mousemove':
|
|
|
|
|
if (this.handleMouseMove(aEvent)) return;
|
|
|
|
|
case 'resize':
|
|
|
|
|
this.onResize(aEvent);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'scroll':
|
2009-09-08 22:12:58 -04:00
|
|
|
|
this.onScroll(aEvent);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'load':
|
2009-09-08 21:55:48 -04:00
|
|
|
|
if (this.shouldRedraw)
|
|
|
|
|
this.redrawContentArea();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return;
|
2009-09-03 03:25:37 -04:00
|
|
|
|
|
|
|
|
|
case 'TabOpen':
|
|
|
|
|
case 'TabClose':
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showForFeedback();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TabMove':
|
2009-09-30 01:42:48 -04:00
|
|
|
|
if (!this.mOwner.subTreeMovingCount && !this.mOwner.internallyTabMovingCount)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showForFeedback();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'select':
|
2009-09-08 21:55:48 -04:00
|
|
|
|
if (this.shouldRedraw)
|
2009-09-03 03:25:37 -04:00
|
|
|
|
this.redrawContentArea();
|
|
|
|
|
if (!TreeStyleTabService.accelKeyPressed)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showForFeedback();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TreeStyleTabTabbarPositionChanging':
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.isResizing = false;
|
|
|
|
|
this.clearBG();
|
2009-12-17 22:20:35 -05:00
|
|
|
|
if (this.shouldRedraw)
|
|
|
|
|
this.hide();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TreeStyleTabTabbarPositionChanged':
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (this.enabled) this.show();
|
|
|
|
|
this.updateTransparency();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TreeStyleTabFocusSwitchingKeyDown':
|
|
|
|
|
this.onKeyDown(aEvent.sourceEvent);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TreeStyleTabFocusSwitchingStart':
|
|
|
|
|
this.cancelDelayedShowForShortcut();
|
|
|
|
|
if (this.enabled &&
|
|
|
|
|
this.getTreePref('tabbar.autoShow.tabSwitch') &&
|
|
|
|
|
(
|
|
|
|
|
aEvent.scrollDown ||
|
|
|
|
|
aEvent.scrollUp ||
|
|
|
|
|
( // when you release "shift" key
|
2009-12-17 22:20:35 -05:00
|
|
|
|
this.expanded &&
|
|
|
|
|
aEvent.standBy &&
|
|
|
|
|
aEvent.onlyShiftKey
|
2009-09-03 03:25:37 -04:00
|
|
|
|
)
|
|
|
|
|
))
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.show(this.kSHOWN_BY_SHORTCUT);
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case 'TreeStyleTabFocusSwitchingEnd':
|
|
|
|
|
this.cancelDelayedShowForShortcut();
|
|
|
|
|
if (this.enabled &&
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideReason == this.kSHOWN_BY_SHORTCUT)
|
|
|
|
|
this.hide();
|
2009-09-03 03:25:37 -04:00
|
|
|
|
return;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onMouseDown : function TSTAutoHide_onMouseDown(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
if (
|
2009-09-03 04:18:41 -04:00
|
|
|
|
!this.isResizing &&
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.evaluateXPath(
|
|
|
|
|
'ancestor-or-self::*[@class="'+this.kSPLITTER+'"]',
|
2009-09-03 05:14:41 -04:00
|
|
|
|
aEvent.originalTarget || aEvent.target,
|
2009-09-03 02:24:06 -04:00
|
|
|
|
XPathResult.BOOLEAN_TYPE
|
|
|
|
|
).booleanValue
|
|
|
|
|
) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.isResizing = true;
|
|
|
|
|
this.clearBG();
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.setTabbrowserAttribute(sv.kRESIZING, true);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
/* canvas<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\<EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̂Ɠ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>^<EFBFBD>C<EFBFBD>~<EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>Ń<EFBFBD><EFBFBD>T<EFBFBD>C<EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><EFBFBD><EFBFBD>ƁA
|
|
|
|
|
<EFBFBD>܂<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><EFBFBD>canvas<EFBFBD>̑傫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>c<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂܂Ȃ̂ŁA<EFBFBD><EFBFBD><EFBFBD>̑傫<EFBFBD><EFBFBD><EFBFBD>ȉ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD>^<EFBFBD>u<EFBFBD>o<EFBFBD>[<EFBFBD>̕<EFBFBD><EFBFBD><EFBFBD><EFBFBD>k<EFBFBD>߂<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD>Ȃ<EFBFBD><EFBFBD>B<EFBFBD>蓮<EFBFBD>ŃC<EFBFBD>x<EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><EFBFBD><EFBFBD>đ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>̖<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>h<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƃ<EFBFBD><EFBFBD>ł<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B */
|
|
|
|
|
aEvent.preventDefault();
|
|
|
|
|
aEvent.stopPropagation();
|
|
|
|
|
var flags = 0;
|
|
|
|
|
const nsIDOMNSEvent = Components.interfaces.nsIDOMNSEvent;
|
|
|
|
|
if (aEvent.altKey) flags |= nsIDOMNSEvent.ALT_MASK;
|
|
|
|
|
if (aEvent.ctrlKey) flags |= nsIDOMNSEvent.CONTROL_MASK;
|
|
|
|
|
if (aEvent.shiftKey) flags |= nsIDOMNSEvent.SHIFT_MASK;
|
|
|
|
|
if (aEvent.metaKey) flags |= nsIDOMNSEvent.META_MASK;
|
|
|
|
|
window.setTimeout(function(aX, aY, aButton, aDetail) {
|
|
|
|
|
window
|
|
|
|
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
|
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
|
|
|
|
.sendMouseEvent('mousedown', aX, aY, aButton, aDetail, flags);
|
|
|
|
|
flags = null;
|
|
|
|
|
}, 0, aEvent.clientX, aEvent.clientY, aEvent.button, aEvent.detail);
|
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.cancelShowHideOnMousemove();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
if (
|
|
|
|
|
this.enabled &&
|
2009-12-17 22:20:35 -05:00
|
|
|
|
this.expanded &&
|
2009-09-03 02:24:06 -04:00
|
|
|
|
(
|
|
|
|
|
aEvent.originalTarget.ownerDocument != document ||
|
|
|
|
|
!this.getTabBrowserFromChild(aEvent.originalTarget)
|
|
|
|
|
)
|
|
|
|
|
)
|
2009-09-03 05:14:41 -04:00
|
|
|
|
this.hide();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.lastMouseDownTarget = aEvent.originalTarget.localName;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onMouseUp : function TSTAutoHide_onMouseUp(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
|
|
|
|
if (aEvent.originalTarget &&
|
2009-09-03 05:17:12 -04:00
|
|
|
|
this.evaluateXPath(
|
|
|
|
|
'ancestor-or-self::*[@class="'+this.kSPLITTER+'"]',
|
|
|
|
|
aEvent.originalTarget,
|
|
|
|
|
XPathResult.BOOLEAN_TYPE
|
|
|
|
|
).booleanValue) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.isResizing = false;
|
2010-03-28 14:22:15 -04:00
|
|
|
|
sv.removeTabbrowserAttribute(sv.kRESIZING);
|
2009-09-03 05:22:34 -04:00
|
|
|
|
window.setTimeout(function(aSelf) {
|
2009-09-08 22:12:58 -04:00
|
|
|
|
if (!aSelf.shouldRedraw) return;
|
2009-09-03 05:22:34 -04:00
|
|
|
|
aSelf.redrawContentArea();
|
|
|
|
|
aSelf.drawBG();
|
|
|
|
|
}, 0, this);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.cancelShowHideOnMousemove();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.lastMouseDownTarget = null;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
handleMouseMove : function TSTAutoHide_handleMouseMove(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
var sv = this.mOwner;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
if (this.isResizing &&
|
2009-09-03 02:24:06 -04:00
|
|
|
|
/^(scrollbar|thumb|slider|scrollbarbutton)$/i.test(this.lastMouseDownTarget))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
!sv.popupMenuShown &&
|
|
|
|
|
(
|
2009-12-17 22:20:35 -05:00
|
|
|
|
!this.expanded ||
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideReason & this.kKEEP_SHOWN_ON_MOUSEOVER
|
2009-09-03 02:24:06 -04:00
|
|
|
|
)
|
|
|
|
|
)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideOnMousemove(aEvent);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onResize : function TSTAutoHide_onResize(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
if (
|
|
|
|
|
!aEvent.originalTarget ||
|
2009-12-24 10:01:23 -05:00
|
|
|
|
(
|
|
|
|
|
aEvent.originalTarget.ownerDocument != document &&
|
|
|
|
|
aEvent.originalTarget != window
|
|
|
|
|
) ||
|
2009-09-08 22:12:58 -04:00
|
|
|
|
!this.shouldRedraw
|
2009-09-03 02:24:06 -04:00
|
|
|
|
) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 01:37:41 -04:00
|
|
|
|
switch (sv.currentTabbarPosition)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
case 'left':
|
|
|
|
|
sv.container.style.marginRight = '-'+this.XOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
case 'right':
|
|
|
|
|
sv.container.style.marginLeft = '-'+this.XOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
case 'bottom':
|
|
|
|
|
sv.container.style.marginTop = '-'+this.YOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sv.container.style.marginBottom = '-'+this.YOffset+'px';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
this.redrawContentArea();
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onScroll : function TSTAutoHide_onScroll(aEvent)
|
2009-09-08 22:12:58 -04:00
|
|
|
|
{
|
|
|
|
|
var node = aEvent.originalTarget;
|
|
|
|
|
if ((node && node.ownerDocument == document) || !this.shouldRedraw) return;
|
|
|
|
|
|
|
|
|
|
var tabbarBox, nodeBox;
|
|
|
|
|
if (
|
|
|
|
|
!(node instanceof Components.interfaces.nsIDOMElement) ||
|
|
|
|
|
(
|
2010-05-08 03:15:38 -04:00
|
|
|
|
(tabbarBox = this.getBoxObjectFor(this.mOwner.browser.mTabContainer)) &&
|
2009-09-08 22:12:58 -04:00
|
|
|
|
(nodeBox = this.getBoxObjectFor(node)) &&
|
|
|
|
|
tabbarBox.screenX <= nodeBox.screenX + nodeBox.width &&
|
|
|
|
|
tabbarBox.screenX + tabbarBox.width >= nodeBox.screenX &&
|
|
|
|
|
tabbarBox.screenY <= nodeBox.screenY + nodeBox.height &&
|
|
|
|
|
tabbarBox.screenY + tabbarBox.height >= nodeBox.screenY
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
this.redrawContentArea();
|
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
onKeyDown : function TSTAutoHide_onKeyDown(aEvent)
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 03:25:37 -04:00
|
|
|
|
var sv = this.mOwner;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = sv.browser;
|
2009-09-03 03:25:37 -04:00
|
|
|
|
|
|
|
|
|
if (this.delayedShowForShortcutDone)
|
|
|
|
|
this.cancelDelayedShowForShortcut();
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
sv.getTabs(b).snapshotLength > 1 &&
|
|
|
|
|
!aEvent.altKey &&
|
|
|
|
|
TreeStyleTabService.accelKeyPressed
|
|
|
|
|
) {
|
|
|
|
|
if (this.enabled &&
|
|
|
|
|
this.getTreePref('tabbar.autoShow.accelKeyDown') &&
|
2009-12-17 22:20:35 -05:00
|
|
|
|
!this.expanded &&
|
2009-09-03 03:25:37 -04:00
|
|
|
|
!this.delayedAutoShowTimer &&
|
|
|
|
|
!this.delayedShowForShortcutTimer) {
|
|
|
|
|
this.delayedShowForShortcutTimer = window.setTimeout(
|
|
|
|
|
function(aSelf) {
|
|
|
|
|
aSelf.delayedShowForShortcutDone = true;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
aSelf.show(aSelf.kSHOWN_BY_SHORTCUT);
|
2009-09-03 03:25:37 -04:00
|
|
|
|
sv = null;
|
|
|
|
|
b = null;
|
|
|
|
|
},
|
|
|
|
|
this.getTreePref('tabbar.autoShow.accelKeyDown.delay'),
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
this.delayedShowForShortcutDone = false;
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 03:25:37 -04:00
|
|
|
|
else {
|
|
|
|
|
if (this.enabled)
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.hide();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
2009-09-03 03:25:37 -04:00
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
cancelDelayedShowForShortcut : function TSTAutoHide_cancelDelayedShowForShortcut()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
2009-09-03 03:25:37 -04:00
|
|
|
|
if (this.delayedShowForShortcutTimer) {
|
|
|
|
|
window.clearTimeout(this.delayedShowForShortcutTimer);
|
|
|
|
|
this.delayedShowForShortcutTimer = null;
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-09-03 03:25:37 -04:00
|
|
|
|
delayedShowForShortcutTimer : null,
|
|
|
|
|
delayedShowForShortcutDone : true,
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
init : function TSTAutoHide_init()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
this.enabled = false;
|
|
|
|
|
this.mouseMoveListening = false;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideReason = 0;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.lastMouseDownTarget = null;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.isResizing = false;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.showHideOnMousemoveTimer = null;
|
|
|
|
|
this.delayedShowForFeedbackTimer = null;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.mOwner.browser.setAttribute(this.kMODE+'-normal', this.getTreePref('tabbar.autoHide.mode'));
|
|
|
|
|
this.mOwner.browser.setAttribute(this.kMODE+'-fullscreen', this.getTreePref('tabbar.autoHide.mode.fullscreen'));
|
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.addPrefListener(this);
|
|
|
|
|
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.area');
|
|
|
|
|
this.onPrefChange('extensions.treestyletab.tabbar.transparent.style');
|
|
|
|
|
this.onPrefChange('extensions.treestyletab.tabbar.togglerSize');
|
|
|
|
|
window.setTimeout(function(aSelf) {
|
|
|
|
|
aSelf.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
|
|
|
|
|
}, 0, this);
|
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = this.mOwner.browser;
|
2010-03-23 09:33:00 -04:00
|
|
|
|
b.mTabContainer.addEventListener('TabOpen', this, false);
|
|
|
|
|
b.mTabContainer.addEventListener('TabClose', this, false);
|
|
|
|
|
b.mTabContainer.addEventListener('TabMove', this, false);
|
2009-09-03 04:18:41 -04:00
|
|
|
|
b.mTabContainer.addEventListener('select', this, false);
|
|
|
|
|
b.addEventListener('TreeStyleTabTabbarPositionChanging', this, false);
|
|
|
|
|
b.addEventListener('TreeStyleTabTabbarPositionChanged', this, false);
|
|
|
|
|
b.addEventListener('TreeStyleTabFocusSwitchingKeyDown', this, false);
|
|
|
|
|
b.addEventListener('TreeStyleTabFocusSwitchingStart', this, false);
|
|
|
|
|
b.addEventListener('TreeStyleTabFocusSwitchingEnd', this, false);
|
|
|
|
|
|
|
|
|
|
var stack = document.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-stack');
|
2010-03-25 23:17:16 -04:00
|
|
|
|
if (stack || this.mOwner.isFloating) {
|
2009-09-03 04:18:41 -04:00
|
|
|
|
let canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
|
2009-09-03 02:24:06 -04:00
|
|
|
|
canvas.setAttribute('style', 'display:none;width:1;height:1;');
|
2010-03-24 15:23:21 -04:00
|
|
|
|
|
|
|
|
|
if (stack)
|
|
|
|
|
stack.firstChild.appendChild(canvas);
|
|
|
|
|
else
|
2010-03-25 23:17:16 -04:00
|
|
|
|
this.mOwner.tabStripPlaceHolder.appendChild(canvas);
|
2010-03-24 15:23:21 -04:00
|
|
|
|
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.tabbarCanvas = canvas;
|
2009-09-03 04:18:41 -04:00
|
|
|
|
this.clearBG();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
2009-09-03 04:18:41 -04:00
|
|
|
|
|
|
|
|
|
b = null;
|
|
|
|
|
stack = null;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
},
|
|
|
|
|
|
2009-12-25 03:34:52 -05:00
|
|
|
|
destroy : function TSTAutoHide_destroy()
|
2009-09-03 02:24:06 -04:00
|
|
|
|
{
|
|
|
|
|
this.end();
|
|
|
|
|
this.removePrefListener(this);
|
2010-05-08 04:30:39 -04:00
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = this.mOwner.browser;
|
2010-03-23 09:33:00 -04:00
|
|
|
|
b.mTabContainer.removeEventListener('TabOpen', this, false);
|
|
|
|
|
b.mTabContainer.removeEventListener('TabClose', this, false);
|
|
|
|
|
b.mTabContainer.removeEventListener('TabMove', this, false);
|
2009-09-03 04:18:41 -04:00
|
|
|
|
b.mTabContainer.removeEventListener('select', this, false);
|
|
|
|
|
b.removeEventListener('TreeStyleTabTabbarPositionChanging', this, false);
|
|
|
|
|
b.removeEventListener('TreeStyleTabTabbarPositionChanged', this, false);
|
|
|
|
|
b.removeEventListener('TreeStyleTabFocusSwitchingKeyDown', this, false);
|
|
|
|
|
b.removeEventListener('TreeStyleTabFocusSwitchingStart', this, false);
|
|
|
|
|
b.removeEventListener('TreeStyleTabFocusSwitchingEnd', this, false);
|
2010-05-08 04:30:39 -04:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
saveCurrentState : function TSTAutoHide_saveCurrentState()
|
|
|
|
|
{
|
|
|
|
|
var b = this.mOwner.browser;
|
|
|
|
|
var prefs = {
|
|
|
|
|
'tabbar.autoHide.mode' : this.getModeForNormal(b),
|
|
|
|
|
'tabbar.autoHide.mode.fullscreen' : this.getModeForFullScreen(b),
|
|
|
|
|
};
|
|
|
|
|
for (var i in prefs)
|
|
|
|
|
{
|
|
|
|
|
if (this.getTreePref(i) != prefs[i])
|
|
|
|
|
this.setTreePref(i, prefs[i]);
|
|
|
|
|
}
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// class methods
|
|
|
|
|
|
|
|
|
|
// mode
|
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
TreeStyleTabBrowserAutoHide.getMode = function TSTAutoHide_class_getMode(aTabBrowser) {
|
|
|
|
|
var b = aTabBrowser || TreeStyleTabService.browser;
|
|
|
|
|
var mode = b.getAttribute(this.prototype.kMODE);
|
|
|
|
|
return mode ? parseInt(mode) : this.prototype.kMODE_DISABLED ;
|
|
|
|
|
};
|
|
|
|
|
|
2010-02-03 11:31:50 -05:00
|
|
|
|
TreeStyleTabBrowserAutoHide.__defineGetter__('mode', function() { /* PUBLIC API */
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var mode = this.getMode();
|
|
|
|
|
if (mode == this.prototype.kMODE_SHRINK &&
|
2009-12-17 21:46:36 -05:00
|
|
|
|
TreeStyleTabService.currentTabbarPosition != 'left' &&
|
|
|
|
|
TreeStyleTabService.currentTabbarPosition != 'right')
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return this.prototype.kMODE_HIDE;
|
2010-05-08 03:15:38 -04:00
|
|
|
|
return mode;
|
2009-09-03 02:24:06 -04:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
TreeStyleTabBrowserAutoHide.__defineSetter__('mode', function(aValue) {
|
2010-05-08 03:15:38 -04:00
|
|
|
|
var b = aTabBrowser || TreeStyleTabService.browser;
|
|
|
|
|
b.setAttribute(this.prototype.kMODE, aValue);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
return aValue;
|
|
|
|
|
});
|
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
TreeStyleTabBrowserAutoHide.toggleMode = function TSTAutoHide_class_toggleMode(aTabBrowser) { /* PUBLIC API */
|
|
|
|
|
var b = aTabBrowser || TreeStyleTabService.browser;
|
|
|
|
|
|
2010-03-31 14:47:30 -04:00
|
|
|
|
var key = 'tabbar.autoHide.mode';
|
|
|
|
|
var toggleKey = 'tabbar.autoHide.mode.toggle';
|
|
|
|
|
if (window.fullScreen) {
|
|
|
|
|
key += '.fullscreen';
|
|
|
|
|
toggleKey += '.fullscreen';
|
|
|
|
|
}
|
2010-05-08 03:15:38 -04:00
|
|
|
|
|
|
|
|
|
var mode = this.getMode(b) == this.prototype.kMODE_DISABLED ?
|
2010-03-31 14:47:30 -04:00
|
|
|
|
TreeStyleTabService.getTreePref(toggleKey) :
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.prototype.kMODE_DISABLED ;
|
|
|
|
|
|
|
|
|
|
TreeStyleTabService.setTreePref(key, mode);
|
|
|
|
|
b.setAttribute(this.prototype.kMODE+'-'+(window.fullScreen ? 'fullscreen' : 'normal' ), mode);
|
|
|
|
|
b.treeStyleTab.autoHide.updateMode();
|
2009-09-03 02:24:06 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// for shortcuts
|
|
|
|
|
|
2010-05-08 03:15:38 -04:00
|
|
|
|
TreeStyleTabBrowserAutoHide.updateKeyListeners = function TSTAutoHide_class_updateKeyListeners() {
|
2009-09-03 02:24:06 -04:00
|
|
|
|
if (
|
2010-05-08 03:15:38 -04:00
|
|
|
|
this.getMode() &&
|
2009-09-03 02:24:06 -04:00
|
|
|
|
this.shouldListenKeyEvents
|
|
|
|
|
) {
|
|
|
|
|
TreeStyleTabService.startListenKeyEventsFor(TreeStyleTabService.LISTEN_FOR_AUTOHIDE);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
TreeStyleTabService.endListenKeyEventsFor(TreeStyleTabService.LISTEN_FOR_AUTOHIDE);
|
|
|
|
|
}
|
|
|
|
|
window.setTimeout(function() {
|
|
|
|
|
if (window.windowState != Components.interfaces.nsIDOMChromeWindow.STATE_NORMAL) return;
|
2009-12-16 12:57:45 -05:00
|
|
|
|
var count = 0;
|
|
|
|
|
var resizeTimer = window.setInterval(function(){
|
|
|
|
|
if (++count > 100 || window.innerHeight > 0) {
|
|
|
|
|
window.clearInterval(resizeTimer);
|
|
|
|
|
window.resizeBy(-1,-1);
|
|
|
|
|
window.resizeBy(1,1);
|
|
|
|
|
}
|
|
|
|
|
}, 250);
|
2009-09-03 02:24:06 -04:00
|
|
|
|
}, 0);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TreeStyleTabBrowserAutoHide.__defineGetter__('shouldListenKeyEvents', function() {
|
|
|
|
|
return !TreeStyleTabService.ctrlTabPreviewsEnabled &&
|
|
|
|
|
(
|
|
|
|
|
TreeStyleTabService.getTreePref('tabbar.autoShow.accelKeyDown') ||
|
|
|
|
|
TreeStyleTabService.getTreePref('tabbar.autoShow.tabSwitch') ||
|
|
|
|
|
TreeStyleTabService.getTreePref('tabbar.autoShow.feedback')
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|