Bug 732564 - Get rid of the updateViewport function by inlining it into call sites. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-03-12 12:03:38 -04:00
parent c7bcd527d5
commit 5d2b7794ad

View File

@ -396,7 +396,7 @@ var BrowserApp = {
return;
aTab.setActive(true);
aTab.updateViewport(false);
aTab.sendViewportUpdate();
this.deck.selectedPanel = aTab.browser;
},
@ -1723,18 +1723,6 @@ Tab.prototype = {
return viewport;
},
updateViewport: function(aReset, aZoomLevel) {
dump("### JS side updateViewport " + aReset + " zoom " + aZoomLevel + "\n");
if (aReset) {
if (!aZoomLevel)
aZoomLevel = this.getDefaultZoomLevel();
this._zoom = aZoomLevel;
}
this.sendViewportUpdate();
},
sendViewportUpdate: function() {
if (BrowserApp.selectedTab != this)
return;
@ -2000,7 +1988,8 @@ Tab.prototype = {
sendMessageToJava(message);
if ((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) == 0) {
this.updateViewport(true);
this._zoom = this.getDefaultZoomLevel();
this.sendViewportUpdate();
} else {
this.sendViewportUpdate();
}
@ -2103,10 +2092,10 @@ Tab.prototype = {
/** Update viewport when the metadata or the window size changes. */
updateViewportSize: function updateViewportSize() {
// When this function gets called on window resize, we must execute
// this.updateViewport(true, ?) so that refreshDisplayPort is called.
// this.sendViewportUpdate() so that refreshDisplayPort is called.
// Ensure that when making changes to this function that code path
// is not accidentally removed (the call to updateViewport is at the
// very end).
// is not accidentally removed (the call to sendViewportUpdate() is
// at the very end).
if (window.outerWidth == 0 || window.outerHeight == 0) {
// this happens sometimes when starting up fennec. we don't want zero
@ -2165,8 +2154,8 @@ Tab.prototype = {
this.userScrollPos.x = win.scrollX;
this.userScrollPos.y = win.scrollY;
let newZoom = oldBrowserWidth * this._zoom / viewportW;
this.updateViewport(true, newZoom);
this._zoom = oldBrowserWidth * this._zoom / viewportW;
this.sendViewportUpdate();
},
getDefaultZoomLevel: function getDefaultZoomLevel() {