B2G/gecko/browser/base/content/browser-fullZoom.js
/**
   * Set the zoom level for the current tab.
   *
   * Per nsPresContext::setFullZoom, we can set the zoom to its current value
   * without significant impact on performance, as the setting is only applied
   * if it differs from the current setting.  In fact getting the zoom and then
   * checking ourselves if it differs costs more.
   * 
   * And perhaps we should always set the zoom even if it was more expensive,
   * since DocumentViewerImpl::SetTextZoom claims that child documents can have
   * a different text zoom (although it would be unusual), and it implies that
   * those child text zooms should get updated when the parent zoom gets set,
   * and perhaps the same is true for full zoom
   * (although DocumentViewerImpl::SetFullZoom doesn't mention it).
   *
   * So when we apply new zoom values to the browser, we simply set the zoom.
   * We don't check first to see if the new value is the same as the current
   * one.
   **/
Set the zoom level for the current tab.
Per nsPresContext::setFullZoom, we can set the zoom to its current value
without significant impact on performance, as the setting is only applied
if it differs from the current setting.  In fact getting the zoom and then
checking ourselves if it differs costs more.

And perhaps we should always set the zoom even if it was more expensive,
since DocumentViewerImpl::SetTextZoom claims that child documents can have
a different text zoom (although it would be unusual), and it implies that
those child text zooms should get updated when the parent zoom gets set,
and perhaps the same is true for full zoom
(although DocumentViewerImpl::SetFullZoom doesn't mention it).

So when we apply new zoom values to the browser, we simply set the zoom.
We don't check first to see if the new value is the same as the current
one.
Set the zoom level for the current tab . Per nsPresContext :: setFullZoom we can set the zoom to its current value without significant impact on performance as the setting is only applied if it differs from the current setting . In fact getting the zoom and then checking ourselves if it differs costs more . And perhaps we should always set the zoom even if it was more expensive since DocumentViewerImpl :: SetTextZoom claims that child documents can have a different text zoom ( although it would be unusual ) and it implies that those child text zooms should get updated when the parent zoom gets set and perhaps the same is true for full zoom ( although DocumentViewerImpl :: SetFullZoom doesn ' t mention it ) . So when we apply new zoom values to the browser we simply set the zoom . We don ' t check first to see if the new value is the same as the current one .
function FullZoom__applyPrefToSetting(aValue, aBrowser) {
    if ((!this.siteSpecific) || gInPrintPreviewMode)
      return;
    var browser = aBrowser || (gBrowser && gBrowser.selectedBrowser);
    try {
      if (browser.contentDocument.mozSyntheticDocument)
        return;
      if (typeof aValue != "undefined")
        ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
      else if (typeof this.globalValue != "undefined")
        ZoomManager.setZoomForBrowser(browser, this.globalValue);
      else
        ZoomManager.setZoomForBrowser(browser, 1);
    }
    catch(ex) {}
  }
function FullZoom__applyPrefToSetting ( aValue , aBrowser ) { if ( ( ! this . siteSpecific ) || gInPrintPreviewMode ) return ; var browser = aBrowser || ( gBrowser && gBrowser . selectedBrowser ) ; try { if ( browser . contentDocument . mozSyntheticDocument ) return ; if ( typeof aValue != "undefined" ) ZoomManager . setZoomForBrowser ( browser , this . _ensureValid ( aValue ) ) ; else if ( typeof this . globalValue != "undefined" ) ZoomManager . setZoomForBrowser ( browser , this . globalValue ) ; else ZoomManager . setZoomForBrowser ( browser , 1 ) ; } catch ( ex ) { } }
Set the zoom level for the current tab.
Set the zoom level for the current tab .