already_AddRefed<nsIDOMCSSStyleDeclaration> nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt, nsIContent *aContent) { nsIContent* content = GetDOMElementFor(aContent); if (!content) return nsnull; // Returns number of items in style declaration nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(content->OwnerDoc()->GetWindow()); if (!window) return nsnull; nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl; nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(content)); window->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(cssDecl)); return cssDecl.forget(); }
already_AddRefed<nsIDOMCSSStyleDeclaration> nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt, nsIContent *aContent) { nsIContent* content = GetDOMElementFor(aContent); if (!content) return nsnull; // Returns number of items in style declaration nsIDocument* document = content->GetOwnerDoc(); if (!document) return nsnull; nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(document->GetWindow())); if (!viewCSS) return nsnull; nsIDOMCSSStyleDeclaration* cssDecl = nsnull; nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(content)); viewCSS->GetComputedStyle(domElement, aPseudoElt, &cssDecl); return cssDecl; }