Auto merge of #6851 - dzbarsky:gCS, r=jdm

Return None as style for elements not in a document



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6851)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-30 16:30:57 -06:00
commit e42fddd9cc
2 changed files with 11 additions and 0 deletions

View file

@ -99,6 +99,11 @@ impl<'a> PrivateCSSStyleDeclarationHelpers for &'a CSSStyleDeclaration {
fn get_computed_style(self, property: &Atom) -> Option<DOMString> {
let owner = self.owner.root();
let node = NodeCast::from_ref(owner.r());
if !node.is_in_doc() {
// TODO: Node should be matched against the style rules of this window.
// Firefox is currently the only browser to implement this.
return None;
}
let addr = node.to_trusted_node_address();
window_from_node(owner.r()).resolved_style_query(addr, self.pseudo.clone(), property)
}