From 075487b83638ee55ebb74986b23fbd1e0b2cb49c Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 18 Aug 2015 12:10:08 +1000 Subject: [PATCH 1/2] Fix sidebar in fullscreen mode for Firefox 40+. This is a change from bug 947854 where FullScreen.mouseoverToggle is replaced with FullScreen.{show,hide}NavToolbox. This fix detects this and do patching accordingly. --- content/treestyletab/windowHelper.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index 0834b6d5..bd6b3b9f 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -259,12 +259,28 @@ var TreeStyleTabWindowHelper = { )); }, 'TreeStyleTab'); - TreeStyleTabUtils.doPatching(FullScreen.mouseoverToggle, 'FullScreen.mouseoverToggle', function(aName, aSource) { - return eval(aName+' = '+aSource.replace( - 'this._isChromeCollapsed = !aShow;', - 'gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_FULLSCREEN); $&' - )); - }, 'treeStyleTab'); + if ('showNavToolbox' in FullScreen) { // for Firefox 40 or later + TreeStyleTabUtils.doPatching(FullScreen.showNavToolbox, 'FullScreen.showNavToolbox', function(aName, aSource) { + return eval(aName+' = '+aSource.replace( + 'this._isChromeCollapsed = false;', + 'gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_FULLSCREEN); $&' + )); + }, 'treeStyleTab'); + TreeStyleTabUtils.doPatching(FullScreen.hideNavToolbox, 'FullScreen.hideNavToolbox', function(aName, aSource) { + return eval(aName+' = '+aSource.replace( + 'this._isChromeCollapsed = true;', + 'gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_FULLSCREEN); $&' + )); + }, 'treeStyleTab'); + } + else if ('mouseoverToggle' in FullScreen) { // for Firefox 39 or older + TreeStyleTabUtils.doPatching(FullScreen.mouseoverToggle, 'FullScreen.mouseoverToggle', function(aName, aSource) { + return eval(aName+' = '+aSource.replace( + 'this._isChromeCollapsed = !aShow;', + 'gBrowser.treeStyleTab.updateFloatingTabbar(gBrowser.treeStyleTab.kTABBAR_UPDATE_BY_FULLSCREEN); $&' + )); + }, 'treeStyleTab'); + } TreeStyleTabUtils.doPatching(FullScreen.toggle, 'FullScreen.toggle', function(aName, aSource) { return eval(aName+' = '+aSource.replace( From 1e8a1bc3240ae60b6a038b8af0ba13197a3a4e81 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 18 Aug 2015 12:11:23 +1000 Subject: [PATCH 2/2] Fix Fullscreen API issue for Firefox 41+. This is a change from bug 1161802 which makes the "fullscreen" event be triggered after window.fullScreen value flips. --- content/treestyletab/windowHelper.js | 4 ++-- modules/browser.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index bd6b3b9f..e0bca8f5 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -284,8 +284,8 @@ var TreeStyleTabWindowHelper = { TreeStyleTabUtils.doPatching(FullScreen.toggle, 'FullScreen.toggle', function(aName, aSource) { return eval(aName+' = '+aSource.replace( - '{', - '{ gBrowser.treeStyleTab.onBeforeFullScreenToggle(); ' + 'if (enterFS) {', + 'gBrowser.treeStyleTab.onBeforeFullScreenToggle(enterFS); $&' )); }, 'treeStyleTab'); diff --git a/modules/browser.js b/modules/browser.js index d91f39d2..a571f16b 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -5120,17 +5120,16 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { }).bind(this), 0); }, - onBeforeFullScreenToggle : function TSTBrowser_onBeforeFullScreenToggle() + onBeforeFullScreenToggle : function TSTBrowser_onBeforeFullScreenToggle(aEnterFS) { if (this.position != 'top') { - var isEnteringFullScreenMode = !this.window.fullScreen; // entering to the DOM-fullscreen (ex. YouTube Player) - if (this.document.mozFullScreen && isEnteringFullScreenMode) { + if (this.document.mozFullScreen) { this.setTabbrowserAttribute(this.kDOM_FULLSCREEN_ACTIVATED, true); } else { if (this.document.documentElement.getAttribute(this.kDOM_FULLSCREEN_ACTIVATED) != 'true') { - if (isEnteringFullScreenMode) + if (aEnterFS) this.autoHide.startForFullScreen(); else this.autoHide.endForFullScreen();