mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Thread ParseError return values through CSS parsing.
This commit is contained in:
parent
58e39bfffa
commit
27ae1ef2e7
121 changed files with 2133 additions and 1505 deletions
|
@ -6,10 +6,11 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use cssparser::Parser as CssParser;
|
||||
use cssparser::{Parser as CssParser, ParserInput};
|
||||
use selectors::Element;
|
||||
use selectors::parser::SelectorList;
|
||||
use std::fmt::Debug;
|
||||
use style_traits::ParseError;
|
||||
use stylesheets::{Origin, Namespaces};
|
||||
|
||||
/// A convenient alias for the type that represents an attribute value used for
|
||||
|
@ -59,13 +60,14 @@ impl<'a> SelectorParser<'a> {
|
|||
///
|
||||
/// This is used for some DOM APIs like `querySelector`.
|
||||
pub fn parse_author_origin_no_namespace(input: &str)
|
||||
-> Result<SelectorList<SelectorImpl>, ()> {
|
||||
-> Result<SelectorList<SelectorImpl>, ParseError> {
|
||||
let namespaces = Namespaces::default();
|
||||
let parser = SelectorParser {
|
||||
stylesheet_origin: Origin::Author,
|
||||
namespaces: &namespaces,
|
||||
};
|
||||
SelectorList::parse(&parser, &mut CssParser::new(input))
|
||||
let mut input = ParserInput::new(input);
|
||||
SelectorList::parse(&parser, &mut CssParser::new(&mut input))
|
||||
}
|
||||
|
||||
/// Whether we're parsing selectors in a user-agent stylesheet.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue