Bug 1896763 - Make display observer timing happen after all layout changes are possibly done. r=smaug,Jamie

Not sure how testable this is, for a11y purposes. The other consumer is
some XRSession stuff which doesn't seem to care too much about the
timing of this.

Differential Revision: https://phabricator.services.mozilla.com/D210384
This commit is contained in:
Emilio Cobos Álvarez 2024-05-15 09:36:52 +00:00
parent 76da252271
commit 98edf786e6
2 changed files with 6 additions and 25 deletions

View File

@ -56,23 +56,7 @@ add_setup(async function () {
});
async function setContentVisibility(browser, value) {
let mutationPromise = (() => {
switch (value) {
case "hidden":
return waitForEvent(EVENT_REORDER, "target");
case "auto":
return waitForEvents({
expected: [
[EVENT_REORDER, "child"],
[EVENT_REORDER, "content-child"],
[EVENT_REORDER, "shadowDiv"],
[EVENT_REORDER, "target"],
],
});
default:
throw new Error(`unexpected content-visibility: ${value}`);
}
})();
let mutationPromise = waitForEvent(EVENT_REORDER, "target");
// Change the value of `content-visibility` property for the target
info(`Setting content-visibility: ${value}`);

View File

@ -2741,14 +2741,6 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
return StopTimer();
}
// Notify display flush observers.
// FIXME(emilio, bug 1896763): Further changes can happen as part of
// ResizeObserver handling and so on, probably should notify around
// IntersectionObserver timing instead.
if (!TickObserverArray(2, aNowTime)) {
return StopTimer();
}
// Recompute approximate frame visibility if it's necessary and enough time
// has passed since the last time we did it.
if (mNeedToRecomputeVisibility && !mThrottled &&
@ -2787,6 +2779,11 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
// steps for doc.
UpdateIntersectionObservations(aNowTime);
// Notify display flush observers (like a11y).
if (!TickObserverArray(2, aNowTime)) {
return StopTimer();
}
UpdateAnimatedImages(previousRefresh, aNowTime);
bool dispatchTasksAfterTick = false;