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
--- 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