Bug 1459260 - Create a MobileViewportManager whenever apz.allow_zooming is set. r=kats
authorBotond Ballo <botond@mozilla.com>
Tue, 14 May 2019 02:16:21 +0000
changeset 535607 db30d35f71305ef3440f98f1a4e6cb541cca314f
parent 535606 5f723f79b70e9f2fa2fb8ec563686e79267cba8f
child 535608 ab450513a15615bc3dd1ddf2db999424dc7531d6
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1459260
milestone68.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 1459260 - Create a MobileViewportManager whenever apz.allow_zooming is set. r=kats However, we continue to only respect a <meta name="viewport"> tag if dom.meta-viewport.enabled is set. Differential Revision: https://phabricator.services.mozilla.com/D30988
dom/base/Document.cpp
layout/base/PresShell.cpp
layout/base/nsLayoutUtils.h
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -6883,17 +6883,19 @@ nsViewportInfo Document::GetViewportInfo
     CSSSize viewportSize(viewportWidth, viewportWidth * aspectRatio);
     ScreenIntSize fakeDesktopSize = RoundedToInt(viewportSize * scaleToFit);
     return nsViewportInfo(fakeDesktopSize, scaleToFit,
                           nsViewportInfo::ZoomFlag::AllowZoom);
   }
 
   if (!nsLayoutUtils::ShouldHandleMetaViewport(this)) {
     return nsViewportInfo(aDisplaySize, defaultScale,
-                          nsViewportInfo::ZoomFlag::DisallowZoom);
+                          nsLayoutUtils::AllowZoomingForDocument(this)
+                              ? nsViewportInfo::ZoomFlag::AllowZoom
+                              : nsViewportInfo::ZoomFlag::DisallowZoom);
   }
 
   // In cases where the width of the CSS viewport is less than or equal to the
   // width of the display (i.e. width <= device-width) then we disable
   // double-tap-to-zoom behaviour. See bug 941995 for details.
 
   switch (mViewportType) {
     case DisplayWidthHeight:
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -10490,20 +10490,21 @@ nsresult PresShell::SetIsActive(bool aIs
   return rv;
 }
 
 RefPtr<MobileViewportManager> PresShell::GetMobileViewportManager() const {
   return mMobileViewportManager;
 }
 
 void PresShell::UpdateViewportOverridden(bool aAfterInitialization) {
-  // Determine if we require a MobileViewportManager. This logic is
-  // equivalent to ShouldHandleMetaViewport, which will check gfxPrefs if
-  // there are not meta viewport overrides.
-  bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument);
+  // Determine if we require a MobileViewportManager. We need one any
+  // time we allow resolution zooming for a document, and any time we
+  // want to obey <meta name="viewport"> tags for it.
+  bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument) ||
+                 nsLayoutUtils::AllowZoomingForDocument(mDocument);
 
   if (needMVM == !!mMobileViewportManager) {
     // Either we've need one and we've already got it, or we don't need one
     // and don't have it. Either way, we're done.
     return;
   }
 
   if (needMVM) {
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -3018,17 +3018,17 @@ class nsLayoutUtils {
   static void ComputeFontVariations(
       const nsCSSValuePairList* aVariationsList,
       nsTArray<gfxFontVariation>& aVariationSettings);
 
   static uint32_t ParseFontLanguageOverride(const nsAString& aLangTag);
 
   /**
    * Returns true if there are any preferences or overrides that indicate a
-   * need to create a MobileViewportManager.
+   * need to handle <meta name="viewport"> tags.
    */
   static bool ShouldHandleMetaViewport(const mozilla::dom::Document*);
 
   /**
    * Resolve a CSS <length-percentage> value to a definite size.
    */
   template <bool clampNegativeResultToZero>
   static nscoord ResolveToLength(const LengthPercentage& aLengthPercentage,