aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/layout/layout_task.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2014-08-12 23:23:52 +0100
committerSimon Sapin <simon.sapin@exyr.org>2014-08-16 08:32:47 +0100
commit5f3dc55f72fc93790dca05fd5fb5d8402d908971 (patch)
tree78224df2398a1a0473270881c4e93c5d1f51f89c /src/components/layout/layout_task.rs
parent7e78e54c3f4e3d5e89c35d2ee36f81aed2278566 (diff)
downloadservo-5f3dc55f72fc93790dca05fd5fb5d8402d908971.tar.gz
servo-5f3dc55f72fc93790dca05fd5fb5d8402d908971.zip
Make more things private to the style crate.
Diffstat (limited to 'src/components/layout/layout_task.rs')
-rw-r--r--src/components/layout/layout_task.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/components/layout/layout_task.rs b/src/components/layout/layout_task.rs
index a0e1dd45d89..e4cba397379 100644
--- a/src/components/layout/layout_task.rs
+++ b/src/components/layout/layout_task.rs
@@ -56,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;
@@ -490,20 +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 in font_face_rule.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);
}