How can I call GetStyle() of nsIDOMNSHTMLElement

hap497 <[email protected]> Thu, 20 May 2010 22:41:46 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <cba62189-12c4-4534-a8f1-80e97a139bd9@z13g2000prh.googlegroups.com>
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.