mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
layout: Do not trigger dirty_all_nodes when web font loading fails (#43595)
Currently, the `web_font_finished_loading_callback` sends a `ScriptThreadMessage::WebFontLoaded` message regardless of whether web font loading succeeds or not, which leads to dirtying all nodes in `script_thread.rs`. This creates unnecessary reflow. This PR removes the boolean field from the `WebFontLoaded` message and only sends the message when the web font loading is successful. Testing: Existing WPT tests Signed-off-by: Minghua Wu <michael.wu1107@gmail.com>
This commit is contained in:
@@ -1849,8 +1849,8 @@ impl ScriptThread {
|
||||
ScriptThreadMessage::WebDriverScriptCommand(pipeline_id, msg) => {
|
||||
self.handle_webdriver_msg(pipeline_id, msg, cx)
|
||||
},
|
||||
ScriptThreadMessage::WebFontLoaded(pipeline_id, success) => {
|
||||
self.handle_web_font_loaded(pipeline_id, success)
|
||||
ScriptThreadMessage::WebFontLoaded(pipeline_id) => {
|
||||
self.handle_web_font_loaded(pipeline_id)
|
||||
},
|
||||
ScriptThreadMessage::DispatchIFrameLoadEvent {
|
||||
target: browsing_context_id,
|
||||
@@ -3265,7 +3265,7 @@ 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, _success: bool) {
|
||||
fn handle_web_font_loaded(&self, pipeline_id: PipelineId) {
|
||||
let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
|
||||
warn!("Web font loaded in closed pipeline {}.", pipeline_id);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user