diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2014-08-16 12:24:34 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2014-08-16 12:24:34 +0100 |
commit | 444ff8425922d350120eb5412c96c26060b55c88 (patch) | |
tree | 53d7e8a5d5c163d084117944bd3fdd4eb71de13d /src/components/layout/layout_task.rs | |
parent | ba592364b7655b66a4d384e8deabcde88755825f (diff) | |
parent | 4ca385ba10faeaf32b5aeb2cbd293542c8d8a3c9 (diff) | |
download | servo-444ff8425922d350120eb5412c96c26060b55c88.tar.gz servo-444ff8425922d350120eb5412c96c26060b55c88.zip |
Merge pull request #3078 from SimonSapin/style-cleanup
Various refactoring and fixes in the style crate
Diffstat (limited to 'src/components/layout/layout_task.rs')
-rw-r--r-- | src/components/layout/layout_task.rs | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/components/layout/layout_task.rs b/src/components/layout/layout_task.rs index 0edb9436771..e4cba397379 100644 --- a/src/components/layout/layout_task.rs +++ b/src/components/layout/layout_task.rs @@ -6,7 +6,6 @@ //! rendered. use css::matching::{ApplicableDeclarations, MatchMethods}; -use css::select::new_stylist; use css::node_style::StyledNode; use construct::{FlowConstructionResult, NoConstructionResult}; use context::{LayoutContext, SharedLayoutContext}; @@ -57,7 +56,7 @@ use std::comm::{channel, Sender, Receiver, Select}; use std::mem; use std::ptr; use style::{AuthorOrigin, Stylesheet, Stylist}; -use style::CSSFontFaceRule; +use style::iter_font_face_rules; use sync::{Arc, Mutex}; use url::Url; @@ -347,7 +346,7 @@ impl LayoutTask { screen_size: screen_size, display_list: None, - stylist: box new_stylist(), + stylist: box Stylist::new(), parallel_traversal: parallel_traversal, time_profiler_chan: time_profiler_chan, opts: opts.clone(), @@ -491,22 +490,9 @@ impl LayoutTask { fn handle_add_stylesheet(&mut self, sheet: Stylesheet) { // Find all font-face rules and notify the font cache of them. // GWTODO: Need to handle unloading web fonts (when we handle unloading stylesheets!) - // GWTODO: Need to handle font-face nested within media rules. - for rule in sheet.rules.iter() { - match rule { - &CSSFontFaceRule(ref font_face_rule) => { - let mut font_urls = vec!(); - for source_line in font_face_rule.source_lines.iter() { - for source in source_line.sources.iter() { - font_urls.push(source.url.clone()); - } - } - self.font_cache_task.add_web_font(font_urls, font_face_rule.family.as_slice()); - }, - _ => {} - } - } - + iter_font_face_rules(&sheet, |family, url| { + self.font_cache_task.add_web_font(family.to_string(), url.clone()); + }); self.stylist.add_stylesheet(sheet, AuthorOrigin); } |