Bug 1512267 - If you set a pres shell resolution, you must scale to it. r=kats,JanH
authorBotond Ballo <botond@mozilla.com>
Mon, 10 Dec 2018 19:32:59 +0000
changeset 449736 fd2587f34b52775d4f6b8816a4310485bef78575
parent 449735 12a45aafbff81839a4152a473887adef03fe2517
child 449737 276287cba1de410595adb04c48fce0c0e22cef80
push id35184
push usernbeleuzu@mozilla.com
push dateTue, 11 Dec 2018 05:24:37 +0000
treeherdermozilla-central@736e6ca6a7e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, JanH
bugs1512267
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 1512267 - If you set a pres shell resolution, you must scale to it. r=kats,JanH Differential Revision: https://phabricator.services.mozilla.com/D13928
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/apz/util/ChromeProcessController.cpp
gfx/layers/composite/ContainerLayerComposite.h
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
layout/base/MobileViewportManager.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/PresState.ipdlh
layout/base/nsILayoutHistoryState.idl
layout/base/nsIPresShell.h
layout/base/nsLayoutHistoryState.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/painting/nsDisplayList.cpp
toolkit/modules/sessionstore/SessionHistory.jsm
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -537,28 +537,16 @@ nsDOMWindowUtils::SetDisplayPortBaseForE
   }
 
   nsLayoutUtils::SetDisplayPortBase(aElement, nsRect(aX, aY, aWidth, aHeight));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::SetResolution(float aResolution) {
-  nsIPresShell* presShell = GetPresShell();
-  if (!presShell) {
-    return NS_ERROR_FAILURE;
-  }
-
-  presShell->SetResolution(aResolution);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDOMWindowUtils::SetResolutionAndScaleTo(float aResolution) {
   nsIPresShell* presShell = GetPresShell();
   if (!presShell) {
     return NS_ERROR_FAILURE;
   }
 
   presShell->SetResolutionAndScaleTo(aResolution, nsGkAtoms::other);
 
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -202,38 +202,31 @@ interface nsIDOMWindowUtils : nsISupport
    * Get/set the resolution at which rescalable web content is drawn.
    *
    * Setting a new resolution does *not* trigger reflow.  This API is
    * entirely separate from textZoom and fullZoom; a resolution scale
    * can be applied together with both textZoom and fullZoom.
    *
    * The effect of this API is for gfx code to allocate more or fewer
    * pixels for rescalable content by a factor of |resolution| in
-   * both dimensions.  The scale at which the content is displayed does
-   * not change; if that is desired, use setResolutionAndScaleTo() instead.
-   *
-   * The caller of this method must have chrome privileges.
-   */
-  void setResolution(in float aResolution);
-
-  void getResolution(out float aResolution);
-
-  /**
-   * Similar to setResolution(), but also scales the content by the
-   * amount of the resolution, so that it is displayed at a
-   * correspondingly larger or smaller size, without the need for
-   * the caller to set an additional transform.
+   * both dimensions.
+   * 
+   * In addition, the content is scaled by the amount of the resolution,
+   * so that it is displayed at a correspondingly larger or smaller size, 
+   * without the need for the caller to set an additional transform.
    *
    * This can be used to implement a non-reflowing scale-zoom, e.g.
    * for pinch-zoom on mobile platforms.
    *
    * The caller of this method must have chrome privileges.
    */
   void setResolutionAndScaleTo(in float aResolution);
 
+  void getResolution(out float aResolution);
+
   /**
    * Set a resolution on the presShell which is the "restored" from history.
    * The display dimensions are compared to their current values and used
    * to scale the resolution value if necessary, e.g. if the device was
    * rotated between saving and restoring of the session data.
    * This resolution should be used when painting for the first time. Calling
    * this too late may have no effect.
    */
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -760,17 +760,16 @@ ContainerLayer::ContainerLayer(LayerMana
     : Layer(aManager, aImplData),
       mFirstChild(nullptr),
       mLastChild(nullptr),
       mPreXScale(1.0f),
       mPreYScale(1.0f),
       mInheritedXScale(1.0f),
       mInheritedYScale(1.0f),
       mPresShellResolution(1.0f),
-      mScaleToResolution(false),
       mUseIntermediateSurface(false),
       mSupportsComponentAlphaChildren(false),
       mMayHaveReadbackChild(false),
       mChildrenChanged(false) {}
 
 ContainerLayer::~ContainerLayer() {}
 
 bool ContainerLayer::InsertAfter(Layer* aChild, Layer* aAfter) {
@@ -940,18 +939,17 @@ bool ContainerLayer::RepositionChild(Lay
   aAfter->SetNextSibling(aChild);
   aChild->SetPrevSibling(aAfter);
   aChild->SetNextSibling(afterNext);
   return true;
 }
 
 void ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs) {
   aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale, mInheritedXScale,
-                                    mInheritedYScale, mPresShellResolution,
-                                    mScaleToResolution);
+                                    mInheritedYScale, mPresShellResolution);
 }
 
 bool ContainerLayer::Creates3DContextWithExtendingChildren() {
   if (Extend3DContext()) {
     return false;
   }
   for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
     if (child->Extend3DContext()) {
@@ -1951,21 +1949,19 @@ void ContainerLayer::PrintInfo(std::stri
   Layer::PrintInfo(aStream, aPrefix);
   if (UseIntermediateSurface()) {
     aStream << " [usesTmpSurf]";
   }
   if (1.0 != mPreXScale || 1.0 != mPreYScale) {
     aStream
         << nsPrintfCString(" [preScale=%g, %g]", mPreXScale, mPreYScale).get();
   }
-  if (mScaleToResolution) {
-    aStream << nsPrintfCString(" [presShellResolution=%g]",
-                               mPresShellResolution)
-                   .get();
-  }
+  aStream << nsPrintfCString(" [presShellResolution=%g]",
+                             mPresShellResolution)
+                 .get();
 }
 
 void ContainerLayer::DumpPacket(layerscope::LayersPacket* aPacket,
                                 const void* aParent) {
   Layer::DumpPacket(aPacket, aParent);
   // Get this layer data
   using namespace layerscope;
   LayersPacket::Layer* layer =
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2200,25 +2200,23 @@ class ContainerLayer : public Layer {
 
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this,
                                  ("Layer::Mutated(%p) InheritedScale", this));
     mInheritedXScale = aXScale;
     mInheritedYScale = aYScale;
     Mutated();
   }
 
-  void SetScaleToResolution(bool aScaleToResolution, float aResolution) {
-    if (mScaleToResolution == aScaleToResolution &&
-        mPresShellResolution == aResolution) {
+  void SetScaleToResolution(float aResolution) {
+    if (mPresShellResolution == aResolution) {
       return;
     }
 
     MOZ_LAYERS_LOG_IF_SHADOWABLE(
         this, ("Layer::Mutated(%p) ScaleToResolution", this));
-    mScaleToResolution = aScaleToResolution;
     mPresShellResolution = aResolution;
     Mutated();
   }
 
   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override;
 
   enum class SortMode {
     WITH_GEOMETRY,
@@ -2235,17 +2233,16 @@ class ContainerLayer : public Layer {
   // These getters can be used anytime.
   virtual Layer* GetFirstChild() const override { return mFirstChild; }
   virtual Layer* GetLastChild() const override { return mLastChild; }
   float GetPreXScale() const { return mPreXScale; }
   float GetPreYScale() const { return mPreYScale; }
   float GetInheritedXScale() const { return mInheritedXScale; }
   float GetInheritedYScale() const { return mInheritedYScale; }
   float GetPresShellResolution() const { return mPresShellResolution; }
-  bool ScaleToResolution() const { return mScaleToResolution; }
 
   MOZ_LAYER_DECL_NAME("ContainerLayer", TYPE_CONTAINER)
 
   /**
    * ContainerLayer backends need to override ComputeEffectiveTransforms
    * since the decision about whether to use a temporary surface for the
    * container is backend-specific. ComputeEffectiveTransforms must also set
    * mUseIntermediateSurface.
@@ -2375,18 +2372,16 @@ class ContainerLayer : public Layer {
   float mPreYScale;
   // The resolution scale inherited from the parent layer. This will already
   // be part of mTransform.
   float mInheritedXScale;
   float mInheritedYScale;
   // For layers corresponding to an nsDisplayResolution, the resolution of the
   // associated pres shell; for other layers, 1.0.
   float mPresShellResolution;
-  // Whether the compositor should scale to mPresShellResolution.
-  bool mScaleToResolution;
   bool mUseIntermediateSurface;
   bool mSupportsComponentAlphaChildren;
   bool mMayHaveReadbackChild;
   // This is updated by ComputeDifferences. This will be true if we need to
   // invalidate the intermediate surface.
   bool mChildrenChanged;
 };
 
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -125,18 +125,17 @@ void ChromeProcessController::HandleDoub
     return;
   }
 
   // CalculateRectToZoomTo performs a hit test on the frame associated with the
   // Root Content Document. Unfortunately that frame does not know about the
   // resolution of the document and so we must remove it before calculating
   // the zoomToRect.
   nsIPresShell* presShell = document->GetShell();
-  const float resolution =
-      presShell->ScaleToResolution() ? presShell->GetResolution() : 1.0f;
+  const float resolution = presShell->GetResolution();
   CSSPoint point(aPoint.x / resolution, aPoint.y / resolution);
   CSSRect zoomToRect = CalculateRectToZoomTo(document, point);
 
   uint32_t presShellId;
   ScrollableLayerGuid::ViewID viewId;
   if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
           document->GetDocumentElement(), &presShellId, &viewId)) {
     APZThreadUtils::RunOnControllerThread(
--- a/gfx/layers/composite/ContainerLayerComposite.h
+++ b/gfx/layers/composite/ContainerLayerComposite.h
@@ -98,26 +98,20 @@ class ContainerLayerComposite : public C
   CompositableHost* GetCompositableHost() override { return nullptr; }
 
   // If the layer is marked as scale-to-resolution, add a post-scale
   // to the layer's transform equal to the pres shell resolution we're
   // scaling to. This cancels out the post scale of '1 / resolution'
   // added by Layout. TODO: It would be nice to get rid of both of these
   // post-scales.
   virtual float GetPostXScale() const override {
-    if (mScaleToResolution) {
-      return mSimpleAttrs.GetPostXScale() * mPresShellResolution;
-    }
-    return mSimpleAttrs.GetPostXScale();
+    return mSimpleAttrs.GetPostXScale() * mPresShellResolution;
   }
   virtual float GetPostYScale() const override {
-    if (mScaleToResolution) {
-      return mSimpleAttrs.GetPostYScale() * mPresShellResolution;
-    }
-    return mSimpleAttrs.GetPostYScale();
+    return mSimpleAttrs.GetPostYScale() * mPresShellResolution;
   }
 
   virtual const char* Name() const override {
     return "ContainerLayerComposite";
   }
   UniquePtr<PreparedData> mPrepared;
 
   RefPtr<CompositingRenderTarget> mLastIntermediateSurface;
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -587,18 +587,17 @@ bool LayerTransactionParent::SetLayerAtt
       if (!containerLayer) {
         return false;
       }
       const ContainerLayerAttributes& attrs =
           specific.get_ContainerLayerAttributes();
       containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
       containerLayer->SetInheritedScale(attrs.inheritedXScale(),
                                         attrs.inheritedYScale());
-      containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
-                                           attrs.presShellResolution());
+      containerLayer->SetScaleToResolution(attrs.presShellResolution());
       break;
     }
     case Specific::TColorLayerAttributes: {
       MOZ_LAYERS_LOG(("[ParentSide]   color layer"));
 
       ColorLayer* colorLayer = layer->AsColorLayer();
       if (!colorLayer) {
         return false;
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -281,17 +281,16 @@ struct PaintedLayerAttributes {
   nsIntRegion validRegion;
 };
 struct ContainerLayerAttributes {
   float preXScale;
   float preYScale;
   float inheritedXScale;
   float inheritedYScale;
   float presShellResolution;
-  bool scaleToResolution;
 };
 
 struct GlyphArray
 {
   LayerColor color;
   Glyph[] glyphs;
 };
 
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -366,18 +366,17 @@ void MobileViewportManager::UpdateVisual
   CSSSize compSize = compositionSize / aZoom;
   MVM_LOG("%p: Setting VVPS %s\n", this, Stringify(compSize).c_str());
   nsLayoutUtils::SetVisualViewportSize(mPresShell, compSize);
 }
 
 void MobileViewportManager::UpdateDisplayPortMargins() {
   if (nsIFrame* root = mPresShell->GetRootScrollFrame()) {
     bool hasDisplayPort = nsLayoutUtils::HasDisplayPort(root->GetContent());
-    bool hasResolution =
-        mPresShell->ScaleToResolution() && mPresShell->GetResolution() != 1.0f;
+    bool hasResolution = mPresShell->GetResolution() != 1.0f;
     if (!hasDisplayPort && !hasResolution) {
       // We only want to update the displayport if there is one already, or
       // add one if there's a resolution on the document (see bug 1225508
       // comment 1).
       return;
     }
     nsRect displayportBase = nsRect(
         nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(root));
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -256,19 +256,17 @@ static nsIContent* GetClickableAncestor(
   return nullptr;
 }
 
 static nscoord AppUnitsFromMM(nsIFrame* aFrame, uint32_t aMM) {
   nsPresContext* pc = aFrame->PresContext();
   nsIPresShell* presShell = pc->PresShell();
   float result = float(aMM) * (pc->DeviceContext()->AppUnitsPerPhysicalInch() /
                                MM_PER_INCH_FLOAT);
-  if (presShell->ScaleToResolution()) {
-    result = result / presShell->GetResolution();
-  }
+  result = result / presShell->GetResolution();
   return NSToCoordRound(result);
 }
 
 /**
  * Clip aRect with the bounds of aFrame in the coordinate system of
  * aRootFrame. aRootFrame is an ancestor of aFrame.
  */
 static nsRect ClipToFrame(nsIFrame* aRootFrame, nsIFrame* aFrame,
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -770,17 +770,16 @@ PresShell::PresShell()
       mHaveShutDown(false),
       mLastRootReflowHadUnconstrainedBSize(false),
       mNoDelayedMouseEvents(false),
       mNoDelayedKeyEvents(false),
       mShouldUnsuppressPainting(false),
       mApproximateFrameVisibilityVisited(false),
       mNextPaintCompressed(false),
       mHasCSSBackgroundColor(false),
-      mScaleToResolution(false),
       mIsLastChromeOnlyEscapeKeyConsumed(false),
       mHasReceivedPaintMessage(false),
       mIsLastKeyDownCanceled(false),
       mHasHandledUserInput(false),
       mResolutionUpdated(false),
       mForceDispatchKeyPressEventsForNonPrintableKeys(false),
       mForceUseLegacyKeyCodeAndCharCodeValues(false),
       mInitializedWithKeyPressEventDispatchingBlacklist(false) {
@@ -5098,60 +5097,54 @@ void PresShell::SetIgnoreViewportScrolli
     return;
   }
   RenderingState state(this);
   state.mRenderFlags = ChangeFlag(state.mRenderFlags, aIgnore,
                                   STATE_IGNORING_VIEWPORT_SCROLLING);
   SetRenderingState(state);
 }
 
-nsresult PresShell::SetResolutionImpl(float aResolution,
-                                      bool aScaleToResolution,
-                                      nsAtom* aOrigin) {
+nsresult PresShell::SetResolutionAndScaleTo(float aResolution,
+                                            nsAtom* aOrigin) {
   if (!(aResolution > 0.0)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
   if (aResolution == mResolution.valueOr(0.0)) {
     MOZ_ASSERT(mResolution.isSome());
     return NS_OK;
   }
   RenderingState state(this);
   state.mResolution = Some(aResolution);
   SetRenderingState(state);
-  mScaleToResolution = aScaleToResolution;
   if (mMobileViewportManager) {
     mMobileViewportManager->ResolutionUpdated();
   }
   if (aOrigin != nsGkAtoms::apz) {
     mResolutionUpdated = true;
   }
 
   return NS_OK;
 }
 
-bool PresShell::ScaleToResolution() const { return mScaleToResolution; }
-
 float PresShell::GetCumulativeResolution() {
   float resolution = GetResolution();
   nsPresContext* parentCtx = GetPresContext()->GetParentPresContext();
   if (parentCtx) {
     resolution *= parentCtx->PresShell()->GetCumulativeResolution();
   }
   return resolution;
 }
 
 float PresShell::GetCumulativeNonRootScaleResolution() {
   float resolution = 1.0;
   nsIPresShell* currentShell = this;
   while (currentShell) {
     nsPresContext* currentCtx = currentShell->GetPresContext();
     if (currentCtx != currentCtx->GetRootPresContext()) {
-      resolution *= currentShell->ScaleToResolution()
-                        ? currentShell->GetResolution()
-                        : 1.0f;
+      resolution *= currentShell->GetResolution();
     }
     nsPresContext* parentCtx = currentCtx->GetParentPresContext();
     if (parentCtx) {
       currentShell = parentCtx->PresShell();
     } else {
       currentShell = nullptr;
     }
   }
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -189,26 +189,18 @@ class PresShell final : public nsIPresSh
       override;
 
   LayerManager* GetLayerManager() override;
 
   bool AsyncPanZoomEnabled() override;
 
   void SetIgnoreViewportScrolling(bool aIgnore) override;
 
-  nsresult SetResolution(float aResolution) override {
-    return SetResolutionImpl(aResolution, /* aScaleToResolution = */ false,
-                             nsGkAtoms::other);
-  }
   nsresult SetResolutionAndScaleTo(float aResolution,
-                                   nsAtom* aOrigin) override {
-    return SetResolutionImpl(aResolution, /* aScaleToResolution = */ true,
-                             aOrigin);
-  }
-  bool ScaleToResolution() const override;
+                                   nsAtom* aOrigin) override;
   bool IsResolutionUpdated() const override { return mResolutionUpdated; }
   void SetResolutionUpdated(bool aUpdated) override {
     mResolutionUpdated = aUpdated;
   }
   float GetCumulativeResolution() override;
   float GetCumulativeNonRootScaleResolution() override;
   void SetRestoreResolution(float aResolution,
                             LayoutDeviceIntSize aDisplaySize) override;
@@ -815,21 +807,16 @@ class PresShell final : public nsIPresSh
   bool mShouldUnsuppressPainting : 1;
 
   bool mApproximateFrameVisibilityVisited : 1;
 
   bool mNextPaintCompressed : 1;
 
   bool mHasCSSBackgroundColor : 1;
 
-  // Whether content should be scaled by the resolution amount. If this is
-  // not set, a transform that scales by the inverse of the resolution is
-  // applied to rendered layers.
-  bool mScaleToResolution : 1;
-
   // Whether the last chrome-only escape key event is consumed.
   bool mIsLastChromeOnlyEscapeKeyConsumed : 1;
 
   // Whether the widget has received a paint message yet.
   bool mHasReceivedPaintMessage : 1;
 
   bool mIsLastKeyDownCanceled : 1;
 
--- a/layout/base/PresState.ipdlh
+++ b/layout/base/PresState.ipdlh
@@ -34,15 +34,14 @@ union PresContentData {
   FileContentData[];
 };
 
 struct PresState {
   PresContentData contentData;
   nsPoint scrollState;
   bool allowScrollOriginDowngrade;
   float resolution;
-  bool scaleToResolution;
   bool disabledSet;
   bool disabled;
   bool droppedDown;
 };
 
 } // namespace mozilla
--- a/layout/base/nsILayoutHistoryState.idl
+++ b/layout/base/nsILayoutHistoryState.idl
@@ -44,26 +44,26 @@ interface nsILayoutHistoryState : nsISup
 
   /*
   * Attempts to get the data of the PresState corresponding to
   * the passed key. Throws if no data could be found.
   */
   void getPresState(in ACString aKey,
                     out float aScrollX, out float aScrollY,
                     out boolean aAllowScrollOriginDowngrade,
-                    out float aRes, out boolean aScaleToRes);
+                    out float aRes);
 
   /**
    * Constructs a new PresState object based on the supplied data
    * and adds it to the LayoutHistoryState.
    */
   void addNewPresState(in ACString aKey,
                    in float aScrollX, in float aScrollY,
                    in boolean aAllowScrollOriginDowngrade,
-                   in float aRes, in boolean aScaleToRes);
+                   in float aRes);
 
   // Native only interface, converted from the original nsILayoutHistoryState.h
 
   /**
    * Set |aState| as the state object for |aKey|.
    * This _transfers_ownership_ of |aState| to the LayoutHistoryState.
    * It will be freed when RemoveState() is called or when the
    * LayoutHistoryState is destroyed.
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1360,19 +1360,28 @@ class nsIPresShell : public nsStubDocume
 
   /**
    * Set a "resolution" for the document, which if not 1.0 will
    * allocate more or fewer pixels for rescalable content by a factor
    * of |resolution| in both dimensions.  Return NS_OK iff the
    * resolution bounds are sane, and the resolution of this was
    * actually updated.
    *
+   * Also increase the scale of the content by the same amount
+   * (that's the "AndScaleTo" part).
+   *
    * The resolution defaults to 1.0.
+   *
+   * |aOrigin| specifies who originated the resolution change. For changes
+   * sent by APZ, pass nsGkAtoms::apz. For changes sent by the main thread,
+   * use pass nsGkAtoms::other or nsGkAtoms::restore (similar to the |aOrigin|
+   * parameter of nsIScrollableFrame::ScrollToCSSPixels()).
    */
-  virtual nsresult SetResolution(float aResolution) = 0;
+  virtual nsresult SetResolutionAndScaleTo(float aResolution,
+                                           nsAtom* aOrigin) = 0;
   float GetResolution() const { return mResolution.valueOr(1.0); }
   virtual float GetCumulativeResolution() = 0;
 
   /**
    * Accessors for a flag that tracks whether the most recent change to
    * the pres shell's resolution was originated by the main thread.
    */
   virtual bool IsResolutionUpdated() const = 0;
@@ -1385,34 +1394,16 @@ class nsIPresShell : public nsStubDocume
   virtual float GetCumulativeNonRootScaleResolution() = 0;
 
   /**
    * Was the current resolution set by the user or just default initialized?
    */
   bool IsResolutionSet() { return mResolution.isSome(); }
 
   /**
-   * Similar to SetResolution() but also increases the scale of the content
-   * by the same amount.
-   * |aOrigin| specifies who originated the resolution change. For changes
-   * sent by APZ, pass nsGkAtoms::apz. For changes sent by the main thread,
-   * use pass nsGkAtoms::other or nsGkAtoms::restore (similar to the |aOrigin|
-   * parameter of nsIScrollableFrame::ScrollToCSSPixels()).
-   */
-  virtual nsresult SetResolutionAndScaleTo(float aResolution,
-                                           nsAtom* aOrigin) = 0;
-
-  /**
-   * Return whether we are scaling to the set resolution.
-   * This is initially false; it's set to true by a call to
-   * SetResolutionAndScaleTo(), and set to false by a call to SetResolution().
-   */
-  virtual bool ScaleToResolution() const = 0;
-
-  /**
    * Used by session restore code to restore a resolution before the first
    * paint.
    */
   virtual void SetRestoreResolution(
       float aResolution, mozilla::LayoutDeviceIntSize aDisplaySize) = 0;
 
   /**
    * Returns whether we are in a DrawWindow() call that used the
--- a/layout/base/nsLayoutHistoryState.cpp
+++ b/layout/base/nsLayoutHistoryState.cpp
@@ -65,42 +65,40 @@ nsLayoutHistoryState::GetKeys(uint32_t* 
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLayoutHistoryState::GetPresState(const nsACString& aKey, float* aScrollX,
                                    float* aScrollY,
                                    bool* aAllowScrollOriginDowngrade,
-                                   float* aRes, bool* aScaleToRes) {
+                                   float* aRes) {
   PresState* state = GetState(nsCString(aKey));
 
   if (!state) {
     return NS_ERROR_FAILURE;
   }
 
   *aScrollX = state->scrollState().x;
   *aScrollY = state->scrollState().y;
   *aAllowScrollOriginDowngrade = state->allowScrollOriginDowngrade();
   *aRes = state->resolution();
-  *aScaleToRes = state->scaleToResolution();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLayoutHistoryState::AddNewPresState(const nsACString& aKey, float aScrollX,
                                       float aScrollY,
                                       bool aAllowScrollOriginDowngrade,
-                                      float aRes, bool aScaleToRes) {
+                                      float aRes) {
   UniquePtr<PresState> newState = NewPresState();
   newState->scrollState() = nsPoint(aScrollX, aScrollY);
   newState->allowScrollOriginDowngrade() = aAllowScrollOriginDowngrade;
   newState->resolution() = aRes;
-  newState->scaleToResolution() = aScaleToRes;
 
   mStates.Put(nsCString(aKey), std::move(newState));
 
   return NS_OK;
 }
 
 void nsLayoutHistoryState::AddState(const nsCString& aStateKey,
                                     UniquePtr<PresState> aState) {
@@ -144,14 +142,13 @@ void nsLayoutHistoryState::ResetScrollSt
 
 namespace mozilla {
 UniquePtr<PresState> NewPresState() {
   return MakeUnique<PresState>(
       /* contentData */ mozilla::void_t(),
       /* scrollState */ nsPoint(0, 0),
       /* allowScrollOriginDowngrade */ true,
       /* resolution */ 1.0,
-      /* scaleToResolution */ false,
       /* disabledSet */ false,
       /* disabled */ false,
       /* droppedDown */ false);
 }
 }  // namespace mozilla
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3765,20 +3765,19 @@ bool ScrollFrameHelper::DecideScrollable
           }
         }
       }
     } else if (mIsRoot) {
       // The displayPort getter takes care of adjusting for resolution. So if
       // we have resolution but no displayPort then we need to adjust for
       // resolution here.
       nsIPresShell* presShell = mOuter->PresShell();
-      *aVisibleRect = aVisibleRect->RemoveResolution(
-          presShell->ScaleToResolution() ? presShell->GetResolution() : 1.0f);
-      *aDirtyRect = aDirtyRect->RemoveResolution(
-          presShell->ScaleToResolution() ? presShell->GetResolution() : 1.0f);
+      *aVisibleRect =
+          aVisibleRect->RemoveResolution(presShell->GetResolution());
+      *aDirtyRect = aDirtyRect->RemoveResolution(presShell->GetResolution());
     }
   }
 
   // Since making new layers is expensive, only create a scrollable layer
   // for some scroll frames.
   // When a displayport is being used, force building of a layer so that
   // the compositor can find the scrollable layer for async scrolling.
   // If the element is marked 'scrollgrab', also force building of a layer
@@ -6118,40 +6117,34 @@ UniquePtr<PresState> ScrollFrameHelper::
     pt = mRestorePos;
   }
   state->scrollState() = pt;
   state->allowScrollOriginDowngrade() = allowScrollOriginDowngrade;
   if (mIsRoot) {
     // Only save resolution properties for root scroll frames
     nsIPresShell* shell = mOuter->PresShell();
     state->resolution() = shell->GetResolution();
-    state->scaleToResolution() = shell->ScaleToResolution();
   }
   return state;
 }
 
 void ScrollFrameHelper::RestoreState(PresState* aState) {
   mRestorePos = aState->scrollState();
   MOZ_ASSERT(mLastScrollOrigin == nsGkAtoms::other);
   mAllowScrollOriginDowngrade = aState->allowScrollOriginDowngrade();
   mDidHistoryRestore = true;
   mLastPos = mScrolledFrame ? GetLogicalScrollPosition() : nsPoint(0, 0);
 
   // Resolution properties should only exist on root scroll frames.
-  MOZ_ASSERT(mIsRoot ||
-             (!aState->scaleToResolution() && aState->resolution() == 1.0));
+  MOZ_ASSERT(mIsRoot || aState->resolution() == 1.0);
 
   if (mIsRoot) {
     nsIPresShell* presShell = mOuter->PresShell();
-    if (aState->scaleToResolution()) {
-      presShell->SetResolutionAndScaleTo(aState->resolution(),
-                                         nsGkAtoms::restore);
-    } else {
-      presShell->SetResolution(aState->resolution());
-    }
+    presShell->SetResolutionAndScaleTo(aState->resolution(), 
+                                       nsGkAtoms::restore);
   }
 }
 
 void ScrollFrameHelper::PostScrolledAreaEvent() {
   if (mScrolledAreaEvent.IsPending()) {
     return;
   }
   mScrolledAreaEvent = new ScrolledAreaEvent(this);
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2495,18 +2495,17 @@ FrameLayerBuilder* nsDisplayList::BuildL
     }
 
     if (!root) {
       return nullptr;
     }
     // Root is being scaled up by the X/Y resolution. Scale it back down.
     root->SetPostScale(1.0f / containerParameters.mXScale,
                        1.0f / containerParameters.mYScale);
-    root->SetScaleToResolution(presShell->ScaleToResolution(),
-                               containerParameters.mXScale);
+    root->SetScaleToResolution(containerParameters.mXScale);
 
     auto callback = [root](ScrollableLayerGuid::ViewID aScrollId) -> bool {
       return nsLayoutUtils::ContainsMetricsWithId(root, aScrollId);
     };
     if (Maybe<ScrollMetadata> rootMetadata = nsLayoutUtils::GetRootMetadata(
             aBuilder, root->Manager(), containerParameters, callback)) {
       root->SetScrollMetadata(rootMetadata.value());
     }
@@ -6547,35 +6546,33 @@ nsDisplayResolution::nsDisplayResolution
     : nsDisplaySubDocument(aBuilder, aFrame, aSubDocFrame, aList, aFlags) {
   MOZ_COUNT_CTOR(nsDisplayResolution);
 }
 
 void nsDisplayResolution::HitTest(nsDisplayListBuilder* aBuilder,
                                   const nsRect& aRect, HitTestState* aState,
                                   nsTArray<nsIFrame*>* aOutFrames) {
   nsIPresShell* presShell = mFrame->PresShell();
-  nsRect rect = aRect.RemoveResolution(
-      presShell->ScaleToResolution() ? presShell->GetResolution() : 1.0f);
+  nsRect rect = aRect.RemoveResolution(presShell->GetResolution());
   mList.HitTest(aBuilder, rect, aState, aOutFrames);
 }
 
 already_AddRefed<Layer> nsDisplayResolution::BuildLayer(
     nsDisplayListBuilder* aBuilder, LayerManager* aManager,
     const ContainerLayerParameters& aContainerParameters) {
   nsIPresShell* presShell = mFrame->PresShell();
   ContainerLayerParameters containerParameters(
       presShell->GetResolution(), presShell->GetResolution(), nsIntPoint(),
       aContainerParameters);
 
   RefPtr<Layer> layer =
       nsDisplaySubDocument::BuildLayer(aBuilder, aManager, containerParameters);
   layer->SetPostScale(1.0f / presShell->GetResolution(),
                       1.0f / presShell->GetResolution());
-  layer->AsContainerLayer()->SetScaleToResolution(
-      presShell->ScaleToResolution(), presShell->GetResolution());
+  layer->AsContainerLayer()->SetScaleToResolution(presShell->GetResolution());
   return layer.forget();
 }
 
 nsDisplayFixedPosition::nsDisplayFixedPosition(
     nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList,
     const ActiveScrolledRoot* aActiveScrolledRoot,
     const ActiveScrolledRoot* aContainerASR)
     : nsDisplayOwnLayer(aBuilder, aFrame, aList, aActiveScrolledRoot),
--- a/toolkit/modules/sessionstore/SessionHistory.jsm
+++ b/toolkit/modules/sessionstore/SessionHistory.jsm
@@ -260,31 +260,28 @@ var SessionHistoryInternal = {
    * @param layoutHistoryState
    *        nsILayoutHistoryState instance
    * @param stateKey
    *        The state key of the presState to be retrieved.
    * @return object
    */
   _getSerializablePresState(layoutHistoryState, stateKey) {
     let presState = { stateKey };
-    let x = {}, y = {}, scrollOriginDowngrade = {}, res = {}, scaleToRes = {};
+    let x = {}, y = {}, scrollOriginDowngrade = {}, res = {};
 
-    layoutHistoryState.getPresState(stateKey, x, y, scrollOriginDowngrade, res, scaleToRes);
+    layoutHistoryState.getPresState(stateKey, x, y, scrollOriginDowngrade, res);
     if (x.value !== 0 || y.value !== 0) {
       presState.scroll = x.value + "," + y.value;
     }
     if (scrollOriginDowngrade.value === false) {
       presState.scrollOriginDowngrade = scrollOriginDowngrade.value;
     }
     if (res.value != 1.0) {
       presState.res = res.value;
     }
-    if (scaleToRes.value === true) {
-      presState.scaleToRes = scaleToRes.value;
-    }
 
     return presState;
   },
 
   /**
    * Restores session history data for a given docShell.
    *
    * @param docShell
@@ -490,20 +487,19 @@ var SessionHistoryInternal = {
    * @param presState
    *        Object containing serialized PresState data.
    */
   _deserializePresState(layoutHistoryState, presState) {
     let stateKey = presState.stateKey;
     let scrollOriginDowngrade =
       typeof presState.scrollOriginDowngrade == "boolean" ? presState.scrollOriginDowngrade : true;
     let res = presState.res || 1.0;
-    let scaleToRes = presState.scaleToRes || false;
 
     layoutHistoryState.addNewPresState(stateKey, ...this._deserializeScrollPosition(presState.scroll),
-                                       scrollOriginDowngrade, res, scaleToRes);
+                                       scrollOriginDowngrade, res);
   },
 
   /**
    * Expands serialized scroll position data into an array containing the x and y coordinates,
    * defaulting to 0,0 if no scroll position was found.
    *
    * @param scroll
    *        Object containing serialized scroll position data.