Bug 470441: Can't switch tabs between website and about:config, r=mfinkle
authorVivien Nicolas <21@vingtetun.org>
Thu, 28 May 2009 11:52:26 -0400
changeset 65225 beab08d7fd26089db1e1099e763ae6f5cd0462ac
parent 65224 7b0b3fb91bca0adff9d8335e18e9a02b13133bf0
child 65226 186b7de7c8f31c319d74887c8a49f54de44d6ae3
push idunknown
push userunknown
push dateunknown
reviewersmfinkle
bugs470441
Bug 470441: Can't switch tabs between website and about:config, r=mfinkle
mobile/chrome/content/WidgetStack.js
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/WidgetStack.js
+++ b/mobile/chrome/content/WidgetStack.js
@@ -347,16 +347,17 @@ WidgetStack.prototype = {
   _viewportUpdateTimeout: -1,
 
   _viewportUpdateHandler: null,
   _panHandler: null,
 
   _dragState: null,
 
   _skipViewportUpdates: 0,
+  _forceViewportUpdate: false,
 
   //
   // init:
   //   el: the <stack> element whose children are to be managed
   //
   init: function (el, ew, eh) {
     this._el = el;
     this._widgetState = {};
@@ -729,31 +730,36 @@ WidgetStack.prototype = {
     // viewportUpdateHandler, even if _adjustViewingRect doesn't trigger a pan.
     // If it does, the batch also ensures that we don't call the handler twice.
     this.beginUpdateBatch();
     this._adjustViewingRect();
     this.endUpdateBatch();
   },
 
   beginUpdateBatch: function startUpdate() {
-    if (!this._skipViewportUpdates)
+    if (!this._skipViewportUpdates) {
       this._startViewportBoundsString = this._viewportBounds.toString();
+      this._forceViewportUpdate = false;
+    }
     this._skipViewportUpdates++;
   },
 
-  endUpdateBatch: function endUpdate() {
+  endUpdateBatch: function endUpdate(aForceRedraw) {
     if (!this._skipViewportUpdates)
       throw new Error("Unbalanced call to endUpdateBatch");
+
+    this._forceViewportUpdate = this._forceViewportUpdate || aForceRedraw;
+
     this._skipViewportUpdates--;
     if (this._skipViewportUpdates)
       return
 
     let boundsSizeChanged =
       this._startViewportBoundsString != this._viewportBounds.toString();
-    this._callViewportUpdateHandler(boundsSizeChanged);
+    this._callViewportUpdateHandler(boundsSizeChanged || this._forceViewportUpdate);
   },
 
   //
   // Internal code
   //
 
   _updateWidgetRect: function(state) {
     // don't need to support updating the viewport rect at the moment
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -349,19 +349,16 @@ var Browser = {
       tab = this.getTabFromContent(tab);
 
     if (!tab || this._selectedTab == tab)
       return;
 
     let firstTab = this._selectedTab == null;
     this._selectedTab = tab;
 
-    // reset the viewportBounds to ensure a redraw
-    this._currentViewportBounds = { width: 0, height: 0};
-
     ws.beginUpdateBatch();
     this._canvasBrowser.setCurrentBrowser(this.selectedBrowser, firstTab);
     document.getElementById("tabs").selectedItem = tab.content;
 
     ws.panTo(0, -60, true);
 
     if (!firstTab) {
       let webProgress = this.selectedBrowser.webProgress;
@@ -375,17 +372,17 @@ var Browser = {
         // don't inhibit other listeners or following code
         Components.utils.reportError(e);
       }
 
       let event = document.createEvent("Events");
       event.initEvent("TabSelect", true, false);
       tab.content.dispatchEvent(event);
     }
-    ws.endUpdateBatch();
+    ws.endUpdateBatch(true);
   },
 
   supportsCommand: function(cmd) {
     var isSupported = false;
     switch (cmd) {
       case "cmd_fullscreen":
         isSupported = true;
         break;