mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Update to rust-cssparser 0.4.0
This commit is contained in:
parent
021f441d24
commit
69d398f29a
14 changed files with 141 additions and 136 deletions
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use computed_values::font_family::FontFamily;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser, Token};
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use parser::{ParserContext, log_css_error};
|
||||
use properties::longhands::font_family::parse_one_family;
|
||||
use std::ascii::AsciiExt;
|
||||
|
@ -106,23 +106,12 @@ fn parse_one_non_generic_family_name(input: &mut Parser) -> Result<Atom, ()> {
|
|||
|
||||
|
||||
fn parse_one_src(context: &ParserContext, input: &mut Parser) -> Result<Source, ()> {
|
||||
let url = match input.next() {
|
||||
// Parsing url()
|
||||
Ok(Token::Url(url)) => {
|
||||
UrlParser::new().base_url(context.base_url).parse(&url).unwrap_or_else(
|
||||
|_error| Url::parse("about:invalid").unwrap())
|
||||
},
|
||||
// Parsing local() with early return
|
||||
Ok(Token::Function(name)) => {
|
||||
if name.eq_ignore_ascii_case("local") {
|
||||
return Ok(Source::Local(try!(input.parse_nested_block(|input| {
|
||||
parse_one_non_generic_family_name(input)
|
||||
}))))
|
||||
}
|
||||
return Err(())
|
||||
},
|
||||
_ => return Err(())
|
||||
};
|
||||
if input.try(|input| input.expect_function_matching("local")).is_ok() {
|
||||
return Ok(Source::Local(try!(input.parse_nested_block(parse_one_non_generic_family_name))))
|
||||
}
|
||||
let url = try!(input.expect_url());
|
||||
let url = UrlParser::new().base_url(context.base_url).parse(&url).unwrap_or_else(
|
||||
|_error| Url::parse("about:invalid").unwrap());
|
||||
|
||||
// Parsing optional format()
|
||||
let format_hints = if input.try(|input| input.expect_function_matching("format")).is_ok() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue