mirror of
https://github.com/servo/servo.git
synced 2025-06-17 04:44:28 +00:00
script: Remove explicit reflow for web font loads (#32455)
Instead of using an explicit reflow when a web font laods, queue a pending reflow. This should be able to eliminate multiple reflows some situations. A followup should ensure that only nodes that have pending fonts loading are reflows, but this change is the first step.
This commit is contained in:
parent
e6ea4a9c29
commit
35bbcc0d95
3 changed files with 8 additions and 8 deletions
|
@ -182,7 +182,6 @@ pub enum ReflowReason {
|
||||||
StylesheetLoaded,
|
StylesheetLoaded,
|
||||||
Timer,
|
Timer,
|
||||||
Viewport,
|
Viewport,
|
||||||
WebFontLoaded,
|
|
||||||
WindowResize,
|
WindowResize,
|
||||||
WorkletLoaded,
|
WorkletLoaded,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3273,10 +3273,14 @@ impl ScriptThread {
|
||||||
|
|
||||||
/// Handles a Web font being loaded. Does nothing if the page no longer exists.
|
/// Handles a Web font being loaded. Does nothing if the page no longer exists.
|
||||||
fn handle_web_font_loaded(&self, pipeline_id: PipelineId) {
|
fn handle_web_font_loaded(&self, pipeline_id: PipelineId) {
|
||||||
let document = self.documents.borrow().find_document(pipeline_id);
|
let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
|
||||||
if let Some(document) = document {
|
warn!("Web font loaded in closed pipeline {}.", pipeline_id);
|
||||||
self.rebuild_and_force_reflow(&document, ReflowReason::WebFontLoaded);
|
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.
|
/// Handles a worklet being loaded. Does nothing if the page no longer exists.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[before-after-dynamic-attr-001.xht]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue