Commit 5a9980e1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Store nsIDOMCSSStyleDeclaration in HTMLStyle.

parent 5b1af5b7
......@@ -243,11 +243,30 @@ static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLEl
static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
{
HTMLElement *This = HTMLELEM_THIS(iface);
nsIDOMElementCSSInlineStyle *nselemstyle;
nsIDOMCSSStyleDeclaration *nsstyle;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
/* FIXME: Store IHTMLStyle instead of creating a new instance in every call. */
*p = HTMLStyle_Create();
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle,
(void**)&nselemstyle);
if(NS_FAILED(nsres)) {
ERR("Coud not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
nsIDOMElementCSSInlineStyle_Release(nselemstyle);
if(NS_FAILED(nsres)) {
ERR("GetStyle failed: %08x\n", nsres);
return E_FAIL;
}
/* FIXME: Store style instead of creating a new instance in each call */
*p = HTMLStyle_Create(nsstyle);
nsIDOMCSSStyleDeclaration_Release(nsstyle);
return S_OK;
}
......
......@@ -40,6 +40,8 @@ typedef struct {
const IHTMLStyleVtbl *lpHTMLStyleVtbl;
LONG ref;
nsIDOMCSSStyleDeclaration *nsstyle;
} HTMLStyle;
#define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl);
......@@ -1578,12 +1580,15 @@ static const IHTMLStyleVtbl HTMLStyleVtbl = {
HTMLStyle_toString
};
IHTMLStyle *HTMLStyle_Create(void)
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
{
HTMLStyle *ret = mshtml_alloc(sizeof(HTMLStyle));
ret->lpHTMLStyleVtbl = &HTMLStyleVtbl;
ret->ref = 1;
ret->nsstyle = nsstyle;
nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
return HTMLSTYLE(ret);
}
......@@ -329,7 +329,7 @@ void set_document_bscallback(HTMLDocument*,BSCallback*);
IHlink *Hlink_Create(void);
IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*);
IHTMLTxtRange *HTMLTxtRange_Create(nsISelection*);
IHTMLStyle *HTMLStyle_Create(void);
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
void HTMLElement_Create(HTMLDOMNode*);
void HTMLBodyElement_Create(HTMLElement*);
......
......@@ -110,6 +110,8 @@ typedef nsISupports nsIDOMHTMLCollection;
typedef nsISupports nsIDOMRange;
typedef nsISupports nsIEditor;
typedef nsISupports nsIWebProgressListener;
typedef nsISupports nsIDOMCSSValue;
typedef nsISupports nsIDOMCSSRule;
[
object,
......@@ -377,6 +379,25 @@ interface nsIUploadChannel : nsISupports
[
object,
uuid(a6cf90be-15b3-11d2-932e-00805f8add32)
]
interface nsIDOMCSSStyleDeclaration : nsISupports
{
nsresult GetCssText(nsAString *aCssText);
nsresult SetCssText(const nsAString *aCssText);
nsresult GetPropertyValue(const nsAString *propertyName, nsAString *_retval);
nsresult GetPropertyCSSValue(const nsAString *propertyName, nsIDOMCSSValue **_retval);
nsresult RemoveProperty(const nsAString *propertyName, nsAString *_retval);
nsresult GetPropertyPriority(const nsAString *propertyName, nsAString *_retval);
nsresult SetProperty(const nsAString *propertyName, const nsAString *value,
const nsAString *priority);
nsresult GetLength(PRUint32 *aLength);
nsresult Item(PRUint32 index, nsAString *_retval);
nsresult GetParentRule(nsIDOMCSSRule **aParentRule);
}
[
object,
uuid(a6cf907d-15b3-11d2-932e-00805f8add32)
]
interface nsIDOMNodeList : nsISupports
......@@ -462,6 +483,15 @@ interface nsIDOMElement : nsIDOMNode
PRBool *_retval);
}
[
object,
uuid(99715845-95fc-4a56-aa53-214b65c26e22)
]
interface nsIDOMElementCSSInlineStyle : nsISupports
{
nsresult GetStyle(nsIDOMCSSStyleDeclaration **aStyle);
}
cpp_quote("#undef GetClassName");
[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment