diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js
index a3684f95f65..6e5f25e5655 100644
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -14,6 +14,13 @@ const Cr = Components.results;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
+#ifdef MOZ_WIDGET_GONK
+XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
+ Cu.import("resource://gre/modules/systemlibs.js");
+ return libcutils;
+});
+#endif
+
// Once Bug 731746 - Allow chrome JS object to implement nsIDOMEventTarget
// is resolved this helper could be removed.
var SettingsListener = {
@@ -174,27 +181,10 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
// Get the hardware info and firmware revision from device properties.
let hardware_info = null;
let firmware_revision = null;
- try {
- let cutils = ctypes.open('libcutils.so');
- let cbuf = ctypes.char.array(128)();
- let c_property_get = cutils.declare('property_get', ctypes.default_abi,
- ctypes.int, // return value: length
- ctypes.char.ptr, // key
- ctypes.char.ptr, // value
- ctypes.char.ptr); // default
- let property_get = function (key, defaultValue) {
- if (defaultValue === undefined) {
- defaultValue = null;
- }
- c_property_get(key, cbuf, defaultValue);
- return cbuf.readString();
- }
- hardware_info = property_get('ro.hardware');
- firmware_revision = property_get('ro.firmware_revision');
- cutils.close();
- } catch(e) {
- // Error.
- }
+#ifdef MOZ_WIDGET_GONK
+ hardware_info = libcutils.property_get('ro.hardware');
+ firmware_revision = libcutils.property_get('ro.firmware_revision');
+#endif
lock.set('deviceinfo.hardware', hardware_info, null, null);
lock.set('deviceinfo.firmware_revision', firmware_revision, null, null);
})();
@@ -205,6 +195,19 @@ SettingsListener.observe('devtools.debugger.remote-enabled', false, function(val
// This preference is consulted during startup
Services.prefs.savePrefFile(null);
value ? RemoteDebugger.start() : RemoteDebugger.stop();
+
+#ifdef MOZ_WIDGET_GONK
+ // Configure adb.
+ try {
+ let current = libcutils.property_get("persist.sys.usb.config");
+ let prefix = current.replace(/,adb/, "");
+ libcutils.property_set("persist.sys.usb.config",
+ prefix + (value ? ",adb" : ""));
+ current = libcutils.property_get("persist.sys.usb.config");
+ } catch(e) {
+ dump("Error configuring adb: " + e);
+ }
+#endif
});
SettingsListener.observe('debug.log-animations.enabled', false, function(value) {
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
index f14829d8f06..3e6278c191b 100644
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -52,6 +52,14 @@ tabbrowser {
opacity 50ms ease-out 180ms /* hide the tab for the last 20ms of the max-width transition */;
}
+.tabbrowser-tabs[dontresize] > .tabbrowser-tab[fadein]:not([pinned]) {
+ /* controlled in tabbrowser.xml */
+}
+
+.tabbrowser-tabs[dontanimate] > .tabbrowser-tab {
+ transition: none !important;
+}
+
.tab-throbber:not([fadein]):not([pinned]),
.tab-label:not([fadein]):not([pinned]),
.tab-icon-image:not([fadein]):not([pinned]),
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 9f6fe17ca48..1dea8f5699c 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1265,7 +1265,7 @@ var gBrowserInit = {
gBrowser.addEventListener("pageshow", function(event) {
// Filter out events that are not about the document load we are interested in
- if (content && event.target == content.document)
+ if (event.target == content.document)
setTimeout(pageShowEventHandlers, 0, event);
}, true);
diff --git a/browser/base/content/tabbrowser.css b/browser/base/content/tabbrowser.css
index 2dd6a05297c..9f1b8a91f44 100644
--- a/browser/base/content/tabbrowser.css
+++ b/browser/base/content/tabbrowser.css
@@ -47,11 +47,12 @@ tabpanels {
}
.closing-tabs-spacer {
+ min-width: 0;
pointer-events: none;
}
.tabbrowser-tabs:not(:hover) > .tabbrowser-arrowscrollbox > .closing-tabs-spacer {
- transition: width .15s ease-out;
+ transition: min-width 150ms ease-out;
}
/**
diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml
index 59bbaedee45..62e887dae38 100644
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1584,7 +1584,6 @@
aTab._animStartTime = Date.now();
this._blurTab(aTab);
- aTab.style.maxWidth = ""; // ensure that fade-out transition happens
aTab.removeAttribute("fadein");
setTimeout(function (tab, tabbrowser) {
@@ -1781,10 +1780,6 @@
// update tab close buttons state
this.tabContainer.adjustTabstrip();
-
- setTimeout(function(tabs) {
- tabs._lastTabClosedByMouse = false;
- }, 0, this.tabContainer);
}
// update first-tab/last-tab/beforeselected/afterselected attributes
@@ -2829,10 +2824,13 @@
return; // Ignore vertical events
var tabs = document.getBindingParent(this);
- tabs.removeAttribute("overflow");
- if (tabs._lastTabClosedByMouse)
- tabs._expandSpacerBy(this._scrollButtonDown.clientWidth);
+ if (tabs.hasAttribute("dontresize") || tabs.hasAttribute("using-closing-tabs-spacer")) {
+ tabs.mTabstrip._scrollButtonUp.style.visibility = "hidden";
+ tabs.mTabstrip._scrollButtonDown.style.visibility = "hidden";
+ } else {
+ tabs.removeAttribute("overflow");
+ }
tabs.tabbrowser._removingTabs.forEach(tabs.tabbrowser.removeTab,
tabs.tabbrowser);
@@ -2877,8 +2875,7 @@
command="cmd_newNavigatorTab"
onclick="checkForMiddleClick(this, event);"
tooltiptext="&newTabButton.tooltip;"/>
-
+
@@ -3075,9 +3072,16 @@
document.getAnonymousElementByAttribute(this, "anonid", "closing-tabs-spacer");
- NaN
- false
- false
+ .tabbrowser-tab[fadein]:not([pinned])";
+
+ // XXX: document.styleSheets is not iterable (see bug 738196)
+ for (let sheet of Array.slice(document.styleSheets))
+ if (sheet.href == href)
+ for (let rule of Array.slice(sheet.cssRules))
+ if (rule.selectorText == selector) { rule; break; }
+ ]]>
@@ -3090,62 +3094,48 @@
var isEndTab = (aTab._tPos > tabs[tabs.length-1]._tPos);
var tabWidth = aTab.getBoundingClientRect().width;
- if (!this._tabDefaultMaxWidth)
- this._tabDefaultMaxWidth =
- parseFloat(window.getComputedStyle(aTab).maxWidth);
- this._lastTabClosedByMouse = true;
+ // Locking is neither in effect nor needed, so let tabs expand normally.
+ if (isEndTab && !this.hasAttribute("dontresize"))
+ return;
- if (this.getAttribute("overflow") == "true") {
- // Don't need to do anything if we're in overflow mode and aren't scrolled
- // all the way to the right, or if we're closing the last tab.
- if (isEndTab || !this.mTabstrip._scrollButtonDown.disabled)
- return;
+ // Let spacer grow to the maximum and lock it, then let tabs expand normally
+ if (isEndTab) {
+ let spacer = this._closingTabsSpacer;
+ spacer.style.MozBoxFlex = 1;
+ spacer.style.minWidth = getComputedStyle(spacer).width;
+ spacer.style.MozBoxFlex = "";
- // If the tab has an owner that will become the active tab, the owner will
- // be to the left of it, so we actually want the left tab to slide over.
- // This can't be done as easily in non-overflow mode, so we don't bother.
- if (aTab.owner)
- return;
-
- this._expandSpacerBy(tabWidth);
- } else { // non-overflow mode
- // Locking is neither in effect nor needed, so let tabs expand normally.
- if (isEndTab && !this._hasTabTempMaxWidth)
- return;
-
- let numPinned = this.tabbrowser._numPinnedTabs;
- // Force tabs to stay the same width, unless we're closing the last tab,
- // which case we need to let them expand just enough so that the overall
- // tabbar width is the same.
- if (isEndTab) {
- let numNormalTabs = tabs.length - numPinned;
- tabWidth = tabWidth * (numNormalTabs + 1) / numNormalTabs;
- if (tabWidth > this._tabDefaultMaxWidth)
- tabWidth = this._tabDefaultMaxWidth;
- }
- tabWidth += "px";
- for (let i = numPinned; i < tabs.length; i++) {
- let tab = tabs[i];
- tab.style.setProperty("max-width", tabWidth, "important");
- if (!isEndTab) { // keep tabs the same width
- tab.style.transition = "none";
- tab.clientTop; // flush styles to skip animation; see bug 649247
- tab.style.transition = "";
- }
- }
- this._hasTabTempMaxWidth = true;
- this.tabbrowser.addEventListener("mousemove", this, false);
- window.addEventListener("mouseout", this, false);
+ this.setAttribute("dontanimate", "true");
+ this.removeAttribute("dontresize");
+ this.clientTop;
+ this.removeAttribute("dontanimate");
+ return;
+ }
+
+ if (!this.hasAttribute("dontresize")) {
+ this._delayResizingRule.style.setProperty("max-width", tabWidth + "px", "important");
+ this.setAttribute("dontanimate", "true");
+ this.setAttribute("dontresize", "true");
+ this.clientTop; // flush styles to skip animation; see bug 649247
+ this.removeAttribute("dontanimate");
+ }
+
+ if (!this.mTabstrip._scrollButtonUp.disabled) {
+ let spacer = this._closingTabsSpacer;
+ let width = parseFloat(spacer.style.minWidth) || 0;
+ width += tabWidth;
+
+ if (!this.mTabstrip._scrollButtonDown.disabled) {
+ let scrollbox = this.mTabstrip._scrollbox;
+ width -= scrollbox.scrollLeftMax - scrollbox.scrollLeft;
+ }
+
+ if (width >= 0) {
+ spacer.style.minWidth = width + "px";
+ this.setAttribute("using-closing-tabs-spacer", "true");
+ }
}
- ]]>