Jacek Caban : mshtml: Store nsIDOMCSSStyleDeclaration in HTMLStyle.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Nov 17 11:49:08 CST 2006
Module: wine
Branch: master
Commit: 5a9980e1b73c591c1f682cb6142b6fb19cc9012e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a9980e1b73c591c1f682cb6142b6fb19cc9012e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Nov 17 13:05:01 2006 +0100
mshtml: Store nsIDOMCSSStyleDeclaration in HTMLStyle.
---
dlls/mshtml/htmlelem.c | 23 +++++++++++++++++++++--
dlls/mshtml/htmlstyle.c | 7 ++++++-
dlls/mshtml/mshtml_private.h | 2 +-
dlls/mshtml/nsiface.idl | 30 ++++++++++++++++++++++++++++++
4 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 57419b0..37abb51 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -243,11 +243,30 @@ static HRESULT WINAPI HTMLElement_get_pa
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;
}
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 57000d7..9bc0333 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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 HTMLStyleVtb
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);
}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 287d574..abc283b 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -329,7 +329,7 @@ void set_document_bscallback(HTMLDocumen
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*);
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index 0e59bc9..39a9da7 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -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");
[
More information about the wine-cvs
mailing list