Add invalidate_stylesheets to StyleSheetsListOwner trait

This commit is contained in:
Fernando Jiménez Moreno 2019-02-21 16:54:37 +01:00
parent 3dd38151d4
commit d77b9c6775
6 changed files with 17 additions and 35 deletions

View file

@ -13,7 +13,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::cssrule::CSSRule;
use crate::dom::element::Element;
use crate::dom::node::{document_from_node, shadow_root_from_node, window_from_node, Node};
use crate::dom::node::{document_from_node, stylesheets_owner_from_node, window_from_node, Node};
use crate::dom::window::Window;
use dom_struct::dom_struct;
use servo_arc::Arc;
@ -115,16 +115,8 @@ impl CSSStyleOwner {
if changed {
// If this is changed, see also
// CSSStyleRule::SetSelectorText, which does the same thing.
if let Some(shadow_root) =
shadow_root_from_node(rule.parent_stylesheet().owner().upcast::<Node>())
{
shadow_root.invalidate_stylesheets();
} else {
rule.global()
.as_window()
.Document()
.invalidate_stylesheets();
}
stylesheets_owner_from_node(rule.parent_stylesheet().owner().upcast::<Node>())
.invalidate_stylesheets();
}
result
},