mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #9149 - adrianheine:webFonts, r=glennw
Correctly handle local sources for CSS3 fonts Currently, servo panics for me when loading something like this: ``` @font-face { font-family: "test family"; src: local(test font face); } ``` That's due to a bug in `FontCacheTask`. `FontCacheTask` tries to get the value for the key "test font face" from `self.web_families`, but previously initialized a value for the key "test family". These two commits add an awkward test and fix the bug by not shadowing the variable `family_name`. Since the argument to `local()` should explicitly not be the name of a font family, the previous variable name was wrong and misleading anyways. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9149) <!-- Reviewable:end -->
This commit is contained in:
commit
8e75a05e6b
5 changed files with 36 additions and 4 deletions
|
@ -152,7 +152,7 @@ impl FontCache {
|
|||
let family_name = LowercaseString::new(family.name());
|
||||
if !self.web_families.contains_key(&family_name) {
|
||||
let templates = FontTemplates::new();
|
||||
self.web_families.insert(family_name, templates);
|
||||
self.web_families.insert(family_name.clone(), templates);
|
||||
}
|
||||
|
||||
match src {
|
||||
|
@ -207,10 +207,10 @@ impl FontCache {
|
|||
}
|
||||
});
|
||||
}
|
||||
Source::Local(ref family) => {
|
||||
let family_name = LowercaseString::new(family.name());
|
||||
Source::Local(ref font) => {
|
||||
let font_face_name = LowercaseString::new(font.name());
|
||||
let templates = &mut self.web_families.get_mut(&family_name).unwrap();
|
||||
for_each_variation(&family_name, |path| {
|
||||
for_each_variation(&font_face_name, |path| {
|
||||
templates.add_template(Atom::from(&*path), None);
|
||||
});
|
||||
result.send(()).unwrap();
|
||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -650,6 +650,8 @@ name = "gfx_tests"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"gfx 0.0.1",
|
||||
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
|
||||
"style 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue