script: Remove note_rendering_opportunity and rendering_opportunity (#34575)

A rendering opportunity is now unconditionally triggered by handling IPC
messages in the `ScriptThread`, unless animations are running in which
case it's driven by the compositor. We can now remove calls to
`note_rendering_opportunity` and `rendering_opportunity`.

There is one tricky case, which is when a promise completion during a
microtask checkpoint dirties the page again. In this case we need to
trigger a new rendering opportunity, unless animations are running.  In
a followup change, when not driven by the compositor, rendering
opportunities will be driven by a timed task, meaning we can remove this
workaround.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-12-12 09:43:58 +01:00 committed by GitHub
parent 7fcde1f7a3
commit 2bcee38e52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 63 additions and 66 deletions

View file

@ -26,7 +26,6 @@ use crate::dom::resizeobserverentry::ResizeObserverEntry;
use crate::dom::resizeobserversize::{ResizeObserverSize, ResizeObserverSizeImpl};
use crate::dom::window::Window;
use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
/// <https://drafts.csswg.org/resize-observer/#calculate-depth-for-node>
#[derive(Debug, Default, PartialEq, PartialOrd)]
@ -191,10 +190,6 @@ impl ResizeObserverMethods<crate::DomTypeHolder> for ResizeObserver {
self.observation_targets
.borrow_mut()
.push((resize_observation, Dom::from_ref(target)));
// Note: noting a rendering opportunity here is necessary
// to make /resize-observer/iframe-same-origin.html PASS.
ScriptThread::note_rendering_opportunity(window_from_node(target).pipeline_id());
}
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve>