Bug 1501665 - No bug: Add comment with rationale behind choice of default viewport. r=dbaron
☠☠ backed out by 10f3bcf2a0ed ☠ ☠
authorJan Henning <jh+bugzilla@buttercookie.de>
Tue, 05 Mar 2019 18:01:07 +0000
changeset 462438 159753062cfa8b9a00885b4879bd5f22157c5280
parent 462437 2bf8760a86672bb1de9709013c329c60e2844999
child 462439 a8ec11730706c4e34b66e19dc0d365ca5caec379
push id79651
push usermozilla@buttercookie.de
push dateTue, 05 Mar 2019 19:54:03 +0000
treeherderautoland@1fa7091b4b4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1501665
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1501665 - No bug: Add comment with rationale behind choice of default viewport. r=dbaron Especially in view of the patches for bug 1501665, which seem to have some- what misunderstood the reason for the choice of viewport width here. Differential Revision: https://phabricator.services.mozilla.com/D20950
dom/base/Document.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -6787,18 +6787,26 @@ nsViewportInfo Document::GetViewportInfo
         height = nsViewportInfo::Max(
             minHeight, nsViewportInfo::Min(maxHeight, displaySize.height));
       }
 
       // Resolve width value
       // https://drafts.csswg.org/css-device-adapt/#resolve-width
       if (width == nsViewportInfo::Auto) {
         if (height == nsViewportInfo::Auto || aDisplaySize.height == 0) {
-          // Stretch CSS pixel size of viewport to keep device pixel size
-          // unchanged after full zoom applied.
+          // If we don't have any applicable viewport width constraints, this is
+          // most likely a desktop page written without mobile devices in mind.
+          // We use the desktop mode viewport for those pages by default,
+          // because a narrow viewport based on typical mobile device screen
+          // sizes (especially in portrait mode) will frequently break the
+          // layout of such pages. To keep text readable in that case, we rely
+          // on font inflation instead.
+
+          // Divide by fullZoom to stretch CSS pixel size of viewport in order
+          // to keep device pixel size unchanged after full zoom applied.
           // See bug 974242.
           width = gfxPrefs::DesktopViewportWidth() / fullZoom;
         } else {
           width = height * aDisplaySize.width / aDisplaySize.height;
         }
       }
 
       // Resolve height value