Pull rule_type into ParserContext

Absorb `rule_type` into the `ParserContext` so that it's easier to pass down to
deeper levels of the parser.

MozReview-Commit-ID: DjBNytLxGKX
This commit is contained in:
J. Ryan Stinnett 2017-04-10 09:24:32 +08:00
parent a093b0a087
commit 4574cd8ea6
35 changed files with 125 additions and 97 deletions

View file

@ -950,9 +950,9 @@ pub extern "C" fn Servo_ParseProperty(property: *const nsACString, value: *const
let url_data = unsafe { RefPtr::from_ptr_ref(&data) };
let reporter = StdoutErrorReporter;
let context = ParserContext::new(Origin::Author, url_data, &reporter);
let context = ParserContext::new(Origin::Author, url_data, &reporter, Some(CssRuleType::Style));
match ParsedDeclaration::parse(id, &context, &mut Parser::new(value), false, CssRuleType::Style) {
match ParsedDeclaration::parse(id, &context, &mut Parser::new(value), false) {
Ok(parsed) => {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut block = PropertyDeclarationBlock::new();
@ -972,7 +972,7 @@ pub extern "C" fn Servo_ParseEasing(easing: *const nsAString,
let url_data = unsafe { RefPtr::from_ptr_ref(&data) };
let reporter = StdoutErrorReporter;
let context = ParserContext::new(Origin::Author, url_data, &reporter);
let context = ParserContext::new(Origin::Author, url_data, &reporter, Some(CssRuleType::Style));
let easing = unsafe { (*easing).to_string() };
match transition_timing_function::single_value::parse(&context, &mut Parser::new(&easing)) {
Ok(parsed_easing) => {
@ -1511,7 +1511,7 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
if let Ok(cond) = cond {
let url_data = unsafe { dummy_url_data() };
let reporter = StdoutErrorReporter;
let context = ParserContext::new_for_cssom(url_data, &reporter);
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Style));
cond.eval(&context)
} else {
false