style: Avoid cloning all over the error reporter.

This commit is contained in:
Emilio Cobos Álvarez 2017-03-14 00:12:38 +01:00
parent eaf27ccfa0
commit b4de69e3eb
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
36 changed files with 186 additions and 154 deletions

View file

@ -11,7 +11,8 @@ use style::stylesheets::Origin;
#[test]
fn background_size_should_reject_negative_values() {
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter);
let parse_result = background_size::parse(&context, &mut Parser::new("-40% -40%"));

View file

@ -21,7 +21,8 @@ use stylesheets::block_from;
fn parse_declaration_block(css_properties: &str) -> PropertyDeclarationBlock {
let url = ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter);
let mut parser = Parser::new(css_properties);
parse_property_declaration_list(&context, &mut parser)
}
@ -963,7 +964,8 @@ mod shorthand_serialization {
let mut s = String::new();
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter);
let parsed = transform::parse(&context, &mut Parser::new("none")).unwrap();
let try_serialize = parsed.to_css(&mut s);
@ -986,7 +988,8 @@ mod shorthand_serialization {
let mut s = String::new();
let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let reporter = CSSErrorReporterTest;
let context = ParserContext::new(Origin::Author, &url, &reporter);
let parsed = quotes::parse(&context, &mut Parser::new("none")).unwrap();
let try_serialize = parsed.to_css(&mut s);