Make CSSRule always keep a pointer to its parent stylesheet

even when the parentStylesheet IDL attribute returns null.
This commit is contained in:
Simon Sapin 2016-11-28 16:33:47 +01:00
parent 0714e2291c
commit f1d49d3773
11 changed files with 84 additions and 69 deletions

View file

@ -23,17 +23,18 @@ pub struct CSSNamespaceRule {
}
impl CSSNamespaceRule {
fn new_inherited(parent: Option<&CSSStyleSheet>, namespacerule: Arc<RwLock<NamespaceRule>>) -> CSSNamespaceRule {
fn new_inherited(parent_stylesheet: &CSSStyleSheet, namespacerule: Arc<RwLock<NamespaceRule>>)
-> CSSNamespaceRule {
CSSNamespaceRule {
cssrule: CSSRule::new_inherited(parent),
cssrule: CSSRule::new_inherited(parent_stylesheet),
namespacerule: namespacerule,
}
}
#[allow(unrooted_must_root)]
pub fn new(window: &Window, parent: Option<&CSSStyleSheet>,
pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet,
namespacerule: Arc<RwLock<NamespaceRule>>) -> Root<CSSNamespaceRule> {
reflect_dom_object(box CSSNamespaceRule::new_inherited(parent, namespacerule),
reflect_dom_object(box CSSNamespaceRule::new_inherited(parent_stylesheet, namespacerule),
window,
CSSNamespaceRuleBinding::Wrap)
}