Add base_url and namespaces to style::Stylesheet

This commit is contained in:
Simon Sapin 2016-11-28 16:16:59 +01:00
parent eb7032f6dd
commit 0714e2291c
3 changed files with 35 additions and 23 deletions

View file

@ -19,7 +19,8 @@ use style::parser::ParserContextExtraData;
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, DeclaredValue, longhands};
use style::properties::Importance;
use style::properties::longhands::animation_play_state;
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, StyleRule, KeyframesRule, Origin};
use style::stylesheets::{Origin, Namespaces};
use style::stylesheets::{Stylesheet, NamespaceRule, CssRule, StyleRule, KeyframesRule};
use style::values::specified::{LengthOrPercentageOrAuto, Percentage};
#[test]
@ -50,12 +51,16 @@ fn test_parse_stylesheet() {
}
}";
let url = ServoUrl::parse("about::test").unwrap();
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent, Default::default(),
let stylesheet = Stylesheet::from_str(css, url.clone(), Origin::UserAgent, Default::default(),
Box::new(CSSErrorReporterTest),
ParserContextExtraData::default());
let mut namespaces = Namespaces::default();
namespaces.default = Some(ns!(html));
let expected = Stylesheet {
origin: Origin::UserAgent,
media: Default::default(),
namespaces: RwLock::new(namespaces),
base_url: url,
dirty_on_viewport_size_change: AtomicBool::new(false),
disabled: AtomicBool::new(false),
rules: vec![