mirror of
https://github.com/servo/servo.git
synced 2025-08-28 16:48:22 +01:00
fixup! Add an extra data field to ParserContext.
This commit is contained in:
parent
e75b1c3b32
commit
f2b1ef4e45
3 changed files with 13 additions and 6 deletions
|
@ -8,6 +8,7 @@ use euclid::size::Size2D;
|
|||
use std::borrow::ToOwned;
|
||||
use style::error_reporting::ParseErrorReporter;
|
||||
use style::media_queries::*;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::servo::Stylesheet;
|
||||
use style::stylesheets::{Origin, CSSRuleIteratorExt};
|
||||
use style::values::specified;
|
||||
|
@ -25,7 +26,8 @@ impl ParseErrorReporter for CSSErrorReporterTest {
|
|||
|
||||
fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest),
|
||||
ParserContextExtraData::default());
|
||||
let mut rule_count = 0;
|
||||
for rule in stylesheet.rules().media() {
|
||||
rule_count += 1;
|
||||
|
@ -36,7 +38,8 @@ fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str)
|
|||
|
||||
fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let ss = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest));
|
||||
let ss = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest),
|
||||
ParserContextExtraData::default());
|
||||
let rule_count = ss.effective_rules(device).style().count();
|
||||
assert!(rule_count == expected_rule_count, css.to_owned());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue