More cleanup and documentation

This commit is contained in:
Martin Robinson 2025-08-03 18:45:38 +02:00
parent bbad1f656a
commit ce0fb3b747

View file

@ -1374,6 +1374,12 @@ impl ScriptThread {
saw_any_reflows
}
/// Schedule a rendering update ("update the rendering"), if necessary. This
/// can be necessary for a couple reasons. For instance, when the DOM
/// changes a scheduled rendering update becomes necessary if one isn't
/// scheduled already. Another example is if rAFs are running but no display
/// lists are being produced. In that case the [`ScriptThread`] is
/// responsible for scheduling animation ticks.
fn maybe_schedule_rendering_opportunity_after_ipc_message(
&self,
built_any_display_lists: bool,
@ -1430,6 +1436,8 @@ impl ScriptThread {
);
}
/// Fulfill the possibly-pending pending `document.fonts.ready` promise if
/// all web fonts have loaded.
fn maybe_fulfill_font_ready_promises(&self, can_gc: CanGc) {
let mut sent_message = false;
for (_, document) in self.documents.borrow().iter() {
@ -1441,7 +1449,10 @@ impl ScriptThread {
}
}
fn maybe_send_document_state_messages(&self) {
/// If waiting for an idle `Pipeline` state in order to dump a screenshot at
/// the right time, inform the `Constellation` this `Pipeline` has entered
/// the idle state when applicable.
fn maybe_send_idle_document_state_to_constellation(&self) {
if !opts::get().wait_for_stable_image {
return;
}
@ -1665,8 +1676,10 @@ impl ScriptThread {
self.update_the_rendering(can_gc);
self.maybe_fulfill_font_ready_promises(can_gc);
self.maybe_send_idle_document_state_to_constellation();
// This must happen last to detect if any change above makes a rendering update necessary.
self.maybe_schedule_rendering_opportunity_after_ipc_message(built_any_display_lists);
self.maybe_send_document_state_messages();
true
}