mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Defined new trait ParseErrorReporter and added error_reporter member to ParserContext
This commit is contained in:
parent
8efc954531
commit
996e9e06b2
24 changed files with 194 additions and 69 deletions
|
@ -6,6 +6,7 @@
|
|||
use cssparser::{Parser, SourcePosition};
|
||||
use log;
|
||||
use selectors::parser::ParserContext as SelectorParserContext;
|
||||
use style_traits::ParseErrorReporter;
|
||||
use stylesheets::Origin;
|
||||
use url::{Url, UrlParser};
|
||||
|
||||
|
@ -13,16 +14,19 @@ pub struct ParserContext<'a> {
|
|||
pub stylesheet_origin: Origin,
|
||||
pub base_url: &'a Url,
|
||||
pub selector_context: SelectorParserContext,
|
||||
pub error_reporter: Box<ParseErrorReporter + Send>
|
||||
}
|
||||
|
||||
impl<'a> ParserContext<'a> {
|
||||
pub fn new(stylesheet_origin: Origin, base_url: &'a Url) -> ParserContext<'a> {
|
||||
pub fn new(stylesheet_origin: Origin, base_url: &'a Url, error_reporter: Box<ParseErrorReporter + Send>)
|
||||
-> ParserContext<'a> {
|
||||
let mut selector_context = SelectorParserContext::new();
|
||||
selector_context.in_user_agent_stylesheet = stylesheet_origin == Origin::UserAgent;
|
||||
ParserContext {
|
||||
stylesheet_origin: stylesheet_origin,
|
||||
base_url: base_url,
|
||||
selector_context: selector_context,
|
||||
error_reporter: error_reporter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue