summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2019-02-04 14:04:03 +0100
committerGitHub <noreply@github.com>2019-02-04 14:04:03 +0100
commit5fde5ba78eece73f54803786a6e3a41085211b6e (patch)
tree99e09ab1f0ebca457aadaaa6fa5c948362f31cfb
parent23f587278abc939b5499e51863e3e63619be8a95 (diff)
parent74e88de9e9e6b10328c69f20b699be6eaf28655a (diff)
downloadUXP-5fde5ba78eece73f54803786a6e3a41085211b6e.tar
UXP-5fde5ba78eece73f54803786a6e3a41085211b6e.tar.gz
UXP-5fde5ba78eece73f54803786a6e3a41085211b6e.tar.lz
UXP-5fde5ba78eece73f54803786a6e3a41085211b6e.tar.xz
UXP-5fde5ba78eece73f54803786a6e3a41085211b6e.zip
Merge pull request #959 from FranklinDM/fullscreenpatch-v2
Use 'mousemove' events for hiding the Navigation Toolbar in Full Screen
-rw-r--r--application/basilisk/base/content/browser-fullScreenAndPointerLock.js35
-rw-r--r--application/palemoon/base/content/browser-fullScreen.js37
2 files changed, 20 insertions, 52 deletions
diff --git a/application/basilisk/base/content/browser-fullScreenAndPointerLock.js b/application/basilisk/base/content/browser-fullScreenAndPointerLock.js
index ebe55377f..b26a31f78 100644
--- a/application/basilisk/base/content/browser-fullScreenAndPointerLock.js
+++ b/application/basilisk/base/content/browser-fullScreenAndPointerLock.js
@@ -322,15 +322,9 @@ var FullScreen = {
document.addEventListener("popuphidden", this._setPopupOpen, false);
// If it is not safe to collapse, add the mouse position tracker or
// else it won't be possible to hide the navigation toolbox again
- if (!this._safeToCollapse()) {
- let rect = gBrowser.mPanelContainer.getBoundingClientRect();
- this._mouseTargetRect = {
- top: rect.top + 50,
- bottom: rect.bottom,
- left: rect.left,
- right: rect.right
- };
- MousePosTracker.addListener(this);
+ if (gPrefService.getBoolPref("browser.fullscreen.autohide")) {
+ gBrowser.mPanelContainer.addEventListener("mousemove",
+ this._collapseCallback, false);
}
// In DOM fullscreen mode, we hide toolbars with CSS
if (!document.fullscreenElement)
@@ -468,7 +462,8 @@ var FullScreen = {
cleanup: function () {
if (!window.fullScreen) {
- MousePosTracker.removeListener(this);
+ gBrowser.mPanelContainer.removeEventListener("mousemove",
+ this._collapseCallback, false);
document.removeEventListener("keypress", this._keyToggleCallback, false);
document.removeEventListener("popupshown", this._setPopupOpen, false);
document.removeEventListener("popuphidden", this._setPopupOpen, false);
@@ -497,17 +492,12 @@ var FullScreen = {
.getInterface(Ci.nsIDOMWindowUtils);
},
- getMouseTargetRect: function()
- {
- return this._mouseTargetRect;
- },
-
// Event callbacks
_expandCallback: function()
{
FullScreen.showNavToolbox();
},
- onMouseEnter: function()
+ _collapseCallback: function()
{
FullScreen.hideNavToolbox();
},
@@ -588,14 +578,8 @@ var FullScreen = {
// Track whether mouse is near the toolbox
if (trackMouse && !this.useLionFullScreen) {
- let rect = gBrowser.mPanelContainer.getBoundingClientRect();
- this._mouseTargetRect = {
- top: rect.top + 50,
- bottom: rect.bottom,
- left: rect.left,
- right: rect.right
- };
- MousePosTracker.addListener(this);
+ gBrowser.mPanelContainer.addEventListener("mousemove",
+ this._collapseCallback, false);
}
this._isChromeCollapsed = false;
@@ -622,7 +606,8 @@ var FullScreen = {
gNavToolbox.style.marginTop =
-gNavToolbox.getBoundingClientRect().height + "px";
this._isChromeCollapsed = true;
- MousePosTracker.removeListener(this);
+ gBrowser.mPanelContainer.removeEventListener("mousemove",
+ this._collapseCallback, false);
},
_updateToolbars: function (aEnterFS) {
diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js
index b1235a8d3..e816ce5c1 100644
--- a/application/palemoon/base/content/browser-fullScreen.js
+++ b/application/palemoon/base/content/browser-fullScreen.js
@@ -53,17 +53,9 @@ var FullScreen = {
document.addEventListener("popupshown", this._setPopupOpen, false);
document.addEventListener("popuphidden", this._setPopupOpen, false);
this._shouldAnimate = true;
- // If it is not safe to collapse, add the mouse position tracker or
- // else it won't be possible to hide the navigation toolbox again
- if (!this._safeToCollapse(document.mozFullScreen)) {
- let rect = gBrowser.mPanelContainer.getBoundingClientRect();
- this._mouseTargetRect = {
- top: rect.top + 50,
- bottom: rect.bottom,
- left: rect.left,
- right: rect.right
- };
- MousePosTracker.addListener(this);
+ if (gPrefService.getBoolPref("browser.fullscreen.autohide")) {
+ gBrowser.mPanelContainer.addEventListener("mousemove",
+ this._collapseCallback, false);
}
// We don't animate the toolbar collapse if in DOM full-screen mode,
// as the size of the content area would still be changing after the
@@ -149,7 +141,8 @@ var FullScreen = {
cleanup: function () {
if (!window.fullScreen) {
- MousePosTracker.removeListener(this);
+ gBrowser.mPanelContainer.removeEventListener("mousemove",
+ this._collapseCallback, false);
document.removeEventListener("keypress", this._keyToggleCallback, false);
document.removeEventListener("popupshown", this._setPopupOpen, false);
document.removeEventListener("popuphidden", this._setPopupOpen, false);
@@ -164,17 +157,12 @@ var FullScreen = {
}
},
- getMouseTargetRect: function()
- {
- return this._mouseTargetRect;
- },
-
// Event callbacks
_expandCallback: function()
{
FullScreen.showNavToolbox();
},
- onMouseEnter: function()
+ _collapseCallback: function()
{
FullScreen.hideNavToolbox();
},
@@ -328,14 +316,8 @@ var FullScreen = {
// Track whether mouse is near the toolbox
this._isChromeCollapsed = false;
if (trackMouse) {
- let rect = gBrowser.mPanelContainer.getBoundingClientRect();
- this._mouseTargetRect = {
- top: rect.top + 50,
- bottom: rect.bottom,
- left: rect.left,
- right: rect.right
- };
- MousePosTracker.addListener(this);
+ gBrowser.mPanelContainer.addEventListener("mousemove",
+ this._collapseCallback, false);
}
},
@@ -378,7 +360,8 @@ var FullScreen = {
gNavToolbox.style.marginTop =
-gNavToolbox.getBoundingClientRect().height + "px";
this._isChromeCollapsed = true;
- MousePosTracker.removeListener(this);
+ gBrowser.mPanelContainer.removeEventListener("mousemove",
+ this._collapseCallback, false);
},
showXULChrome: function(aTag, aShow)