diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 5dbbc3f2377..a86dcfc4ed8 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -182,7 +182,6 @@ pub enum ReflowReason { StylesheetLoaded, Timer, Viewport, - WebFontLoaded, WindowResize, WorkletLoaded, } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index f3b13f8deb8..ffcfb98daac 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -3273,10 +3273,14 @@ impl ScriptThread { /// Handles a Web font being loaded. Does nothing if the page no longer exists. fn handle_web_font_loaded(&self, pipeline_id: PipelineId) { - let document = self.documents.borrow().find_document(pipeline_id); - if let Some(document) = document { - self.rebuild_and_force_reflow(&document, ReflowReason::WebFontLoaded); - } + let Some(document) = self.documents.borrow().find_document(pipeline_id) else { + warn!("Web font loaded in closed pipeline {}.", pipeline_id); + return; + }; + + // TODO: This should only dirty nodes that are waiting for a web font to finish loading! + document.dirty_all_nodes(); + document.window().add_pending_reflow(); } /// Handles a worklet being loaded. Does nothing if the page no longer exists. diff --git a/tests/wpt/meta-legacy-layout/css/CSS2/generated-content/before-after-dynamic-attr-001.xht.ini b/tests/wpt/meta-legacy-layout/css/CSS2/generated-content/before-after-dynamic-attr-001.xht.ini deleted file mode 100644 index e0d367787bb..00000000000 --- a/tests/wpt/meta-legacy-layout/css/CSS2/generated-content/before-after-dynamic-attr-001.xht.ini +++ /dev/null @@ -1,3 +0,0 @@ -[before-after-dynamic-attr-001.xht] - type: reftest - expected: FAIL