[Pkg-mozext-commits] [tabmixplus] 68/107: Update the area that uses to hide the tabbar on full screen when Tabmix changes the tabbar height or when the tabbar is below content

David Prévot taffit at moszumanska.debian.org
Tue Dec 29 19:02:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit f34e7df7622f5d43123bf7b8fa2db8a7d6504d68
Author: onemen <tabmix.onemen at gmail.com>
Date:   Wed Nov 11 21:25:33 2015 +0200

    Update the area that uses to hide the tabbar on full screen when Tabmix changes the tabbar height or when the tabbar is below content
---
 chrome/content/tab/tab.js | 17 ++++++++++++++++-
 chrome/content/tabmix.js  | 30 +++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index a59be34..859910c 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -264,6 +264,11 @@ var TabmixTabbar = {
       else
         newHeight = this.getRowHeight(tabsPosition) * aRows;
 
+      // don't proceed, probably the tabbar is not visible
+      if (newHeight === 0) {
+        return;
+      }
+
       this._heights[tabsPosition][aRows] = newHeight;
       if (fillRowsHeights || (aRows > 2 && typeof (this._heights[tabsPosition][aRows - 1]) == "undefined")) {
         let rowHeight = newHeight / aRows;
@@ -312,7 +317,7 @@ var TabmixTabbar = {
         mWin.style.setProperty("padding-top", newTabbarHeight + "px", "important");
       }
     }
-    gTMPprefObserver.updateTabbarBottomPosition();
+    this.tabBarHeightModified();
   },
 
   resetHeight: function TMP_resetHeight() {
@@ -336,7 +341,17 @@ var TabmixTabbar = {
     if (TabmixSvc.isMac) {
       document.getElementById("TabsToolbar").style.removeProperty("height");
     }
+    this.tabBarHeightModified();
+  },
+
+  tabBarHeightModified: function() {
     gTMPprefObserver.updateTabbarBottomPosition();
+    TMP_eventListener.updateMouseTargetRect();
+
+    // dispatch event
+    let event = document.createEvent("Events");
+    event.initEvent("Tabmix.TabBarHeightModified", true, false);
+    document.getElementById("TabsToolbar").dispatchEvent(event);
   },
 
   _handleResize: function TMP__handleResize() {
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index da16c6a..b4fbb76 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -687,10 +687,38 @@ var TMP_eventListener = {
     this._updateMarginBottom("");
     this.toggleTabbarVisibility(true);
     this.updateMultiRow();
-    setTimeout(() => this.updateMultiRow(), 0);
+    setTimeout(() => {
+      this.updateMultiRow();
+      // overwrite FullScreen.showNavToolbox calculation for _mouseTargetRect
+      if (TabmixTabbar.position == 1) {
+        this.updateMouseTargetRect();
+      }
+    }, 0);
     gBrowser.ensureTabIsVisible(gBrowser.selectedTab, false);
   },
 
+ /**
+  * for use in Firefox 40+.
+  * update FullScreen._mouseTargetRect when in full screen and the tabbar is
+  * visible. we call this function from tabBarHeightModified and showNavToolbox
+  */
+  updateMouseTargetRect: function() {
+    if (!Tabmix.isVersion(400)) {
+      return;
+    }
+    if (!window.fullScreen || FullScreen._isChromeCollapsed) {
+      return;
+    }
+
+    let rect = gBrowser.mPanelContainer.getBoundingClientRect();
+    FullScreen._mouseTargetRect = {
+      top: rect.top + 50,
+      bottom: rect.bottom - (TabmixTabbar.position == 1) * 50,
+      left: rect.left,
+      right: rect.right
+    };
+  },
+
   _updateMarginBottom: function TMP_EL__updateMarginBottom(aMargin) {
     if (TabmixTabbar.position == 1) {
       let bottomToolbox = document.getElementById("tabmix-bottom-toolbox");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list