Bug 1578933 - Run scroll anchoring adjustments when blocking script. r=dholbert a=RyanVM
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 26 Sep 2019 17:07:03 +0000
changeset 523734 c4f133b69add9e5d394aa1f7056afd0b2291fa11
parent 523733 750758879fc3ddbaed66678f109ef65f48cafc78
child 523735 e5ac44b74045913396db258c8887dbd7a87b4bd0
push id421
push userarchaeopteryx@coole-files.de
push dateMon, 30 Sep 2019 14:07:53 +0000
treeherdermozilla-esr68@c4f133b69add [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, RyanVM
bugs1578933
milestone68.2.0
Bug 1578933 - Run scroll anchoring adjustments when blocking script. r=dholbert a=RyanVM I wanted to fix the more general problem and script-block more of FlushPendingNotifications, but simple attempts to do that have resulted in terribly orange try runs with very bizarre failures, so in the "perfect is the enemy of good" spirit, fix the issue at hand (scroll anchoring adjustments not dealing with layout reentering beneath them) by running them while script-blocked, which is the right thing to do anyway. Differential Revision: https://phabricator.services.mozilla.com/D47256
layout/base/PresShell.cpp
testing/web-platform/meta/css/css-scroll-anchoring/anchoring-with-bounds-clamping-div.html.ini
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4223,20 +4223,16 @@ void PresShell::DoFlushPendingNotificati
     if (flushType >= (SuppressInterruptibleReflows()
                           ? FlushType::Layout
                           : FlushType::InterruptibleLayout) &&
         !mIsDestroying) {
       didLayoutFlush = true;
       mFrameConstructor->RecalcQuotesAndCounters();
       viewManager->FlushDelayedResize(true);
       if (ProcessReflowCommands(flushType < FlushType::Layout)) {
-        // We didn't get interrupted. Go ahead and perform scroll anchor
-        // adjustments and scroll content into view
-        FlushPendingScrollAnchorAdjustments();
-
         if (mContentToScrollTo) {
           DoScrollContentIntoView();
           if (mContentToScrollTo) {
             mContentToScrollTo->DeleteProperty(nsGkAtoms::scrolling);
             mContentToScrollTo = nullptr;
           }
         }
       }
@@ -9426,16 +9422,22 @@ bool PresShell::ProcessReflowCommands(bo
         // Keep going until we're out of reflow commands, or we've run
         // past our deadline, or we're interrupted.
       } while (!interrupted && !mDirtyRoots.IsEmpty() &&
                (!aInterruptible || PR_IntervalNow() < deadline));
 
       interrupted = !mDirtyRoots.IsEmpty();
 
       overflowTracker.Flush();
+
+      if (!interrupted) {
+        // We didn't get interrupted. Go ahead and perform scroll anchor
+        // adjustments.
+        FlushPendingScrollAnchorAdjustments();
+      }
     }
 
     // Exiting the scriptblocker might have killed us
     if (!mIsDestroying) {
       DidDoReflow(aInterruptible);
     }
 
     // DidDoReflow might have killed us
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-scroll-anchoring/anchoring-with-bounds-clamping-div.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[anchoring-with-bounds-clamping-div.html]
-    [Anchoring combined with scroll bounds clamping in a <div>.]
-        expected: FAIL