diff --git a/tests/unit/style/lib.rs b/tests/unit/style/lib.rs index d8e5464b75e..2c46bb65063 100644 --- a/tests/unit/style/lib.rs +++ b/tests/unit/style/lib.rs @@ -45,7 +45,7 @@ mod writing_modes { #[test] fn initial_writing_mode_is_empty() { assert_eq!( - WritingMode::new(INITIAL_SERVO_VALUES.get_inheritedbox()), + WritingMode::new(INITIAL_SERVO_VALUES.get_inherited_box()), WritingMode::empty(), ) } diff --git a/tests/unit/style/media_queries.rs b/tests/unit/style/media_queries.rs index 58b878bfb8d..044dee3db72 100644 --- a/tests/unit/style/media_queries.rs +++ b/tests/unit/style/media_queries.rs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use cssparser::SourceLocation; use euclid::TypedScale; use euclid::TypedSize2D; use servo_arc::Arc; @@ -10,7 +9,6 @@ use servo_url::ServoUrl; use std::borrow::ToOwned; use style::Atom; use style::context::QuirksMode; -use style::error_reporting::{ParseErrorReporter, ContextualParseError}; use style::media_queries::*; use style::servo::media_queries::*; use style::shared_lock::SharedRwLock; @@ -18,18 +16,9 @@ use style::stylesheets::{AllRules, Stylesheet, StylesheetInDocument, Origin, Css use style::values::{CustomIdent, specified}; use style_traits::ToCss; -pub struct CSSErrorReporterTest; - -impl ParseErrorReporter for CSSErrorReporterTest { - fn report_error(&self, - _url: &ServoUrl, - _location: SourceLocation, - _error: ContextualParseError) { - } -} - fn test_media_rule(css: &str, callback: F) - where F: Fn(&MediaList, &str), +where + F: Fn(&MediaList, &str), { let url = ServoUrl::parse("http://localhost").unwrap(); let css_str = css.to_owned(); @@ -37,7 +26,7 @@ fn test_media_rule(css: &str, callback: F) let media_list = Arc::new(lock.wrap(MediaList::empty())); let stylesheet = Stylesheet::from_str( css, url, Origin::Author, media_list, lock, - None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0); + None, None, QuirksMode::NoQuirks, 0); let dummy = Device::new(MediaType::screen(), TypedSize2D::new(200.0, 100.0), TypedScale::new(1.0)); let mut rule_count = 0; let guard = stylesheet.shared_lock.read(); @@ -56,7 +45,7 @@ fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) { let media_list = Arc::new(lock.wrap(MediaList::empty())); let ss = Stylesheet::from_str( css, url, Origin::Author, media_list, lock, - None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0); + None, None, QuirksMode::NoQuirks, 0); let mut rule_count = 0; ss.effective_style_rules(device, &ss.shared_lock.read(), |_| rule_count += 1); assert!(rule_count == expected_rule_count, css.to_owned()); diff --git a/tests/unit/style/parsing/length.rs b/tests/unit/style/parsing/length.rs deleted file mode 100644 index 0d506926ad8..00000000000 --- a/tests/unit/style/parsing/length.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use cssparser::{Parser, ParserInput}; -use parsing::parse; -use style::context::QuirksMode; -use style::parser::{Parse, ParserContext}; -use style::stylesheets::{CssRuleType, Origin}; -use style::values::specified::length::{AbsoluteLength, Length, NoCalcLength}; -use style_traits::{ParsingMode, ToCss}; - -#[test] -fn test_calc() { - assert!(parse(Length::parse, "calc(1px+ 2px)").is_err()); - assert!(parse(Length::parse, "calc(calc(1px) + calc(1px + 4px))").is_ok()); - assert!(parse(Length::parse, "calc( 1px + 2px )").is_ok()); - assert!(parse(Length::parse, "calc(1px + 2px )").is_ok()); - assert!(parse(Length::parse, "calc( 1px + 2px)").is_ok()); - assert!(parse(Length::parse, "calc( 1px + 2px / ( 1 + 2 - 1))").is_ok()); -} - -#[test] -fn test_length_literals() { - assert_roundtrip_with_context!(Length::parse, "0.33px", "0.33px"); - assert_roundtrip_with_context!(Length::parse, "0.33in", "0.33in"); - assert_roundtrip_with_context!(Length::parse, "0.33cm", "0.33cm"); - assert_roundtrip_with_context!(Length::parse, "0.33mm", "0.33mm"); - assert_roundtrip_with_context!(Length::parse, "0.33q", "0.33q"); - assert_roundtrip_with_context!(Length::parse, "0.33pt", "0.33pt"); - assert_roundtrip_with_context!(Length::parse, "0.33pc", "0.33pc"); -} - -#[test] -fn test_parsing_modes() { - // In default length mode, non-zero lengths must have a unit. - assert!(parse(Length::parse, "1").is_err()); - - // In SVG length mode, non-zero lengths are assumed to be px. - let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); - let context = ParserContext::new(Origin::Author, &url, - Some(CssRuleType::Style), ParsingMode::ALLOW_UNITLESS_LENGTH, - QuirksMode::NoQuirks); - let mut input = ParserInput::new("1"); - let mut parser = Parser::new(&mut input); - let result = Length::parse(&context, &mut parser); - assert!(result.is_ok()); - assert_eq!(result.unwrap(), Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(1.)))); -} diff --git a/tests/unit/style/parsing/mod.rs b/tests/unit/style/parsing/mod.rs index d89e76378f7..b75e3a7ce42 100644 --- a/tests/unit/style/parsing/mod.rs +++ b/tests/unit/style/parsing/mod.rs @@ -21,7 +21,7 @@ where F: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result> { let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new(Origin::Author, &url, Some(CssRuleType::Style), ParsingMode::DEFAULT, - QuirksMode::NoQuirks); + QuirksMode::NoQuirks, None); let mut parser = Parser::new(input); f(&context, &mut parser) } @@ -111,7 +111,6 @@ mod column; mod effects; mod image; mod inherited_text; -mod length; mod outline; mod position; mod selectors; @@ -119,4 +118,3 @@ mod supports; mod text_overflow; mod transition_duration; mod transition_timing_function; -mod value; diff --git a/tests/unit/style/parsing/value.rs b/tests/unit/style/parsing/value.rs deleted file mode 100644 index d464831f56b..00000000000 --- a/tests/unit/style/parsing/value.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use cssparser::{Parser, ParserInput}; -use style::context::QuirksMode; -use style::parser::ParserContext; -use style::stylesheets::{CssRuleType, Origin}; -use style::values::specified::Number; -use style_traits::ParsingMode; - -#[test] -fn test_parsing_allo_all_numeric_values() { - // In SVG length mode, non-zero lengths are assumed to be px. - let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); - let context = ParserContext::new(Origin::Author, &url, - Some(CssRuleType::Style), ParsingMode::ALLOW_ALL_NUMERIC_VALUES, - QuirksMode::NoQuirks); - let mut input = ParserInput::new("-1"); - let mut parser = Parser::new(&mut input); - let result = Number::parse_non_negative(&context, &mut parser); - assert!(result.is_ok()); - assert_eq!(result.unwrap(), Number::new(-1.)); -} - diff --git a/tests/unit/style/properties/background.rs b/tests/unit/style/properties/background.rs deleted file mode 100644 index 6c0b27a49fe..00000000000 --- a/tests/unit/style/properties/background.rs +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use properties::parse; -use style::properties::longhands::background_size; - -#[test] -fn background_size_should_reject_negative_values() { - assert!(parse(|c, _, i| background_size::parse(c, i), "-40% -40%").is_err()); -} diff --git a/tests/unit/style/properties/mod.rs b/tests/unit/style/properties/mod.rs index ccd4fdd7a0b..725aabc42a4 100644 --- a/tests/unit/style/properties/mod.rs +++ b/tests/unit/style/properties/mod.rs @@ -3,34 +3,32 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::{Parser, ParserInput}; -use media_queries::CSSErrorReporterTest; use style::context::QuirksMode; -use style::parser::{ParserContext, ParserErrorContext}; +use style::parser::ParserContext; use style::stylesheets::{CssRuleType, Origin}; use style_traits::{ParsingMode, ParseError}; fn parse(f: F, s: &'static str) -> Result> - where F: for<'t> Fn(&ParserContext, - &ParserErrorContext, - &mut Parser<'static, 't>) -> Result> +where + F: for<'t> Fn( + &ParserContext, + &mut Parser<'static, 't>, + ) -> Result> { let mut input = ParserInput::new(s); parse_input(f, &mut input) } fn parse_input<'i: 't, 't, T, F>(f: F, input: &'t mut ParserInput<'i>) -> Result> - where F: Fn(&ParserContext, - &ParserErrorContext, - &mut Parser<'i, 't>) -> Result> +where + F: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result>, { let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new(Origin::Author, &url, Some(CssRuleType::Style), ParsingMode::DEFAULT, - QuirksMode::NoQuirks); - let reporter = CSSErrorReporterTest; - let error_context = ParserErrorContext { error_reporter: &reporter }; + QuirksMode::NoQuirks, None); let mut parser = Parser::new(input); - f(&context, &error_context, &mut parser) + f(&context, &mut parser) } macro_rules! assert_roundtrip_with_context { @@ -38,7 +36,7 @@ macro_rules! assert_roundtrip_with_context { assert_roundtrip_with_context!($fun, $string, $string); }; ($fun:expr, $input:expr, $output:expr) => {{ - let serialized = parse(|context, _, i| { + let serialized = parse(|context, i| { let parsed = $fun(context, i) .expect(&format!("Failed to parse {}", $input)); let serialized = ToCss::to_css_string(&parsed); @@ -47,7 +45,7 @@ macro_rules! assert_roundtrip_with_context { }, $input).unwrap(); let mut input = ::cssparser::ParserInput::new(&serialized); - let unwrapped = parse_input(|context, _, i| { + let unwrapped = parse_input(|context, i| { let re_parsed = $fun(context, i) .expect(&format!("Failed to parse serialization {}", $input)); let re_serialized = ToCss::to_css_string(&re_parsed); @@ -58,6 +56,5 @@ macro_rules! assert_roundtrip_with_context { }} } -mod background; mod scaffolding; mod serialization; diff --git a/tests/unit/style/properties/serialization.rs b/tests/unit/style/properties/serialization.rs index e7b5689e05f..4ab79d25a2f 100644 --- a/tests/unit/style/properties/serialization.rs +++ b/tests/unit/style/properties/serialization.rs @@ -451,7 +451,7 @@ mod shorthand_serialization { border-left: 4px solid; \ border-image: none;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -503,7 +503,7 @@ mod shorthand_serialization { background-origin: border-box; \ background-clip: padding-box;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -527,7 +527,7 @@ mod shorthand_serialization { background-origin: padding-box; \ background-clip: padding-box;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -551,7 +551,7 @@ mod shorthand_serialization { background-origin: border-box, padding-box; \ background-clip: padding-box, padding-box;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -582,7 +582,7 @@ mod shorthand_serialization { background-origin: border-box; \ background-clip: padding-box, padding-box;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -596,7 +596,7 @@ mod shorthand_serialization { let block_text = "\ background-position-x: 30px;\ background-position-y: bottom 20px;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); assert_eq!(serialization, "background-position: left 30px bottom 20px;"); @@ -605,7 +605,7 @@ mod shorthand_serialization { let block_text = "\ background-position-x: center;\ background-position-y: 20px;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); assert_eq!(serialization, "background-position: center 20px;"); } @@ -691,7 +691,7 @@ mod shorthand_serialization { animation-iteration-count: infinite;\ animation-play-state: paused;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -710,7 +710,7 @@ mod shorthand_serialization { animation-iteration-count: infinite, 2;\ animation-play-state: paused, running;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -736,7 +736,7 @@ mod shorthand_serialization { animation-iteration-count: infinite, 2; \ animation-play-state: paused, running;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -753,7 +753,7 @@ mod shorthand_serialization { animation-iteration-count: infinite, 2; \ animation-play-state: paused, running;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -771,7 +771,7 @@ mod shorthand_serialization { transition-delay: 4s; \ transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2);"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -785,7 +785,7 @@ mod shorthand_serialization { transition-delay: 4s, 5s; \ transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -807,7 +807,7 @@ mod shorthand_serialization { transition-delay: 4s, 5s; \ transition-timing-function: cubic-bezier(0.2, 5, 0.5, 2), ease;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -820,7 +820,7 @@ mod shorthand_serialization { transition-duration: 3s; \ transition-delay: 4s; \ transition-timing-function: steps(2, start);"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -833,7 +833,7 @@ mod shorthand_serialization { transition-duration: 3s; \ transition-delay: 4s; \ transition-timing-function: frames(2);"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); @@ -846,7 +846,7 @@ mod shorthand_serialization { #[test] fn css_wide_keywords_should_be_parsed() { let block_text = "--a:inherit;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); assert_eq!(serialization, "--a: inherit;"); @@ -855,7 +855,7 @@ mod shorthand_serialization { #[test] fn non_keyword_custom_property_should_be_unparsed() { let block_text = "--main-color: #06c;"; - let block = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), block_text).unwrap(); + let block = parse(|c, i| Ok(parse_property_declaration_list(c, i)), block_text).unwrap(); let serialization = block.to_css_string(); assert_eq!(serialization, block_text); @@ -885,7 +885,7 @@ mod shorthand_serialization { let shadow_decl = BoxShadowList(vec![shadow_val]); properties.push(PropertyDeclaration::BoxShadow(shadow_decl)); let shadow_css = "box-shadow: 1px 2px 3px 4px;"; - let shadow = parse(|c, e, i| Ok(parse_property_declaration_list(c, e, i)), shadow_css).unwrap(); + let shadow = parse(|c, i| Ok(parse_property_declaration_list(c, i)), shadow_css).unwrap(); assert_eq!(shadow.to_css_string(), shadow_css); } diff --git a/tests/unit/style/rule_tree/bench.rs b/tests/unit/style/rule_tree/bench.rs index 54af9d39532..c1ea58f5248 100644 --- a/tests/unit/style/rule_tree/bench.rs +++ b/tests/unit/style/rule_tree/bench.rs @@ -55,7 +55,7 @@ fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> { media, lock, None, - &ErrorringErrorReporter, + Some(&ErrorringErrorReporter), QuirksMode::NoQuirks, 0); let guard = s.shared_lock.read(); diff --git a/tests/unit/style/stylesheets.rs b/tests/unit/style/stylesheets.rs index be4e2d9cbc1..632d51074fe 100644 --- a/tests/unit/style/stylesheets.rs +++ b/tests/unit/style/stylesheets.rs @@ -4,7 +4,6 @@ use cssparser::{self, SourceLocation}; use html5ever::{Namespace as NsAtom}; -use media_queries::CSSErrorReporterTest; use parking_lot::RwLock; use selectors::attr::*; use selectors::parser::*; @@ -71,7 +70,7 @@ fn test_parse_stylesheet() { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); let stylesheet = Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock, - None, &CSSErrorReporterTest, QuirksMode::NoQuirks, 0); + None, None, QuirksMode::NoQuirks, 0); let mut namespaces = Namespaces::default(); namespaces.default = Some(ns!(html)); let expected = Stylesheet { @@ -345,7 +344,7 @@ fn test_report_error_stylesheet() { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); Stylesheet::from_str(css, url.clone(), Origin::UserAgent, media, lock, - None, &error_reporter, QuirksMode::NoQuirks, 5); + None, Some(&error_reporter), QuirksMode::NoQuirks, 5); error_reporter.assert_messages_contain(&[ (8, 18, "Unsupported property declaration: 'display: invalid;'"), @@ -387,7 +386,7 @@ fn test_no_report_unrecognized_vendor_properties() { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); Stylesheet::from_str(css, url, Origin::UserAgent, media, lock, - None, &error_reporter, QuirksMode::NoQuirks, 0); + None, Some(&error_reporter), QuirksMode::NoQuirks, 0); error_reporter.assert_messages_contain(&[ (4, 31, "Unsupported property declaration: '-moz-background-color: red;'"), @@ -406,7 +405,7 @@ fn test_source_map_url() { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); let stylesheet = Stylesheet::from_str(test.0, url.clone(), Origin::UserAgent, media, lock, - None, &CSSErrorReporterTest, QuirksMode::NoQuirks, + None, None, QuirksMode::NoQuirks, 0); let url_opt = stylesheet.contents.source_map_url.read(); assert_eq!(*url_opt, test.1); @@ -425,7 +424,7 @@ fn test_source_url() { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); let stylesheet = Stylesheet::from_str(test.0, url.clone(), Origin::UserAgent, media, lock, - None, &CSSErrorReporterTest, QuirksMode::NoQuirks, + None, None, QuirksMode::NoQuirks, 0); let url_opt = stylesheet.contents.source_url.read(); assert_eq!(*url_opt, test.1); diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 44759bed701..9243dbcb403 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -5,13 +5,12 @@ use cssparser::{Parser, ParserInput}; use euclid::TypedScale; use euclid::TypedSize2D; -use media_queries::CSSErrorReporterTest; use servo_arc::Arc; use servo_config::prefs::{PREFS, PrefValue}; use servo_url::ServoUrl; use style::context::QuirksMode; use style::media_queries::{Device, MediaList, MediaType}; -use style::parser::{ParserContext, ParserErrorContext}; +use style::parser::ParserContext; use style::shared_lock::{SharedRwLock, StylesheetGuards}; use style::stylesheets::{CssRuleType, Stylesheet, StylesheetInDocument, Origin}; use style::stylesheets::viewport_rule::*; @@ -22,10 +21,10 @@ use style_traits::{ParsingMode, PinchZoomFactor}; use style_traits::viewport::*; macro_rules! stylesheet { - ($css:expr, $origin:ident, $error_reporter:expr) => { - stylesheet!($css, $origin, $error_reporter, SharedRwLock::new()) + ($css:expr, $origin:ident) => { + stylesheet!($css, $origin, SharedRwLock::new()) }; - ($css:expr, $origin:ident, $error_reporter:expr, $shared_lock:expr) => { + ($css:expr, $origin:ident, $shared_lock:expr) => { Arc::new(Stylesheet::from_str( $css, ServoUrl::parse("http://localhost").unwrap(), @@ -33,7 +32,7 @@ macro_rules! stylesheet { Arc::new($shared_lock.wrap(MediaList::empty())), $shared_lock, None, - &$error_reporter, + None, QuirksMode::NoQuirks, 0 )) @@ -46,7 +45,7 @@ fn test_viewport_rule(css: &str, where F: Fn(&Vec, &str) { PREFS.set("layout.viewport.enabled", PrefValue::Boolean(true)); - let stylesheet = stylesheet!(css, Author, CSSErrorReporterTest); + let stylesheet = stylesheet!(css, Author); let mut rule_count = 0; stylesheet.effective_viewport_rules(&device, &stylesheet.shared_lock.read(), |rule| { rule_count += 1; @@ -259,15 +258,15 @@ fn cascading_within_viewport_rule() { fn multiple_stylesheets_cascading() { PREFS.set("layout.viewport.enabled", PrefValue::Boolean(true)); let device = Device::new(MediaType::screen(), TypedSize2D::new(800., 600.), TypedScale::new(1.0)); - let error_reporter = CSSErrorReporterTest; let shared_lock = SharedRwLock::new(); let stylesheets = vec![ stylesheet!("@viewport { min-width: 100px; min-height: 100px; zoom: 1; }", - UserAgent, error_reporter, shared_lock.clone()), + UserAgent, + shared_lock.clone()), stylesheet!("@viewport { min-width: 200px; min-height: 200px; }", - User, error_reporter, shared_lock.clone()), + User, shared_lock.clone()), stylesheet!("@viewport { min-width: 300px; }", - Author, error_reporter, shared_lock.clone()) + Author, shared_lock.clone()) ]; let declarations = Cascade::from_stylesheets( @@ -282,11 +281,11 @@ fn multiple_stylesheets_cascading() { let stylesheets = vec![ stylesheet!("@viewport { min-width: 100px !important; }", - UserAgent, error_reporter, shared_lock.clone()), + UserAgent, shared_lock.clone()), stylesheet!("@viewport { min-width: 200px !important; min-height: 200px !important; }", - User, error_reporter, shared_lock.clone()), + User, shared_lock.clone()), stylesheet!("@viewport { min-width: 300px !important; min-height: 300px !important; zoom: 3 !important; }", - Author, error_reporter, shared_lock.clone()) + Author, shared_lock.clone()) ]; let declarations = Cascade::from_stylesheets( stylesheets.iter().map(|s| (&**s, Origin::Author)), @@ -304,12 +303,11 @@ fn constrain_viewport() { let url = ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new(Origin::Author, &url, Some(CssRuleType::Viewport), ParsingMode::DEFAULT, - QuirksMode::NoQuirks); - let error_context = ParserErrorContext { error_reporter: &CSSErrorReporterTest }; + QuirksMode::NoQuirks, None); macro_rules! from_css { ($css:expr) => { - &ViewportRule::parse(&context, &error_context, &mut Parser::new(&mut $css)).unwrap() + &ViewportRule::parse(&context, &mut Parser::new(&mut $css)).unwrap() } }