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 552160 98b1971b0a2684e0cc076fe783c480760a9b4508
parent 552159 110ad98bd8c7f3bfbe5b22178ff10ca10123a110
child 552161 e8e31000eab25dc36710eb66dea7392646161cda
push id12074
push userarchaeopteryx@coole-files.de
push dateMon, 30 Sep 2019 13:28:43 +0000
treeherdermozilla-beta@e8e31000eab2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, RyanVM
bugs1578933
milestone70.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
@@ -4167,20 +4167,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;
           }
         }
       }
@@ -9433,16 +9429,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