mshtml: Store nsIDOMCSSStyleDeclaration in HTMLStyle.

This commit is contained in:
Jacek Caban 2006-11-17 13:05:01 +01:00 committed by Alexandre Julliard
parent 5b1af5b7d1
commit 5a9980e1b7
4 changed files with 58 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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*);

View File

@ -110,6 +110,8 @@ typedef nsISupports nsIDOMHTMLCollection;
typedef nsISupports nsIDOMRange;
typedef nsISupports nsIEditor;
typedef nsISupports nsIWebProgressListener;
typedef nsISupports nsIDOMCSSValue;
typedef nsISupports nsIDOMCSSRule;
[
object,
@ -375,6 +377,25 @@ interface nsIUploadChannel : nsISupports
nsresult GetUploadStream(nsIInputStream **aUploadStream);
}
[
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)
@ -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");
[