Bug 1543315 - part 12: Mark nsIPresShell::DoScrollContentIntoView() as MOZ_CAN_RUN_SCRIPT r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 23 Apr 2019 01:34:26 +0000
changeset 470448 7b69b606bb29b260d42eea8365ddae86207324b7
parent 470447 7d67598c90435110cb0ee046e14750306f1d32f6
child 470449 f841c2ff2efd0a4835f71df5f4b6ddc84b6c1b40
push id35906
push useraciure@mozilla.com
push dateTue, 23 Apr 2019 22:14:56 +0000
treeherdermozilla-central@0ce3633f8b80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1543315
milestone68.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 1543315 - part 12: Mark nsIPresShell::DoScrollContentIntoView() as MOZ_CAN_RUN_SCRIPT r=smaug Now, we can mark `DoScrollContentIntoView()` as `MOZ_CAN_RUN_SCRIPT` and move it from `nsIPresShell` to `PresShell` with a member. Differential Revision: https://phabricator.services.mozilla.com/D28321
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/nsIPresShell.h
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -3435,17 +3435,17 @@ nsresult PresShell::ScrollContentIntoVie
   // than a single best-effort scroll followed by one final scroll on the first
   // completed reflow.
   if (mContentToScrollTo) {
     DoScrollContentIntoView();
   }
   return NS_OK;
 }
 
-void nsIPresShell::DoScrollContentIntoView() {
+void PresShell::DoScrollContentIntoView() {
   NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
 
   nsIFrame* frame = mContentToScrollTo->GetPrimaryFrame();
   if (!frame) {
     mContentToScrollTo->DeleteProperty(nsGkAtoms::scrolling);
     mContentToScrollTo = nullptr;
     return;
   }
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -434,16 +434,21 @@ class PresShell final : public nsIPresSh
    *
    * @param aInterruptible Whether or not reflow interruption is allowed.
    */
   MOZ_CAN_RUN_SCRIPT void DidDoReflow(bool aInterruptible);
 
   MOZ_CAN_RUN_SCRIPT void HandlePostedReflowCallbacks(bool aInterruptible);
 
   /**
+   * Helper for ScrollContentIntoView()
+   */
+  MOZ_CAN_RUN_SCRIPT void DoScrollContentIntoView();
+
+  /**
    * Initialize cached font inflation preference values and do an initial
    * computation to determine if font inflation is enabled.
    *
    * @see nsLayoutUtils::sFontSizeInflationEmPerLine
    * @see nsLayoutUtils::sFontSizeInflationMinTwips
    * @see nsLayoutUtils::sFontSizeInflationLineThreshold
    */
   void SetupFontInflation();
@@ -1449,16 +1454,23 @@ class PresShell final : public nsIPresSh
 
   // Information about live content (which still stay in DOM tree).
   // Used in case we need re-dispatch event after sending pointer event,
   // when target of pointer event was deleted during executing user handlers.
   nsCOMPtr<nsIContent> mPointerEventTarget;
 
   nsCOMPtr<nsIContent> mLastAnchorScrolledTo;
 
+  // Information needed to properly handle scrolling content into view if the
+  // pre-scroll reflow flush can be interrupted.  mContentToScrollTo is non-null
+  // between the initial scroll attempt and the first time we finish processing
+  // all our dirty roots.  mContentToScrollTo has a content property storing the
+  // details for the scroll operation, see ScrollIntoViewData above.
+  nsCOMPtr<nsIContent> mContentToScrollTo;
+
   // The focus sequence number of the last processed input event
   uint64_t mAPZFocusSequenceNumber;
   // The focus information needed for async keyboard scrolling
   FocusTarget mAPZFocusTarget;
 
   nscoord mLastAnchorScrollPositionY = 0;
 
   int32_t mActiveSuppressDisplayport;
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1734,19 +1734,16 @@ class nsIPresShell : public nsStubDocume
   // not in reflow.
   nsIFrame* mCurrentReflowRoot = nullptr;
 #endif
 
 #ifdef MOZ_REFLOW_PERF
   mozilla::UniquePtr<ReflowCountMgr> mReflowCountMgr;
 #endif
 
-  // Helper for ScrollContentIntoView
-  void DoScrollContentIntoView();
-
   /**
    * Methods to handle changes to user and UA sheet lists that we get
    * notified about.
    */
   void AddUserSheet(mozilla::StyleSheet*);
   void AddAgentSheet(mozilla::StyleSheet*);
   void AddAuthorSheet(mozilla::StyleSheet*);
   void RemoveSheet(mozilla::StyleOrigin, mozilla::StyleSheet*);
@@ -1823,23 +1820,16 @@ class nsIPresShell : public nsStubDocume
 #endif
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   // We track allocated pointers in a debug-only hashtable to assert against
   // missing/double frees.
   nsTHashtable<nsPtrHashKey<void>> mAllocatedPointers;
 #endif
 
-  // Information needed to properly handle scrolling content into view if the
-  // pre-scroll reflow flush can be interrupted.  mContentToScrollTo is non-null
-  // between the initial scroll attempt and the first time we finish processing
-  // all our dirty roots.  mContentToScrollTo has a content property storing the
-  // details for the scroll operation, see ScrollIntoViewData above.
-  nsCOMPtr<nsIContent> mContentToScrollTo;
-
   // Count of the number of times this presshell has been painted to a window.
   uint64_t mPaintCount;
 
   nsSize mVisualViewportSize;
 
   mozilla::Maybe<nsPoint> mVisualViewportOffset;
 
   // A pending visual scroll offset that we will ask APZ to scroll to