From 6080b6fb5c62e141e4c402cce0c04f2632813546 Mon Sep 17 00:00:00 2001 From: Jan Henning Date: Tue, 5 Mar 2019 18:01:07 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- dom/base/Document.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 1c56b63d1e88..aa32c4b35085 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -6792,8 +6792,16 @@ nsViewportInfo Document::GetViewportInfo(const ScreenIntSize& aDisplaySize) { // 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 {