Bug 558840 - Botched tab preview for start page [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Tue, 13 Apr 2010 16:10:54 -0400
changeset 66136 9051a192cc7c5b8e8de6806181e4a621c4faa760
parent 66135 13be0e81cb7a2d25d3b890edb20dc108a97d7f2c
child 66137 d0e5bdc1f4e3be17882a9697d37a46a8de796d5e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs558840
Bug 558840 - Botched tab preview for start page [r=mfinkle]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -406,16 +406,25 @@ var Browser = {
       // Cause a resize of the viewport if the current browser holds a XUL document
       let browser = Browser.selectedBrowser;
       if (browser.contentDocument instanceof XULDocument)
         BrowserView.Util.ensureMozScrolledAreaEvent(browser, w, h);
 
       // Tell the UI to resize the browser controls
       BrowserUI.sizeControls(w, h);
 
+      // XXX During the launch, the resize of the window arrive after we add
+      // the first tab, so we need to force the viewport state for this case
+      // see bug 558840
+      let bvs = bv._browserViewportState;
+      if (bvs.viewportRect.width == 1 && bvs.viewportRect.height == 1) {
+        bvs.viewportRect.width = window.innerWidth;
+        bvs.viewportRect.height = window.innerHeight;
+      }
+
       bv.updateDefaultZoom();
       if (bv.isDefaultZoom())
         // XXX this should really only happen on browser startup, not every resize
         Browser.hideSidebars();
       bv.onAfterVisibleMove();
 
       bv.commitBatchOperation();
       
@@ -3170,17 +3179,19 @@ Tab.prototype = {
     let bvs = this._browserViewportState;
     bvs.defaultZoomLevel = bvs.zoomLevel;
   },
 
   updateThumbnail: function updateThumbnail() {
     if (!this._browser)
       return;
 
-    let browserView = (Browser.selectedBrowser == this._browser) ? Browser._browserView : null;
+    let bv = Browser._browserView;
+    let browserView = (Browser.selectedBrowser == this._browser && bv.isDefaultZoom()) ? Browser._browserView 
+                                                                                       : null;
     this._chromeTab.updateThumbnail(this._browser, browserView);
   },
 
   setIcon: function setIcon(aURI) {
     let faviconURI = null;
     if (aURI) {
       try {
         faviconURI = gIOService.newURI(aURI, null, null);