Bug 1518584 - Rename {FrameMetrics,RepaintRequest}::mViewport to mLayoutViewport. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 09 Jan 2019 15:34:34 +0000
changeset 510206 3d58d90a9bc4b0e30e935d850cc9a90d12fbbeb2
parent 510205 01f03c4f2600d4aba086779a9a1b3beb4fe1c6fa
child 510207 f12fba5d2706be972c86072f4ec733de1aac363b
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1518584
milestone66.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 1518584 - Rename {FrameMetrics,RepaintRequest}::mViewport to mLayoutViewport. r=kats Depends on D15972 Differential Revision: https://phabricator.services.mozilla.com/D15973
gfx/layers/FrameMetrics.cpp
gfx/layers/FrameMetrics.h
gfx/layers/LayersLogging.cpp
gfx/layers/RepaintRequest.h
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/test/gtest/TestPinching.cpp
gfx/layers/apz/util/APZCCallbackHelper.cpp
gfx/layers/ipc/LayersMessageUtils.h
layout/base/nsLayoutUtils.cpp
--- a/gfx/layers/FrameMetrics.cpp
+++ b/gfx/layers/FrameMetrics.cpp
@@ -8,21 +8,21 @@
 #include "gfxPrefs.h"
 #include "nsStyleConsts.h"
 
 namespace mozilla {
 namespace layers {
 
 const ScrollableLayerGuid::ViewID ScrollableLayerGuid::NULL_SCROLL_ID = 0;
 
-void FrameMetrics::RecalculateViewportOffset() {
+void FrameMetrics::RecalculateLayoutViewportOffset() {
   if (!mIsRootContent) {
     return;
   }
-  KeepLayoutViewportEnclosingVisualViewport(GetVisualViewport(), mViewport);
+  KeepLayoutViewportEnclosingVisualViewport(GetVisualViewport(), mLayoutViewport);
 }
 
 /* static */ void FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
     const CSSRect& aVisualViewport, CSSRect& aLayoutViewport) {
   // If the visual viewport is contained within the layout viewport, we don't
   // need to make any adjustments, so we can exit early.
   //
   // Additionally, if the composition bounds changes (due to an orientation
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -95,17 +95,17 @@ struct FrameMetrics {
         mScrollOffset(0, 0),
         mBaseScrollOffset(0, 0),
         mZoom(),
         mScrollGeneration(0),
         mSmoothScrollOffset(0, 0),
         mRootCompositionSize(0, 0),
         mDisplayPortMargins(0, 0, 0, 0),
         mPresShellId(-1),
-        mViewport(0, 0, 0, 0),
+        mLayoutViewport(0, 0, 0, 0),
         mExtraResolution(),
         mPaintRequestTime(),
         mScrollUpdateType(eNone),
         mIsRootContent(false),
         mIsRelative(false),
         mDoSmoothScroll(false),
         mIsScrollInfoLayer(false) {}
 
@@ -124,17 +124,17 @@ struct FrameMetrics {
            mScrollOffset == aOther.mScrollOffset &&
            mBaseScrollOffset == aOther.mBaseScrollOffset &&
            // don't compare mZoom
            mScrollGeneration == aOther.mScrollGeneration &&
            mSmoothScrollOffset == aOther.mSmoothScrollOffset &&
            mRootCompositionSize == aOther.mRootCompositionSize &&
            mDisplayPortMargins == aOther.mDisplayPortMargins &&
            mPresShellId == aOther.mPresShellId &&
-           mViewport.IsEqualEdges(aOther.mViewport) &&
+           mLayoutViewport.IsEqualEdges(aOther.mLayoutViewport) &&
            mExtraResolution == aOther.mExtraResolution &&
            mPaintRequestTime == aOther.mPaintRequestTime &&
            mScrollUpdateType == aOther.mScrollUpdateType &&
            mIsRootContent == aOther.mIsRootContent &&
            mIsRelative == aOther.mIsRelative &&
            mDoSmoothScroll == aOther.mDoSmoothScroll &&
            mIsScrollInfoLayer == aOther.mIsScrollInfoLayer;
   }
@@ -432,19 +432,21 @@ struct FrameMetrics {
   const ScreenMargin& GetDisplayPortMargins() const {
     return mDisplayPortMargins;
   }
 
   uint32_t GetPresShellId() const { return mPresShellId; }
 
   void SetPresShellId(uint32_t aPresShellId) { mPresShellId = aPresShellId; }
 
-  void SetViewport(const CSSRect& aViewport) { mViewport = aViewport; }
+  void SetLayoutViewport(const CSSRect& aLayoutViewport) {
+    mLayoutViewport = aLayoutViewport;
+  }
 
-  const CSSRect& GetViewport() const { return mViewport; }
+  const CSSRect& GetLayoutViewport() const { return mLayoutViewport; }
 
   CSSRect GetVisualViewport() const {
     return CSSRect(mScrollOffset, CalculateCompositedSizeInCssPixels());
   }
 
   void SetExtraResolution(const ScreenToLayerScale2D& aExtraResolution) {
     mExtraResolution = aExtraResolution;
   }
@@ -474,21 +476,21 @@ struct FrameMetrics {
   const TimeStamp& GetPaintRequestTime() const { return mPaintRequestTime; }
 
   void SetIsScrollInfoLayer(bool aIsScrollInfoLayer) {
     mIsScrollInfoLayer = aIsScrollInfoLayer;
   }
   bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
 
   // Determine if the visual viewport is outside of the layout viewport and
-  // adjust the x,y-offset in mViewport accordingly. This is necessary to
+  // adjust the x,y-offset in mLayoutViewport accordingly. This is necessary to
   // allow APZ to async-scroll the layout viewport.
   //
   // This is a no-op if mIsRootContent is false.
-  void RecalculateViewportOffset();
+  void RecalculateLayoutViewportOffset();
 
   // Helper function for RecalculateViewportOffset(). Exposed so that
   // APZC can perform the operation on other copies of the layout
   // and visual viewport rects (e.g. the "effective" ones used to implement
   // the frame delay).
   // Modifies |aLayoutViewport| to continue enclosing |aVisualViewport|
   // if possible.
   static void KeepLayoutViewportEnclosingVisualViewport(
@@ -620,17 +622,17 @@ struct FrameMetrics {
   // exposed to web content via window.scrollX/Y.
   //
   // Note that only the root content document's RSF has a layout viewport
   // that's distinct from the visual viewport. For an iframe RSF, the two
   // are the same.
   //
   // For a scroll frame that is not an RSF, this metric is meaningless and
   // invalid.
-  CSSRect mViewport;
+  CSSRect mLayoutViewport;
 
   // The extra resolution at which content in this scroll frame is drawn beyond
   // that necessary to draw one Layer pixel per Screen pixel.
   ScreenToLayerScale2D mExtraResolution;
 
   // The time at which the APZC last requested a repaint for this scroll frame.
   TimeStamp mPaintRequestTime;
 
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -224,17 +224,17 @@ void AppendToString(std::stringstream& a
     AppendToString(aStream, m.GetScrollId(), "] [scrollId=");
     if (m.IsRootContent()) {
       aStream << "] [rcd";
     }
     AppendToString(aStream, m.GetZoom(), "] [z=", "] }");
   } else {
     AppendToString(aStream, m.GetDisplayPortMargins(), " [dpm=");
     AppendToString(aStream, m.GetRootCompositionSize(), "] [rcs=");
-    AppendToString(aStream, m.GetViewport(), "] [v=");
+    AppendToString(aStream, m.GetLayoutViewport(), "] [v=");
     aStream << nsPrintfCString("] [z=(ld=%.3f r=%.3f",
                                m.GetDevPixelsPerCSSPixel().scale,
                                m.GetPresShellResolution())
                    .get();
     AppendToString(aStream, m.GetCumulativeResolution(), " cr=");
     AppendToString(aStream, m.GetZoom(), " z=");
     AppendToString(aStream, m.GetExtraResolution(), " er=");
     aStream << nsPrintfCString(")] [u=(%d %d %" PRIu32 ")",
--- a/gfx/layers/RepaintRequest.h
+++ b/gfx/layers/RepaintRequest.h
@@ -43,17 +43,17 @@ struct RepaintRequest {
         mCompositionBounds(0, 0, 0, 0),
         mCumulativeResolution(),
         mDevPixelsPerCSSPixel(1),
         mScrollOffset(0, 0),
         mZoom(),
         mScrollGeneration(0),
         mDisplayPortMargins(0, 0, 0, 0),
         mPresShellId(-1),
-        mViewport(0, 0, 0, 0),
+        mLayoutViewport(0, 0, 0, 0),
         mExtraResolution(),
         mPaintRequestTime(),
         mScrollUpdateType(eNone),
         mIsRootContent(false),
         mIsScrollInfoLayer(false) {}
 
   RepaintRequest(const FrameMetrics& aOther,
                  const ScrollOffsetUpdateType aScrollUpdateType)
@@ -62,17 +62,17 @@ struct RepaintRequest {
         mCompositionBounds(aOther.GetCompositionBounds()),
         mCumulativeResolution(aOther.GetCumulativeResolution()),
         mDevPixelsPerCSSPixel(aOther.GetDevPixelsPerCSSPixel()),
         mScrollOffset(aOther.GetScrollOffset()),
         mZoom(aOther.GetZoom()),
         mScrollGeneration(aOther.GetScrollGeneration()),
         mDisplayPortMargins(aOther.GetDisplayPortMargins()),
         mPresShellId(aOther.GetPresShellId()),
-        mViewport(aOther.GetViewport()),
+        mLayoutViewport(aOther.GetLayoutViewport()),
         mExtraResolution(aOther.GetExtraResolution()),
         mPaintRequestTime(aOther.GetPaintRequestTime()),
         mScrollUpdateType(aScrollUpdateType),
         mIsRootContent(aOther.IsRootContent()),
         mIsScrollInfoLayer(aOther.IsScrollInfoLayer()) {}
 
   // Default copy ctor and operator= are fine
 
@@ -83,17 +83,17 @@ struct RepaintRequest {
            mCompositionBounds.IsEqualEdges(aOther.mCompositionBounds) &&
            mCumulativeResolution == aOther.mCumulativeResolution &&
            mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel &&
            mScrollOffset == aOther.mScrollOffset &&
            // don't compare mZoom
            mScrollGeneration == aOther.mScrollGeneration &&
            mDisplayPortMargins == aOther.mDisplayPortMargins &&
            mPresShellId == aOther.mPresShellId &&
-           mViewport.IsEqualEdges(aOther.mViewport) &&
+           mLayoutViewport.IsEqualEdges(aOther.mLayoutViewport) &&
            mExtraResolution == aOther.mExtraResolution &&
            mPaintRequestTime == aOther.mPaintRequestTime &&
            mScrollUpdateType == aOther.mScrollUpdateType &&
            mIsRootContent == aOther.mIsRootContent &&
            mIsScrollInfoLayer == aOther.mIsScrollInfoLayer;
   }
 
   bool operator!=(const RepaintRequest& aOther) const {
@@ -160,17 +160,17 @@ struct RepaintRequest {
   ScrollableLayerGuid::ViewID GetScrollId() const { return mScrollId; }
 
   const ScreenMargin& GetDisplayPortMargins() const {
     return mDisplayPortMargins;
   }
 
   uint32_t GetPresShellId() const { return mPresShellId; }
 
-  const CSSRect& GetViewport() const { return mViewport; }
+  const CSSRect& GetLayoutViewport() const { return mLayoutViewport; }
 
   const ScreenToLayerScale2D& GetExtraResolution() const {
     return mExtraResolution;
   }
 
   const TimeStamp& GetPaintRequestTime() const { return mPaintRequestTime; }
 
   bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
@@ -254,17 +254,17 @@ struct RepaintRequest {
   // exposed to web content via window.scrollX/Y.
   //
   // Note that only the root content document's RSF has a layout viewport
   // that's distinct from the visual viewport. For an iframe RSF, the two
   // are the same.
   //
   // For a scroll frame that is not an RSF, this metric is meaningless and
   // invalid.
-  CSSRect mViewport;
+  CSSRect mLayoutViewport;
 
   // The extra resolution at which content in this scroll frame is drawn beyond
   // that necessary to draw one Layer pixel per Screen pixel.
   ScreenToLayerScale2D mExtraResolution;
 
   // The time at which the APZC last requested a repaint for this scroll frame.
   TimeStamp mPaintRequestTime;
 
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3428,33 +3428,33 @@ void AsyncPanZoomController::AdjustScrol
   // Apply shift to mCompositedScrollOffset, since the dynamic toolbar expects
   // the shift to take effect right away, without the usual frame delay.
   mCompositedScrollOffset =
       scrollRange.ClampPoint(mCompositedScrollOffset + adjustment);
   // For a similar reason, apply the shift to mCompositedLayoutViewport.
   // mCompositedLayoutViewport also needs to immediately pick up any new
   // size from Metrics().GetViewport() to make sure it reflects any height
   // change due to dynamic toolbar movement.
-  mCompositedLayoutViewport.SizeTo(Metrics().GetViewport().Size());
+  mCompositedLayoutViewport.SizeTo(Metrics().GetLayoutViewport().Size());
   FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
       CSSRect(mCompositedScrollOffset,
               Metrics().CalculateCompositedSizeInCssPixels()),
       mCompositedLayoutViewport);
   RequestContentRepaint();
   UpdateSharedCompositorFrameMetrics();
 }
 
 void AsyncPanZoomController::SetScrollOffset(const CSSPoint& aOffset) {
   Metrics().SetScrollOffset(aOffset);
-  Metrics().RecalculateViewportOffset();
+  Metrics().RecalculateLayoutViewportOffset();
 }
 
 void AsyncPanZoomController::ClampAndSetScrollOffset(const CSSPoint& aOffset) {
   Metrics().ClampAndSetScrollOffset(aOffset);
-  Metrics().RecalculateViewportOffset();
+  Metrics().RecalculateLayoutViewportOffset();
 }
 
 void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) {
   SetScrollOffset(Metrics().GetScrollOffset() + aOffset);
 }
 
 void AsyncPanZoomController::ScrollByAndClamp(const CSSPoint& aOffset) {
   ClampAndSetScrollOffset(Metrics().GetScrollOffset() + aOffset);
@@ -3734,24 +3734,24 @@ void AsyncPanZoomController::RequestCont
       fabsf(marginDelta.bottom) < EPSILON &&
       fabsf(mLastPaintRequestMetrics.GetScrollOffset().x -
             request.GetScrollOffset().x) < EPSILON &&
       fabsf(mLastPaintRequestMetrics.GetScrollOffset().y -
             request.GetScrollOffset().y) < EPSILON &&
       request.GetPresShellResolution() ==
           mLastPaintRequestMetrics.GetPresShellResolution() &&
       request.GetZoom() == mLastPaintRequestMetrics.GetZoom() &&
-      fabsf(request.GetViewport().Width() -
-            mLastPaintRequestMetrics.GetViewport().Width()) < EPSILON &&
-      fabsf(request.GetViewport().Height() -
-            mLastPaintRequestMetrics.GetViewport().Height()) < EPSILON &&
-      fabsf(request.GetViewport().X() -
-            mLastPaintRequestMetrics.GetViewport().X()) < EPSILON &&
-      fabsf(request.GetViewport().Y() -
-            mLastPaintRequestMetrics.GetViewport().Y()) < EPSILON &&
+      fabsf(request.GetLayoutViewport().Width() -
+            mLastPaintRequestMetrics.GetLayoutViewport().Width()) < EPSILON &&
+      fabsf(request.GetLayoutViewport().Height() -
+            mLastPaintRequestMetrics.GetLayoutViewport().Height()) < EPSILON &&
+      fabsf(request.GetLayoutViewport().X() -
+            mLastPaintRequestMetrics.GetLayoutViewport().X()) < EPSILON &&
+      fabsf(request.GetLayoutViewport().Y() -
+            mLastPaintRequestMetrics.GetLayoutViewport().Y()) < EPSILON &&
       request.GetScrollGeneration() ==
           mLastPaintRequestMetrics.GetScrollGeneration() &&
       request.GetScrollUpdateType() ==
           mLastPaintRequestMetrics.GetScrollUpdateType()) {
     return;
   }
 
   APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
@@ -3884,17 +3884,17 @@ bool AsyncPanZoomController::AdvanceAnim
 }
 
 CSSRect AsyncPanZoomController::GetCurrentAsyncLayoutViewport(
     AsyncTransformConsumer aMode) const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   MOZ_ASSERT(Metrics().IsRootContent(),
              "Only the root content APZC has a layout viewport");
   if (aMode == eForCompositing && mScrollMetadata.IsApzForceDisabled()) {
-    return mLastContentPaintMetrics.GetViewport();
+    return mLastContentPaintMetrics.GetLayoutViewport();
   }
   return GetEffectiveLayoutViewport(aMode);
 }
 
 ParentLayerPoint AsyncPanZoomController::GetCurrentAsyncScrollOffset(
     AsyncTransformConsumer aMode) const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
 
@@ -3922,17 +3922,17 @@ AsyncTransform AsyncPanZoomController::G
   RecursiveMutexAutoLock lock(mRecursiveMutex);
 
   if (aMode == eForCompositing && mScrollMetadata.IsApzForceDisabled()) {
     return AsyncTransform();
   }
 
   CSSRect lastPaintViewport;
   if (mLastContentPaintMetrics.IsScrollable()) {
-    lastPaintViewport = mLastContentPaintMetrics.GetViewport();
+    lastPaintViewport = mLastContentPaintMetrics.GetLayoutViewport();
   }
 
   CSSRect currentViewport = GetEffectiveLayoutViewport(aMode);
   CSSPoint currentViewportOffset = currentViewport.TopLeft();
 
   // Unlike the visual viewport, the layout viewport does not change size
   // (in the sense of "number of CSS pixels of page content it covers")
   // when zooming, so the async transform of the layout viewport does not
@@ -3976,17 +3976,17 @@ AsyncPanZoomController::GetCurrentAsyncT
     AsyncTransformConsumer aMode) const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
 
   // Use the layout viewport to adjust fixed position elements if and only if
   // it's larger than the visual viewport (assuming we're scrolling the RCD-RSF
   // with apz.allow_zooming enabled).
   return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
           Metrics().GetVisualViewport().Size() <=
-              Metrics().GetViewport().Size())
+              Metrics().GetLayoutViewport().Size())
              ? GetCurrentAsyncViewportTransform(aMode)
              : GetCurrentAsyncTransform(aMode);
 }
 
 AsyncTransformComponentMatrix
 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll(
     AsyncTransformConsumer aMode) const {
   return AsyncTransformComponentMatrix(GetCurrentAsyncTransform(aMode)) *
@@ -4002,17 +4002,17 @@ LayoutDeviceToParentLayerScale AsyncPanZ
   return scale.ToScaleFactor() / Metrics().GetDevPixelsPerCSSPixel();
 }
 
 CSSRect AsyncPanZoomController::GetEffectiveLayoutViewport(
     AsyncTransformConsumer aMode) const {
   if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedLayoutViewport;
   }
-  return Metrics().GetViewport();
+  return Metrics().GetLayoutViewport();
 }
 
 CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
     AsyncTransformConsumer aMode) const {
   if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedScrollOffset;
   }
   return Metrics().GetScrollOffset();
@@ -4023,20 +4023,20 @@ CSSToParentLayerScale2D AsyncPanZoomCont
   if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedZoom;
   }
   return Metrics().GetZoom();
 }
 
 bool AsyncPanZoomController::SampleCompositedAsyncTransform() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
-  if (!mCompositedLayoutViewport.IsEqualEdges(Metrics().GetViewport()) ||
+  if (!mCompositedLayoutViewport.IsEqualEdges(Metrics().GetLayoutViewport()) ||
       mCompositedScrollOffset != Metrics().GetScrollOffset() ||
       mCompositedZoom != Metrics().GetZoom()) {
-    mCompositedLayoutViewport = Metrics().GetViewport();
+    mCompositedLayoutViewport = Metrics().GetLayoutViewport();
     mCompositedScrollOffset = Metrics().GetScrollOffset();
     mCompositedZoom = Metrics().GetZoom();
     return true;
   }
   return false;
 }
 
 bool AsyncPanZoomController::ApplyAsyncTestAttributes() {
@@ -4301,25 +4301,25 @@ void AsyncPanZoomController::NotifyLayer
       FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Width(),
                           Metrics().GetCompositionBounds().Width()) &&
       FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Height(),
                           Metrics().GetCompositionBounds().Height());
 #if defined(MOZ_WIDGET_ANDROID)
   entertainViewportUpdates = true;
 #endif
   if (entertainViewportUpdates) {
-    if (Metrics().GetViewport().Width() !=
-            aLayerMetrics.GetViewport().Width() ||
-        Metrics().GetViewport().Height() !=
-            aLayerMetrics.GetViewport().Height()) {
+    if (Metrics().GetLayoutViewport().Width() !=
+            aLayerMetrics.GetLayoutViewport().Width() ||
+        Metrics().GetLayoutViewport().Height() !=
+            aLayerMetrics.GetLayoutViewport().Height()) {
       needContentRepaint = true;
       viewportUpdated = true;
     }
     if (viewportUpdated || scrollOffsetUpdated) {
-      Metrics().SetViewport(aLayerMetrics.GetViewport());
+      Metrics().SetLayoutViewport(aLayerMetrics.GetLayoutViewport());
     }
   }
 
 #if defined(MOZ_WIDGET_ANDROID)
   if (aLayerMetrics.IsRootContent()) {
     if (APZCTreeManager* manager = GetApzcTreeManager()) {
       if (AndroidDynamicToolbarAnimator* animator =
               manager->GetAndroidDynamicToolbarAnimator()) {
@@ -4333,17 +4333,17 @@ void AsyncPanZoomController::NotifyLayer
     // Initialize our internal state to something sane when the content
     // that was just painted is something we knew nothing about previously
     CancelAnimation();
 
     mScrollMetadata = aScrollMetadata;
     mExpectedGeckoMetrics = aLayerMetrics;
     ShareCompositorFrameMetrics();
 
-    mCompositedLayoutViewport = Metrics().GetViewport();
+    mCompositedLayoutViewport = Metrics().GetLayoutViewport();
     mCompositedScrollOffset = Metrics().GetScrollOffset();
     mCompositedZoom = Metrics().GetZoom();
 
     if (Metrics().GetDisplayPortMargins() != ScreenMargin()) {
       // A non-zero display port margin here indicates a displayport has
       // been set by a previous APZC for the content at this guid. The
       // scrollable rect may have changed since then, making the margins
       // wrong, so we need to calculate a new display port.
@@ -4451,19 +4451,19 @@ void AsyncPanZoomController::NotifyLayer
         relativeDelta =
             Some(Metrics().ApplyRelativeScrollUpdateFrom(aLayerMetrics));
       } else {
         APZC_LOG("%p updating scroll offset from %s to %s\n", this,
                  ToString(Metrics().GetScrollOffset()).c_str(),
                  ToString(aLayerMetrics.GetScrollOffset()).c_str());
         Metrics().ApplyScrollUpdateFrom(aLayerMetrics);
       }
-      Metrics().RecalculateViewportOffset();
-
-      mCompositedLayoutViewport = Metrics().GetViewport();
+      Metrics().RecalculateLayoutViewportOffset();
+
+      mCompositedLayoutViewport = Metrics().GetLayoutViewport();
       mCompositedScrollOffset = Metrics().GetScrollOffset();
       mExpectedGeckoMetrics = aLayerMetrics;
 
       // If an animation is underway, tell it about the scroll offset update.
       // Some animations can handle some scroll offset updates and continue
       // running. Those that can't will return false, and we cancel them.
       if (!mAnimation || !mAnimation->HandleScrollOffsetUpdate(relativeDelta)) {
         // Cancel the animation (which might also trigger a repaint request)
@@ -4515,17 +4515,17 @@ void AsyncPanZoomController::NotifyLayer
 
   if (viewportUpdated) {
     // While we want to accept the main thread's layout viewport _size_,
     // its position may be out of date in light of async scrolling, to
     // adjust it if necessary to make sure it continues to enclose the
     // visual viewport.
     // Note: it's important to do this _after_ we've accepted any
     // updated composition bounds.
-    Metrics().RecalculateViewportOffset();
+    Metrics().RecalculateLayoutViewportOffset();
   }
 
   if (needContentRepaint) {
     // This repaint request could be driven by a user action if we accept a
     // relative scroll offset update
     RequestContentRepaint(contentRepaintType);
   }
   UpdateSharedCompositorFrameMetrics();
@@ -4686,17 +4686,17 @@ void AsyncPanZoomController::ZoomToRect(
     if (aRect.Y() + sizeAfterZoom.height > cssPageRect.Height()) {
       aRect.MoveToY(std::max(0.f, cssPageRect.Height() - sizeAfterZoom.height));
     }
     if (aRect.X() + sizeAfterZoom.width > cssPageRect.Width()) {
       aRect.MoveToX(std::max(0.f, cssPageRect.Width() - sizeAfterZoom.width));
     }
 
     endZoomToMetrics.SetScrollOffset(aRect.TopLeft());
-    endZoomToMetrics.RecalculateViewportOffset();
+    endZoomToMetrics.RecalculateLayoutViewportOffset();
 
     StartAnimation(new ZoomAnimation(
         *this, Metrics().GetScrollOffset(), Metrics().GetZoom(),
         endZoomToMetrics.GetScrollOffset(), endZoomToMetrics.GetZoom()));
 
     // Schedule a repaint now, so the new displayport will be painted before the
     // animation finishes.
     ParentLayerPoint velocity(0, 0);
--- a/gfx/layers/apz/test/gtest/TestPinching.cpp
+++ b/gfx/layers/apz/test/gtest/TestPinching.cpp
@@ -16,17 +16,17 @@ class APZCPinchTester : public APZCBasic
       : APZCBasicTester(aGestureBehavior) {}
 
  protected:
   FrameMetrics GetPinchableFrameMetrics() {
     FrameMetrics fm;
     fm.SetCompositionBounds(ParentLayerRect(0, 0, 100, 200));
     fm.SetScrollableRect(CSSRect(0, 0, 980, 1000));
     fm.SetScrollOffset(CSSPoint(300, 300));
-    fm.SetViewport(CSSRect(300, 300, 100, 200));
+    fm.SetLayoutViewport(CSSRect(300, 300, 100, 200));
     fm.SetZoom(CSSToParentLayerScale2D(2.0, 2.0));
     // APZC only allows zooming on the root scrollable frame.
     fm.SetIsRootContent(true);
     // the visible area of the document in CSS pixels is x=300 y=300 w=50 h=100
     return fm;
   }
 
   void DoPinchTest(bool aShouldTriggerPinch,
@@ -351,84 +351,84 @@ TEST_F(APZCPinchTester, Panning_Beyond_L
   // Case 1 - visual viewport is still inside layout viewport.
   Pan(apzc, 350, 300, PanOptions::NoFling);
   FrameMetrics fm = apzc->GetFrameMetrics();
   // It starts from (300, 300) pans by (0, 50) screen pixels, but there is a
   // 2x zoom, which causes the scroll offset to change by half of that (0, 25).
   // But the visual viewport is still inside the layout viewport.
   EXPECT_EQ(300, fm.GetScrollOffset().x);
   EXPECT_EQ(325, fm.GetScrollOffset().y);
-  EXPECT_EQ(300, fm.GetViewport().X());
-  EXPECT_EQ(300, fm.GetViewport().Y());
+  EXPECT_EQ(300, fm.GetLayoutViewport().X());
+  EXPECT_EQ(300, fm.GetLayoutViewport().Y());
 
   // Case 2 - visual viewport crosses the bottom boundary of the layout
   // viewport.
   Pan(apzc, 525, 325, PanOptions::NoFling);
   fm = apzc->GetFrameMetrics();
   // It starts from (300, 325) pans by (0, 200) screen pixels, but there is a
   // 2x zoom, which causes the scroll offset to change by half of that
   // (0, 100). The visual viewport crossed the bottom boundary of the layout
   // viewport by 25px.
   EXPECT_EQ(300, fm.GetScrollOffset().x);
   EXPECT_EQ(425, fm.GetScrollOffset().y);
-  EXPECT_EQ(300, fm.GetViewport().X());
-  EXPECT_EQ(325, fm.GetViewport().Y());
+  EXPECT_EQ(300, fm.GetLayoutViewport().X());
+  EXPECT_EQ(325, fm.GetLayoutViewport().Y());
 
   // Case 3 - visual viewport crosses the top boundary of the layout viewport.
   Pan(apzc, 425, 775, PanOptions::NoFling);
   fm = apzc->GetFrameMetrics();
   // It starts from (300, 425) pans by (0, -350) screen pixels, but there is a
   // 2x zoom, which causes the scroll offset to change by half of that
   // (0, -175). The visual viewport crossed the top of the layout viewport by
   // 75px.
   EXPECT_EQ(300, fm.GetScrollOffset().x);
   EXPECT_EQ(250, fm.GetScrollOffset().y);
-  EXPECT_EQ(300, fm.GetViewport().X());
-  EXPECT_EQ(250, fm.GetViewport().Y());
+  EXPECT_EQ(300, fm.GetLayoutViewport().X());
+  EXPECT_EQ(250, fm.GetLayoutViewport().Y());
 
   // Case 4 - visual viewport crosses the left boundary of the layout viewport.
   Pan(apzc, ScreenIntPoint(150, 10), ScreenIntPoint(350, 10),
       PanOptions::NoFling);
   fm = apzc->GetFrameMetrics();
   // It starts from (300, 250) pans by (-200, 0) screen pixels, but there is a
   // 2x zoom, which causes the scroll offset to change by half of that
   // (-100, 0). The visual viewport crossed the left boundary of the layout
   // viewport by 100px.
   EXPECT_EQ(200, fm.GetScrollOffset().x);
   EXPECT_EQ(250, fm.GetScrollOffset().y);
-  EXPECT_EQ(200, fm.GetViewport().X());
-  EXPECT_EQ(250, fm.GetViewport().Y());
+  EXPECT_EQ(200, fm.GetLayoutViewport().X());
+  EXPECT_EQ(250, fm.GetLayoutViewport().Y());
 
   // Case 5 - visual viewport crosses the right boundary of the layout viewport.
   Pan(apzc, ScreenIntPoint(350, 10), ScreenIntPoint(150, 10),
       PanOptions::NoFling);
   fm = apzc->GetFrameMetrics();
   // It starts from (200, 250) pans by (200, 0) screen pixels, but there is a
   // 2x zoom, which causes the scroll offset to change by half of that
   // (100, 0). The visual viewport crossed the right boundary of the layout
   // viewport by 50px.
   EXPECT_EQ(300, fm.GetScrollOffset().x);
   EXPECT_EQ(250, fm.GetScrollOffset().y);
-  EXPECT_EQ(250, fm.GetViewport().X());
-  EXPECT_EQ(250, fm.GetViewport().Y());
+  EXPECT_EQ(250, fm.GetLayoutViewport().X());
+  EXPECT_EQ(250, fm.GetLayoutViewport().Y());
 
   // Case 6 - visual viewport crosses both the vertical and horizontal
   // boundaries of the layout viewport by moving diagonally towards the
   // top-right corner.
   Pan(apzc, ScreenIntPoint(350, 200), ScreenIntPoint(150, 400),
       PanOptions::NoFling);
   fm = apzc->GetFrameMetrics();
   // It starts from (300, 250) pans by (200, -200) screen pixels, but there is
   // a 2x zoom, which causes the scroll offset to change by half of that
   // (100, -100). The visual viewport moved by (100, -100) outside the
   // boundary of the layout viewport.
   EXPECT_EQ(400, fm.GetScrollOffset().x);
   EXPECT_EQ(150, fm.GetScrollOffset().y);
-  EXPECT_EQ(350, fm.GetViewport().X());
-  EXPECT_EQ(150, fm.GetViewport().Y());
+  EXPECT_EQ(350, fm.GetLayoutViewport().X());
+  EXPECT_EQ(150, fm.GetLayoutViewport().Y());
 }
 
 TEST_F(APZCPinchGestureDetectorTester, Pinch_APZZoom_Disabled) {
   SCOPED_GFX_PREF(APZAllowZooming, bool, false);
 
   FrameMetrics originalMetrics = GetPinchableFrameMetrics();
   apzc->SetFrameMetrics(originalMetrics);
 
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -78,17 +78,17 @@ static already_AddRefed<nsIPresShell> Ge
   return result.forget();
 }
 
 static CSSPoint ScrollFrameTo(nsIScrollableFrame* aFrame,
                               const RepaintRequest& aRequest,
                               bool& aSuccessOut) {
   aSuccessOut = false;
   CSSPoint targetScrollPosition = aRequest.IsRootContent()
-                                      ? aRequest.GetViewport().TopLeft()
+                                      ? aRequest.GetLayoutViewport().TopLeft()
                                       : aRequest.GetScrollOffset();
 
   if (!aFrame) {
     return targetScrollPosition;
   }
 
   CSSPoint geckoScrollPosition =
       CSSPoint::FromAppUnits(aFrame->GetScrollPosition());
@@ -198,17 +198,17 @@ static ScreenMargin ScrollFrame(nsIConte
       }
     } else {
       // Correct the display port due to the difference between mScrollOffset
       // and the actual scroll offset.
       displayPortMargins = APZCCallbackHelper::AdjustDisplayPortForScrollDelta(
           aRequest, actualScrollOffset);
     }
   } else if (aRequest.IsRootContent() &&
-             aRequest.GetScrollOffset() != aRequest.GetViewport().TopLeft()) {
+             aRequest.GetScrollOffset() != aRequest.GetLayoutViewport().TopLeft()) {
     // APZ uses the visual viewport's offset to calculate where to place the
     // display port, so the display port is misplaced when a pinch zoom occurs.
     //
     // We need to force a display port adjustment in the following paint to
     // account for a difference between mScrollOffset and the actual scroll
     // offset in repaints requested by
     // AsyncPanZoomController::NotifyLayersUpdated.
     displayPortMargins = APZCCallbackHelper::AdjustDisplayPortForScrollDelta(
--- a/gfx/layers/ipc/LayersMessageUtils.h
+++ b/gfx/layers/ipc/LayersMessageUtils.h
@@ -186,17 +186,17 @@ struct ParamTraits<mozilla::layers::Fram
     WriteParam(aMsg, aParam.mScrollOffset);
     WriteParam(aMsg, aParam.mBaseScrollOffset);
     WriteParam(aMsg, aParam.mZoom);
     WriteParam(aMsg, aParam.mScrollGeneration);
     WriteParam(aMsg, aParam.mSmoothScrollOffset);
     WriteParam(aMsg, aParam.mRootCompositionSize);
     WriteParam(aMsg, aParam.mDisplayPortMargins);
     WriteParam(aMsg, aParam.mPresShellId);
-    WriteParam(aMsg, aParam.mViewport);
+    WriteParam(aMsg, aParam.mLayoutViewport);
     WriteParam(aMsg, aParam.mExtraResolution);
     WriteParam(aMsg, aParam.mPaintRequestTime);
     WriteParam(aMsg, aParam.mScrollUpdateType);
     WriteParam(aMsg, aParam.mIsRootContent);
     WriteParam(aMsg, aParam.mIsRelative);
     WriteParam(aMsg, aParam.mDoSmoothScroll);
     WriteParam(aMsg, aParam.mIsScrollInfoLayer);
   }
@@ -215,17 +215,17 @@ struct ParamTraits<mozilla::layers::Fram
         ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
         ReadParam(aMsg, aIter, &aResult->mBaseScrollOffset) &&
         ReadParam(aMsg, aIter, &aResult->mZoom) &&
         ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
         ReadParam(aMsg, aIter, &aResult->mSmoothScrollOffset) &&
         ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) &&
         ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
         ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
-        ReadParam(aMsg, aIter, &aResult->mViewport) &&
+        ReadParam(aMsg, aIter, &aResult->mLayoutViewport) &&
         ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
         ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
         ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
         ReadBoolForBitfield(aMsg, aIter, aResult,
                             &paramType::SetIsRootContent) &&
         ReadBoolForBitfield(aMsg, aIter, aResult, &paramType::SetIsRelative) &&
         ReadBoolForBitfield(aMsg, aIter, aResult,
                             &paramType::SetDoSmoothScroll) &&
@@ -245,17 +245,17 @@ struct ParamTraits<mozilla::layers::Repa
     WriteParam(aMsg, aParam.mCompositionBounds);
     WriteParam(aMsg, aParam.mCumulativeResolution);
     WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
     WriteParam(aMsg, aParam.mScrollOffset);
     WriteParam(aMsg, aParam.mZoom);
     WriteParam(aMsg, aParam.mScrollGeneration);
     WriteParam(aMsg, aParam.mDisplayPortMargins);
     WriteParam(aMsg, aParam.mPresShellId);
-    WriteParam(aMsg, aParam.mViewport);
+    WriteParam(aMsg, aParam.mLayoutViewport);
     WriteParam(aMsg, aParam.mExtraResolution);
     WriteParam(aMsg, aParam.mPaintRequestTime);
     WriteParam(aMsg, aParam.mScrollUpdateType);
     WriteParam(aMsg, aParam.mIsRootContent);
     WriteParam(aMsg, aParam.mIsScrollInfoLayer);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter,
@@ -265,17 +265,17 @@ struct ParamTraits<mozilla::layers::Repa
             ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
             ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
             ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
             ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
             ReadParam(aMsg, aIter, &aResult->mZoom) &&
             ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
             ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
             ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
-            ReadParam(aMsg, aIter, &aResult->mViewport) &&
+            ReadParam(aMsg, aIter, &aResult->mLayoutViewport) &&
             ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
             ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
             ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
             ReadBoolForBitfield(aMsg, aIter, aResult,
                                 &paramType::SetIsRootContent) &&
             ReadBoolForBitfield(aMsg, aIter, aResult,
                                 &paramType::SetIsScrollInfoLayer));
   }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8652,17 +8652,17 @@ static void MaybeReflowForInflationScree
     const Maybe<nsRect>& aClipRect, bool aIsRootContent,
     const Maybe<ContainerLayerParameters>& aContainerParameters) {
   nsPresContext* presContext = aForFrame->PresContext();
   int32_t auPerDevPixel = presContext->AppUnitsPerDevPixel();
 
   nsIPresShell* presShell = presContext->GetPresShell();
   ScrollMetadata metadata;
   FrameMetrics& metrics = metadata.GetMetrics();
-  metrics.SetViewport(CSSRect::FromAppUnits(aViewport));
+  metrics.SetLayoutViewport(CSSRect::FromAppUnits(aViewport));
 
   ViewID scrollId = ScrollableLayerGuid::NULL_SCROLL_ID;
   if (aContent) {
     if (void* paintRequestTime =
             aContent->GetProperty(nsGkAtoms::paintRequestTime)) {
       metrics.SetPaintRequestTime(*static_cast<TimeStamp*>(paintRequestTime));
       aContent->DeleteProperty(nsGkAtoms::paintRequestTime);
     }
@@ -8702,19 +8702,19 @@ static void MaybeReflowForInflationScree
   if (scrollableFrame) {
     CSSPoint scrollPosition =
         CSSPoint::FromAppUnits(scrollableFrame->GetScrollPosition());
     CSSPoint apzScrollPosition =
         CSSPoint::FromAppUnits(scrollableFrame->GetApzScrollPosition());
     metrics.SetScrollOffset(scrollPosition);
     metrics.SetBaseScrollOffset(apzScrollPosition);
 
-    CSSRect viewport = metrics.GetViewport();
+    CSSRect viewport = metrics.GetLayoutViewport();
     viewport.MoveTo(scrollPosition);
-    metrics.SetViewport(viewport);
+    metrics.SetLayoutViewport(viewport);
 
     nsPoint smoothScrollPosition = scrollableFrame->LastScrollDestination();
     metrics.SetSmoothScrollOffset(CSSPoint::FromAppUnits(smoothScrollPosition));
 
     // If the frame was scrolled since the last layers update, and by something
     // that is higher priority than APZ, we want to tell the APZ to update
     // its scroll offset. We want to distinguish the case where the scroll
     // offset was "restored" because in that case the restored scroll position