mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update font face to new url parser.
This commit is contained in:
parent
c76cd128a7
commit
a500099df6
2 changed files with 5 additions and 4 deletions
|
@ -31,7 +31,7 @@ extern crate servo_util = "util";
|
||||||
extern crate servo_msg = "msg";
|
extern crate servo_msg = "msg";
|
||||||
extern crate style;
|
extern crate style;
|
||||||
extern crate sync;
|
extern crate sync;
|
||||||
extern crate url;
|
extern crate url = "url_";
|
||||||
|
|
||||||
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
|
// Eventually we would like the shaper to be pluggable, as many operating systems have their own
|
||||||
// shapers. For now, however, this is a hard dependency.
|
// shapers. For now, however, this is a hard dependency.
|
||||||
|
|
|
@ -8,8 +8,7 @@ use errors::{ErrorLoggerIterator, log_css_error};
|
||||||
use std::ascii::StrAsciiExt;
|
use std::ascii::StrAsciiExt;
|
||||||
use parsing_utils::one_component_value;
|
use parsing_utils::one_component_value;
|
||||||
use stylesheets::{CSSRule, CSSFontFaceRule};
|
use stylesheets::{CSSRule, CSSFontFaceRule};
|
||||||
use url::Url;
|
use url::{Url, UrlParser};
|
||||||
use servo_util::url::parse_url;
|
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(PartialEq)]
|
||||||
pub enum FontFaceFormat {
|
pub enum FontFaceFormat {
|
||||||
|
@ -80,7 +79,9 @@ pub fn parse_font_face_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, base_
|
||||||
// url() or local() should be next
|
// url() or local() should be next
|
||||||
let maybe_url = match iter.next() {
|
let maybe_url = match iter.next() {
|
||||||
Some(&URL(ref string_value)) => {
|
Some(&URL(ref string_value)) => {
|
||||||
Some(parse_url(string_value.as_slice(), Some(base_url.clone())))
|
// FIXME: handle URL parse errors more gracefully.
|
||||||
|
let url = UrlParser::new().base_url(base_url).parse(string_value.as_slice()).unwrap();
|
||||||
|
Some(url)
|
||||||
},
|
},
|
||||||
Some(&Function(ref string_value, ref _values)) => {
|
Some(&Function(ref string_value, ref _values)) => {
|
||||||
match string_value.as_slice() {
|
match string_value.as_slice() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue