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 {