mirror of
https://github.com/servo/servo.git
synced 2025-08-29 00:58:20 +01:00
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:
parent
a093b0a087
commit
4574cd8ea6
35 changed files with 125 additions and 97 deletions
|
@ -6,13 +6,13 @@ use cssparser::Parser;
|
|||
use media_queries::CSSErrorReporterTest;
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::longhands::background_size;
|
||||
use style::stylesheets::Origin;
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
|
||||
#[test]
|
||||
fn background_size_should_reject_negative_values() {
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter);
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style));
|
||||
|
||||
let parse_result = background_size::parse(&context, &mut Parser::new("-40% -40%"));
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ use stylesheets::block_from;
|
|||
fn parse_declaration_block(css_properties: &str) -> PropertyDeclarationBlock {
|
||||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter);
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style));
|
||||
let mut parser = Parser::new(css_properties);
|
||||
parse_property_declaration_list(&context, &mut parser, CssRuleType::Style)
|
||||
parse_property_declaration_list(&context, &mut parser)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -976,7 +976,7 @@ mod shorthand_serialization {
|
|||
let mut s = String::new();
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter);
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style));
|
||||
|
||||
let parsed = transform::parse(&context, &mut Parser::new("none")).unwrap();
|
||||
let try_serialize = parsed.to_css(&mut s);
|
||||
|
@ -1040,7 +1040,7 @@ mod shorthand_serialization {
|
|||
let mut s = String::new();
|
||||
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
|
||||
let reporter = CSSErrorReporterTest;
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter);
|
||||
let context = ParserContext::new(Origin::Author, &url, &reporter, Some(CssRuleType::Style));
|
||||
|
||||
let parsed = quotes::parse(&context, &mut Parser::new("none")).unwrap();
|
||||
let try_serialize = parsed.to_css(&mut s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue