mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Make the parser accept @font-face rules without font-family or src.
Fix #16165. Also, it turns out that the CSSFontFaceRule IDL specified in the css-fonts spec is not web-compatible. Instead browsers implement a .style attribute like in CSSStyleRule: https://github.com/w3c/csswg-drafts/issues/825 This in turn requires preserving data about which descriptors were set or not (distinguishing unset from set to a value that happens to be the initial value), so this commit also makes every field `Option<_>`.
This commit is contained in:
parent
15fc9f3bbf
commit
61812d4d9d
7 changed files with 169 additions and 168 deletions
|
@ -355,20 +355,24 @@ fn add_font_face_rules(stylesheet: &Stylesheet,
|
|||
outstanding_web_fonts_counter: &Arc<AtomicUsize>) {
|
||||
if opts::get().load_webfonts_synchronously {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
stylesheet.effective_font_face_rules(&device, guard, |font_face| {
|
||||
let effective_sources = font_face.effective_sources();
|
||||
font_cache_thread.add_web_font(font_face.family.clone(),
|
||||
effective_sources,
|
||||
sender.clone());
|
||||
receiver.recv().unwrap();
|
||||
stylesheet.effective_font_face_rules(&device, guard, |rule| {
|
||||
if let Some(font_face) = rule.font_face() {
|
||||
let effective_sources = font_face.effective_sources();
|
||||
font_cache_thread.add_web_font(font_face.family().clone(),
|
||||
effective_sources,
|
||||
sender.clone());
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
stylesheet.effective_font_face_rules(&device, guard, |font_face| {
|
||||
let effective_sources = font_face.effective_sources();
|
||||
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
|
||||
font_cache_thread.add_web_font(font_face.family.clone(),
|
||||
effective_sources,
|
||||
(*font_cache_sender).clone());
|
||||
stylesheet.effective_font_face_rules(&device, guard, |rule| {
|
||||
if let Some(font_face) = rule.font_face() {
|
||||
let effective_sources = font_face.effective_sources();
|
||||
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
|
||||
font_cache_thread.add_web_font(font_face.family().clone(),
|
||||
effective_sources,
|
||||
(*font_cache_sender).clone());
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue