[Pkg-mozext-commits] [tree-style-tab] 01/04: Imported Upstream version 0.15.2015030601
Ximin Luo
infinity0 at pwned.gg
Fri Apr 17 08:43:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0-guest pushed a commit to branch master
in repository tree-style-tab.
commit 42d8deaab0aa94aa92948b15eae26084389ad0d1
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Fri Apr 17 10:33:11 2015 +0200
Imported Upstream version 0.15.2015030601
---
content/treestyletab/bookmarksOverlay.js | 25 +-
content/treestyletab/treestyletab.xul | 2 +-
content/treestyletab/windowHelper.js | 58 ++--
content/treestyletab/windowHelperHacks.js | 64 ++--
defaults/preferences/treestyletab.js | 1 +
install.rdf | 4 +-
locale/da-DK/treestyletab/treestyletab.properties | 2 +-
locale/de-DE/treestyletab/treestyletab.properties | 2 +-
locale/en-US/treestyletab/treestyletab.properties | 4 +-
locale/es-ES/treestyletab/treestyletab.properties | 4 +-
locale/it-IT/treestyletab/treestyletab.properties | 4 +-
locale/pl/treestyletab/treestyletab.properties | 4 +-
locale/sv-SE/treestyletab/treestyletab.properties | 2 +-
locale/zh-CN/treestyletab/treestyletab.properties | 2 +-
locale/zh-TW/treestyletab/treestyletab.properties | 2 +-
modules/autoHide.js | 397 ++++++++++++++++------
modules/base.js | 91 +++--
modules/browser.js | 242 ++++++++++---
modules/constants.js | 7 +-
modules/contentBridge.js | 27 +-
modules/fullTooltip.js | 3 +-
modules/pseudoTreeBuilder.js | 4 +-
modules/tabbarDNDObserver.js | 3 +-
modules/tabpanelDNDObserver.js | 6 +-
modules/utils.js | 25 +-
modules/window.js | 141 +++++---
skin/classic/treestyletab/base.css | 13 +
27 files changed, 804 insertions(+), 335 deletions(-)
diff --git a/content/treestyletab/bookmarksOverlay.js b/content/treestyletab/bookmarksOverlay.js
index 568e79c..8bf362a 100644
--- a/content/treestyletab/bookmarksOverlay.js
+++ b/content/treestyletab/bookmarksOverlay.js
@@ -233,9 +233,10 @@ var TreeStyleTabBookmarksService = inherit(TreeStyleTabService, {
var sv = this;
with (ns) {
- let (method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU__openTabset) ?
+ {
+ let method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU__openTabset) ?
'TU__openTabset' :
- '_openTabset') {
+ '_openTabset';
TreeStyleTabUtils.doPatching(PlacesUIUtils[method], 'PlacesUIUtils.'+method, function(aName, aSource) {
var patched = eval(aName+' = '+aSource.replace(
/(function[^\(]*\([^\)]+)(\))/,
@@ -275,17 +276,19 @@ var TreeStyleTabBookmarksService = inherit(TreeStyleTabService, {
}, 'TreeStyleTab');
}
- let (method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openContainerNodeInTabs) ?
+ {
+ let method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openContainerNodeInTabs) ?
'TU_openContainerNodeInTabs' :
- 'openContainerNodeInTabs') {
+ 'openContainerNodeInTabs';
TreeStyleTabUtils.doPatching(PlacesUIUtils[method], 'PlacesUIUtils.'+method, function(aName, aSource) {
var patched = eval(aName+' = '+aSource.replace(
/(this\._openTabset\([^\)]+)(\))/,
- 'let (w = "_getTopBrowserWin" in this ?\n' +
+ '{\n' +
+ ' let w = "_getTopBrowserWin" in this ?\n' +
' this._getTopBrowserWin() :\n' +
' "_getCurrentActiveWin" in this ?\n' +
' this._getCurrentActiveWin() :\n' +
- ' window) {\n' +
+ ' window;\n' +
' let nodes = w.TreeStyleTabBookmarksService.getItemIdsForContainerNode(aNode);\n' +
' for (let i in nodes) {\n' +
' urlsToOpen[i].id = nodes[i];\n' +
@@ -299,19 +302,21 @@ var TreeStyleTabBookmarksService = inherit(TreeStyleTabService, {
}, 'TreeStyleTab');
}
- let (method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openURINodesInTabs) ?
+ {
+ let method = (TreeStyleTabUtils.getTreePref('compatibility.TabUtilities') && PlacesUIUtils.TU_openURINodesInTabs) ?
'TU_openURINodesInTabs' :
- 'openURINodesInTabs') {
+ 'openURINodesInTabs';
TreeStyleTabUtils.doPatching(PlacesUIUtils[method], 'PlacesUIUtils.'+method, function(aName, aSource) {
var patched = eval(aName+' = '+aSource.replace(
'{',
'{\n' +
' var TSTBS, TSTUtils;\n' +
- ' let (w = "_getTopBrowserWin" in this ?\n' +
+ ' {\n'+
+ ' let w = "_getTopBrowserWin" in this ?\n' +
' this._getTopBrowserWin() :\n' +
' "_getCurrentActiveWin" in this ?\n' +
' this._getCurrentActiveWin() :\n' +
- ' window) {\n' +
+ ' window;\n' +
' TSTBS = w.TreeStyleTabBookmarksService;\n' +
' TSTUtils = w.TreeStyleTabUtils;\n' +
' PlacesUtils = w.PlacesUtils;\n' +
diff --git a/content/treestyletab/treestyletab.xul b/content/treestyletab/treestyletab.xul
index 88e4dc3..6c6d7c7 100644
--- a/content/treestyletab/treestyletab.xul
+++ b/content/treestyletab/treestyletab.xul
@@ -143,7 +143,7 @@
<tooltip id="treestyletab-full-tree-tooltip"/>
<panel id="treestyletab-autohide-content-area-screen"
treestyletab-ignore-state="true"
- onpopupshown="if ('setConsumeRollupEvent' in this.popupBoxObject) this.popupBoxObject.setConsumeRollupEvent(this.popupBoxObject.ROLLUP_NO_CONSUME);"
+ onpopupshown="if ('setConsumeRollupEvent' in this.popupBoxObject) this.popupBoxObject.setConsumeRollupEvent(this.popupBoxObject.ROLLUP_NO_CONSUME || PopupBoxObject.ROLLUP_NO_CONSUME);"
onclick="this.hidePopup();"
onDOMMouseScroll="this.hidePopup()"/>
</popupset>
diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js
index e1648e0..7095eb9 100644
--- a/content/treestyletab/windowHelper.js
+++ b/content/treestyletab/windowHelper.js
@@ -20,7 +20,7 @@ var TreeStyleTabWindowHelper = {
}
else if (aSource.indexOf('gBrowser.swapBrowsersAndCloseOther') > -1) {
return eval(aName+' = '+aSource.replace(
- 'gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);',
+ /gBrowser\.swapBrowsersAndCloseOther\([^)]+\);/g,
'if (!TreeStyleTabService.tearOffSubtreeFromRemote()) { $& }'
).replace(
// Workaround for https://github.com/piroor/treestyletab/issues/741
@@ -200,8 +200,9 @@ var TreeStyleTabWindowHelper = {
TreeStyleTabUtils.doPatching(window.openLinkIn, 'window.openLinkIn', function(aName, aSource) {
// Bug 1050447 changed this line in Fx 34 to
// newTab = w.gBrowser.loadOneTab(
+ // Bug 1108555 removed newTab assignment
return eval(aName+' = '+aSource.replace(
- /((b|newTab = w\.gB)rowser.loadOneTab\()/g,
+ /((b|(newTab = )?w\.gB)rowser.loadOneTab\()/g,
'TreeStyleTabService.onBeforeOpenLinkWithTab(gBrowser.selectedTab, aFromChrome); $1'
));
}, 'TreeStyleTab');
@@ -294,12 +295,30 @@ var TreeStyleTabWindowHelper = {
}, 'treeStyleTab');
}
- TreeStyleTabUtils.doPatching(window.toggleSidebar, 'window.toggleSidebar', function(aName, aSource) {
- return eval(aName+' = '+aSource.replace(
- '{',
- '{ gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR);'
- ));
- }, 'treeStyleTab');
+ if ('SidebarUI' in window) { // for Firefox 39 or later
+ SidebarUI.__treestyletab__show = SidebarUI.show;
+ SidebarUI.show = function(...aArgs) {
+ return this.__treestyletab__show.apply(this, aArgs)
+ .then(function(aResult) {
+ gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR);
+ return aResult;
+ });
+ };
+ SidebarUI.__treestyletab__hide = SidebarUI.hide;
+ SidebarUI.hide = function(...aArgs) {
+ var retVal = this.__treestyletab__hide.apply(this, aArgs);
+ gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR);
+ return retVal;
+ };
+ }
+ else if ('toggleSidebar' in window) { // for Firefox 38 or older
+ TreeStyleTabUtils.doPatching(window.toggleSidebar, 'window.toggleSidebar', function(aName, aSource) {
+ return eval(aName+' = '+aSource.replace(
+ '{',
+ '{ gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_TOGGLE_SIDEBAR);'
+ ));
+ }, 'treeStyleTab');
+ }
},
_splitFunctionNames : function TSTWH__splitFunctionNames(aString)
{
@@ -329,15 +348,14 @@ var TreeStyleTabWindowHelper = {
var searchbar = document.getElementById('searchbar');
if (searchbar &&
searchbar.doSearch &&
- searchbar.doSearch.toSource().toSource().indexOf('TreeStyleTabService') < 0) {
- TreeStyleTabUtils.doPatching(searchbar.doSearch, 'searchbar.doSearch', function(aName, aSource) {
- return eval(aName+' = '+aSource.replace(
- /(openUILinkIn\(.+?\);)/,
- 'TreeStyleTabService.onBeforeBrowserSearch(arguments[0]);\n' +
- '$1\n' +
- 'TreeStyleTabService.stopToOpenChildTab();'
- ));
- }, 'TreeStyleTab');
+ !searchbar.__treestyletab__original_doSearch) {
+ searchbar.__treestyletab__original_doSearch = searchbar.doSearch;
+ searchbar.doSearch = function(...aArgs) {
+ TreeStyleTabService.onBeforeBrowserSearch(aArgs[0]);
+ var retVal = this.__treestyletab__original_doSearch.apply(this, aArgs);
+ TreeStyleTabService.stopToOpenChildTab();
+ return retVal;
+ };
}
var goButton = document.getElementById('urlbar-go-button');
@@ -534,7 +552,8 @@ var TreeStyleTabWindowHelper = {
* The default implementation fails to scroll to tab if it is expanding.
* So we have to inject codes to override its effect.
*/
- let (scrollbox = aTabBrowser.treeStyleTab.scrollBox) {
+ {
+ let scrollbox = aTabBrowser.treeStyleTab.scrollBox;
TreeStyleTabUtils.doPatching(scrollbox.ensureElementIsVisible, 'scrollbox.ensureElementIsVisible', function(aName, aSource) {
return eval(aName+' = '+aSource.replace(
'{',
@@ -551,7 +570,8 @@ var TreeStyleTabWindowHelper = {
}, /treeStyleTab|ensureTabIsVisible/); // if there is a string "ensureTabIsVisible", it is replaced by Tab Mix Plus!
}
- let (popup = document.getElementById('alltabs-popup')) {
+ {
+ let popup = document.getElementById('alltabs-popup');
TreeStyleTabUtils.doPatching(popup._updateTabsVisibilityStatus, 'popup._updateTabsVisibilityStatus', function(aName, aSource) {
return eval(aName+' = '+aSource.replace(
'{',
diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js
index 3e4298d..167de96 100644
--- a/content/treestyletab/windowHelperHacks.js
+++ b/content/treestyletab/windowHelperHacks.js
@@ -203,7 +203,8 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
eval('gSessionManager.load = '+gSessionManager.load.toSource().replace(
'var tabcount = ',
' gBrowser.treeStyleTab.collapseExpandAllSubtree(false, true);\n' +
- ' let (tabs = gBrowser.treeStyleTab.getTabs(gBrowser).slice(1).reverse()) {\n' +
+ ' {\n'+
+ ' let tabs = gBrowser.treeStyleTab.getTabs(gBrowser).slice(1).reverse();\n' +
' for (let i = 0, maxi = tabs.length; i < maxi; i++)\n' +
' {\n' +
' let tab = tabs[i];\n' +
@@ -220,16 +221,15 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
// https://addons.mozilla.org/firefox/addon/4650
if ('FS_onFullerScreen' in window &&
TreeStyleTabUtils.getTreePref('compatibility.FullerScreen')) {
- let (functions = 'CheckIfFullScreen,FS_onFullerScreen,FS_onMouseMove'.split(',')) {
- for (let i = 0, maxi = functions.length; i < maxi; i++)
- {
- let func = functions[i];
- if (!(func in window)) continue;
- eval('window.'+func+' = '+window[func].toSource().replace(
- /FS_data.mTabs.(removeAttribute\("moz-collapsed"\)|setAttribute\("moz-collapsed", "true"\));/g,
- 'if (gBrowser.treeStyleTab.currentTabbarPosition == "top") { $& }'
- ));
- }
+ let functions = 'CheckIfFullScreen,FS_onFullerScreen,FS_onMouseMove'.split(',');
+ for (let i = 0, maxi = functions.length; i < maxi; i++)
+ {
+ let func = functions[i];
+ if (!(func in window)) continue;
+ eval('window.'+func+' = '+window[func].toSource().replace(
+ /FS_data.mTabs.(removeAttribute\("moz-collapsed"\)|setAttribute\("moz-collapsed", "true"\));/g,
+ 'if (gBrowser.treeStyleTab.currentTabbarPosition == "top") { $& }'
+ ));
}
}
@@ -352,6 +352,20 @@ TreeStyleTabWindowHelper.overrideExtensionsPreInit = function TSTWH_overrideExte
dump(e+'\n');
}
}
+
+ // Duplicate in Tab Context Menu
+ // https://addons.mozilla.org/firefox/duplicate-in-tab-context-menu/
+ if (TreeStyleTabUtils.getTreePref('compatibility.DuplicateInTabContext') &&
+ 'SchuzakJp' in window &&
+ 'DuplicateInTabContext' in SchuzakJp &&
+ typeof SchuzakJp.DuplicateInTabContext.Duplicate == 'function') {
+ TreeStyleTabUtils.doPatching(SchuzakJp.DuplicateInTabContext.Duplicate, 'SchuzakJp.DuplicateInTabContext.Duplicate', function(aName, aSource) {
+ return eval(aName+' = '+aSource.replace(
+ '{',
+ '{ gBrowser.treeStyleTab.onBeforeTabDuplicate(oriTab); '
+ ));
+ }, 'treeStyleTab');
+ }
};
TreeStyleTabWindowHelper.overrideExtensionsBeforeBrowserInit = function TSTWH_overrideExtensionsBeforeBrowserInit() {
@@ -801,18 +815,17 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
if ('LinkyContext' in window &&
'prototype' in LinkyContext &&
TreeStyleTabUtils.getTreePref('compatibility.Linky')) {
- let (methods = 'openLink,openLinks,generateDocument'.split(',')) {
- for (let i = 0, maxi = methods.length; i < maxi; i++)
- {
- let method = methods[i];
- if (!(method in LinkyContext.prototype)) continue;
- eval('LinkyContext.prototype.'+method+' = '+
- LinkyContext.prototype[method].toSource().replace(
- '{',
- '{ TreeStyleTabService.readyToOpenChildTabNow(null, true);'
- )
- );
- }
+ let methods = 'openLink,openLinks,generateDocument'.split(',');
+ for (let i = 0, maxi = methods.length; i < maxi; i++)
+ {
+ let method = methods[i];
+ if (!(method in LinkyContext.prototype)) continue;
+ eval('LinkyContext.prototype.'+method+' = '+
+ LinkyContext.prototype[method].toSource().replace(
+ '{',
+ '{ TreeStyleTabService.readyToOpenChildTabNow(null, true);'
+ )
+ );
}
}
@@ -1335,8 +1348,9 @@ TreeStyleTabWindowHelper.overrideExtensionsDelayed = function TSTWH_overrideExte
// TotalToolbar
// http://totaltoolbar.mozdev.org/
- let (menu = document.getElementById('tt-toolbar-properties') &&
- TreeStyleTabUtils.getTreePref('compatibility.TotalToolbar')) {
+ {
+ let menu = document.getElementById('tt-toolbar-properties') &&
+ TreeStyleTabUtils.getTreePref('compatibility.TotalToolbar');
if (menu) {
let tabbarToolboxes = ['tt-toolbox-tabright', 'tt-toolbox-tableft']
.map(document.getElementById, document)
diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js
index 53c7759..a4b81f9 100644
--- a/defaults/preferences/treestyletab.js
+++ b/defaults/preferences/treestyletab.js
@@ -652,6 +652,7 @@ pref("extensions.treestyletab.compatibility.DomainTab", true);
pref("extensions.treestyletab.compatibility.DragDeGo", true);
pref("extensions.treestyletab.compatibility.DragIt", true);
pref("extensions.treestyletab.compatibility.DragNDropToolbars", true);
+pref("extensions.treestyletab.compatibility.DuplicateInTabContext", true);
pref("extensions.treestyletab.compatibility.DuplicateThisTab", true);
pref("extensions.treestyletab.compatibility.FirefoxSync", true);
pref("extensions.treestyletab.compatibility.FireGestures", true);
diff --git a/install.rdf b/install.rdf
index c1581ba..d3de2ab 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="treestyletab at piro.sakura.ne.jp"
em:name="Tree Style Tab"
- em:version="0.15.2014120101"
+ em:version="0.15.2015030601"
em:creator="YUKI "Piro" Hiroshi"
em:description="Show tabs like a tree."
em:homepageURL="http://piro.sakura.ne.jp/xul/_treestyletab.html.en"
@@ -222,7 +222,7 @@
<em:targetApplication>
<RDF:Description em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
em:minVersion="31.0"
- em:maxVersion="37.0a1" />
+ em:maxVersion="39.0a1" />
</em:targetApplication>
</RDF:Description>
</RDF:RDF>
diff --git a/locale/da-DK/treestyletab/treestyletab.properties b/locale/da-DK/treestyletab/treestyletab.properties
index b0bdc0d..bb9be1c 100644
--- a/locale/da-DK/treestyletab/treestyletab.properties
+++ b/locale/da-DK/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bogmærk kun hovedfanen.
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# undoCloseTabSetBehavior.label=Vil du også gendanne følgende %S fane(r)?
# undoCloseTabSetBehavior.never=Spørg ikke igen
diff --git a/locale/de-DE/treestyletab/treestyletab.properties b/locale/de-DE/treestyletab/treestyletab.properties
index 8bfe43b..03b46e3 100644
--- a/locale/de-DE/treestyletab/treestyletab.properties
+++ b/locale/de-DE/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Nur das gezogene Tab als Lesezeichen spei
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# #undoCloseTabSetBehavior.title=Möchten Sie andere geschlossene Tabs auch wieder herstellen?
# #undoCloseTabSetBehavior.text=Dieses Tab wurde gemeinsam mit %S anderen geschlossen. Wie sollen diese behandelt werden?
diff --git a/locale/en-US/treestyletab/treestyletab.properties b/locale/en-US/treestyletab/treestyletab.properties
index 4348495..f321193 100644
--- a/locale/en-US/treestyletab/treestyletab.properties
+++ b/locale/en-US/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bookmark the Parent Tab Only.
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
openSelectedPlaces.bookmarks=from %2$S bookmarks, including "%1$S"
@@ -48,7 +48,7 @@ compatibility_STM_warning_title=Super Tab Mode collides with Tree Style Tab
compatibility_STM_warning_text=New tabs opened from links (or others) don't become child of the current tab, because the position of new tabs is controlled by Super Tab Mode. Which feature do you want to be enabled?\n(*You can change those settings manually by the configuration dialog of Super Tab Mode.)
compatibility_STM_warning_use_TST=Make tabs children of the current tab
compatibility_STM_warning_use_STM=Put tabs to the position specified by Super Tab Mode
-compatibility_STM_warning_never=Don't show this dialo anymore.
+compatibility_STM_warning_never=Don't show this dialog anymore.
closeTabsToTheEnd_vertical_label=Close Tabs to the Bottom
diff --git a/locale/es-ES/treestyletab/treestyletab.properties b/locale/es-ES/treestyletab/treestyletab.properties
index f9b6be5..45471f6 100644
--- a/locale/es-ES/treestyletab/treestyletab.properties
+++ b/locale/es-ES/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bookmark the Parent Tab Only.
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# #undoCloseTabSetBehavior.title=Do you want other closed tabs to be restored too?
# #undoCloseTabSetBehavior.text=This tab was closed with other %S tab(s) together. How treat them?
@@ -57,7 +57,7 @@ compatibility_STM_warning_title=Super Tab Mode collides with Tree Style Tab
compatibility_STM_warning_text=New tabs opened from links (or others) don't become child of the current tab, because the position of new tabs is controlled by Super Tab Mode. Which feature do you want to be enabled?\n(*You can change those settings manually by the configuration dialog of Super Tab Mode.)
compatibility_STM_warning_use_TST=Make tabs children of the current tab
compatibility_STM_warning_use_STM=Put tabs to the position specified by Super Tab Mode
-compatibility_STM_warning_never=Don't show this dialo anymore.
+compatibility_STM_warning_never=Don't show this dialog anymore.
closeTabsToTheEnd_vertical_label=Close Tabs to the Bottom
diff --git a/locale/it-IT/treestyletab/treestyletab.properties b/locale/it-IT/treestyletab/treestyletab.properties
index b7a8ddc..3855431 100644
--- a/locale/it-IT/treestyletab/treestyletab.properties
+++ b/locale/it-IT/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bookmark the Parent Tab Only.
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# #undoCloseTabSetBehavior.title=Do you want other closed tabs to be restored too?
# #undoCloseTabSetBehavior.text=This tab was closed with other %S tab(s) together. How treat them?
@@ -57,7 +57,7 @@ compatibility_STM_warning_title=Super Tab Mode collides with Tree Style Tab
compatibility_STM_warning_text=New tabs opened from links (or others) don't become child of the current tab, because the position of new tabs is controlled by Super Tab Mode. Which feature do you want to be enabled?\n(*You can change those settings manually by the configuration dialog of Super Tab Mode.)
compatibility_STM_warning_use_TST=Make tabs children of the current tab
compatibility_STM_warning_use_STM=Put tabs to the position specified by Super Tab Mode
-compatibility_STM_warning_never=Don't show this dialo anymore.
+compatibility_STM_warning_never=Don't show this dialog anymore.
closeTabsToTheEnd_vertical_label=Close Tabs to the Bottom
diff --git a/locale/pl/treestyletab/treestyletab.properties b/locale/pl/treestyletab/treestyletab.properties
index 1957524..509a8df 100644
--- a/locale/pl/treestyletab/treestyletab.properties
+++ b/locale/pl/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bookmark the Parent Tab Only.
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# #undoCloseTabSetBehavior.title=Czy chcesz przywrócić również inne zamknięte karty?
# #undoCloseTabSetBehavior.text=Ta karta została zamknięta razem z innymi kartami: (&S). Jak je potraktować?
@@ -57,7 +57,7 @@ compatibility_STM_warning_title=Super Tab Mode collides with Tree Style Tab
compatibility_STM_warning_text=New tabs opened from links (or others) don't become child of the current tab, because the position of new tabs is controlled by Super Tab Mode. Which feature do you want to be enabled?\n(*You can change those settings manually by the configuration dialog of Super Tab Mode.)
compatibility_STM_warning_use_TST=Make tabs children of the current tab
compatibility_STM_warning_use_STM=Put tabs to the position specified by Super Tab Mode
-compatibility_STM_warning_never=Don't show this dialo anymore.
+compatibility_STM_warning_never=Don't show this dialog anymore.
closeTabsToTheEnd_vertical_label=Close Tabs to the Bottom
diff --git a/locale/sv-SE/treestyletab/treestyletab.properties b/locale/sv-SE/treestyletab/treestyletab.properties
index 5d6c1f3..065fabf 100644
--- a/locale/sv-SE/treestyletab/treestyletab.properties
+++ b/locale/sv-SE/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=Bokmärke endast för den överordnade fl
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# undoCloseTabSetBehavior.label=Vill du att följande %S flik(ar) skall #å terställas?
# undoCloseTabSetBehavior.never=Fråga mig inte igen
diff --git a/locale/zh-CN/treestyletab/treestyletab.properties b/locale/zh-CN/treestyletab/treestyletab.properties
index 2f9182b..d97d07e 100644
--- a/locale/zh-CN/treestyletab/treestyletab.properties
+++ b/locale/zh-CN/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=仅将该标签加入书签
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# undoCloseTabSetBehavior.label=你要恢复的标签是跟其他 %S 个标签一起被关闭的,是否一并恢复?
# undoCloseTabSetBehavior.never=以后都按此处理,不再提问
diff --git a/locale/zh-TW/treestyletab/treestyletab.properties b/locale/zh-TW/treestyletab/treestyletab.properties
index aa11be1..a692a40 100644
--- a/locale/zh-TW/treestyletab/treestyletab.properties
+++ b/locale/zh-TW/treestyletab/treestyletab.properties
@@ -28,7 +28,7 @@ bookmarkDroppedTabs.bookmarkOnlyParent=只加入父分頁
undoCloseTabSetBehavior.label=This tab was closed together with other %S tab(s) in a tree. Do you want them to be restored along?
undoCloseTabSetBehavior.restoreOnce=Restore tabs
-undoCloseTabSetBehavior.restoreForever=Always resotre tabs
+undoCloseTabSetBehavior.restoreForever=Always restore tabs
undoCloseTabSetBehavior.ignoreForever=Never show this notification
# undoCloseTabSetBehavior.label=您要一併復原以下 %S 個同時關閉的分頁嗎?
# undoCloseTabSetBehavior.never=不要再問我,以後都照此辦理
diff --git a/modules/autoHide.js b/modules/autoHide.js
index a614af2..694c728 100644
--- a/modules/autoHide.js
+++ b/modules/autoHide.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2010-2014
+ * Portions created by the Initial Developer are Copyright (C) 2010-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -59,12 +59,7 @@ XPCOMUtils.defineLazyGetter(this, 'prefs', function() {
});
-function AutoHideBrowser(aTabBrowser)
-{
- this.init(aTabBrowser);
-}
-AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
-
+const AutoHideConstants = Object.freeze(inherit(TreeStyleTabConstants, {
kMODE : 'treestyletab-tabbar-autohide-mode',
kMODE_DISABLED : 0,
kMODE_HIDE : 1,
@@ -88,17 +83,27 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
kSHOWHIDE_BY_RESIZE : 1 << 6,
kSHOWHIDE_BY_API : 1 << 8,
kHIDDEN_BY_CLICK : 1 << 7,
-
- get mode() /* PUBLIC API */
- {
- var mode = this.browser.getAttribute(this.kMODE);
- return mode ? parseInt(mode) : this.kMODE_DISABLED ;
- },
- set mode(aValue)
- {
- this.browser.setAttribute(this.kMODE, aValue);
- return aValue;
- },
+
+ CLOSE_BUTTONS_ONLY_ON_CURRENT_TAB : 0,
+ CLOSE_BUTTONS_ON_ALL_TABS : 1,
+ CLOSE_BUTTONS_DISABLED : 2,
+ CLOSE_BUTTONS_ON_TABBAR : 3,
+
+ MOUSE_POSITION_UNKNOWN : 0,
+ MOUSE_POSITION_OUTSIDE : (1 << 0),
+ MOUSE_POSITION_INSIDE : (1 << 1),
+ MOUSE_POSITION_NEAR : (1 << 2),
+ MOUSE_POSITION_SENSITIVE : (1 << 1) | (1 << 2)
+}));
+
+
+function AutoHideBase(aTabBrowser)
+{
+}
+AutoHideBase.prototype = inherit(AutoHideConstants, {
+ window : null,
+ browser : null,
+ treeStyleTab : null,
getMode : function AHB_getMode(aTabBrowser)
{
@@ -109,14 +114,60 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
getModeForNormal : function AHB_getModeForNormal(aTabBrowser)
{
var b = aTabBrowser || this.browser;
- return parseInt(b.getAttribute(this.kMODE+'-normal') || utils.getTreePref('tabbar.autoHide.mode'));
+ return parseInt(b.getAttribute(this.kMODE+'-normal') || this.lastNormalMode);
},
getModeForFullScreen : function AHB_getModeForFullScreen(aTabBrowser)
{
var b = aTabBrowser || this.browser;
- return parseInt(b.getAttribute(this.kMODE+'-fullscreen') || utils.getTreePref('tabbar.autoHide.mode.fullscreen'));
+ return parseInt(b.getAttribute(this.kMODE+'-fullscreen') || this.lastFullscreenMode);
+ },
+
+ get mode() /* PUBLIC API */
+ {
+ return this.getMode(this.browser);
+ },
+ set mode(aValue)
+ {
+ this.browser.setAttribute(this.kMODE, aValue);
+ return aValue;
+ },
+
+ get lastNormalMode()
+ {
+ var lastMode = this.treeStyleTab.getWindowValue(this.kMODE + '-normal');
+ if (lastMode !== '')
+ return parseInt(lastMode);
+
+ return utils.getTreePref('tabbar.autoHide.mode');
+ },
+ set lastNormalMode(aValue)
+ {
+ this.treeStyleTab.setWindowValue(this.kMODE + '-normal', aValue);
+ return aValue;
},
+
+ get lastFullscreenMode()
+ {
+ var lastMode = this.treeStyleTab.getWindowValue(this.kMODE + '-fullscreen');
+ if (lastMode !== '')
+ return parseInt(lastMode);
+
+ return utils.getTreePref('tabbar.autoHide.mode.fullscreen');
+ },
+ set lastFullscreenMode(aValue)
+ {
+ this.treeStyleTab.setWindowValue(this.kMODE + '-fullscreen', aValue);
+ return aValue;
+ }
+});
+
+function AutoHideBrowser(aTabBrowser)
+{
+ this.init(aTabBrowser);
+}
+AutoHideBrowser.prototype = inherit(AutoHideBase.prototype, {
+
get state()
{
return this.browser.getAttribute(this.kSTATE) || this.kSTATE_EXPANDED;
@@ -133,16 +184,25 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
{
return this.state == this.kSTATE_HIDDEN;
},
+
+ get toggler()
+ {
+ return this.document.getAnonymousElementByAttribute(this.browser, 'class', this.treeStyleTab.kTABBAR_TOGGLER);
+ },
- updateMode : function AHB_updateMode()
+ updateMode : function AHB_updateMode(aNewMode)
{
+ if (aNewMode === undefined)
+ aNewMode = this.mode;
+
+ var suffix = this.treeStyleTab.isFullscreenAutoHide ? 'fullscreen' : 'normal' ;
+ this.treeStyleTab.setWindowValue(this.kMODE + '-' + suffix, aNewMode);
+
this.end();
// update internal property after the appearance of the tab bar is updated.
var w = this.window;
w.setTimeout(function(aSelf) {
- aSelf.mode = (w.fullScreen && prefs.getPref('browser.fullscreen.autohide')) ?
- aSelf.getModeForFullScreen() :
- aSelf.getModeForNormal() ;
+ aSelf.mode = aNewMode;
if (aSelf.mode != aSelf.kMODE_DISABLED)
aSelf.start();
}, 0, this);
@@ -153,10 +213,6 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
contentAreaScreenEnabled : true,
closeButtonsMode : -1,
- CLOSE_BUTTONS_ONLY_ON_CURRENT_TAB : 0,
- CLOSE_BUTTONS_ON_ALL_TABS : 1,
- CLOSE_BUTTONS_DISABLED : 2,
- CLOSE_BUTTONS_ON_TABBAR : 3,
get XOffset()
{
@@ -183,8 +239,7 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
default:
case this.kMODE_SHRINK:
- return utils.getTreePref('tabbar.width')
- - utils.getTreePref('tabbar.shrunkenWidth');
+ return this.expandedWidth - this.shrunkenWidth;
}
},
get YOffset()
@@ -213,6 +268,70 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
) ? this.YOffset : 0 ;
},
+ get tabbarWidth()
+ {
+ return this.expanded ? this.expandedWidth : this.shrunkenWidth ;
+ },
+ set tabbarWidth(aValue)
+ {
+ if (this.expanded)
+ return this.expandedWidth = aValue;
+ else
+ return this.shrunkenWidth = aValue;
+ },
+ get expandedWidth()
+ {
+ var lastWidth = this.treeStyleTab.getWindowValue(this.kTABBAR_EXPANDED_WIDTH);
+ return lastWidth === '' ?
+ utils.getTreePref('tabbar.width') :
+ parseInt(lastWidth);
+ },
+ set expandedWidth(aValue)
+ {
+ var newWidth = this.treeStyleTab.calculateCorrectExpandedAndShrunkenWidth({
+ expanded : aValue,
+ shrunken : this.shrunkenWidth
+ }, 'expanded');
+ if (newWidth.corrected) {
+ this.shrunkenWidth = newWidth.shrunken;
+ aValue = newWidth.expanded;
+ }
+ this.treeStyleTab.setWindowValue(this.kTABBAR_EXPANDED_WIDTH, aValue);
+ this.treeStyleTab.setPrefForActiveWindow(function() {
+ utils.setTreePref('tabbar.width', aValue);
+ });
+ return aValue;
+ },
+ get shrunkenWidth()
+ {
+ var lastWidth = this.treeStyleTab.getWindowValue(this.kTABBAR_SHRUNKEN_WIDTH);
+ return lastWidth === '' ?
+ utils.getTreePref('tabbar.shrunkenWidth') :
+ parseInt(lastWidth);
+ },
+ set shrunkenWidth(aValue)
+ {
+ var newWidth = this.treeStyleTab.calculateCorrectExpandedAndShrunkenWidth({
+ expanded : this.expandedWidth,
+ shrunken : aValue
+ }, 'shrunken');
+ if (newWidth.corrected) {
+ this.expandedWidth = newWidth.expanded;
+ aValue = newWidth.shrunken;
+ }
+ this.treeStyleTab.setWindowValue(this.kTABBAR_SHRUNKEN_WIDTH, aValue);
+ this.treeStyleTab.setPrefForActiveWindow(function() {
+ utils.setTreePref('tabbar.shrunkenWidth', aValue);
+ });
+ return aValue;
+ },
+
+ resetWidth : function AHB_resetWidth()
+ {
+ this.expandedWidth = utils.getTreePref('tabbar.width.default');
+ this.shrunkenWidth = utils.getTreePref('tabbar.shrunkenWidth.default');
+ },
+
get screen()
{
return this.document.getElementById('treestyletab-autohide-content-area-screen');
@@ -224,7 +343,9 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
start : function AHB_start(aReason)
{
- if (this.enabled) return;
+ if (this.enabled)
+ return;
+
this.enabled = true;
aReason = aReason || 0;
@@ -262,7 +383,9 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
end : function AHB_end()
{
- if (!this.enabled) return;
+ if (!this.enabled)
+ return;
+
this.enabled = false;
var sv = this.treeStyleTab;
@@ -340,11 +463,13 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
startListenMouseMove : function AHB_startListenMouseMove()
{
- if (this.mouseMoveListening) return;
+ if (this.mouseMoveListening)
+ return;
this.screen.addEventListener('mousemove', this, true);
this.treeStyleTab.tabStripPlaceHolder.addEventListener('mousemove', this, true);
this.treeStyleTab.tabStrip.addEventListener('mousemove', this, true);
+ this.toggler.addEventListener('mousemove', this, true);
this.mouseMoveListening = true;
@@ -353,11 +478,13 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
endListenMouseMove : function AHB_endListenMouseMove()
{
- if (!this.mouseMoveListening) return;
+ if (!this.mouseMoveListening)
+ return;
this.screen.removeEventListener('mousemove', this, true);
this.treeStyleTab.tabStripPlaceHolder.removeEventListener('mousemove', this, true);
this.treeStyleTab.tabStrip.removeEventListener('mousemove', this, true);
+ this.toggler.removeEventListener('mousemove', this, true);
this.mouseMoveListening = false;
@@ -503,11 +630,6 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
};
return box;
},
- MOUSE_POSITION_UNKNOWN : 0,
- MOUSE_POSITION_OUTSIDE : (1 << 0),
- MOUSE_POSITION_INSIDE : (1 << 1),
- MOUSE_POSITION_NEAR : (1 << 2),
- MOUSE_POSITION_SENSITIVE : (1 << 1) | (1 << 2),
getNearestClickableBox : function AHB_getNearestClickableBox(aCoordinates)
{
var sv = this.treeStyleTab;
@@ -621,17 +743,19 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
setWidth : function AHB_setWidth(aWidth, aForceExpanded)
{
+ aWidth = this.treeStyleTab.maxTabbarWidth(aWidth);
if (aForceExpanded ||
this.expanded ||
this.mode != this.kMODE_SHRINK)
- utils.setTreePref('tabbar.width', this.treeStyleTab.maxTabbarWidth(aWidth));
+ this.expandedWidth = aWidth;
else
- utils.setTreePref('tabbar.shrunkenWidth', this.treeStyleTab.maxTabbarWidth(aWidth));
+ this.shrunkenWidth = aWidth;
},
updateMenuItem : function AHB_updateMenuItem(aNode)
{
- if (!aNode) return;
+ if (!aNode)
+ return;
if (this.mode != this.kMODE_DISABLED)
aNode.setAttribute('checked', true);
@@ -657,15 +781,15 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
get widthFromMode()
{
- return (this.shrunken) ?
- utils.getTreePref('tabbar.shrunkenWidth') :
- utils.getTreePref('tabbar.width') ;
+ return this.shrunken ?
+ this.shrunkenWidth :
+ this.expandedWidth ;
},
get placeHolderWidthFromMode()
{
return (this.mode == this.kMODE_SHRINK) ?
- utils.getTreePref('tabbar.shrunkenWidth') :
- utils.getTreePref('tabbar.width') ;
+ this.shrunkenWidth :
+ this.expandedWidth ;
},
get height()
@@ -846,7 +970,7 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
default:
case this.kMODE_SHRINK:
if (pos == 'left' || pos == 'right') {
- let width = sv.maxTabbarWidth(utils.getTreePref('tabbar.width'));
+ let width = sv.maxTabbarWidth(this.expandedWidth);
sv.updateFloatingTabbar(sv.kTABBAR_UPDATE_BY_AUTOHIDE);
}
break;
@@ -885,7 +1009,7 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show');
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN);
if (pos == 'left' || pos == 'right')
- sv.setTabStripAttribute('width', utils.getTreePref('tabbar.shrunkenWidth'));
+ sv.setTabStripAttribute('width', this.shrunkenWidth);
sv.updateFloatingTabbar(sv.kTABBAR_UPDATE_BY_AUTOHIDE);
break;
}
@@ -959,15 +1083,17 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
switch (aPrefName)
{
case 'extensions.treestyletab.tabbar.autoHide.mode':
- if (!this.window.TreeStyleTabService.shouldApplyNewPref) return;
+ if (!this.window.TreeStyleTabService.shouldApplyNewPref)
+ return;
this.browser.setAttribute(this.kMODE+'-normal', value);
- this.updateMode();
+ this.updateMode(value);
return;
case 'extensions.treestyletab.tabbar.autoHide.mode.fullscreen':
- if (!this.window.TreeStyleTabService.shouldApplyNewPref) return;
+ if (!this.window.TreeStyleTabService.shouldApplyNewPref)
+ return;
this.browser.setAttribute(this.kMODE+'-fullscreen', value);
- this.updateMode();
+ this.updateMode(value);
return;
case 'extensions.treestyletab.tabbar.autoShow.mousemove':
@@ -985,19 +1111,22 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
case 'extensions.treestyletab.tabbar.togglerSize':
this.togglerSize = value;
- var toggler = this.document.getAnonymousElementByAttribute(this.browser, 'class', this.treeStyleTab.kTABBAR_TOGGLER);
- toggler.style.minWidth = toggler.style.minHeight = value+'px';
- if (this.togglerSize <= 0)
- toggler.setAttribute('collapsed', true);
- else
- toggler.removeAttribute('collapsed');
+ {
+ let toggler = this.toggler;
+ toggler.style.minWidth = toggler.style.minHeight = value+'px';
+ if (this.togglerSize <= 0)
+ toggler.setAttribute('collapsed', true);
+ else
+ toggler.removeAttribute('collapsed');
+ }
return;
case 'extensions.treestyletab.tabbar.autoHide.contentAreaScreen.enabled':
return this.contentAreaScreenEnabled = value;
case 'browser.fullscreen.autohide':
- if (!this.window.fullScreen) return;
+ if (!this.window.fullScreen)
+ return;
this.end();
this.mode = value ?
this.getModeForFullScreen() :
@@ -1275,16 +1404,13 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
this.showHideOnMouseMoveTimer = null;
this.delayedShowForFeedbackTimer = null;
- b.setAttribute(this.kMODE+'-normal', utils.getTreePref('tabbar.autoHide.mode'));
- b.setAttribute(this.kMODE+'-fullscreen', utils.getTreePref('tabbar.autoHide.mode.fullscreen'));
+ b.setAttribute(this.kMODE+'-normal', this.lastNormalMode);
+ b.setAttribute(this.kMODE+'-fullscreen', this.lastFullscreenMode);
prefs.addPrefListener(this);
this.onPrefChange('browser.tabs.closeButtons');
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.area');
this.onPrefChange('extensions.treestyletab.tabbar.togglerSize');
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.contentAreaScreen.enabled');
- this.window.setTimeout(function(aSelf) {
- aSelf.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
- }, 0, this);
b.mTabContainer.addEventListener('TabOpen', this, false);
b.mTabContainer.addEventListener('TabClose', this, false);
@@ -1318,20 +1444,6 @@ AutoHideBrowser.prototype = inherit(TreeStyleTabConstants, {
delete this.browser;
delete this.document;
delete this.window;
- },
-
- saveCurrentState : function AHB_saveCurrentState()
- {
- var b = this.browser;
- var prefs = {
- 'tabbar.autoHide.mode' : this.getModeForNormal(b),
- 'tabbar.autoHide.mode.fullscreen' : this.getModeForFullScreen(b),
- };
- for (var i in prefs)
- {
- if (utils.getTreePref(i) != prefs[i])
- utils.setTreePref(i, prefs[i]);
- }
}
});
@@ -1340,7 +1452,7 @@ function AutoHideWindow(aWindow)
{
this.init(aWindow);
}
-AutoHideWindow.prototype = {
+AutoHideWindow.prototype = inherit(AutoHideBase.prototype, {
get browser()
{
return this.treeStyleTab.browser;
@@ -1348,29 +1460,13 @@ AutoHideWindow.prototype = {
// mode
- getMode : function AHW_getMode(aTabBrowser)
- {
- var b = aTabBrowser || this.browser;
- var mode = b.getAttribute(AutoHideBrowser.prototype.kMODE);
- return mode ? parseInt(mode) : AutoHideBrowser.prototype.kMODE_DISABLED ;
- },
-
- get mode() /* PUBLIC API */
+ get mode() /* PUBLIC API, overrides base class's one */
{
var mode = this.getMode();
- if (mode == AutoHideBrowser.prototype.kMODE_SHRINK &&
- this.treeStyleTab.position != 'left' &&
- this.treeStyleTab.position != 'right')
- return AutoHideBrowser.prototype.kMODE_HIDE;
+ if (mode == this.kMODE_SHRINK && !this.treeStyleTab.isVertical)
+ return this.kMODE_HIDE;
return mode;
},
-
- set mode(aValue)
- {
- var b = aTabBrowser || this.browser;
- b.setAttribute(AutoHideBrowser.prototype.kMODE, aValue);
- return aValue;
- },
toggleMode : function AHW_toggleMode(aTabBrowser) /* PUBLIC API */
{
@@ -1388,9 +1484,33 @@ AutoHideWindow.prototype = {
utils.getTreePref(toggleKey) :
AutoHideBrowser.prototype.kMODE_DISABLED ;
- utils.setTreePref(key, mode);
- b.setAttribute(AutoHideBrowser.prototype.kMODE+'-'+(w.fullScreen ? 'fullscreen' : 'normal' ), mode);
- b.treeStyleTab.autoHide.updateMode();
+ this.treeStyleTab.setPrefForActiveWindow(function() {
+ utils.setTreePref(key, mode);
+ b.setAttribute(AutoHideBrowser.prototype.kMODE+'-'+(w.fullScreen ? 'fullscreen' : 'normal' ), mode);
+ b.treeStyleTab.autoHide.updateMode(mode);
+ });
+ },
+
+ initMode : function AHW_initMode()
+ {
+ // save current state for this window's last state for new (clean) window
+ this.lastNormalMode = this.lastNormalMode;
+ this.lastFullscreenMode = this.lastFullscreenMode;
+
+ var mode = this.treeStyleTab.isFullscreenAutoHide ?
+ this.lastFullscreenMode :
+ this.lastNormalMode;
+
+ if (mode == this.mode)
+ return;
+
+ this.mode = mode;
+ if (mode != this.kMODE_DISABLED)
+ this.updateKeyListeners(this.window);
+
+ this.window.setTimeout(function(aSelf) {
+ aSelf.window.gBrowser.treeStyleTab.autoHide.updateMode(mode);
+ }, 0, this);
},
// for shortcuts
@@ -1438,19 +1558,86 @@ AutoHideWindow.prototype = {
);
},
- init : function AHB_init(aWindow)
+ init : function AHW_init(aWindow)
{
this.window = aWindow;
this.document = aWindow.document;
this.treeStyleTab = aWindow.TreeStyleTabService;
+ prefs.addPrefListener(this);
+ this.waitForWindowReady();
+
},
- destroy : function AHB_destroy()
+ destroy : function AHW_destroy()
{
+ this.endWaitForWindowReady();
+ prefs.removePrefListener(this);
delete this.treeStyleTab;
delete this.document;
delete this.window;
+ },
+
+ waitForWindowReady : function AHW_waitForWindowReady()
+ {
+ if (this.waitingForWindowReady)
+ return;
+
+ this.waitingForWindowReady = true;
+ this.window.addEventListener('SSWindowStateReady', this, false);
+ Services.obs.addObserver(this, 'browser-delayed-startup-finished', false);
+ },
+
+ endWaitForWindowReady : function AHW_endWaitForWindowReady()
+ {
+ if (!this.waitingForWindowReady)
+ return;
+
+ this.waitingForWindowReady = false;
+ this.window.removeEventListener('SSWindowStateReady', this, false);
+ Services.obs.removeObserver(this, 'browser-delayed-startup-finished');
+ },
+
+ handleEvent : function AHW_handleEvent(aEvent)
+ {
+ switch (aEvent.type)
+ {
+ case 'SSWindowStateReady':
+ this.endWaitForWindowReady();
+ this.initMode();
+ return;
+ }
+ },
+
+ observe : function AHW_observe(aSubject, aTopic, aData)
+ {
+ if (aSubject != this.window)
+ return;
+
+ this.endWaitForWindowReady();
+ this.window.setTimeout(this.initMode.bind(this), 0);
+ },
+
+ domains : [
+ 'extensions.treestyletab.',
+ 'browser.ctrlTab.previews'
+ ],
+
+ onPrefChange : function AHW_onPrefChange(aPrefName)
+ {
+ var value = prefs.getPref(aPrefName);
+ switch (aPrefName)
+ {
+ case 'extensions.treestyletab.tabbar.autoHide.mode':
+ case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown':
+ case 'extensions.treestyletab.tabbar.autoShow.tabSwitch':
+ case 'extensions.treestyletab.tabbar.autoShow.feedback':
+ case 'browser.ctrlTab.previews':
+ this.updateKeyListeners(this.window);
+
+ default:
+ return;
+ }
}
-};
+});
diff --git a/modules/base.js b/modules/base.js
index 8849492..9bbaab1 100644
--- a/modules/base.js
+++ b/modules/base.js
@@ -888,7 +888,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
setTabValue : function TSTBase_setTabValue(aTab, aKey, aValue)
{
- if (!aValue)
+ if (aValue === null || aValue === undefined || aValue === '')
return this.deleteTabValue(aTab, aKey);
aTab.setAttribute(aKey, aValue);
@@ -1749,7 +1749,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
this.readyToOpenChildTabNow(aBaseTab);
break;
case this.kNEWTAB_OPEN_AS_SIBLING:
- let (parentTab = this.getParentTab(aBaseTab)) {
+ {
+ let parentTab = this.getParentTab(aBaseTab);
if (parentTab)
this.readyToOpenChildTabNow(parentTab);
}
@@ -2414,10 +2415,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
},
set position(aValue)
{
- var position = String(aValue).toLowerCase();
- if (!position || !/^(top|bottom|left|right)$/.test(position))
- position = 'top';
-
+ var position = this.normalizeTabbarPosition(aValue);
if (position != utils.getTreePref('tabbar.position'))
utils.setTreePref('tabbar.position', position);
@@ -2431,6 +2429,24 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
{
return this.position = aValue;
},
+ normalizeTabbarPosition : function TSTBase_normalizeTabbarPosition(aPosition)
+ {
+ switch (aPosition)
+ {
+ case this.kTABBAR_TOP: return 'top';
+ case this.kTABBAR_RIGHT: return 'right';
+ case this.kTABBAR_BOTTOM: return 'bottom';
+ case this.kTABBAR_LEFT: return 'left';
+ default:
+ break;
+ }
+
+ var position = String(aPosition).toLowerCase();
+ if (!position || !/^(top|bottom|left|right)$/.test(position))
+ position = 'top';
+
+ return position;
+ },
getPositionFlag : function TSTBase_getPositionFlag(aPosition)
{
@@ -2476,7 +2492,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
case 'extensions.treestyletab.tabbar.width':
case 'extensions.treestyletab.tabbar.shrunkenWidth':
- return this.updateTabWidthPrefs(aPrefName);
+ return this.correctMismatchedTabWidthPrefs(aPrefName);
case 'browser.tabs.insertRelatedAfterCurrent':
case 'extensions.stm.tabBarMultiRows': // Super Tab Mode
@@ -2494,7 +2510,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
}
}
this.prefOverriding = true;
- let (target = aPrefName.replace('.override', '')) {
+ {
+ let target = aPrefName.replace('.override', '');
let originalValue = prefs.getPref(target);
if (originalValue !== null && originalValue != value)
prefs.setPref(target+'.backup', originalValue);
@@ -2538,31 +2555,47 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
}
},
- updateTabWidthPrefs : function TSTBase_updateTabWidthPrefs(aPrefName)
- {
- var expanded = utils.getTreePref('tabbar.width');
- var shrunken = utils.getTreePref('tabbar.shrunkenWidth');
- var originalExpanded = expanded;
- var originalShrunken = shrunken;
- if (aPrefName == 'extensions.treestyletab.tabbar.shrunkenWidth') {
- if (expanded <= shrunken)
- expanded = parseInt(shrunken / this.DEFAULT_SHRUNKEN_WIDTH_RATIO)
+ correctMismatchedTabWidthPrefs : function TSTBase_correctMismatchedTabWidthPrefs(aPrefName)
+ {
+ var newWidth = this.calculateCorrectExpandedAndShrunkenWidth({
+ expanded : utils.getTreePref('tabbar.width'),
+ shrunken : utils.getTreePref('tabbar.shrunkenWidth')
+ }, aPrefName.toLowerCase());
+ if (newWidth.corrected) {
+ utils.setTreePref('tabbar.width', newWidth.expanded);
+ utils.setTreePref('tabbar.shrunkenWidth', newWidth.shrunken);
+ }
+ },
+ calculateCorrectExpandedAndShrunkenWidth : function TSTBase_calculateCorrectExpandedAndShrunkenWidth(aSource, aModifiedTarget)
+ {
+ var size = {
+ expanded : aSource.expanded,
+ shrunken : aSource.shrunken,
+ corrected : false
+ };
+ var originalExpanded = size.expanded;
+ var originalShrunken = size.shrunken;
+ if (aModifiedTarget.indexOf('shrunken') > -1) {
+ if (size.expanded <= size.shrunken)
+ size.expanded = parseInt(size.shrunken / this.DEFAULT_SHRUNKEN_WIDTH_RATIO)
let w = this.browserWindow;
- if (w && expanded > w.gBrowser.boxObject.width) {
- expanded = w.gBrowser.boxObject.width * this.MAX_TABBAR_SIZE_RATIO;
- if (expanded <= shrunken)
- shrunken = parseInt(expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO)
+ if (w && size.expanded > w.gBrowser.boxObject.width) {
+ size.expanded = w.gBrowser.boxObject.width * this.MAX_TABBAR_SIZE_RATIO;
+ if (size.expanded <= size.shrunken)
+ size.shrunken = parseInt(size.expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO)
}
}
else {
- if (expanded <= shrunken)
- shrunken = parseInt(expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO);
- }
- if (expanded != originalExpanded ||
- shrunken != originalShrunken) {
- utils.setTreePref('tabbar.width', Math.max(0, expanded));
- utils.setTreePref('tabbar.shrunkenWidth', Math.max(0, shrunken));
- }
+ if (size.expanded <= size.shrunken)
+ size.shrunken = parseInt(size.expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO);
+ }
+ size.expanded = Math.max(0, size.expanded);
+ size.shrunken = Math.max(0, size.shrunken);
+ size.corrected = (
+ size.expanded != originalExpanded ||
+ size.shrunken != originalShrunken
+ );
+ return size;
},
get shouldApplyNewPref()
diff --git a/modules/browser.js b/modules/browser.js
index e52546d..8029094 100644
--- a/modules/browser.js
+++ b/modules/browser.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2011-2014
+ * Portions created by the Initial Developer are Copyright (C) 2011-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -194,6 +194,48 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
/* properties */
+ get tabbarWidth()
+ {
+ return this.autoHide.tabbarWidth;
+ },
+ set tabbarWidth(aValue)
+ {
+ return this.autoHide.tabbarWidth = aValue;
+ },
+/* // this section will be used after autoHide feature is separated in the future...
+ get tabbarWidth()
+ {
+ var width = this.getWindowValue(this.kTABBAR_WIDTH);
+ return width === '' ?
+ utils.getTreePref('tabbar.width') :
+ parseInt(width);
+ },
+ set tabbarWidth(aValue)
+ {
+ this.setWindowValue(this.kTABBAR_WIDTH, aValue);
+ this.setPrefForActiveWindow(function() {
+ utils.setTreePref('tabbar.width', aValue);
+ });
+ return aValue;
+ },
+*/
+
+ get tabbarHeight()
+ {
+ var height = this.getWindowValue(this.kTABBAR_HEIGHT);
+ return height === '' ?
+ utils.getTreePref('tabbar.height') :
+ parseInt(height);
+ },
+ set tabbarHeight(aValue)
+ {
+ this.setWindowValue(this.kTABBAR_HEIGHT, aValue);
+ this.setPrefForActiveWindow(function() {
+ utils.setTreePref('tabbar.height', aValue);
+ });
+ return aValue;
+ },
+
get maxTreeLevel()
{
return this._maxTreeLevel;
@@ -256,8 +298,48 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return this.fixed;
},
+ set temporaryPosition(aValue)
+ {
+ var position = this.normalizeTabbarPosition(aValue);
+ if (position == this.position)
+ return position;
+
+ if ('UndoTabService' in this.window && this.window.UndoTabService.isUndoable()) {
+ var current = this.position;
+ var self = this;
+ this.window.UndoTabService.doOperation(
+ function() {
+ self._changeTabbarPosition(position, true);
+ self._temporaryPosition = aValue;
+ },
+ {
+ label : utils.treeBundle.getString('undo_changeTabbarPosition_label'),
+ name : 'treestyletab-changeTabbarPosition-private',
+ data : {
+ oldPosition : current,
+ newPosition : position,
+ target : self.mTabBrowser.id
+ }
+ }
+ );
+ }
+ else {
+ this._changeTabbarPosition(position, true);
+ this._temporaryPosition = aValue;
+ }
+ return position;
+ },
+ _temporaryPosition : null,
+
get position() /* PUBLIC API */
{
+ if (this._temporaryPosition)
+ return this._temporaryPosition;
+
+ var lastPosition = this.getWindowValue(this.kTABBAR_POSITION);
+ if (lastPosition !== '')
+ return lastPosition;
+
return (
// Don't touch to the <tabbrowser/> element before it is initialized by XBL constructor.
(this.windowService.preInitialized && this.browser.getAttribute(this.kTABBAR_POSITION)) ||
@@ -266,10 +348,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
},
set position(aValue)
{
- var position = String(aValue).toLowerCase();
- if (!position || !/^(top|bottom|left|right)$/.test(position))
- position = 'top';
-
+ var position = this.normalizeTabbarPosition(aValue);
if (position == this.position)
return position;
@@ -279,6 +358,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
this.window.UndoTabService.doOperation(
function() {
self._changeTabbarPosition(position);
+ delete self._temporaryPosition;
},
{
label : utils.treeBundle.getString('undo_changeTabbarPosition_label'),
@@ -293,10 +373,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
}
else {
this._changeTabbarPosition(position);
+ delete this._temporaryPosition;
}
return position;
},
- _changeTabbarPosition : function TSTBrowser_changeTabbarPosition(aNewPosition)
+ _changeTabbarPosition : function TSTBrowser_changeTabbarPosition(aNewPosition, aIsTemporaryChange)
{
if (this.timers['_changeTabbarPosition'])
clearTimeout(this.timers['_changeTabbarPosition']);
@@ -304,7 +385,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
var oldPosition = this.position;
this.fireTabbarPositionEvent(true, oldPosition, aNewPosition);
- this.initTabbar(aNewPosition, oldPosition);
+ this.initTabbar(aNewPosition, oldPosition, aIsTemporaryChange);
this.reinitAllTabs();
this.timers['_changeTabbarPosition'] = setTimeout((function() {
@@ -483,16 +564,23 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
{
if (!this.windowService.preInitialized || !aTab)
return false;
+
if (aTab.getAttribute('pinned') == 'true')
return true;
+
var tabBox = this.getFutureBoxObject(aTab);
var barBox = this.scrollBox.boxObject;
- return (
- tabBox.screenX >= barBox.screenX &&
- tabBox.screenX + tabBox.width <= barBox.screenX + barBox.width &&
- tabBox.screenY >= barBox.screenY &&
- tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height
- );
+
+ if (this.isVertical)
+ return (
+ tabBox.screenY >= barBox.screenY &&
+ tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height
+ );
+ else
+ return (
+ tabBox.screenX >= barBox.screenX &&
+ tabBox.screenX + tabBox.width <= barBox.screenX + barBox.width
+ );
},
isMultiRow : function TSTBrowser_isMultiRow()
@@ -661,25 +749,23 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
* the tab bar larger than the floating tab bar.
*/
if (this.isVertical) {
- let key = this.autoHide.expanded ?
- 'tabbar.width' : 'tabbar.shrunkenWidth' ;
- let width = utils.getTreePref(key);
+ let width = this.tabbarWidth;
let minWidth = Math.max(this.MIN_TABBAR_WIDTH, this.scrollBox.boxObject.width);
if (minWidth > width) {
- this.setPrefForActiveWindow(function() {
- utils.setTreePref(key, minWidth);
+ this.setPrefForActiveWindow((function() {
+ this.tabbarWidth = minWidth;
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
- });
+ }).bind(this));
}
}
else {
- let height = utils.getTreePref('tabbar.height');
+ let height = this.tabbarHeight;
let minHeight = Math.max(this.MIN_TABBAR_HEIGHT, this.scrollBox.boxObject.height);
if (minHeight > height) {
- this.setPrefForActiveWindow(function() {
- utils.setTreePref('tabbar.height', minHeight);
+ this.setPrefForActiveWindow((function() {
+ this.tabbarHeight = minHeight;
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_PREF_CHANGE);
- });
+ }).bind(this));
}
}
},
@@ -737,7 +823,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
b.style.backgroundColor = '';
}
- this.initTabbar(null, this.kTABBAR_TOP);
+ this.initTabbar(null, this.kTABBAR_TOP, true);
w.addEventListener('resize', this, true);
w.addEventListener('beforecustomization', this, true);
@@ -781,10 +867,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
// this.panelDNDObserver;
this._readyToInitDNDObservers();
- // Init autohide service only if it have to be activated.
- if (this.isAutoHide)
- this.autoHide;
-
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_INITIALIZE);
this.fixTooNarrowTabbar();
@@ -1251,7 +1333,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
}).bind(this), 0);
},
- initTabbar : function TSTBrowser_initTabbar(aNewPosition, aOldPosition)
+ initTabbar : function TSTBrowser_initTabbar(aNewPosition, aOldPosition, aIsTemporaryChange)
{
var d = this.document;
var b = this.mTabBrowser;
@@ -1270,6 +1352,14 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
pos = this.kTABBAR_TOP;
}
+ if (!aIsTemporaryChange) {
+ let positionName = this.normalizeTabbarPosition(pos);
+ this.setWindowValue(this.kTABBAR_POSITION, positionName);
+ this.setPrefForActiveWindow(function() {
+ utils.setTreePref('tabbar.position', positionName);
+ });
+ }
+
aOldPosition = aOldPosition || pos;
var strip = this.tabStrip;
@@ -1342,7 +1432,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
this.setTabbrowserAttribute(this.kMODE, 'vertical');
- let width = this.maxTabbarWidth(utils.getTreePref('tabbar.width'), b);
+ //let width = this.maxTabbarWidth(this.tabbarWidth, b);
+ let width = this.maxTabbarWidth(this.autoHide.expandedWidth, b);
this.setTabStripAttribute('width', width);
this.removeTabStripAttribute('height');
b.mPanelContainer.removeAttribute('height');
@@ -1488,7 +1579,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
// for updateTabbarOverflow(), we should reset the "overflow" now.
b.mTabContainer.removeAttribute('overflow');
- let (container = this.document.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-container')) {
+ {
+ let container = this.document.getAnonymousElementByAttribute(b.mTabContainer, 'class', 'tabs-container');
if (container)
container.removeAttribute('overflow');
}
@@ -1701,7 +1793,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
}
else {
this.fixed = false; // ensure set to the current orient
- this.setTabStripAttribute('height', this.maxTabbarHeight(utils.getTreePref('tabbar.height'), b));
+ this.setTabStripAttribute('height', this.maxTabbarHeight(this.tabbarHeight, b));
}
if (toggleTabsOnTop) {
if (this.position == 'top')
@@ -1898,11 +1990,12 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
let realSize = this.getTabbarPlaceholderSize();
let width = (this.autoHide.expanded && this.isVertical && (aReason & this.kTABBAR_UPDATE_SYNC_TO_TABBAR) ?
- this.maxTabbarWidth(utils.getTreePref('tabbar.width')) :
+// this.maxTabbarWidth(this.tabbarWidth) :
+ this.maxTabbarWidth(this.autoHide.expandedWidth) :
0
) || realSize.width;
let height = (this.autoHide.expanded && !this.isVertical && (aReason & this.kTABBAR_UPDATE_SYNC_TO_TABBAR) ?
- this.maxTabbarHeight(utils.getTreePref('tabbar.height')) :
+ this.maxTabbarHeight(this.tabbarHeight) :
0
) || realSize.height;
let yOffset = pos == 'bottom' ? height - realSize.height : 0 ;
@@ -1944,6 +2037,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
}
this.mTabBrowser.tabContainer.setAttribute('context', this.mTabBrowser.tabContextMenu.id);
+ this._updateChatbar();
}
else {
strip.collapsed = tabContainerBox.collapsed = collapsed;
@@ -1964,6 +2058,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
strip.removeAttribute('layer'); // https://bugzilla.mozilla.org/show_bug.cgi?id=590468
this.mTabBrowser.tabContainer.removeAttribute('context');
+ this._resetChatbar();
}
if (tabContainerBox.boxObject.width)
@@ -2054,6 +2149,49 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
vertical ? '0' :
box.height+'px' ;
},
+
+ get _chatbarBox()
+ {
+ var chatbar = this.document.getElementById('pinnedchats');
+ return chatbar && chatbar.innerbox;
+ },
+ _updateChatbar : function TSTBrowser_updateChatbar()
+ {
+ var box = this._chatbarBox;
+ if (!box)
+ return;
+
+ this._resetChatbar();
+
+ var tabbarSize = this.getTabbarPlaceholderSize();
+ var splitterBox = this.splitter.boxObject;
+
+ switch (this.position)
+ {
+ case 'left':
+ box.style.marginLeft = (tabbarSize.width + splitterBox.width) + 'px';
+ break;
+
+ case 'right':
+ box.style.marginRight = (tabbarSize.width + splitterBox.width) + 'px';
+ break;
+
+ case 'bottom':
+ box.style.marginBottom = (tabbarSize.height + splitterBox.height) + 'px';
+ break;
+ }
+ },
+ _resetChatbar : function TSTBrowser_resetChatbar()
+ {
+ var box = this._chatbarBox;
+ if (!box)
+ return;
+
+ var style = box.style;
+ style.marginLeft =
+ style.marginRight =
+ style.marginBottom = '';
+ },
updateTabbarOverflow : function TSTBrowser_updateTabbarOverflow()
{
@@ -2238,24 +2376,18 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
saveCurrentState : function TSTBrowser_saveCurrentState()
{
- this.autoHide.saveCurrentState();
-
var b = this.mTabBrowser;
var floatingBox = this.getTabStrip(b).boxObject;
var fixedBox = (this.tabStripPlaceHolder || this.getTabStrip(b)).boxObject;
var prefs = {
'tabbar.fixed.horizontal' : b.getAttribute(this.kFIXED+'-horizontal') == 'true',
- 'tabbar.fixed.vertical' : b.getAttribute(this.kFIXED+'-vertical') == 'true',
- 'tabbar.width' : this.isVertical && this.autoHide.expanded && floatingBox.width ? floatingBox.width : void(0),
- 'tabbar.shrunkenWidth' : this.isVertical && !this.autoHide.expanded && fixedBox.width ? fixedBox.width : void(0),
- 'tabbar.height' : !this.isVertical && this.autoHide.expanded && floatingBox.height ? floatingBox.height : void(0)
+ 'tabbar.fixed.vertical' : b.getAttribute(this.kFIXED+'-vertical') == 'true'
};
for (var i in prefs)
{
if (prefs[i] !== void(0) && utils.getTreePref(i) != prefs[i])
utils.setTreePref(i, prefs[i]);
}
- this.position = this.position;
},
/* toolbar customization */
@@ -2274,7 +2406,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
this.window,
100,
function() {
- self.position = 'top';
+ self.temporaryPosition = 'top';
}
);
}
@@ -2528,7 +2660,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return;
case 'extensions.treestyletab.tabbar.autoShow.mousemove':
- let (toggler = this.document.getAnonymousElementByAttribute(b, 'class', this.kTABBAR_TOGGLER)) {
+ {
+ let toggler = this.document.getAnonymousElementByAttribute(b, 'class', this.kTABBAR_TOGGLER);
if (toggler) {
if (value)
toggler.removeAttribute('hidden');
@@ -2734,7 +2867,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
this._initTooltipManager();
if (!this._DNDObserversInitialized)
this._initDNDObservers();
- let (tab = aEvent.target) {
+ {
+ let tab = aEvent.target;
if (tab.__treestyletab__twistyHoverTimer)
this.window.clearTimeout(tab.__treestyletab__twistyHoverTimer);
if (this.isEventFiredOnTwisty(aEvent)) {
@@ -2748,7 +2882,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return;
case 'mouseout':
- let (tab = aEvent.target) {
+ {
+ let tab = aEvent.target;
if (tab.__treestyletab__twistyHoverTimer) {
this.window.clearTimeout(tab.__treestyletab__twistyHoverTimer);
delete tab.__treestyletab__twistyHoverTimer;
@@ -4101,7 +4236,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
return;
var restoringChildren = aTab.getAttribute(this.kCHILDREN_RESTORING);
- if (!restoringChildren) return;
+ if (!restoringChildren)
+ return;
var children = aTab.getAttribute(this.kCHILDREN);
if (restoringChildren != children) {
@@ -5068,15 +5204,16 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
resetTabbarSize : function TSTBrowser_resetTabbarSize()
{
if (this.isVertical) {
- utils.setTreePref('tabbar.shrunkenWidth', utils.getTreePref('tabbar.shrunkenWidth.default'));
- utils.setTreePref('tabbar.width', utils.getTreePref('tabbar.width.default'));
+ //this.tabbarWidth = utils.getTreePref('tabbar.width.default');
+ this.autoHide.resetWidth();
}
else {
- utils.setTreePref('tabbar.height', utils.getTreePref('tabbar.height.default'));
+ this.tabbarHeight = utils.getTreePref('tabbar.height.default');
let tabContainerBox = this.getTabContainerBox(this.mTabBrowser);
tabContainerBox.removeAttribute('height');
this._tabStripPlaceHolder.height = tabContainerBox.boxObject.height;
}
+
this.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_RESET);
},
@@ -6175,7 +6312,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
var maxMargin;
var offsetAttr;
var collapseProp = 'margin-'+this.collapseTarget;
- let (firstTab = this.getFirstNormalTab(this.mTabBrowser)) {
+ {
+ let firstTab = this.getFirstNormalTab(this.mTabBrowser);
if (this.isVertical) {
maxMargin = firstTab.boxObject.height;
offsetAttr = this.kY_OFFSET;
@@ -6827,10 +6965,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
get lastMouseDownTarget() { return this.autoHide.lastMouseDownTarget; },
set lastMouseDownTarget(aValue) { return this.autoHide.lastMouseDownTarget = aValue; },
- get tabbarWidth() { return this.autoHide.width; },
- set tabbarWidth(aValue) { return this.autoHide.widthwidth = aValue; },
- get tabbarHeight() { return this.autoHide.height; },
- set tabbarHeight(aValue) { return this.autoHide.height = aValue; },
get splitterWidth() { return this.autoHide.splitterWidth; },
get autoHideShown() { return this.autoHide.expanded; },
diff --git a/modules/constants.js b/modules/constants.js
index 9ac5a02..c1d4cbe 100644
--- a/modules/constants.js
+++ b/modules/constants.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2010-2014
+ * Portions created by the Initial Developer are Copyright (C) 2010-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -97,6 +97,11 @@ const TreeStyleTabConstants = Object.freeze({
kTABBAR_MOVE_FORCE : 'force',
kTABBAR_MOVE_NORMAL : 'normal',
+ kTABBAR_WIDTH : 'treestyletab-tabbar-width',
+ kTABBAR_EXPANDED_WIDTH : 'treestyletab-tabbar-width',
+ kTABBAR_SHRUNKEN_WIDTH : 'treestyletab-tabbar-shrunken-width',
+ kTABBAR_HEIGHT : 'treestyletab-tabbar-height',
+
kTAB_STRIP_ELEMENT : 'treestyletab-tabstrip-element',
/* classes */
diff --git a/modules/contentBridge.js b/modules/contentBridge.js
index f47dfbd..3bc0143 100644
--- a/modules/contentBridge.js
+++ b/modules/contentBridge.js
@@ -101,19 +101,22 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, {
switch (aMessage.json.command)
{
case this.COMMAND_REPORT_MOUSEDOWN:
- let (fakeEvent = this.fixupEventCoordinates(aMessage.json.event)) {
+ {
+ let fakeEvent = this.fixupEventCoordinates(aMessage.json.event);
this.mTabBrowser.treeStyleTab.autoHide.onMouseDown(fakeEvent);
}
return;
case this.COMMAND_REPORT_MOUSEUP:
- let (fakeEvent = this.fixupEventCoordinates(aMessage.json.event)) {
+ {
+ let fakeEvent = this.fixupEventCoordinates(aMessage.json.event);
this.mTabBrowser.treeStyleTab.autoHide.onMouseUp(fakeEvent);
}
return;
case this.COMMAND_REPORT_MOUSEMOVE:
- let (fakeEvent = this.fixupEventCoordinates(aMessage.json.event)) {
+ {
+ let fakeEvent = this.fixupEventCoordinates(aMessage.json.event);
this.mTabBrowser.treeStyleTab.autoHide.handleMouseMove(fakeEvent);
}
return;
@@ -130,13 +133,17 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, {
},
fixupEventCoordinates : function CB_fixupEventCoordinates(aCoordinates)
{
- var box = this.mTab.linkedBrowser.boxObject;
- // On Firefox 36 and later, screenX/screenY from content frame
- // is wrong (the position (0,0) is not the screen edge, but the
- // edge of the frame itself), so we have to calculate correct
- // screen coordinates manually.
- aCoordinates.screenX = box.screenX + aCoordinates.clientX;
- aCoordinates.screenY = box.screenY + aCoordinates.clientY;
+ // On Firefox 36 and later, screenX/screenY from out-of-process
+ // content frame is wrong, so we have to calculate correct
+ // screen coordinates manually via the utility method.
+ // This hack should be removed after the bug
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1075670
+ // is fixed.
+ if (typeof this.mTab.linkedBrowser.mapScreenCoordinatesFromContent == 'function') {
+ let fixedCoordinates = this.mTab.linkedBrowser.mapScreenCoordinatesFromContent(aCoordinates.screenX, aCoordinates.screenY);
+ aCoordinates.screenX = fixedCoordinates.x;
+ aCoordinates.screenY = fixedCoordinates.y;
+ }
return aCoordinates;
}
});
diff --git a/modules/fullTooltip.js b/modules/fullTooltip.js
index a0644e0..7962f2f 100644
--- a/modules/fullTooltip.js
+++ b/modules/fullTooltip.js
@@ -399,7 +399,8 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
aSelf.fill(aTab, aExtraLabels);
var tooltip = aSelf.tabFullTooltip;
- let (style = tooltip.style) {
+ {
+ let style = tooltip.style;
style.marginLeft = x+'px';
style.marginTop = y+'px';
style.maxWidth = style.minWidth = w+'px';
diff --git a/modules/pseudoTreeBuilder.js b/modules/pseudoTreeBuilder.js
index 4e3b4e3..de5ecf9 100644
--- a/modules/pseudoTreeBuilder.js
+++ b/modules/pseudoTreeBuilder.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2011-2014
+ * Portions created by the Initial Developer are Copyright (C) 2011-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -85,7 +85,7 @@ var PseudoTreeBuilder = {
' }\n' +
' });\n' +
' event.target.dispatchEvent(customEvent);\n' +
- '}').replace('%EVENT_TYPE%', this.kTAB_LINK_CLICK.quote()));
+ '}').replace('%EVENT_TYPE%', JSON.stringify(this.kTAB_LINK_CLICK)));
return tree;
},
diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js
index d6f6f61..d4204ac 100644
--- a/modules/tabbarDNDObserver.js
+++ b/modules/tabbarDNDObserver.js
@@ -1245,7 +1245,8 @@ catch(e) {
switch (aType)
{
case 'text/x-moz-place':
- let (uri = JSON.parse(aData).uri) {
+ {
+ let uri = JSON.parse(aData).uri;
if (uri)
return uri;
else
diff --git a/modules/tabpanelDNDObserver.js b/modules/tabpanelDNDObserver.js
index fa7e273..69689c5 100644
--- a/modules/tabpanelDNDObserver.js
+++ b/modules/tabpanelDNDObserver.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2010-2013
+ * Portions created by the Initial Developer are Copyright (C) 2010-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -129,9 +129,7 @@ TabpanelDNDObserver.prototype = {
let orient = (position == 'left' || position == 'right') ? 'vertical' : 'horizontal' ;
utils.setTreePref('tabbar.fixed.'+orient, false);
}
- sv.setPrefForActiveWindow(function() {
- sv.position = sv.base.position = position;
- });
+ sv.position = position;
}
aEvent.preventDefault();
diff --git a/modules/utils.js b/modules/utils.js
index 840a47b..da96b50 100644
--- a/modules/utils.js
+++ b/modules/utils.js
@@ -142,7 +142,8 @@ let TreeStyleTabUtils = {
this.clearTreePref('openGroupBookmarkAsTabSubTree.underParent');
}
case 4:
- let (subTreePrefs = [
+ {
+ let subTreePrefs = [
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.onCurrentTabRemove',
'extensions.treestyletab.autoCollapseExpandSubTreeOnSelect.whileFocusMovingByShortcut',
@@ -155,7 +156,7 @@ let TreeStyleTabUtils = {
'extensions.treestyletab.show.context-item-bookmarkTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-removeTabSubTree',
'extensions.multipletab.show.multipletab-selection-item-createSubTree'
- ]) {
+ ];
for (let i = 0, maxi = subTreePrefs.length; i < maxi; i++)
{
let pref = subTreePrefs[i];
@@ -168,25 +169,24 @@ let TreeStyleTabUtils = {
}
}
case 5:
- let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
+ {
+ let behavior = this.getTreePref('openGroupBookmark.behavior');
behavior = behavior | 2048;
this.setTreePref('openGroupBookmark.behavior', behavior);
}
case 6:
- let (
- general = this.getTreePref('autoAttachNewTabsAsChildren'),
- search = this.getTreePref('autoAttachSearchResultAsChildren')
- ) {
+ {
+ let general = this.getTreePref('autoAttachNewTabsAsChildren');
+ let search = this.getTreePref('autoAttachSearchResultAsChildren');
if (general !== null)
this.setTreePref('autoAttach', general);
if (search !== null)
this.setTreePref('autoAttach.searchResult', search);
}
case 7:
- let (
- enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'),
- delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay')
- ) {
+ {
+ let enabled = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut');
+ let delay = this.getTreePref('autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay');
if (enabled !== null) {
this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut', enabled);
this.setTreePref('autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.collapseOthers', enabled);
@@ -200,7 +200,8 @@ let TreeStyleTabUtils = {
'extensions.treestyletab.indent.min'
]);
case 9:
- let (behavior = this.getTreePref('openGroupBookmark.behavior')) {
+ {
+ let behavior = this.getTreePref('openGroupBookmark.behavior');
if (behavior & 4) {
behavior ^= 4;
behavior |= 1;
diff --git a/modules/window.js b/modules/window.js
index a1b87ae..b807215 100644
--- a/modules/window.js
+++ b/modules/window.js
@@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab.
*
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
- * Portions created by the Initial Developer are Copyright (C) 2012-2014
+ * Portions created by the Initial Developer are Copyright (C) 2012-2015
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex at gmail.com>
@@ -66,6 +66,9 @@ XPCOMUtils.defineLazyModuleGetter(this, 'TreeStyleTabThemeManager', 'resource://
XPCOMUtils.defineLazyModuleGetter(this, 'FullscreenObserver', 'resource://treestyletab-modules/fullscreenObserver.js');
XPCOMUtils.defineLazyModuleGetter(this, 'BrowserUIShowHideObserver', 'resource://treestyletab-modules/browserUIShowHideObserver.js');
+XPCOMUtils.defineLazyServiceGetter(this, 'SessionStore',
+ '@mozilla.org/browser/sessionstore;1', 'nsISessionStore');
+
function TreeStyleTabWindow(aWindow)
{
this.window = aWindow;
@@ -104,13 +107,20 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
},
set position(aValue)
{
+ var setPosition = (function() {
+ this.setPrefForActiveWindow((function() {
+ if (this.preInitialized && this.browser.treeStyleTab)
+ this.browser.treeStyleTab.position = aValue;
+ else
+ this.base.position = aValue;
+ }).bind(this));
+ }).bind(this);
+
if ('UndoTabService' in this.window && this.window.UndoTabService.isUndoable()) {
- var current = this.base.position;
+ var current = this.position;
var self = this;
this.window.UndoTabService.doOperation(
- function() {
- self.base.position = aValue;
- },
+ setPosition,
{
label : utils.treeBundle.getString('undo_changeTabbarPosition_label'),
name : 'treestyletab-changeTabbarPosition',
@@ -122,7 +132,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
);
}
else {
- this.base.position = aValue;
+ setPosition();
}
return aValue;
},
@@ -278,14 +288,13 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
kSEARCH_RESULT_ATTACH_IF_SELECTED : 1,
kSEARCH_RESULT_ATTACH_ALWAYS : 2,
- get isAutoHide()
+ get isFullscreenAutoHide()
{
- return this.window.fullScreen ?
- (
- prefs.getPref('browser.fullscreen.autohide') &&
- utils.getTreePref('tabbar.autoHide.mode.fullscreen')
- ) :
- utils.getTreePref('tabbar.autoHide.mode');
+ return Boolean(
+ this.window.fullScreen &&
+ prefs.getPref('browser.fullscreen.autohide') &&
+ utils.getTreePref('tabbar.autoHide.mode.fullscreen') != AutoHideWindow.prototype.kMODE_DISABLED
+ );
},
get autoHideWindow()
@@ -303,6 +312,43 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
}
return this._themeManager;
},
+
+ getWindowValue : function TSTWindow_getWindowValue(aKey)
+ {
+ var value = '';
+ try {
+ value = SessionStore.getWindowValue(this.window, aKey);
+ }
+ catch(e) {
+ }
+
+ return value;
+ },
+
+ setWindowValue : function TSTWindow_setWindowValue(aKey, aValue)
+ {
+ if (aValue === null || aValue === undefined || aValue === '')
+ return this.deleteWindowValue(this.window, aKey);
+
+ try {
+ SessionStore.setWindowValue(this.window, aKey, String(aValue));
+ }
+ catch(e) {
+ }
+
+ return aValue;
+ },
+
+ deleteWindowValue : function TSTWindow_deleteWindowValue(aKey)
+ {
+ aTab.removeAttribute(aKey);
+ try {
+ SessionStore.setWindowValue(this.window, aKey, '');
+ SessionStore.deleteWindowValue(this.window, aKey);
+ }
+ catch(e) {
+ }
+ },
/* Initializing */
@@ -380,9 +426,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
this.processRestoredTabs();
this.updateTabsOnTop();
- // Init autohide service only if it have to be activated.
- if (this.isAutoHide)
- this.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
+ this.autoHideWindow; // initialize
this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut');
@@ -793,11 +837,9 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
// when you just release accel key...
/* PUBLIC API */
- let (event) {
- this.fireCustomEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END, b, true, false, data);
- // for backward compatibility
- this.fireCustomEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END.replace(/^nsDOM/, ''), b, true, false, data);
- }
+ this.fireCustomEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END, b, true, false, data);
+ // for backward compatibility
+ this.fireCustomEvent(this.kEVENT_TYPE_TAB_FOCUS_SWITCHING_END.replace(/^nsDOM/, ''), b, true, false, data);
if (this._tabShouldBeExpandedAfterKeyReleased) {
let tab = this._tabShouldBeExpandedAfterKeyReleased;
@@ -931,25 +973,21 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
width += (pos == 'left' ? delta : -delta );
width = this.maxTabbarWidth(width, b);
if (expanded || b.treeStyleTab.autoHide.expanded) {
- this.setPrefForActiveWindow(function() {
- utils.setTreePref('tabbar.width', width);
- });
+ // b.treeStyleTab.tabbarWidth = width;
+ b.treeStyleTab.autoHide.expandedWidth = width;
if (b.treeStyleTab.autoHide.mode == b.treeStyleTab.autoHide.kMODE_SHRINK &&
b.treeStyleTab.tabStripPlaceHolder)
- b.treeStyleTab.tabStripPlaceHolder.setAttribute('width', utils.getTreePref('tabbar.shrunkenWidth'));
+ b.treeStyleTab.tabStripPlaceHolder.setAttribute('width', b.treeStyleTab.autoHide.shrunkenWidth);
}
else {
- this.setPrefForActiveWindow(function() {
- utils.setTreePref('tabbar.shrunkenWidth', width);
- });
+ b.treeStyleTab.autoHide.shrunkenWidth = width;
}
}
else {
let delta = aEvent.screenY - this.tabbarResizeStartY;
height += (pos == 'top' ? delta : -delta );
- this.setPrefForActiveWindow(function() {
- utils.setTreePref('tabbar.height', this.maxTabbarHeight(height, b));
- });
+ height = this.maxTabbarHeight(height, b);
+ b.treeStyleTab.tabbarHeight = height;
}
b.treeStyleTab.updateFloatingTabbar(this.kTABBAR_UPDATE_BY_TABBAR_RESIZE);
},
@@ -1224,14 +1262,35 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
onBeforeBrowserAccessOpenURI : function TSTWindow_onBeforeBrowserAccessOpenURI(aOpener, aWhere, aContext)
{
- var hasOwnerTab = (
- aOpener &&
- this.getTabFromFrame(aOpener.top)
- );
+ var hasOwnerTab = false;
+ var opener = null;
+ if (aOpener) {
+ if (aOpener instanceof Ci.nsIDOMWindow) {
+ opener = aOpener;
+ hasOwnerTab = this.getTabFromFrame(opener.top);
+ }
+ else if (Ci.nsIOpenURIInFrameParams &&
+ aOpener instanceof Ci.nsIOpenURIInFrameParams) {
+ // from remote contents, we have to detect its opener from the URI.
+ let referrer = aOpener.referrer;
+ if (referrer) {
+ let activeTab = this.browser.selectedTab;
+ let possibleOwners = [activeTab].concat(this.getAncestorTabs(activeTab));
+ for (let i = 0, maxi = possibleOwners.length; i < maxi; i++) {
+ let possibleOwner = possibleOwners[i];
+ if (possibleOwner.linkedBrowser.currentURI.spec != referrer)
+ continue;
+ hasOwnerTab = true;
+ opener = possibleOwner.linkedBrowser;
+ break;
+ }
+ }
+ }
+ }
var internalOpen = aContext != Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL;
if ((hasOwnerTab || internalOpen) &&
aWhere == Ci.nsIBrowserDOMWindow.OPEN_NEWTAB)
- this.handleNewTabFromCurrent(aOpener);
+ this.handleNewTabFromCurrent(opener);
},
onBeforeViewMedia : function TSTWindow_onBeforeViewMedia(aEvent, aOwner)
@@ -1746,22 +1805,12 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
var value = prefs.getPref(aPrefName);
switch (aPrefName)
{
- case 'extensions.treestyletab.tabbar.autoHide.mode':
- // don't set on this time, because appearance of all tabbrowsers are not updated yet.
- // this.autoHide.mode = utils.getTreePref('tabbar.autoHide.mode');
- case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown':
- case 'extensions.treestyletab.tabbar.autoShow.tabSwitch':
- case 'extensions.treestyletab.tabbar.autoShow.feedback':
- this.autoHideWindow.updateKeyListeners(this.window);
- break;
-
case 'extensions.treestyletab.tabbar.style':
case 'extensions.treestyletab.tabbar.position':
this.themeManager.set(prefs.getPref('extensions.treestyletab.tabbar.style'), this.position);
break;
case 'browser.ctrlTab.previews':
- this.autoHideWindow.updateKeyListeners(this.window);
case 'extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut':
case 'extensions.treestyletab.autoCollapseExpandSubtreeOnSelect':
if (this.shouldListenKeyEventsForAutoExpandByFocusChange)
diff --git a/skin/classic/treestyletab/base.css b/skin/classic/treestyletab/base.css
index 4cce227..6e69a51 100644
--- a/skin/classic/treestyletab/base.css
+++ b/skin/classic/treestyletab/base.css
@@ -118,3 +118,16 @@
.tab-icon-image:not([src]):not([pinned]) {
display: -moz-box;
}
+
+
+/* Don't show vertical tabs above other browser elements.
+ See also:
+ https://github.com/piroor/treestyletab/issues/586
+ https://github.com/piroor/treestyletab/pull/843
+ */
+.tabbrowser-tabs[treestyletab-mode="vertical"]
+ .tabbrowser-tab:not([selected="true"]),
+.tabbrowser-tabs[treestyletab-mode="vertical"]
+ .tabbrowser-tab[selected="true"] {
+ z-index: auto;
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tree-style-tab.git
More information about the Pkg-mozext-commits
mailing list