Bug 596952 - Temporary hack to fix the viewport in local tabs [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 16 Sep 2010 13:17:09 -0700
changeset 2020 748e503f9ae9c9f6bb4845b1e308d8e0157e5c3d
parent 2019 e302473d1a696c732ea827757720b596d21705a9
child 2021 593c928000b5f96c68d6945b28b2e0597173c008
push id1724
push usermbrubeck@mozilla.com
push dateThu, 16 Sep 2010 20:21:08 +0000
reviewersmfinkle
bugs596952
Bug 596952 - Temporary hack to fix the viewport in local tabs [r=mfinkle]
chrome/content/content.js
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -574,16 +574,21 @@ let ViewportHandler = {
     let windowUtils = Util.getWindowUtils(content);
     let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
     if (handheldFriendly == "true")
       return { defaultZoom: dpiScale, autoSize: true };
 
     if (content.document instanceof XULDocument)
       return { defaultZoom: 1.0, autoSize: true, allowZoom: false };
 
+    // HACK: Since we can't set the scale in local tabs (bug 597081), we force
+    // them to device-width and scale=1 so they will lay out reasonably.
+    if (Util.isParentProcess())
+      return { defaultZoom: 1.0, autoSize: true, allowZoom: false };
+
     // viewport details found here
     // http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
     // http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html
 
     // Note: These values will be NaN if parseFloat or parseInt doesn't find a number.
     // Remember that NaN is contagious: Math.max(1, NaN) == Math.min(1, NaN) == NaN.
     let viewportScale = parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
     let viewportMinScale = parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale"));