Bug 1532443 - Drop clampScrollPoistion stuff. r=kats
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 04 Mar 2019 22:16:46 +0000
changeset 462795 fb1e1ab7408a17c1fda2dc6283fbbb7c4d1cd88f
parent 462794 989ecfe52f3a7dd426374d71927c10db5b3e37ce
child 462796 238d9fba1b5a62117ddf96bfb020c0743c877ba7
push id79859
push userhikezoe@mozilla.com
push dateThu, 07 Mar 2019 03:18:24 +0000
treeherderautoland@fb1e1ab7408a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1532443, 726817
milestone67.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 1532443 - Drop clampScrollPoistion stuff. r=kats This was introduced in bug 726817 for B2G stuff and there is no call site of SetClampScrollPosition now and the only one entry point to call the function was nsIFrameLoader.clampScrollPosition which was removed in https://hg.mozilla.org/mozilla-central/rev/cd9aace7bb96 . ScrollFrameHelper::ShouldClampScrollPosition() had always returned true in both cases of root and non-root scrollable frames. (In the case of non-root scrollable, nsFrameLoader.mClampScrollPosition is initially set to true and nobody changes the value) Differential Revision: https://phabricator.services.mozilla.com/D22026
dom/base/nsFrameLoader.cpp
dom/base/nsFrameLoader.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsSubDocumentFrame.h
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -175,17 +175,16 @@ nsFrameLoader::nsFrameLoader(Element* aO
       mNeedsAsyncDestroy(false),
       mInSwap(false),
       mInShow(false),
       mHideCalled(false),
       mNetworkCreated(aNetworkCreated),
       mLoadingOriginalSrc(false),
       mRemoteBrowserShown(false),
       mRemoteFrame(false),
-      mClampScrollPosition(true),
       mObservingOwnerContent(false) {
   mRemoteFrame = ShouldUseRemoteProcess();
   MOZ_ASSERT(!mRemoteFrame || !aOpener,
              "Cannot pass aOpener for a remote frame!");
 }
 
 nsFrameLoader::~nsFrameLoader() {
   if (mMessageManager) {
@@ -2364,38 +2363,16 @@ uint32_t nsFrameLoader::LazyHeight() con
   nsIFrame* frame = GetPrimaryFrameOfOwningContent();
   if (frame) {
     lazyHeight = frame->PresContext()->DevPixelsToIntCSSPixels(lazyHeight);
   }
 
   return lazyHeight;
 }
 
-void nsFrameLoader::SetClampScrollPosition(bool aClamp) {
-  mClampScrollPosition = aClamp;
-
-  // When turning clamping on, make sure the current position is clamped.
-  if (aClamp) {
-    nsIFrame* frame = GetPrimaryFrameOfOwningContent();
-    nsSubDocumentFrame* subdocFrame = do_QueryFrame(frame);
-    if (subdocFrame) {
-      nsIFrame* subdocRootFrame = subdocFrame->GetSubdocumentRootFrame();
-      if (subdocRootFrame) {
-        nsIScrollableFrame* subdocRootScrollFrame =
-            subdocRootFrame->PresShell()->GetRootScrollFrameAsScrollable();
-        if (subdocRootScrollFrame) {
-          subdocRootScrollFrame->ScrollTo(
-              subdocRootScrollFrame->GetScrollPosition(),
-              nsIScrollableFrame::INSTANT);
-        }
-      }
-    }
-  }
-}
-
 static Tuple<ContentParent*, TabParent*> GetContentParent(Element* aBrowser) {
   using ReturnTuple = Tuple<ContentParent*, TabParent*>;
 
   nsCOMPtr<nsIBrowser> browser = aBrowser ? aBrowser->AsBrowser() : nullptr;
   if (!browser) {
     return ReturnTuple(nullptr, nullptr);
   }
 
--- a/dom/base/nsFrameLoader.h
+++ b/dom/base/nsFrameLoader.h
@@ -188,19 +188,16 @@ class nsFrameLoader final : public nsStu
   already_AddRefed<Element> GetOwnerElement();
 
   uint32_t LazyWidth() const;
 
   uint32_t LazyHeight() const;
 
   uint64_t ChildID() const { return mChildID; }
 
-  bool ClampScrollPosition() const { return mClampScrollPosition; }
-  void SetClampScrollPosition(bool aClamp);
-
   bool DepthTooGreat() const { return mDepthTooGreat; }
 
   bool IsDead() const { return mDestroyCalled; }
 
   /**
    * Is this a frame loader for a bona fide <iframe mozbrowser>?
    * <xul:browser> is not a mozbrowser, so this is false for that case.
    */
@@ -299,18 +296,16 @@ class nsFrameLoader final : public nsStu
   mozilla::layers::LayersId GetLayersId() const;
 
   mozilla::dom::ChromeMessageSender* GetFrameMessageManager() {
     return mMessageManager;
   }
 
   mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
 
-  bool ShouldClampScrollPosition() { return mClampScrollPosition; }
-
   mozilla::dom::ParentSHistory* GetParentSHistory() { return mParentSHistory; }
 
   /**
    * Tell this FrameLoader to use a particular remote browser.
    *
    * This will assert if mRemoteBrowser is non-null.  In practice,
    * this means you can't have successfully run TryRemoteBrowser() on
    * this object, which means you can't have called ShowRemoteFrame()
@@ -480,17 +475,16 @@ class nsFrameLoader final : public nsStu
   bool mNetworkCreated : 1;
 
   // True if a pending load corresponds to the original src (or srcdoc)
   // attribute of the frame element.
   bool mLoadingOriginalSrc : 1;
 
   bool mRemoteBrowserShown : 1;
   bool mRemoteFrame : 1;
-  bool mClampScrollPosition : 1;
   bool mObservingOwnerContent : 1;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsFrameLoader, NS_FRAMELOADER_IID)
 
 inline nsISupports* ToSupports(nsFrameLoader* aFrameLoader) {
   return aFrameLoader;
 }
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2406,24 +2406,16 @@ void ScrollFrameHelper::MarkScrollbarsDi
                                 NS_FRAME_IS_DIRTY);
   }
   if (mHScrollbarBox) {
     presShell->FrameNeedsReflow(mHScrollbarBox, nsIPresShell::eResize,
                                 NS_FRAME_IS_DIRTY);
   }
 }
 
-bool ScrollFrameHelper::ShouldClampScrollPosition() const {
-  if (!mIsRoot) return true;
-  nsSubDocumentFrame* subdocFrame =
-      static_cast<nsSubDocumentFrame*>(nsLayoutUtils::GetCrossDocParentFrame(
-          mOuter->PresShell()->GetRootFrame()));
-  return !subdocFrame || subdocFrame->ShouldClampScrollPosition();
-}
-
 bool ScrollFrameHelper::IsAlwaysActive() const {
   if (nsDisplayItem::ForceActiveLayers()) {
     return true;
   }
 
   // Unless this is the root scrollframe for a non-chrome document
   // which is the direct child of a chrome document, we default to not
   // being "active".
@@ -4054,20 +4046,16 @@ nsRect ScrollFrameHelper::GetScrollRange
                                          nscoord aHeight) const {
   nsRect range = GetScrolledRect();
   range.width = std::max(range.width - aWidth, 0);
   range.height = std::max(range.height - aHeight, 0);
   return range;
 }
 
 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 visualViewportSize = GetVisualViewportSize();
   return GetScrollRange(visualViewportSize.width, visualViewportSize.height);
 }
 
 nsSize ScrollFrameHelper::GetVisualViewportSize() const {
   nsIPresShell* presShell = mOuter->PresShell();
   if (mIsRoot && presShell->IsVisualViewportSizeSet()) {
     return presShell->GetVisualViewportSize();
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -442,18 +442,16 @@ class ScrollFrameHelper : public nsIRefl
       bool aHasResizer, mozilla::layers::ScrollDirection aDirection);
   // returns true if a resizer should be visible
   bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
   void LayoutScrollbars(nsBoxLayoutState& aState, const nsRect& aContentArea,
                         const nsRect& aOldScrollArea);
 
   void MarkScrollbarsDirtyForReflow() const;
 
-  bool ShouldClampScrollPosition() const;
-
   bool IsAlwaysActive() const;
   void MarkEverScrolled();
   void MarkRecentlyScrolled();
   void MarkNotRecentlyScrolled();
   nsExpirationState* GetExpirationState() { return &mActivityExpirationState; }
 
   void SetTransformingByAPZ(bool aTransforming) {
     if (mTransformingByAPZ && !aTransforming) {
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -96,21 +96,16 @@ class nsSubDocumentFrame final : public 
   enum { IGNORE_PAINT_SUPPRESSION = 0x1 };
   nsIPresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags);
   mozilla::ScreenIntSize GetSubdocumentSize();
 
   // nsIReflowCallback
   bool ReflowFinished() override;
   void ReflowCallbackCanceled() override;
 
-  bool ShouldClampScrollPosition() {
-    nsFrameLoader* frameLoader = FrameLoader();
-    return !frameLoader || frameLoader->ShouldClampScrollPosition();
-  }
-
   /**
    * Return true if pointer event hit-testing should be allowed to target
    * content in the subdocument.
    */
   bool PassPointerEventsToChildren();
 
   void MaybeShowViewer() {
     if (!mDidCreateDoc && !mCallingShow) {