From 07793fbbed66b1704d5a533bb8a426ce6c5a9f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Thu, 12 Jan 2012 22:25:13 +0100 Subject: [PATCH] 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 --- browser/base/content/browser.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 8965f0226b82..00e71388c392 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1701,6 +1701,12 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) { 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) { @@ -2610,6 +2616,24 @@ function UpdateUrlbarSearchSplitterState() splitter.parentNode.removeChild(splitter); } +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) @@ -3735,6 +3759,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) { // and the location bar are combined, so we need this ordering CombinedStopReload.init(); UpdateUrlbarSearchSplitterState(); + setUrlAndSearchBarWidthForConditionalForwardButton(); // Update the urlbar if (gURLBar) {