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

@ -9,7 +9,7 @@ use servo_atoms::Atom;
use style::parser::{Parse, ParserContext};
use style::properties::longhands::animation_iteration_count::single_value::computed_value::T as AnimationIterationCount;
use style::properties::longhands::animation_name;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]

View file

@ -10,13 +10,13 @@ use style::properties::longhands::{background_attachment, background_clip, backg
use style::properties::longhands::{background_origin, background_position_x, background_position_y, background_repeat};
use style::properties::longhands::background_size;
use style::properties::shorthands::background;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
#[test]
fn background_shorthand_should_parse_all_available_properties_when_specified() {
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("url(\"http://servo/test.png\") top center / 200px 200px repeat-x fixed padding-box \
content-box red");
let result = background::parse_value(&context, &mut parser).unwrap();
@ -36,7 +36,7 @@ fn background_shorthand_should_parse_all_available_properties_when_specified() {
fn background_shorthand_should_parse_when_some_fields_set() {
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("14px 40px repeat-y");
let result = background::parse_value(&context, &mut parser).unwrap();
@ -67,7 +67,7 @@ fn background_shorthand_should_parse_when_some_fields_set() {
fn background_shorthand_should_parse_comma_separated_declarations() {
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("url(\"http://servo/test.png\") top left no-repeat, url(\"http://servo/test.png\") \
center / 100% 100% no-repeat, white");
let result = background::parse_value(&context, &mut parser).unwrap();
@ -89,7 +89,7 @@ fn background_shorthand_should_parse_comma_separated_declarations() {
fn background_shorthand_should_parse_position_and_size_correctly() {
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("7px 4px");
let result = background::parse_value(&context, &mut parser).unwrap();
@ -114,7 +114,7 @@ fn background_shorthand_should_parse_position_and_size_correctly() {
fn background_shorthand_should_parse_origin_and_clip_correctly() {
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("padding-box content-box");
let result = background::parse_value(&context, &mut parser).unwrap();

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::{Parse, ParserContext};
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style::values::specified::basic_shape::*;
use style_traits::ToCss;

View file

@ -9,14 +9,14 @@ use style::parser::{ParserContext, Parse};
use style::properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use style::properties::longhands::{border_image_source, border_image_width};
use style::properties::shorthands::border_image;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]
fn border_image_shorthand_should_parse_when_all_properties_specified() {
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("linear-gradient(red, blue) 30 30% 45 fill / 20px 40px / 10px \
round stretch");
let result = border_image::parse_value(&context, &mut parser).unwrap();
@ -33,7 +33,7 @@ fn border_image_shorthand_should_parse_when_all_properties_specified() {
fn border_image_shorthand_should_parse_without_width() {
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("linear-gradient(red, blue) 30 30% 45 fill / / 10px round stretch");
let result = border_image::parse_value(&context, &mut parser).unwrap();
@ -49,7 +49,7 @@ fn border_image_shorthand_should_parse_without_width() {
fn border_image_shorthand_should_parse_without_outset() {
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("linear-gradient(red, blue) 30 30% 45 fill / 20px 40px round");
let result = border_image::parse_value(&context, &mut parser).unwrap();
@ -65,7 +65,7 @@ fn border_image_shorthand_should_parse_without_outset() {
fn border_image_shorthand_should_parse_without_width_or_outset() {
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("linear-gradient(red, blue) 30 30% 45 fill round");
let result = border_image::parse_value(&context, &mut parser).unwrap();
@ -81,7 +81,7 @@ fn border_image_shorthand_should_parse_without_width_or_outset() {
fn border_image_shorthand_should_parse_with_just_source() {
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("linear-gradient(red, blue)");
let result = border_image::parse_value(&context, &mut parser).unwrap();
@ -97,7 +97,7 @@ fn border_image_shorthand_should_parse_with_just_source() {
fn border_image_outset_should_error_on_negative_length() {
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("-1em");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result, Err(()));
@ -107,7 +107,7 @@ fn border_image_outset_should_error_on_negative_length() {
fn border_image_outset_should_error_on_negative_number() {
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("-15");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result, Err(()));
@ -117,7 +117,7 @@ fn border_image_outset_should_error_on_negative_number() {
fn border_image_outset_should_return_number_on_plain_zero() {
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("0");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(border_image_outset, "0"));
@ -127,7 +127,7 @@ fn border_image_outset_should_return_number_on_plain_zero() {
fn border_image_outset_should_return_length_on_length_zero() {
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("0em");
let result = border_image_outset::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(border_image_outset, "0em"));

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use servo_url::ServoUrl;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]
@ -20,7 +20,7 @@ fn test_column_width() {
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 negative = Parser::new("-6px");
assert!(column_width::parse(&context, &mut negative).is_err());
@ -37,7 +37,7 @@ fn test_column_gap() {
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 negative = Parser::new("-6px");
assert!(column_gap::parse(&context, &mut negative).is_err());

View file

@ -5,7 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
#[test]
fn contain_longhand_should_parse_correctly() {

View file

@ -8,7 +8,7 @@ use parsing::parse;
use servo_url::ServoUrl;
use style::parser::ParserContext;
use style::properties::longhands::{self, perspective_origin, transform_origin};
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]
@ -39,7 +39,7 @@ fn test_clip() {
fn test_longhands_parse_origin() {
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("1px some-rubbish");
let parsed = longhands::parse_origin(&context, &mut parser);

View file

@ -9,7 +9,7 @@ use style::parser::ParserContext;
use style::properties::longhands::{font_feature_settings, font_weight};
use style::properties::longhands::font_feature_settings::computed_value;
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]
@ -54,7 +54,7 @@ fn font_feature_settings_should_parse_properly() {
fn font_feature_settings_should_throw_on_bad_input() {
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 empty = Parser::new("");
assert!(font_feature_settings::parse(&context, &mut empty).is_err());
@ -105,7 +105,7 @@ fn font_weight_keyword_should_preserve_keyword() {
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("normal");
let result = font_weight::parse(&context, &mut parser);
assert_eq!(result.unwrap(), SpecifiedValue::Normal);

View file

@ -10,7 +10,7 @@ use style::font_metrics::ServoMetricsProvider;
use style::media_queries::{Device, MediaType};
use style::parser::ParserContext;
use style::properties::ComputedValues;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style::values::computed;
use style::values::computed::{Angle, Context, ToComputedValue};
use style::values::specified;

View file

@ -5,7 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
#[test]
fn image_orientation_longhand_should_parse_properly() {

View file

@ -5,7 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
#[test]
fn negative_letter_spacing_should_parse_properly() {
@ -112,7 +112,7 @@ fn webkit_text_stroke_shorthand_should_parse_properly() {
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("thin red");
let result = _webkit_text_stroke::parse_value(&context, &mut parser).unwrap();
@ -134,7 +134,7 @@ fn line_height_should_return_number_on_plain_zero() {
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("0");
let result = line_height::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(line_height, "0"));
@ -148,7 +148,7 @@ fn line_height_should_return_length_on_length_zero() {
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("0px");
let result = line_height::parse(&context, &mut parser);
assert_eq!(result.unwrap(), parse_longhand!(line_height, "0px"));

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::{Parse, ParserContext};
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style::values::specified::length::Length;
use style_traits::ToCss;

View file

@ -9,13 +9,13 @@ use style::parser::ParserContext;
use style::properties::longhands::{mask_clip, mask_composite, mask_image, mask_mode};
use style::properties::longhands::{mask_origin, mask_position_x, mask_position_y, mask_repeat, mask_size};
use style::properties::shorthands::mask;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
#[test]
fn mask_shorthand_should_parse_all_available_properties_when_specified() {
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("url(\"http://servo/test.png\") luminance 7px 4px / 70px 50px \
repeat-x padding-box border-box subtract");
let result = mask::parse_value(&context, &mut parser).unwrap();
@ -35,7 +35,7 @@ fn mask_shorthand_should_parse_all_available_properties_when_specified() {
fn mask_shorthand_should_parse_when_some_fields_set() {
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("14px 40px repeat-y");
let result = mask::parse_value(&context, &mut parser).unwrap();
@ -65,7 +65,7 @@ fn mask_shorthand_should_parse_when_some_fields_set() {
fn mask_shorthand_should_parse_position_and_size_correctly() {
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("7px 4px");
let result = mask::parse_value(&context, &mut parser).unwrap();
@ -90,7 +90,7 @@ fn mask_shorthand_should_parse_position_and_size_correctly() {
fn mask_shorthand_should_parse_origin_and_clip_correctly() {
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("padding-box content-box");
let result = mask::parse_value(&context, &mut parser).unwrap();
@ -114,7 +114,7 @@ fn mask_shorthand_should_parse_origin_and_clip_correctly() {
fn mask_shorthand_should_parse_mode_everywhere() {
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("luminance 7px 4px repeat-x padding-box");
assert!(mask::parse_value(&context, &mut parser).is_ok());
@ -155,7 +155,7 @@ fn mask_repeat_should_parse_longhand_correctly() {
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));
// repeat-x is not available in longhand form.
let mut parser = Parser::new("repeat-x no-repeat");

View file

@ -7,12 +7,12 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
fn parse<T, F: Fn(&ParserContext, &mut Parser) -> Result<T, ()>>(f: F, s: &str) -> Result<T, ()> {
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 mut parser = Parser::new(s);
f(&context, &mut parser)
}
@ -26,7 +26,7 @@ macro_rules! assert_roundtrip_with_context {
($fun:expr,$input:expr, $output:expr) => {
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 mut parser = Parser::new($input);
let parsed = $fun(&context, &mut parser)
.expect(&format!("Failed to parse {}", $input));
@ -64,7 +64,7 @@ macro_rules! assert_parser_exhausted {
($name:ident, $string:expr, $should_exhausted:expr) => {{
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 mut parser = Parser::new($string);
let parsed = $name::parse(&context, &mut parser);
assert_eq!(parsed.is_ok(), true);
@ -76,7 +76,7 @@ macro_rules! parse_longhand {
($name:ident, $s:expr) => {{
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));
$name::parse(&context, &mut Parser::new($s)).unwrap()
}};
}

View file

@ -5,7 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]
@ -29,7 +29,7 @@ fn test_outline_style() {
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 mut parser = Parser::new(r#"hidden"#);
let parsed = outline_style::parse(&context, &mut parser);
assert!(parsed.is_err());

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::{Parse, ParserContext};
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style::values::specified::position::*;
use style_traits::ToCss;

View file

@ -7,7 +7,7 @@ use media_queries::CSSErrorReporterTest;
use selectors::parser::SelectorList;
use style::parser::ParserContext;
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylesheets::{Origin, Namespaces};
use style::stylesheets::{CssRuleType, Origin, Namespaces};
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SelectorList<SelectorImpl>, ()> {
let mut ns = Namespaces::default();

View file

@ -6,7 +6,7 @@ use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]

View file

@ -5,7 +5,7 @@
use cssparser::Parser;
use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]

View file

@ -7,7 +7,7 @@ use media_queries::CSSErrorReporterTest;
use parsing::parse;
use style::parser::ParserContext;
use style::properties::longhands::transition_timing_function;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style_traits::ToCss;
#[test]

View file

@ -6,7 +6,7 @@ use cssparser::{Color, Parser, RGBA};
use media_queries::CSSErrorReporterTest;
use servo_url::ServoUrl;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::stylesheets::{CssRuleType, Origin};
use style::values::{Auto, Either};
use style::values::specified::CSSColor;
use style_traits::ToCss;
@ -28,7 +28,7 @@ fn test_moz_user_select() {
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 negative = Parser::new("potato");
assert!(_moz_user_select::parse(&context, &mut negative).is_err());