mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix parsing invalid url, clean up font template matching.
This commit is contained in:
parent
a500099df6
commit
a37b5cb326
2 changed files with 22 additions and 25 deletions
|
@ -97,8 +97,7 @@ impl FontTemplate {
|
|||
}
|
||||
},
|
||||
None => {
|
||||
match self.is_valid {
|
||||
true => {
|
||||
if self.is_valid {
|
||||
let data = self.get_data();
|
||||
let handle: Result<FontHandle, ()> = FontHandleMethods::new_from_template(fctx, data.clone(), None);
|
||||
match handle {
|
||||
|
@ -121,14 +120,12 @@ impl FontTemplate {
|
|||
None
|
||||
}
|
||||
}
|
||||
},
|
||||
false => {
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the data for creating a font.
|
||||
pub fn get(&mut self) -> Option<Arc<FontTemplateData>> {
|
||||
|
|
|
@ -79,8 +79,8 @@ pub fn parse_font_face_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, base_
|
|||
// url() or local() should be next
|
||||
let maybe_url = match iter.next() {
|
||||
Some(&URL(ref string_value)) => {
|
||||
// FIXME: handle URL parse errors more gracefully.
|
||||
let url = UrlParser::new().base_url(base_url).parse(string_value.as_slice()).unwrap();
|
||||
let maybe_url = UrlParser::new().base_url(base_url).parse(string_value.as_slice());
|
||||
let url = maybe_url.unwrap_or_else(|_| Url::parse("about:invalid").unwrap());
|
||||
Some(url)
|
||||
},
|
||||
Some(&Function(ref string_value, ref _values)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue