mirror of
https://github.com/servo/servo.git
synced 2025-08-17 11:25:35 +01:00
Replace Stylesheet::set_media with a constructor argument
This commit is contained in:
parent
f4dcc38816
commit
236c575c50
8 changed files with 29 additions and 31 deletions
|
@ -26,8 +26,9 @@ impl ParseErrorReporter for CSSErrorReporterTest {
|
|||
|
||||
fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaList, &str) {
|
||||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest),
|
||||
ParserContextExtraData::default());
|
||||
let stylesheet = Stylesheet::from_str(
|
||||
css, url, Origin::Author, Default::default(),
|
||||
Box::new(CSSErrorReporterTest), ParserContextExtraData::default());
|
||||
let mut rule_count = 0;
|
||||
media_queries(&stylesheet.rules.0.read(), &mut |mq| {
|
||||
rule_count += 1;
|
||||
|
@ -49,8 +50,9 @@ fn media_queries<F>(rules: &[CssRule], f: &mut F) where F: FnMut(&MediaList) {
|
|||
|
||||
fn media_query_test(device: &Device, css: &str, expected_rule_count: usize) {
|
||||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let ss = Stylesheet::from_str(css, url, Origin::Author, Box::new(CSSErrorReporterTest),
|
||||
ParserContextExtraData::default());
|
||||
let ss = Stylesheet::from_str(
|
||||
css, url, Origin::Author, Default::default(),
|
||||
Box::new(CSSErrorReporterTest), ParserContextExtraData::default());
|
||||
let mut rule_count = 0;
|
||||
ss.effective_style_rules(device, |_| rule_count += 1);
|
||||
assert!(rule_count == expected_rule_count, css.to_owned());
|
||||
|
|
|
@ -49,7 +49,7 @@ fn test_parse_stylesheet() {
|
|||
}
|
||||
}";
|
||||
let url = ServoUrl::parse("about::test").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent,
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent, Default::default(),
|
||||
Box::new(CSSErrorReporterTest),
|
||||
ParserContextExtraData::default());
|
||||
let expected = Stylesheet {
|
||||
|
@ -320,7 +320,7 @@ fn test_report_error_stylesheet() {
|
|||
|
||||
let errors = error_reporter.errors.clone();
|
||||
|
||||
Stylesheet::from_str(css, url, Origin::UserAgent, error_reporter,
|
||||
Stylesheet::from_str(css, url, Origin::UserAgent, Default::default(), error_reporter,
|
||||
ParserContextExtraData::default());
|
||||
|
||||
let mut errors = errors.lock().unwrap();
|
||||
|
|
|
@ -23,6 +23,7 @@ macro_rules! stylesheet {
|
|||
$css,
|
||||
ServoUrl::parse("http://localhost").unwrap(),
|
||||
Origin::$origin,
|
||||
Default::default(),
|
||||
$error_reporter,
|
||||
ParserContextExtraData::default()
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue