diff options
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 30684e0ee00..a935e4b91f5 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -942,6 +942,8 @@ impl ScriptTask { self.handle_webdriver_msg(pipeline_id, msg), ConstellationControlMsg::TickAllAnimations(pipeline_id) => self.handle_tick_all_animations(pipeline_id), + ConstellationControlMsg::WebFontLoaded(pipeline_id) => + self.handle_web_font_loaded(pipeline_id), ConstellationControlMsg::StylesheetLoadComplete(id, url, responder) => { responder.respond(); self.handle_resource_loaded(id, LoadType::Stylesheet(url)); @@ -1478,6 +1480,15 @@ impl ScriptTask { document.r().run_the_animation_frame_callbacks(); } + /// Handles a Web font being loaded. Does nothing if the page no longer exists. + fn handle_web_font_loaded(&self, pipeline_id: PipelineId) { + if let Some(page) = self.page.borrow().as_ref() { + if let Some(page) = page.find(pipeline_id) { + self.rebuild_and_force_reflow(&*page, ReflowReason::WebFontLoaded); + } + } + } + /// The entry point to document loading. Defines bindings, sets up the window and document /// objects, parses HTML and CSS, and kicks off initial layout. fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> Root<ServoHTMLParser> { |