[Pkg-mozext-commits] [tabmixplus] 50/123: Call Tabmix.getAfterTabsButtonsWidth after delay and clean adjustNewtabButtonvisibility. this should fix - 'Sometimes the newtab button gets placed into a new row on its own'
David Prévot
taffit at moszumanska.debian.org
Wed Sep 17 21:16:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 50ed05335ecf9b71ffe3ee794799cce873db263a
Author: onemen <tabmix.onemen at gmail.com>
Date: Tue Aug 26 19:51:04 2014 +0300
Call Tabmix.getAfterTabsButtonsWidth after delay and clean adjustNewtabButtonvisibility. this should fix - 'Sometimes the newtab button gets placed into a new row on its own'
---
chrome/content/tab/tabbrowser_4.xml | 13 +++++++---
chrome/content/tabmix.js | 51 +++++++++++++++++++++++++++----------
2 files changed, 47 insertions(+), 17 deletions(-)
diff --git a/chrome/content/tab/tabbrowser_4.xml b/chrome/content/tab/tabbrowser_4.xml
index d4a88df..6d3a602 100644
--- a/chrome/content/tab/tabbrowser_4.xml
+++ b/chrome/content/tab/tabbrowser_4.xml
@@ -414,7 +414,7 @@
* if we set this in field[s] they will reset each time the tabbar binding construct
* by tabbar position change
*/
- Tabmix.afterTabsButtonsWidth = [22];
+ Tabmix.afterTabsButtonsWidth = [Tabmix.isVersion(280) ? 37.2 : 28];
Tabmix.tabsNewtabButton =
document.getAnonymousElementByAttribute(this, "command", "cmd_newNavigatorTab");
Tabmix._show_newtabbutton = "aftertabs";
@@ -488,6 +488,7 @@
if (this._inUpdateVerticalTabStrip)
return this.getAttribute("multibar");
this._inUpdateVerticalTabStrip = true;
+
// we must adjustNewtabButtonvisibility before get lastTabRowNumber
this.adjustNewtabButtonvisibility();
let visibleRows = TabmixTabbar.visibleRows;
@@ -535,11 +536,15 @@
if (timeFromLastTabOpenedTime < 250)
timeout = 0;
}
+ /**
+ no need to change newTabButton visibility in order to calculate
+ its position
// Don't reset adjustNewtabButtonvisibility if multibar or rows
// didn't changed or when we get here from _enterVerticalMode
if (callerName != "_enterVerticalMode" &&
(multibar != currentMultibar || rows != visibleRows))
this.disAllowNewtabbutton = false;
+ */
let self = this;
this.adjustNewtabButtonTimeout = setTimeout(function() {
self.adjustNewtabButtonvisibility();
@@ -709,9 +714,9 @@
return document.getElementById("TabsToolbar").getAttribute("tabmix-show-newtabbutton") == "temporary-right-side";
]]></getter>
<setter><![CDATA[
- if (val || !this.overflow)
- TabmixTabbar.showNewTabButtonOnSide(val, "temporary-right-side");
- return val;
+ let newVal = this.overflow || val;
+ TabmixTabbar.showNewTabButtonOnSide(this.overflow || val, "temporary-right-side");
+ return newVal;
]]></setter>
</property>
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index a246eb2..dc4cf1a 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -53,8 +53,16 @@ Tabmix.beforeSessionStoreInit = function TMP_beforeSessionStoreInit(aPromise) {
Cu.import("resource://tabmixplus/extensions/AddonManager.jsm", tmp);
TMP_SessionStore.setService(1, true);
}
- this.getAfterTabsButtonsWidth();
+
TabmixSessionManager.init(aPromise);
+
+ // if we call this functions erlier we get this warning:
+ // XUL box for _moz_generated_content_before element contained an inline #text child
+ // by calling getBoundingClientRect
+ Tabmix.getButtonsHeight();
+ // with Australis build the button is not ready yet at this time
+ if (!this.isVersion(280))
+ this.getAfterTabsButtonsWidth();
}
// after TabmixSessionManager and SessionStore initialized
@@ -110,9 +118,23 @@ Tabmix.sessionInitialized = function() {
TabmixConvertSession.startup();
}
-// we call this at the start of gBrowserInit._delayedStartup
-// if we call it erlier we get this warning:
-// XUL box for _moz_generated_content_before element contained an inline #text child
+// we call gTMPprefObserver.miscellaneousRules to add some dynamic rules
+// from Tabmix.delayedStartup
+Tabmix.getButtonsHeight = function() {
+ if (gBrowser.tabContainer.orient == "horizontal") {
+ let tabBar = gBrowser.tabContainer;
+ let stripIsHidden = TabmixTabbar.hideMode != 0 && !tabBar.visible;
+ if (stripIsHidden)
+ tabBar.visible = true;
+ this._buttonsHeight =
+ tabBar.visibleTabsFirstChild.getBoundingClientRect().height;
+ if (stripIsHidden)
+ tabBar.visible = false;
+ }
+ else
+ this._buttonsHeight = 24;
+}
+
Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
if (gBrowser.tabContainer.orient == "horizontal") {
let tabBar = gBrowser.tabContainer;
@@ -123,12 +145,19 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
let showButton = tabsToolbar.getAttribute("tabmix-show-newtabbutton");
this.setItem(tabsToolbar, "tabmix-show-newtabbutton", "aftertabs-force");
// save tabsNewtabButton width
- let lwtheme = document.getElementById("main-window").getAttribute("lwtheme");
+ let lwtheme = !this.isVersion(280) && document.getElementById("main-window").getAttribute("lwtheme");
this.tabsNewtabButton =
document.getAnonymousElementByAttribute(tabBar, "command", "cmd_newNavigatorTab");
let openNewTabRect = this.tabsNewtabButton.getBoundingClientRect();
+ let style = window.getComputedStyle(this.tabsNewtabButton, null);
+ let marginStart = style.getPropertyValue("margin-left");
+ // it doesn't work when marginEnd add to buttonWidth
+ // let marginEnd = style.getPropertyValue("margin-right");
+ // let buttonWidth = openNewTabRect.width + parseFloat(marginStart) + parseFloat(marginEnd);
+ let buttonWidth = openNewTabRect.width + parseFloat(marginStart);
this.afterTabsButtonsWidth = [];
- this.afterTabsButtonsWidth.push(lwtheme ? 31 : openNewTabRect.width);
+ this.afterTabsButtonsWidth.push(lwtheme ? 31 : buttonWidth);
+
// when privateTab extension installed add its new tab button width
// for the use of adjustNewtabButtonvisibility set tabsNewtabButton to be
// the right button
@@ -139,17 +168,10 @@ Tabmix.getAfterTabsButtonsWidth = function TMP_getAfterTabsButtonsWidth() {
if (openNewPrivateTabRect.right > openNewTabRect.right)
this.tabsNewtabButton = openNewPrivateTab;
}
- // we call gTMPprefObserver.miscellaneousRules to add some dynamic rules
- // from Tabmix.delayedStartup
- this._buttonsHeight =
- tabBar.visibleTabsFirstChild.getBoundingClientRect().height;
-
this.setItem(tabsToolbar, "tabmix-show-newtabbutton", showButton);
if (stripIsHidden)
tabBar.visible = false;
}
- else
- this._buttonsHeight = 24;
}
Tabmix.delayedStartup = function TMP_delayedStartup() {
@@ -186,6 +208,9 @@ Tabmix.delayedStartup = function TMP_delayedStartup() {
TMP_extensionsCompatibility.onDelayedStartup();
+ if (this.isVersion(280))
+ setTimeout(function() {Tabmix.getAfterTabsButtonsWidth();}, 100);
+
gTMPprefObserver.setMenuIcons();
TabmixTabbar.updateSettings(true);
--
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