Bug 1471708 - Rename the "scroll-position clamping scroll port size" to "visual viewport size". r=botond
☠☠ backed out by 5c5509a1a351 ☠ ☠
authorJeremy Lempereur <jeremy.lempereur@gmail.com>
Sun, 22 Jul 2018 21:49:38 +0200
changeset 430176 542243f5f600243e088c949e647690c8c46fa5b0
parent 430175 37b33c4f58b9372ad8d4fa969ad7a86ae305790a
child 430177 5c5509a1a351d8ccba033b8702a84e7e2b0dedd8
push id34386
push usernbeleuzu@mozilla.com
push dateSun, 05 Aug 2018 09:43:12 +0000
treeherdermozilla-central@5c5509a1a351 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1471708
milestone63.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 1471708 - Rename the "scroll-position clamping scroll port size" to "visual viewport size". r=botond MozReview-Commit-ID: IWPzXSF5jfR
dom/base/nsDOMWindowUtils.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/test/test_innersize_scrollport.html
dom/events/EventStateManager.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
layout/base/MobileViewportManager.cpp
layout/base/PresShell.cpp
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/generic/ViewportFrame.cpp
layout/generic/ViewportFrame.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsIScrollableFrame.h
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
layout/tools/reftest/reftest-content.js
third_party/webkit/PerformanceTests/Speedometer/index.html
third_party/webkit/PerformanceTests/StyleBench/index.html
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -3235,28 +3235,28 @@ nsDOMWindowUtils::GetPlugins(JSContext* 
   nsresult rv = nsTArrayToJSArray(cx, plugins, &jsPlugins);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aPlugins.setObject(*jsPlugins);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight)
+nsDOMWindowUtils::SetVisualViewportSize(float aWidth, float aHeight)
 {
   if (!(aWidth >= 0.0 && aHeight >= 0.0)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   nsIPresShell* presShell = GetPresShell();
   if (!presShell) {
     return NS_ERROR_FAILURE;
   }
 
-  nsLayoutUtils::SetScrollPositionClampingScrollPortSize(presShell, CSSSize(aWidth, aHeight));
+  nsLayoutUtils::SetVisualViewportSize(presShell, CSSSize(aWidth, aHeight));
 
   return NS_OK;
 }
 
 nsresult
 nsDOMWindowUtils::RemoteFrameFullscreenChanged(Element* aFrameElement)
 {
   nsCOMPtr<nsIDocument> doc = GetDocument();
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -3132,19 +3132,19 @@ nsGlobalWindowOuter::GetInnerSize(CSSInt
   }
 
   /*
    * On platforms with resolution-based zooming, the CSS viewport
    * and visual viewport may not be the same. The inner size should
    * be the visual viewport, but we fall back to the CSS viewport
    * if it is not set.
    */
-  if (presShell->IsScrollPositionClampingScrollPortSizeSet()) {
+  if (presShell->IsVisualViewportSizeSet()) {
     aSize = CSSIntRect::FromAppUnitsRounded(
-      presShell->GetScrollPositionClampingScrollPortSize());
+      presShell->GetVisualViewportSize());
   } else {
     RefPtr<nsViewManager> viewManager = presShell->GetViewManager();
     if (viewManager) {
       viewManager->FlushDelayedResize(false);
     }
 
     aSize = CSSIntRect::FromAppUnitsRounded(
       presContext->GetVisibleArea().Size());
--- a/dom/base/test/test_innersize_scrollport.html
+++ b/dom/base/test/test_innersize_scrollport.html
@@ -18,19 +18,19 @@ SimpleTest.waitForExplicitFinish();
 function run()
 {
   var oldWidth = window.innerWidth;
   var oldHeight = window.innerHeight;
   var newWidth = oldWidth / 2;
   var newHeight = oldHeight / 2;
 
   var utils = SpecialPowers.getDOMWindowUtils(window);
-  utils.setScrollPositionClampingScrollPortSize(newWidth, newHeight);
-  is(window.innerWidth, newWidth, "innerWidth not updated to scroll port width");
-  is(window.innerHeight, newHeight, "innerHeight not updated to scroll port height");
+  utils.setVisualViewportSize(newWidth, newHeight);
+  is(window.innerWidth, newWidth, "innerWidth not updated to viewport width");
+  is(window.innerHeight, newHeight, "innerHeight not updated to viewport height");
 
   var innerWidthGetter = Object.getOwnPropertyDescriptor(window, "innerWidth").get;
   var innerHeightGetter = Object.getOwnPropertyDescriptor(window, "innerHeight").get;
 
   window.innerWidth = oldWidth;
   window.innerHeight = oldHeight;
   is(window.innerWidth, oldWidth, "Should have redefined innerWidth");
   is(window.innerHeight, oldHeight, "Should have redefined innerWidth");
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2748,17 +2748,17 @@ EventStateManager::GetScrollAmount(nsPre
   MOZ_ASSERT(aEvent);
 
   bool isPage = (aEvent->mDeltaMode == WheelEvent_Binding::DOM_DELTA_PAGE);
   if (aScrollableFrame) {
     return isPage ? aScrollableFrame->GetPageScrollAmount() :
                     aScrollableFrame->GetLineScrollAmount();
   }
 
-  // If there is no scrollable frame and page scrolling, use view port size.
+  // If there is no scrollable frame and page scrolling, use viewport size.
   if (isPage) {
     return aPresContext->GetVisibleArea().Size();
   }
 
   // If there is no scrollable frame, we should use root frame's information.
   nsIFrame* rootFrame = aPresContext->PresShell()->GetRootFrame();
   if (!rootFrame) {
     return nsSize(0, 0);
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1586,22 +1586,22 @@ interface nsIDOMWindowUtils : nsISupport
    * Cannot be accessed from unprivileged context (not content-accessible).
    * Will throw a DOM security error if called without chrome privileges.
    *
    */
   [implicit_jscontext]
   readonly attribute jsval plugins;
 
   /**
-   * Set the scrollport size for the purposes of clamping scroll positions for
+   * Set the viewport size for the purposes of clamping scroll positions for
    * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels.
    *
    * The caller of this method must have chrome privileges.
    */
-  void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight);
+  void setVisualViewportSize(in float aWidth, in float aHeight);
 
   /**
    * These are used to control whether dialogs (alert, prompt, confirm) are
    * allowed.
    */
   void disableDialogs();
   void enableDialogs();
   bool areDialogsEnabled();
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -296,18 +296,18 @@ MobileViewportManager::UpdateSPCSPS(cons
       mPresShell->GetPresContext()->AppUnitsPerDevPixel())
     // Scrollbars are not subject to resolution scaling, so LD pixels =
     // Screen pixels for them.
     * LayoutDeviceToScreenScale(1.0f);
 
   compositionSize.width -= scrollbars.LeftRight();
   compositionSize.height -= scrollbars.TopBottom();
   CSSSize compSize = compositionSize / aZoom;
-  MVM_LOG("%p: Setting SPCSPS %s\n", this, Stringify(compSize).c_str());
-  nsLayoutUtils::SetScrollPositionClampingScrollPortSize(mPresShell, compSize);
+  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() &&
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -772,17 +772,17 @@ nsIPresShell::nsIPresShell()
     , mIsObservingDocument(false)
     , mIsDocumentGone(false)
     , mPaintingSuppressed(false)
     , mIsActive(false)
     , mFrozen(false)
     , mIsFirstPaint(false)
     , mObservesMutationsForPrint(false)
     , mWasLastReflowInterrupted(false)
-    , mScrollPositionClampingScrollPortSizeSet(false)
+    , mVisualViewportSizeSet(false)
     , mNeedLayoutFlush(true)
     , mNeedStyleFlush(true)
     , mObservingStyleFlushes(false)
     , mObservingLayoutFlushes(false)
     , mResizeEventPending(false)
     , mNeedThrottledAnimationFlush(true)
     , mPresShellId(0)
     , mFontSizeInflationEmPerLine(0)
@@ -845,17 +845,17 @@ PresShell::PresShell()
   mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
   mIsActive = true;
   // FIXME/bug 735029: find a better solution to this problem
   mIsFirstPaint = true;
   mPresShellId = sNextPresShellId++;
   mFrozen = false;
   mRenderFlags = 0;
 
-  mScrollPositionClampingScrollPortSizeSet = false;
+  mVisualViewportSizeSet = false;
 
   static bool addedSynthMouseMove = false;
   if (!addedSynthMouseMove) {
     Preferences::AddBoolVarCache(&sSynthMouseMove,
                                  "layout.reflow.synthMouseMove", true);
     addedSynthMouseMove = true;
   }
   PointerEventHandler::Initialize();
@@ -3440,17 +3440,17 @@ ComputeWhereToScroll(int16_t aWhereToScr
 static void ScrollToShowRect(nsIScrollableFrame*      aFrameAsScrollable,
                              const nsRect&            aRect,
                              nsIPresShell::ScrollAxis aVertical,
                              nsIPresShell::ScrollAxis aHorizontal,
                              uint32_t                 aFlags)
 {
   nsPoint scrollPt = aFrameAsScrollable->GetScrollPosition();
   nsRect visibleRect(scrollPt,
-                     aFrameAsScrollable->GetScrollPositionClampingScrollPortSize());
+                     aFrameAsScrollable->GetVisualViewportSize());
 
   nsSize lineSize;
   // Don't call GetLineScrollAmount unless we actually need it. Not only
   // does this save time, but it's not safe to call GetLineScrollAmount
   // during reflow (because it depends on font size inflation and doesn't
   // use the in-reflow-safe font-size inflation path). If we did call it,
   // it would assert and possible give the wrong result.
   if (aVertical.mWhenToScroll == nsIPresShell::SCROLL_IF_NOT_VISIBLE ||
@@ -10585,24 +10585,24 @@ nsIPresShell::MarkFixedFramesForReflow(I
     const nsFrameList& childList = rootFrame->GetChildList(nsIFrame::kFixedList);
     for (nsIFrame* childFrame : childList) {
       FrameNeedsReflow(childFrame, aIntrinsicDirty, NS_FRAME_IS_DIRTY);
     }
   }
 }
 
 void
-nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight)
-{
-  if (!mScrollPositionClampingScrollPortSizeSet ||
-      mScrollPositionClampingScrollPortSize.width != aWidth ||
-      mScrollPositionClampingScrollPortSize.height != aHeight) {
-    mScrollPositionClampingScrollPortSizeSet = true;
-    mScrollPositionClampingScrollPortSize.width = aWidth;
-    mScrollPositionClampingScrollPortSize.height = aHeight;
+nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight)
+{
+  if (!mVisualViewportSizeSet ||
+      mVisualViewportSize.width != aWidth ||
+      mVisualViewportSize.height != aHeight) {
+    mVisualViewportSizeSet = true;
+    mVisualViewportSize.width = aWidth;
+    mVisualViewportSize.height = aHeight;
 
     if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
       rootScrollFrame->MarkScrollbarsDirtyForReflow();
     }
     MarkFixedFramesForReflow(nsIPresShell::eResize);
   }
 }
 
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1655,23 +1655,23 @@ public:
 
   virtual bool AddPostRefreshObserver(nsAPostRefreshObserver* aObserver);
   virtual bool RemovePostRefreshObserver(nsAPostRefreshObserver* aObserver);
 
   // If a frame in the subtree rooted at aFrame is capturing the mouse then
   // clears that capture.
   static void ClearMouseCapture(nsIFrame* aFrame);
 
-  void SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight);
-  bool IsScrollPositionClampingScrollPortSizeSet() {
-    return mScrollPositionClampingScrollPortSizeSet;
+  void SetVisualViewportSize(nscoord aWidth, nscoord aHeight);
+  bool IsVisualViewportSizeSet() {
+    return mVisualViewportSizeSet;
   }
-  nsSize GetScrollPositionClampingScrollPortSize() {
-    NS_ASSERTION(mScrollPositionClampingScrollPortSizeSet, "asking for scroll port when its not set?");
-    return mScrollPositionClampingScrollPortSize;
+  nsSize GetVisualViewportSize() {
+    NS_ASSERTION(mVisualViewportSizeSet, "asking for visual viewport size when its not set?");
+    return mVisualViewportSize;
   }
 
   void SetVisualViewportOffset(const nsPoint& aScrollOffset) {
     mVisualViewportOffset = aScrollOffset;
   }
 
   nsPoint GetVisualViewportOffset() const {
     return mVisualViewportOffset;
@@ -1748,17 +1748,17 @@ protected:
   // We track allocated pointers in a debug-only hashtable to assert against
   // missing/double frees.
   nsTHashtable<nsPtrHashKey<void>> mAllocatedPointers;
 #endif
 
   // Count of the number of times this presshell has been painted to a window.
   uint64_t                  mPaintCount;
 
-  nsSize                    mScrollPositionClampingScrollPortSize;
+  nsSize                    mVisualViewportSize;
 
   nsPoint                   mVisualViewportOffset;
 
   // A list of stack weak frames. This is a pointer to the last item in the list.
   AutoWeakFrame*            mAutoWeakFrames;
 
   // A hash table of heap allocated weak frames.
   nsTHashtable<nsPtrHashKey<WeakFrame>> mWeakFrames;
@@ -1808,17 +1808,17 @@ protected:
 
   bool                      mIsActive : 1;
   bool                      mFrozen : 1;
   bool                      mIsFirstPaint : 1;
   bool                      mObservesMutationsForPrint : 1;
 
   // Whether the most recent interruptible reflow was actually interrupted:
   bool                      mWasLastReflowInterrupted : 1;
-  bool                      mScrollPositionClampingScrollPortSizeSet : 1;
+  bool                      mVisualViewportSizeSet : 1;
 
   // True if a layout flush might not be a no-op
   bool mNeedLayoutFlush : 1;
 
   // True if a style flush might not be a no-op
   bool mNeedStyleFlush : 1;
 
   // True if we're observing the refresh driver for style flushes.
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -9035,21 +9035,21 @@ MaybeReflowForInflationScreenSizeChange(
           }
         }
       }
     }
   }
 }
 
 /* static */ void
-nsLayoutUtils::SetScrollPositionClampingScrollPortSize(nsIPresShell* aPresShell, CSSSize aSize)
+nsLayoutUtils::SetVisualViewportSize(nsIPresShell* aPresShell, CSSSize aSize)
 {
   MOZ_ASSERT(aSize.width >= 0.0 && aSize.height >= 0.0);
 
-  aPresShell->SetScrollPositionClampingScrollPortSize(
+  aPresShell->SetVisualViewportSize(
     nsPresContext::CSSPixelsToAppUnits(aSize.width),
     nsPresContext::CSSPixelsToAppUnits(aSize.height));
 
   // When the "font.size.inflation.minTwips" preference is set, the
   // layout depends on the size of the screen.  Since when the size
   // of the screen changes, the scroll position clamping scroll port
   // size also changes, we hook in the needed updates here rather
   // than adding a separate notification just for this change.
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2847,21 +2847,21 @@ public:
                                       mozilla::ReflowOutput& aMetrics,
                                       const mozilla::LogicalMargin& aFramePadding,
                                       mozilla::WritingMode aLineWM,
                                       mozilla::WritingMode aFrameWM);
 
   static bool HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell);
 
   /**
-   * Set the scroll port size for the purpose of clamping the scroll position
+   * Set the viewport size for the purpose of clamping the scroll position
    * for the root scroll frame of this document
-   * (see nsIDOMWindowUtils.setScrollPositionClampingScrollPortSize).
+   * (see nsIDOMWindowUtils.setVisualViewportSize).
    */
-  static void SetScrollPositionClampingScrollPortSize(nsIPresShell* aPresShell,
+  static void SetVisualViewportSize(nsIPresShell* aPresShell,
                                                       CSSSize aSize);
 
   /**
    * Returns true if the given scroll origin is "higher priority" than APZ.
    * In general any content programmatic scrolls (e.g. scrollTo calls) are
    * higher priority, and take precedence over APZ scrolling. This function
    * returns true for those, and returns false for other origins like APZ
    * itself, or scroll position updates from the history restore code.
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -276,22 +276,22 @@ ViewportFrame::AdjustReflowInputAsContai
 #endif
     AdjustReflowInputForScrollbars(aReflowInput);
 
   NS_ASSERTION(GetAbsoluteContainingBlock()->GetChildList().IsEmpty() ||
                (offset.x == 0 && offset.y == 0),
                "We don't handle correct positioning of fixed frames with "
                "scrollbars in odd positions");
 
-  // If a scroll position clamping scroll-port size has been set, layout
+  // If a scroll position clamping viewport size has been set, layout
   // fixed position elements to this size instead of the computed size.
   nsRect rect(0, 0, aReflowInput->ComputedWidth(), aReflowInput->ComputedHeight());
   nsIPresShell* ps = PresShell();
-  if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
-    rect.SizeTo(ps->GetScrollPositionClampingScrollPortSize());
+  if (ps->IsVisualViewportSizeSet()) {
+    rect.SizeTo(ps->GetVisualViewportSize());
   }
 
   return rect;
 }
 
 void
 ViewportFrame::Reflow(nsPresContext*           aPresContext,
                       ReflowOutput&     aDesiredSize,
--- a/layout/generic/ViewportFrame.h
+++ b/layout/generic/ViewportFrame.h
@@ -63,17 +63,17 @@ public:
                       ReflowOutput& aDesiredSize,
                       const ReflowInput& aReflowInput,
                       nsReflowStatus& aStatus) override;
 
   virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
 
   /**
    * Adjust aReflowInput to account for scrollbars and pres shell
-   * GetScrollPositionClampingScrollPortSizeSet and
+   * GetVisualViewportSizeSet and
    * GetContentDocumentFixedPositionMargins adjustments.
    * @return the rect to use as containing block rect
    */
   nsRect AdjustReflowInputAsContainingBlock(ReflowInput* aReflowInput) const;
 
   /**
    * Update our style (and recursively the styles of any anonymous boxes we
    * might own)
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -376,96 +376,95 @@ nsHTMLScrollFrame::TryLayout(ScrollReflo
   // XXXldb Can we depend more on ComputeSize here?
   nsSize desiredInsideBorderSize;
   desiredInsideBorderSize.width = vScrollbarDesiredWidth +
     std::max(aKidMetrics->Width(), hScrollbarMinWidth);
   desiredInsideBorderSize.height = hScrollbarDesiredHeight +
     std::max(aKidMetrics->Height(), vScrollbarMinHeight);
   aState->mInsideBorderSize =
     ComputeInsideBorderSize(aState, desiredInsideBorderSize);
-  nsSize scrollPortSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
+  nsSize visualViewportSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
                                  std::max(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
 
-  nsSize visualScrollPortSize = scrollPortSize;
   nsIPresShell* presShell = PresShell();
-  if (mHelper.mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) {
+  if (mHelper.mIsRoot && presShell->IsVisualViewportSizeSet()) {
     nsSize compositionSize = nsLayoutUtils::CalculateCompositionSizeForFrame(this, false);
     float resolution = presShell->GetResolution();
     compositionSize.width /= resolution;
     compositionSize.height /= resolution;
-    visualScrollPortSize = nsSize(std::max(0, compositionSize.width - vScrollbarDesiredWidth),
+    visualViewportSize = nsSize(std::max(0, compositionSize.width - vScrollbarDesiredWidth),
                                   std::max(0, compositionSize.height - hScrollbarDesiredHeight));
   }
 
   nsRect scrolledRect =
     mHelper.GetUnsnappedScrolledRectInternal(aState->mContentsOverflowAreas.ScrollableOverflow(),
-                                             scrollPortSize);
+                                             visualViewportSize);
   nscoord oneDevPixel = aState->mBoxState.PresContext()->DevPixelsToAppUnits(1);
 
   if (!aForce) {
     // If the style is HIDDEN then we already know that aAssumeHScroll is false
     if (aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
       bool wantHScrollbar =
         aState->mStyles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
-        scrolledRect.XMost() >= visualScrollPortSize.width + oneDevPixel ||
+        scrolledRect.XMost() >= visualViewportSize.width + oneDevPixel ||
         scrolledRect.x <= -oneDevPixel;
-      if (scrollPortSize.width < hScrollbarMinSize.width)
+      if (visualViewportSize.width < hScrollbarMinSize.width)
         wantHScrollbar = false;
       if (wantHScrollbar != aAssumeHScroll)
         return false;
     }
 
     // If the style is HIDDEN then we already know that aAssumeVScroll is false
     if (aState->mStyles.mVertical != NS_STYLE_OVERFLOW_HIDDEN) {
       bool wantVScrollbar =
         aState->mStyles.mVertical == NS_STYLE_OVERFLOW_SCROLL ||
-        scrolledRect.YMost() >= visualScrollPortSize.height + oneDevPixel ||
+        scrolledRect.YMost() >= visualViewportSize.height + oneDevPixel ||
         scrolledRect.y <= -oneDevPixel;
-      if (scrollPortSize.height < vScrollbarMinSize.height)
+      if (visualViewportSize.height < vScrollbarMinSize.height)
         wantVScrollbar = false;
       if (wantVScrollbar != aAssumeVScroll)
         return false;
     }
   }
 
   do {
     if (!mHelper.mIsRoot) {
       break;
     }
     // Check whether there is actually any overflow.
     nscoord scrolledWidth = scrolledRect.width + oneDevPixel;
-    if (scrolledWidth <= scrollPortSize.width) {
+    if (scrolledWidth <= visualViewportSize.width) {
       break;
     }
     // Viewport scrollbar style is used below instead of aState->mStyles
     // because the latter can be affected by various factors, while we
     // only care about what the page itself specifies.
     nsPresContext* pc = PresContext();
     ScrollStyles styles = pc->GetViewportScrollStylesOverride();
     if (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
       break;
     }
     // Only top level content document is considered.
     nsIDocument* doc = pc->Document();
     if (!doc->IsTopLevelContentDocument()) {
       break;
     }
-    doc->UpdateViewportOverflowType(scrolledWidth, scrollPortSize.width);
+    doc->UpdateViewportOverflowType(scrolledWidth, visualViewportSize.width);
   } while (false);
 
-  nscoord vScrollbarActualWidth = aState->mInsideBorderSize.width - scrollPortSize.width;
+  nscoord vScrollbarActualWidth = aState->mInsideBorderSize.width - visualViewportSize.width;
 
   aState->mShowHScrollbar = aAssumeHScroll;
   aState->mShowVScrollbar = aAssumeVScroll;
   nsPoint scrollPortOrigin(aState->mComputedBorder.left,
                            aState->mComputedBorder.top);
   if (!IsScrollbarOnRight()) {
     scrollPortOrigin.x += vScrollbarActualWidth;
   }
-  mHelper.mScrollPort = nsRect(scrollPortOrigin, scrollPortSize);
+  mHelper.mScrollPort = nsRect(scrollPortOrigin, visualViewportSize);
   return true;
 }
 
 // XXX Height/BSize mismatch needs to be addressed here; check the caller!
 // Currently this will only behave as expected for horizontal writing modes.
 // (See bug 1175509.)
 bool
 nsHTMLScrollFrame::ScrolledContentDependsOnHeight(ScrollReflowInput* aState)
@@ -2855,20 +2854,20 @@ ScrollFrameHelper::ScrollToImpl(nsPoint 
   if (pt == curPos) {
     return;
   }
 
   bool needFrameVisibilityUpdate = mLastUpdateFramesPos == nsPoint(-1,-1);
 
   nsPoint dist(std::abs(pt.x - mLastUpdateFramesPos.x),
                std::abs(pt.y - mLastUpdateFramesPos.y));
-  nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
-  nscoord horzAllowance = std::max(scrollPortSize.width / std::max(sHorzScrollFraction, 1),
+  nsSize visualViewportSize = GetVisualViewportSize();
+  nscoord horzAllowance = std::max(visualViewportSize.width / std::max(sHorzScrollFraction, 1),
                                    nsPresContext::AppUnitsPerCSSPixel());
-  nscoord vertAllowance = std::max(scrollPortSize.height / std::max(sVertScrollFraction, 1),
+  nscoord vertAllowance = std::max(visualViewportSize.height / std::max(sVertScrollFraction, 1),
                                    nsPresContext::AppUnitsPerCSSPixel());
   if (dist.x >= horzAllowance || dist.y >= vertAllowance) {
     needFrameVisibilityUpdate = true;
   }
 
   // notify the listeners.
   for (uint32_t i = 0; i < mListeners.Length(); i++) {
     mListeners[i]->ScrollPositionWillChange(pt.x, pt.y);
@@ -3486,17 +3485,17 @@ ScrollFrameHelper::BuildDisplayList(nsDi
   // in the tree.
   // Note that this does not apply for overlay scrollbars; those are drawn
   // in the positioned-elements layer on top of everything else by the call
   // to AppendScrollPartsTo(..., true) further down.
   AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, false);
 
   const nsStyleDisplay* disp = mOuter->StyleDisplay();
   if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL)) {
-    aBuilder->AddToWillChangeBudget(mOuter, GetScrollPositionClampingScrollPortSize());
+    aBuilder->AddToWillChangeBudget(mOuter, GetVisualViewportSize());
   }
 
   mScrollParentID = aBuilder->GetCurrentScrollParentId();
 
   Maybe<nsRect> contentBoxClip;
   Maybe<const DisplayItemClipChain*> extraContentBoxClipForNonCaretContent;
   if (MOZ_UNLIKELY(disp->mOverflowClipBoxBlock ==
                      NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX ||
@@ -4051,26 +4050,26 @@ ScrollFrameHelper::GetScrollRange(nscoor
 
 nsRect
 ScrollFrameHelper::GetScrollRangeForClamping() const
 {
   if (!ShouldClampScrollPosition()) {
     return nsRect(nscoord_MIN/2, nscoord_MIN/2,
                   nscoord_MAX - nscoord_MIN/2, nscoord_MAX - nscoord_MIN/2);
   }
-  nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
-  return GetScrollRange(scrollPortSize.width, scrollPortSize.height);
+  nsSize visualViewportSize = GetVisualViewportSize();
+  return GetScrollRange(visualViewportSize.width, visualViewportSize.height);
 }
 
 nsSize
-ScrollFrameHelper::GetScrollPositionClampingScrollPortSize() const
+ScrollFrameHelper::GetVisualViewportSize() const
 {
   nsIPresShell* presShell = mOuter->PresShell();
-  if (mIsRoot && presShell->IsScrollPositionClampingScrollPortSizeSet()) {
-    return presShell->GetScrollPositionClampingScrollPortSize();
+  if (mIsRoot && presShell->IsVisualViewportSizeSet()) {
+    return presShell->GetVisualViewportSize();
   }
   return mScrollPort.Size();
 }
 
 static void
 AdjustForWholeDelta(int32_t aDelta, nscoord* aCoord)
 {
   if (aDelta < 0) {
@@ -5291,17 +5290,17 @@ ScrollFrameHelper::IsMaybeScrollingActiv
          nsContentUtils::HasScrollgrab(content);
 }
 
 bool
 ScrollFrameHelper::IsScrollingActive(nsDisplayListBuilder* aBuilder) const
 {
   const nsStyleDisplay* disp = mOuter->StyleDisplay();
   if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL) &&
-    aBuilder->IsInWillChangeBudget(mOuter, GetScrollPositionClampingScrollPortSize())) {
+    aBuilder->IsInWillChangeBudget(mOuter, GetVisualViewportSize())) {
     return true;
   }
 
   nsIContent* content = mOuter->GetContent();
   return mHasBeenScrolledRecently ||
          IsAlwaysActive() ||
          nsLayoutUtils::HasDisplayPort(content) ||
          nsContentUtils::HasScrollgrab(content);
@@ -5599,17 +5598,17 @@ ScrollFrameHelper::ReflowFinished()
       // force a reflow of the fixed child
       presContext->PresShell()->
         FrameNeedsReflow(fixedChild, nsIPresShell::eResize,
                          NS_FRAME_HAS_DIRTY_CHILDREN);
     }
   }
 
   nsRect scrolledContentRect = GetScrolledRect();
-  nsSize scrollClampingScrollPort = GetScrollPositionClampingScrollPortSize();
+  nsSize scrollClampingScrollPort = GetVisualViewportSize();
   nscoord minX = scrolledContentRect.x;
   nscoord maxX = scrolledContentRect.XMost() - scrollClampingScrollPort.width;
   nscoord minY = scrolledContentRect.y;
   nscoord maxY = scrolledContentRect.YMost() - scrollClampingScrollPort.height;
 
   // Suppress handling of the curpos attribute changes we make here.
   NS_ASSERTION(!mFrameIsUpdatingScrollbar, "We shouldn't be reentering here");
   mFrameIsUpdatingScrollbar = true;
@@ -5819,22 +5818,22 @@ ScrollFrameHelper::LayoutScrollbars(nsBo
                "This should have been suppressed");
 
   nsIPresShell* presShell = mOuter->PresShell();
 
   bool hasResizer = HasResizer();
   bool scrollbarOnLeft = !IsScrollbarOnRight();
   bool overlayScrollBarsWithZoom =
     mIsRoot && LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) &&
-    presShell->IsScrollPositionClampingScrollPortSizeSet();
+    presShell->IsVisualViewportSizeSet();
 
   nsSize scrollPortClampingSize = mScrollPort.Size();
   double res = 1.0;
   if (overlayScrollBarsWithZoom) {
-    scrollPortClampingSize = presShell->GetScrollPositionClampingScrollPortSize();
+    scrollPortClampingSize = presShell->GetVisualViewportSize();
     res = presShell->GetCumulativeResolution();
   }
 
   // place the scrollcorner
   if (mScrollCornerBox || mResizerBox) {
     MOZ_ASSERT(!mScrollCornerBox || mScrollCornerBox->IsXULBoxFrame(), "Must be a box frame!");
 
     nsRect r(0, 0, 0, 0);
@@ -6104,21 +6103,21 @@ ScrollFrameHelper::GetScrolledRect() con
     // The edges that we would snap are already aligned with the scroll port,
     // so we can skip all the work below.
     return result;
   }
 
   // For that, we first convert the scroll port and the scrolled rect to rects
   // relative to the reference frame, since that's the space where painting does
   // snapping.
-  nsSize scrollPortSize = GetScrollPositionClampingScrollPortSize();
+  nsSize visualViewportSize = GetVisualViewportSize();
   const nsIFrame* referenceFrame =
     mReferenceFrameDuringPainting ? mReferenceFrameDuringPainting : nsLayoutUtils::GetReferenceFrame(mOuter);
   nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(referenceFrame);
-  nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame, scrollPortSize);
+  nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame, visualViewportSize);
   nsRect scrolledRect = result + scrollPort.TopLeft();
 
   if (scrollPort.Overflows() || scrolledRect.Overflows()) {
     return result;
   }
 
   // Now, snap the bottom right corner of both of these rects.
   // We snap to layer pixels, so we need to respect the layer's scale.
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -209,19 +209,19 @@ public:
     nsPoint pt;
     pt.x = IsPhysicalLTR() ?
       mScrollPort.x - mScrolledFrame->GetPosition().x :
       mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
     pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
     return pt;
   }
   nsRect GetScrollRange() const;
-  // Get the scroll range assuming the scrollport has size (aWidth, aHeight).
+  // Get the scroll range assuming the viewport has size (aWidth, aHeight).
   nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
-  nsSize GetScrollPositionClampingScrollPortSize() const;
+  nsSize GetVisualViewportSize() const;
   void ScrollSnap(nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
   void ScrollSnap(const nsPoint &aDestination,
                   nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
 
 protected:
   nsRect GetScrollRangeForClamping() const;
 
 public:
@@ -847,18 +847,18 @@ public:
     return mHelper.GetScrollPosition();
   }
   virtual nsPoint GetLogicalScrollPosition() const override {
     return mHelper.GetLogicalScrollPosition();
   }
   virtual nsRect GetScrollRange() const override {
     return mHelper.GetScrollRange();
   }
-  virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
-    return mHelper.GetScrollPositionClampingScrollPortSize();
+  virtual nsSize GetVisualViewportSize() const override {
+    return mHelper.GetVisualViewportSize();
   }
   virtual nsSize GetLineScrollAmount() const override {
     return mHelper.GetLineScrollAmount();
   }
   virtual nsSize GetPageScrollAmount() const override {
     return mHelper.GetPageScrollAmount();
   }
   /**
@@ -1299,18 +1299,18 @@ public:
     return mHelper.GetScrollPosition();
   }
   virtual nsPoint GetLogicalScrollPosition() const override {
     return mHelper.GetLogicalScrollPosition();
   }
   virtual nsRect GetScrollRange() const override {
     return mHelper.GetScrollRange();
   }
-  virtual nsSize GetScrollPositionClampingScrollPortSize() const override {
-    return mHelper.GetScrollPositionClampingScrollPortSize();
+  virtual nsSize GetVisualViewportSize() const override {
+    return mHelper.GetVisualViewportSize();
   }
   virtual nsSize GetLineScrollAmount() const override {
     return mHelper.GetLineScrollAmount();
   }
   virtual nsSize GetPageScrollAmount() const override {
     return mHelper.GetPageScrollAmount();
   }
   /**
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -143,20 +143,20 @@ public:
    * (but not always, e.g. for RTL content) x and y will be 0, and
    * width or height will be nonzero if the content can be scrolled in
    * that direction. Since scroll positions must be a multiple of
    * device pixels, the range extrema will also be a multiple of
    * device pixels.
    */
   virtual nsRect GetScrollRange() const = 0;
   /**
-   * Get the size of the scroll port to use when clamping the scroll
+   * Get the size of the view port to use when clamping the scroll
    * position.
    */
-  virtual nsSize GetScrollPositionClampingScrollPortSize() const = 0;
+  virtual nsSize GetVisualViewportSize() const = 0;
   /**
    * Return how much we would try to scroll by in each direction if
    * asked to scroll by one "line" vertically and horizontally.
    */
   virtual nsSize GetLineScrollAmount() const = 0;
   /**
    * Return how much we would try to scroll by in each direction if
    * asked to scroll by one "page" vertically and horizontally.
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -7012,18 +7012,18 @@ nsDisplayFixedPosition::BuildLayer(nsDis
 
   const nsIFrame* viewportFrame = fixedFrame->GetParent();
   // anchorRect will be in the container's coordinate system (aLayer's parent layer).
   // This is the same as the display items' reference frame.
   nsRect anchorRect;
   if (viewportFrame) {
     // Fixed position frames are reflowed into the scroll-port size if one has
     // been set.
-    if (presContext->PresShell()->IsScrollPositionClampingScrollPortSizeSet()) {
-      anchorRect.SizeTo(presContext->PresShell()->GetScrollPositionClampingScrollPortSize());
+    if (presContext->PresShell()->IsVisualViewportSizeSet()) {
+      anchorRect.SizeTo(presContext->PresShell()->GetVisualViewportSize());
     } else {
       anchorRect.SizeTo(viewportFrame->GetSize());
     }
   } else {
     // A display item directly attached to the viewport.
     // For background-attachment:fixed items, the anchor point is always the
     // top-left of the viewport currently.
     viewportFrame = fixedFrame;
@@ -7188,19 +7188,19 @@ nsDisplayStickyPosition::BuildLayer(nsDi
 
   nsIFrame* scrollFrame = do_QueryFrame(stickyScrollContainer->ScrollFrame());
   nsPresContext* presContext = scrollFrame->PresContext();
 
   // Sticky position frames whose scroll frame is the root scroll frame are
   // reflowed into the scroll-port size if one has been set.
   nsSize scrollFrameSize = scrollFrame->GetSize();
   if (scrollFrame == presContext->PresShell()->GetRootScrollFrame() &&
-      presContext->PresShell()->IsScrollPositionClampingScrollPortSizeSet()) {
+      presContext->PresShell()->IsVisualViewportSizeSet()) {
     scrollFrameSize = presContext->PresShell()->
-      GetScrollPositionClampingScrollPortSize();
+      GetVisualViewportSize();
   }
 
   nsLayoutUtils::SetFixedPositionLayerData(layer, scrollFrame,
     nsRect(scrollFrame->GetOffsetToCrossDoc(ReferenceFrame()), scrollFrameSize),
     mFrame, presContext, aContainerParameters);
 
   ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor(
     stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent());
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1460,22 +1460,21 @@ public:
                                              const nsRect& aDirtyRect,
                                              nsRect* aOutDirtyRect) {
       nsRect visible = aVisibleRect;
       nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
 
       if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
           aBuilder->IsPaintingToWindow()) {
         // position: fixed items are reflowed into and only drawn inside the
-        // viewport, or the scroll position clamping scrollport size, if one is
-        // set.
+        // viewport, or the visual viewport size, if one is set.
         nsIPresShell* ps = aFrame->PresShell();
-        if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
+        if (ps->IsVisualViewportSizeSet()) {
           dirtyRectRelativeToDirtyFrame =
-            nsRect(nsPoint(0, 0), ps->GetScrollPositionClampingScrollPortSize());
+            nsRect(nsPoint(0, 0), ps->GetVisualViewportSize());
           visible = dirtyRectRelativeToDirtyFrame;
 #ifdef MOZ_WIDGET_ANDROID
         } else {
           dirtyRectRelativeToDirtyFrame =
             nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
           visible = dirtyRectRelativeToDirtyFrame;
 #endif
         }
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -287,18 +287,18 @@ function attrOrDefault(element, attr, de
 function setupViewport(contentRootElement) {
     if (!contentRootElement) {
         return;
     }
 
     var sw = attrOrDefault(contentRootElement, "reftest-scrollport-w", 0);
     var sh = attrOrDefault(contentRootElement, "reftest-scrollport-h", 0);
     if (sw !== 0 || sh !== 0) {
-        LogInfo("Setting scrollport to <w=" + sw + ", h=" + sh + ">");
-        windowUtils().setScrollPositionClampingScrollPortSize(sw, sh);
+        LogInfo("Setting viewport to <w=" + sw + ", h=" + sh + ">");
+        windowUtils().setVisualViewportSize(sw, sh);
     }
 
     // XXX support resolution when needed
 
     // XXX support viewconfig when needed
 }
  
 function setupDisplayport(contentRootElement) {
--- a/third_party/webkit/PerformanceTests/Speedometer/index.html
+++ b/third_party/webkit/PerformanceTests/Speedometer/index.html
@@ -15,17 +15,17 @@
     <a id="logo-link" href="javascript:showHome()"><img id="logo" src="resources/logo.png"></a>
 
     <section id="home" class="selected">
         <p>
             Speedometer is a browser benchmark that measures the responsiveness of Web applications.
             It uses demo web applications to simulate user actions such as adding to-do items.
         </p>
         <p id="screen-size-warning"><strong>
-            Your browser window is too small. For most accurate results, please make the view port size at least 850px by 650px.<br>
+            Your browser window is too small. For most accurate results, please make the viewport size at least 850px by 650px.<br>
             It's currently <span id="screen-size"></span>.
         </strong></p>
         <div class="buttons">
             <button onclick="startTest()">Start Test</button>
         </div>
         <p class="show-about"><a href="javascript:showAbout()">About Speedometer</a></p>
     </section>
 
--- a/third_party/webkit/PerformanceTests/StyleBench/index.html
+++ b/third_party/webkit/PerformanceTests/StyleBench/index.html
@@ -24,17 +24,17 @@
 <main>
     <a id="logo-link" href="javascript:showHome()"></a>
 
     <section id="home" class="selected">
         <p>
             StyleBench is a browser benchmark that measures the performance of the style resolution mechanism.
         </p>
         <p id="screen-size-warning"><strong>
-            Your browser window is too small. For most accurate results, please make the view port size at least 850px by 650px.<br>
+            Your browser window is too small. For most accurate results, please make the viewport size at least 850px by 650px.<br>
             It's currently <span id="screen-size"></span>.
         </strong>
         <div class="buttons">
             <button onclick="startTest()">Start Test</button>
         </div>
         <p class="show-about"><a href="javascript:showAbout()">About StyleBench</a></p>
     </section>