style: Add a StylesheetLoader abstraction, and make it a no-op on Geckolib.

Servo doesn't compile at this stage.
This commit is contained in:
Emilio Cobos Álvarez 2016-12-16 12:10:05 +01:00
parent 444fef164e
commit a42cfae153
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 62 additions and 6 deletions

View file

@ -29,7 +29,8 @@ 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, Default::default(),
Box::new(CSSErrorReporterTest), ParserContextExtraData::default());
None, Box::new(CSSErrorReporterTest),
ParserContextExtraData::default());
let mut rule_count = 0;
media_queries(&stylesheet.rules.read().0, &mut |mq| {
rule_count += 1;
@ -53,7 +54,8 @@ 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, Default::default(),
Box::new(CSSErrorReporterTest), ParserContextExtraData::default());
None, 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());

View file

@ -52,6 +52,7 @@ fn test_parse_stylesheet() {
}";
let url = ServoUrl::parse("about::test").unwrap();
let stylesheet = Stylesheet::from_str(css, url.clone(), Origin::UserAgent, Default::default(),
None,
Box::new(CSSErrorReporterTest),
ParserContextExtraData::default());
let mut namespaces = Namespaces::default();
@ -332,7 +333,9 @@ fn test_report_error_stylesheet() {
let errors = error_reporter.errors.clone();
Stylesheet::from_str(css, url, Origin::UserAgent, Default::default(), error_reporter,
Stylesheet::from_str(css, url, Origin::UserAgent, Default::default(),
None,
error_reporter,
ParserContextExtraData::default());
let mut errors = errors.lock().unwrap();

View file

@ -25,6 +25,7 @@ macro_rules! stylesheet {
ServoUrl::parse("http://localhost").unwrap(),
Origin::$origin,
Default::default(),
None,
$error_reporter,
ParserContextExtraData::default()
))

View file

@ -16,5 +16,8 @@ extern crate style_traits;
mod sanity_checks;
#[path = "../../../ports/geckolib/stylesheet_loader.rs"]
mod stylesheet_loader;
mod servo_function_signatures;