Bug 1423709 - Set mDefaultZoomValid is false in the case of auto-scale. r=botond
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 20 Nov 2018 03:55:56 +0000
changeset 503608 e5485cbe65cd889b633e48405bd3525f198c477e
parent 503607 e00d7edbb963f9d88fd4c7f477c88a5ccb04344f
child 503609 e41abff7fff927ba9c791a4f9a546b398ce194f0
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1423709
milestone65.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 1423709 - Set mDefaultZoomValid is false in the case of auto-scale. r=botond Depends on D10194 Differential Revision: https://phabricator.services.mozilla.com/D10195
dom/base/nsDocument.cpp
dom/base/nsViewportInfo.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7607,16 +7607,19 @@ nsIDocument::GetViewportInfo(const Scree
     } else if (effectiveValidMaxScale) {
       CSSSize displaySize = ScreenSize(aDisplaySize) / scaleMaxFloat;
       size.width = std::max(size.width, displaySize.width);
       size.height = std::max(size.height, displaySize.height);
     }
 
     return nsViewportInfo(scaleFloat, scaleMinFloat, scaleMaxFloat, size,
                           sizeFlag,
+                          mValidScaleFloat
+                            ? nsViewportInfo::AutoScaleFlag::FixedScale
+                            : nsViewportInfo::AutoScaleFlag::AutoScale,
                           effectiveZoomFlag);
   }
 }
 
 void
 nsIDocument::UpdateViewportOverflowType(nscoord aScrolledWidth,
                                         nscoord aScrollportWidth)
 {
--- a/dom/base/nsViewportInfo.h
+++ b/dom/base/nsViewportInfo.h
@@ -23,16 +23,20 @@ static const mozilla::CSSIntSize kViewpo
  */
 class MOZ_STACK_CLASS nsViewportInfo
 {
   public:
     enum class AutoSizeFlag {
       AutoSize,
       FixedSize,
     };
+    enum class AutoScaleFlag {
+      AutoScale,
+      FixedScale,
+    };
     enum class ZoomFlag {
       AllowZoom,
       DisallowZoom,
     };
     nsViewportInfo(const mozilla::ScreenIntSize& aDisplaySize,
                    const mozilla::CSSToScreenScale& aDefaultZoom,
                    ZoomFlag aZoomFlag) :
       mDefaultZoom(aDefaultZoom),
@@ -47,22 +51,23 @@ class MOZ_STACK_CLASS nsViewportInfo
         ConstrainViewportValues();
     }
 
     nsViewportInfo(const mozilla::CSSToScreenScale& aDefaultZoom,
                    const mozilla::CSSToScreenScale& aMinZoom,
                    const mozilla::CSSToScreenScale& aMaxZoom,
                    const mozilla::CSSSize& aSize,
                    AutoSizeFlag aAutoSizeFlag,
+                   AutoScaleFlag aAutoScaleFlag,
                    ZoomFlag aZoomFlag) :
                      mDefaultZoom(aDefaultZoom),
                      mMinZoom(aMinZoom),
                      mMaxZoom(aMaxZoom),
                      mSize(aSize),
-                     mDefaultZoomValid(true),
+                     mDefaultZoomValid(aAutoScaleFlag != AutoScaleFlag::AutoScale),
                      mAutoSize(aAutoSizeFlag == AutoSizeFlag::AutoSize),
                      mAllowZoom(aZoomFlag == ZoomFlag::AllowZoom)
     {
       ConstrainViewportValues();
     }
 
     bool IsDefaultZoomValid() const { return mDefaultZoomValid; }
     mozilla::CSSToScreenScale GetDefaultZoom() const { return mDefaultZoom; }
@@ -105,16 +110,18 @@ class MOZ_STACK_CLASS nsViewportInfo
     // The maximum zoom level permitted by the page.
     mozilla::CSSToScreenScale mMaxZoom;
 
     // The size of the viewport, specified by the <meta name="viewport"> tag.
     mozilla::CSSSize mSize;
 
     // If the default zoom was specified and was between the min and max
     // zoom values.
+    // FIXME: Bug 1504362 - Unify this and mDefaultZoom into
+    // Maybe<CSSToScreenScale>.
     bool mDefaultZoomValid;
 
     // Whether or not we should automatically size the viewport to the device's
     // width. This is true if the document has been optimized for mobile, and
     // the width property of a specified <meta name="viewport"> tag is either
     // not specified, or is set to the special value 'device-width'.
     bool mAutoSize;