Bug 694084 - Showing/hiding the conditional forward button resizes the search bar in a new profile (when the url/search bar splitter hasn't been used). r=gavin a=johnath CALENDAR_1_2_BUILD1 CALENDAR_1_2_RELEASE
authorDão Gottwald <dao@mozilla.com>
Fri, 20 Jan 2012 15:25:56 +0100
changeset 81614 9a4a472c23b3b237c4f1b3ab1872d66f521a33b6
parent 81613 a02b2c63e8d967f2b80d7227e3a9e808351fe06b
child 81615 138e167dcd3d0ff03ab544f79f9f56c3654f87d4
child 81616 ccb2d3a6813b910412f59bda1c97a32881ee93d1
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersgavin, johnath
bugs694084
milestone10.0
Bug 694084 - Showing/hiding the conditional forward button resizes the search bar in a new profile (when the url/search bar splitter hasn't been used). r=gavin a=johnath
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1685,16 +1685,22 @@ function delayedStartup(isLoadingBlank, 
 
 #ifdef MOZ_SERVICES_SYNC
   // initialize the sync UI
   gSyncUI.init();
 #endif
 
   TabView.init();
 
+  setUrlAndSearchBarWidthForConditionalForwardButton();
+  window.addEventListener("resize", function resizeHandler(event) {
+    if (event.target == window)
+      setUrlAndSearchBarWidthForConditionalForwardButton();
+  });
+
   // Enable Inspector?
   let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
   if (enabled) {
     document.getElementById("menu_pageinspect").hidden = false;
     document.getElementById("Tools:Inspect").removeAttribute("disabled");
 #ifdef MENUBAR_CAN_AUTOHIDE
     document.getElementById("appmenu_pageInspect").hidden = false;
 #endif
@@ -2608,16 +2614,34 @@ var LocationBarHelpers = {
     if (this._timeoutID) {
       clearTimeout(this._timeoutID);
       this._timeoutID = null;
     }
     document.getElementById("urlbar-throbber").removeAttribute("busy");
   }
 };
 
+function setUrlAndSearchBarWidthForConditionalForwardButton() {
+  // Woraround for bug 694084: Showing/hiding the conditional forward button resizes
+  // the search bar when the url/search bar splitter hasn't been used.
+  var urlbarContainer = document.getElementById("urlbar-container");
+  var searchbarContainer = document.getElementById("search-container");
+  if (!urlbarContainer ||
+      !searchbarContainer ||
+      urlbarContainer.hasAttribute("width") ||
+      searchbarContainer.hasAttribute("width") ||
+      urlbarContainer.parentNode != searchbarContainer.parentNode)
+    return;
+  urlbarContainer.style.width = searchbarContainer.style.width = "";
+  var urlbarWidth = urlbarContainer.clientWidth;
+  var searchbarWidth = searchbarContainer.clientWidth;
+  urlbarContainer.style.width = urlbarWidth + "px";
+  searchbarContainer.style.width = searchbarWidth + "px";
+}
+
 function UpdatePageProxyState()
 {
   if (gURLBar && gURLBar.value != gLastValidURLStr)
     SetPageProxyState("invalid");
 }
 
 function SetPageProxyState(aState)
 {
@@ -3705,16 +3729,17 @@ function BrowserToolboxCustomizeDone(aTo
 
   PlacesToolbarHelper.customizeDone();
   BookmarksMenuButton.customizeDone();
 
   // The url bar splitter state is dependent on whether stop/reload
   // and the location bar are combined, so we need this ordering
   CombinedStopReload.init();
   UpdateUrlbarSearchSplitterState();
+  setUrlAndSearchBarWidthForConditionalForwardButton();
 
   // Update the urlbar
   if (gURLBar) {
     URLBarSetURI();
     XULBrowserWindow.asyncUpdateUI();
     PlacesStarButton.updateState();
   }