aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorJ. Ryan Stinnett <jryans@gmail.com>2017-04-10 09:24:32 +0800
committerJ. Ryan Stinnett <jryans@gmail.com>2017-04-12 16:40:17 +0800
commit4574cd8ea61b56b1fb553b5e4fe765888d419945 (patch)
tree69ba122f702f15bbecc15291a3d9782860264369 /tests/unit
parenta093b0a087d45bff0bb8a7039c8bfb8ec6706442 (diff)
downloadservo-4574cd8ea61b56b1fb553b5e4fe765888d419945.tar.gz
servo-4574cd8ea61b56b1fb553b5e4fe765888d419945.zip
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
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/style/parsing/animation.rs2
-rw-r--r--tests/unit/style/parsing/background.rs12
-rw-r--r--tests/unit/style/parsing/basic_shape.rs2
-rw-r--r--tests/unit/style/parsing/border.rs20
-rw-r--r--tests/unit/style/parsing/box_.rs2
-rw-r--r--tests/unit/style/parsing/column.rs6
-rw-r--r--tests/unit/style/parsing/containment.rs2
-rw-r--r--tests/unit/style/parsing/effects.rs4
-rw-r--r--tests/unit/style/parsing/font.rs6
-rw-r--r--tests/unit/style/parsing/image.rs2
-rw-r--r--tests/unit/style/parsing/inherited_box.rs2
-rw-r--r--tests/unit/style/parsing/inherited_text.rs8
-rw-r--r--tests/unit/style/parsing/length.rs2
-rw-r--r--tests/unit/style/parsing/mask.rs14
-rw-r--r--tests/unit/style/parsing/mod.rs10
-rw-r--r--tests/unit/style/parsing/outline.rs4
-rw-r--r--tests/unit/style/parsing/position.rs2
-rw-r--r--tests/unit/style/parsing/selectors.rs2
-rw-r--r--tests/unit/style/parsing/text.rs2
-rw-r--r--tests/unit/style/parsing/text_overflow.rs2
-rw-r--r--tests/unit/style/parsing/transition_timing_function.rs2
-rw-r--r--tests/unit/style/parsing/ui.rs4
-rw-r--r--tests/unit/style/properties/background.rs4
-rw-r--r--tests/unit/style/properties/serialization.rs8
-rw-r--r--tests/unit/style/viewport.rs4
25 files changed, 64 insertions, 64 deletions
diff --git a/tests/unit/style/parsing/animation.rs b/tests/unit/style/parsing/animation.rs
index bf9f3b3e2ee..0cb0bc62a03 100644
--- a/tests/unit/style/parsing/animation.rs
+++ b/tests/unit/style/parsing/animation.rs
@@ -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]
diff --git a/tests/unit/style/parsing/background.rs b/tests/unit/style/parsing/background.rs
index 084c2e10201..d2fea3944c7 100644
--- a/tests/unit/style/parsing/background.rs
+++ b/tests/unit/style/parsing/background.rs
@@ -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();
diff --git a/tests/unit/style/parsing/basic_shape.rs b/tests/unit/style/parsing/basic_shape.rs
index dcb269c9397..0923499aed9 100644
--- a/tests/unit/style/parsing/basic_shape.rs
+++ b/tests/unit/style/parsing/basic_shape.rs
@@ -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;
diff --git a/tests/unit/style/parsing/border.rs b/tests/unit/style/parsing/border.rs
index 94a4d8f6ff3..e89d33b2b0f 100644
--- a/tests/unit/style/parsing/border.rs
+++ b/tests/unit/style/parsing/border.rs
@@ -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"));
diff --git a/tests/unit/style/parsing/box_.rs b/tests/unit/style/parsing/box_.rs
index e6b73a3b246..0f7925391a7 100644
--- a/tests/unit/style/parsing/box_.rs
+++ b/tests/unit/style/parsing/box_.rs
@@ -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]
diff --git a/tests/unit/style/parsing/column.rs b/tests/unit/style/parsing/column.rs
index f8aff1e04b7..cc8c8532db7 100644
--- a/tests/unit/style/parsing/column.rs
+++ b/tests/unit/style/parsing/column.rs
@@ -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());
diff --git a/tests/unit/style/parsing/containment.rs b/tests/unit/style/parsing/containment.rs
index de697cb8441..d5a7bea9723 100644
--- a/tests/unit/style/parsing/containment.rs
+++ b/tests/unit/style/parsing/containment.rs
@@ -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() {
diff --git a/tests/unit/style/parsing/effects.rs b/tests/unit/style/parsing/effects.rs
index 2b8ef18c2e5..aa53c3c209e 100644
--- a/tests/unit/style/parsing/effects.rs
+++ b/tests/unit/style/parsing/effects.rs
@@ -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);
diff --git a/tests/unit/style/parsing/font.rs b/tests/unit/style/parsing/font.rs
index 6d44e1f532f..19aa0f12172 100644
--- a/tests/unit/style/parsing/font.rs
+++ b/tests/unit/style/parsing/font.rs
@@ -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);
diff --git a/tests/unit/style/parsing/image.rs b/tests/unit/style/parsing/image.rs
index 68ccec16a5f..4859abf41df 100644
--- a/tests/unit/style/parsing/image.rs
+++ b/tests/unit/style/parsing/image.rs
@@ -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;
diff --git a/tests/unit/style/parsing/inherited_box.rs b/tests/unit/style/parsing/inherited_box.rs
index 749641c79cf..8eb0cd8d48d 100644
--- a/tests/unit/style/parsing/inherited_box.rs
+++ b/tests/unit/style/parsing/inherited_box.rs
@@ -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() {
diff --git a/tests/unit/style/parsing/inherited_text.rs b/tests/unit/style/parsing/inherited_text.rs
index b0d474b6024..ce25252b25d 100644
--- a/tests/unit/style/parsing/inherited_text.rs
+++ b/tests/unit/style/parsing/inherited_text.rs
@@ -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"));
diff --git a/tests/unit/style/parsing/length.rs b/tests/unit/style/parsing/length.rs
index 39407441aaf..bc94ab5ba91 100644
--- a/tests/unit/style/parsing/length.rs
+++ b/tests/unit/style/parsing/length.rs
@@ -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;
diff --git a/tests/unit/style/parsing/mask.rs b/tests/unit/style/parsing/mask.rs
index 15f498c4c73..b3f3912d7c9 100644
--- a/tests/unit/style/parsing/mask.rs
+++ b/tests/unit/style/parsing/mask.rs
@@ -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");
diff --git a/tests/unit/style/parsing/mod.rs b/tests/unit/style/parsing/mod.rs
index cb5181fc6cc..b6da9a138d6 100644
--- a/tests/unit/style/parsing/mod.rs
+++ b/tests/unit/style/parsing/mod.rs
@@ -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()
}};
}
diff --git a/tests/unit/style/parsing/outline.rs b/tests/unit/style/parsing/outline.rs
index 3603ccda1db..787d4172055 100644
--- a/tests/unit/style/parsing/outline.rs
+++ b/tests/unit/style/parsing/outline.rs
@@ -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());
diff --git a/tests/unit/style/parsing/position.rs b/tests/unit/style/parsing/position.rs
index 8c56b323e67..04da426ded8 100644
--- a/tests/unit/style/parsing/position.rs
+++ b/tests/unit/style/parsing/position.rs
@@ -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;
diff --git a/tests/unit/style/parsing/selectors.rs b/tests/unit/style/parsing/selectors.rs
index 3654360b07c..24ccc11d546 100644
--- a/tests/unit/style/parsing/selectors.rs
+++ b/tests/unit/style/parsing/selectors.rs
@@ -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();
diff --git a/tests/unit/style/parsing/text.rs b/tests/unit/style/parsing/text.rs
index d1646c0b887..298d8255e7f 100644
--- a/tests/unit/style/parsing/text.rs
+++ b/tests/unit/style/parsing/text.rs
@@ -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]
diff --git a/tests/unit/style/parsing/text_overflow.rs b/tests/unit/style/parsing/text_overflow.rs
index fd2b6b91cab..0e57e733477 100644
--- a/tests/unit/style/parsing/text_overflow.rs
+++ b/tests/unit/style/parsing/text_overflow.rs
@@ -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]
diff --git a/tests/unit/style/parsing/transition_timing_function.rs b/tests/unit/style/parsing/transition_timing_function.rs
index fe24b2453c3..5b27ab75188 100644
--- a/tests/unit/style/parsing/transition_timing_function.rs
+++ b/tests/unit/style/parsing/transition_timing_function.rs
@@ -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]
diff --git a/tests/unit/style/parsing/ui.rs b/tests/unit/style/parsing/ui.rs
index 10342947ea5..07a1b0a5d4b 100644
--- a/tests/unit/style/parsing/ui.rs
+++ b/tests/unit/style/parsing/ui.rs
@@ -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());
diff --git a/tests/unit/style/properties/background.rs b/tests/unit/style/properties/background.rs
index 4640845ae85..c83286c10c8 100644
--- a/tests/unit/style/properties/background.rs
+++ b/tests/unit/style/properties/background.rs
@@ -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%"));
diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs
index 1dc93fc7656..04dffa1aa5a 100644
--- a/tests/unit/style/properties/serialization.rs
+++ b/tests/unit/style/properties/serialization.rs
@@ -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);
diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs
index dc15436af5e..252aa266478 100644
--- a/tests/unit/style/viewport.rs
+++ b/tests/unit/style/viewport.rs
@@ -10,7 +10,7 @@ use servo_url::ServoUrl;
use style::media_queries::{Device, MediaType};
use style::parser::{Parse, ParserContext};
use style::shared_lock::SharedRwLock;
-use style::stylesheets::{Stylesheet, Origin};
+use style::stylesheets::{CssRuleType, Stylesheet, Origin};
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
use style::values::specified::NoCalcLength::{self, ViewportPercentage};
use style::values::specified::ViewportPercentageLength::Vw;
@@ -290,7 +290,7 @@ fn multiple_stylesheets_cascading() {
fn constrain_viewport() {
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::Viewport));
macro_rules! from_css {
($css:expr) => {