Bug 678480 - First-run animation is busted and tab sidebar is visible at startup r=wjohnston
authorMark Finkle <mfinkle@mozilla.com>
Thu, 22 Sep 2011 22:31:06 -0400
changeset 77373 cbc62f5e79e8e33b47ff089b762caadb86399ec7
parent 77372 94852085df97069e100f79a360af7ee3a99a9aaa
child 77374 0ec8974f09172e85dc883a84e808193b80ad88b8
push id2087
push usermfinkle@mozilla.com
push dateFri, 23 Sep 2011 02:32:45 +0000
treeherdermozilla-inbound@0ec8974f0917 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswjohnston
bugs678480
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 678480 - First-run animation is busted and tab sidebar is visible at startup r=wjohnston
mobile/chrome/content/aboutHome.xhtml
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/aboutHome.xhtml
+++ b/mobile/chrome/content/aboutHome.xhtml
@@ -422,18 +422,20 @@
     }
 
     function uninitAddons() {
       getChromeWin().Services.obs.removeObserver(updateAddons, "recommended-addons-cache-updated");
     }
    
    function startDiscovery() {
      let win = getChromeWin();
+
+     // If a sidebar is completely open, just bail
      let [leftWidth, rightWidth] = win.Browser.computeSidebarVisibility();
-     if (leftWidth > 0 || rightWidth > 0) {
+     if (leftWidth == 1 || rightWidth == 1) {
        endDiscovery();
        return;
      }
 
      let doc = win.document;
      let broadcaster = doc.getElementById("bcast_uidiscovery");
 
      doc.addEventListener("animationend", endDiscovery, false);
@@ -446,17 +448,16 @@
      let broadcaster = doc.getElementById("bcast_uidiscovery");
 
      broadcaster.removeAttribute("mode");
      doc.removeEventListener("animationend", endDiscovery, false);
      doc.removeEventListener("PanBegin", endDiscovery, false);
    }
    
    function initLightbox() {
-
      let prefs = getChromeWin().Services.prefs;
      let channel = prefs.getCharPref("app.update.channel");
      let startupCount = 0;
      try {
        startupCount = prefs.getIntPref("app.promo.aurora");
        if(startupCount != 6)
          prefs.setIntPref("app.promo.aurora", ++startupCount);
      } catch(e) {
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -273,18 +273,26 @@ var Browser = {
 
       // Tell the UI to resize the browser controls
       BrowserUI.sizeControls(w, h);
       ViewableAreaObserver.update();
 
       // Restore the previous scroll position
       let restorePosition = Browser.controlsPosition || { hideSidebars: true };
       if (restorePosition.hideSidebars) {
-        restorePosition.hideSidebars = false;
+        // Since this happens early in the startup process, we need to make sure
+        // the UI has really responded
+        let x = {}, y = {};
         Browser.hideSidebars();
+        Browser.controlsScrollboxScroller.getPosition(x, y);
+        if (x.value > 0) {
+          // Update the control position data so we are set correctly for the next resize
+          restorePosition.hideSidebars = false;
+          restorePosition.x = x.value;
+        }
       } else {
         // Handle Width transformation of the tabs sidebar
         if (restorePosition.x) {
           let [,, leftWidth, rightWidth] = Browser.computeSidebarVisibility();
           let delta = ((restorePosition.leftSidebar - leftWidth) || (restorePosition.rightSidebar - rightWidth));
           restorePosition.x += (restorePosition.x == leftWidth) ? delta : -delta;
         }