mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
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:
parent
444fef164e
commit
a42cfae153
9 changed files with 62 additions and 6 deletions
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -25,6 +25,7 @@ macro_rules! stylesheet {
|
|||
ServoUrl::parse("http://localhost").unwrap(),
|
||||
Origin::$origin,
|
||||
Default::default(),
|
||||
None,
|
||||
$error_reporter,
|
||||
ParserContextExtraData::default()
|
||||
))
|
||||
|
|
|
@ -16,5 +16,8 @@ extern crate style_traits;
|
|||
|
||||
mod sanity_checks;
|
||||
|
||||
#[path = "../../../ports/geckolib/stylesheet_loader.rs"]
|
||||
mod stylesheet_loader;
|
||||
|
||||
mod servo_function_signatures;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue