Re: How can I call GetStyle() of nsIDOMNSHTMLElement
Jens Sorensen <[email protected]> Sat, 22 May 2010 10:46:15 -0700
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
I assume you have a valid nsIDOMElement pointer .. nsCOMPtr<nsIDOMElement> domElement; // valid pointer to a DOM element // QI nsIDOMElementCSSInlineStyle nsCOMPtr<nsIDOMElementCSSInlineStyle> elementCSSInlineStyle = do_QueryInterface(domElement); // And get the style... nsCOMPtr<nsIDOMCSSStyleDeclaration> domCSSStyleDecl; domCSSStyleDecl->GetStyle( getter_AddRefs(domCSSStyleDecl)); -Jens On Thu, May 20, 2010 at 10:41 PM, hap497 <[email protected]> wrote: > Hi, > > If I have a pointer to nsIDOMNSHTMLElement* element, how can I call > the GetStyle()? > > In nsGenericHTMLElement.h, it said > // nsIDOMNSHTMLElement methods. Note that these are non-virtual > // methods, implementations are expected to forward calls to these > // methods. > // Forward to GetStyle which is protected in the super-class > inline nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle) > > But when I do > nsIDOMNSHTMLElement* element; > nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl; > > nsresult result = element->GetStyle(getter_AddRefs(cssDecl)); > > My code will not compile. > > So can I safely cast my nsIDOMNSHTMLElement* to nsGenericHTMLElement* > and call GetStyle() that way? > > Thank you. > _______________________________________________ > dev-tech-dom mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-dom >