Jacek Caban : mshtml: Added IDispatchEx support to HTMLStyle.

Alexandre Julliard julliard at winehq.org
Thu May 1 06:38:43 CDT 2008


Module: wine
Branch: master
Commit: 9483760b35355024f892d85af35d1a3034079b9d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9483760b35355024f892d85af35d1a3034079b9d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr 30 18:20:58 2008 +0200

mshtml: Added IDispatchEx support to HTMLStyle.

---

 dlls/mshtml/dispex.c         |    2 ++
 dlls/mshtml/htmlstyle.c      |   18 +++++++++++++++++-
 dlls/mshtml/mshtml_private.h |    2 ++
 dlls/mshtml/tests/dom.c      |    2 ++
 4 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index 13319cc..9e68461 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -58,6 +58,7 @@ static REFIID tid_ids[] = {
     &DIID_DispHTMLElementCollection,
     &DIID_DispHTMLInputElement,
     &DIID_DispHTMLOptionElement,
+    &DIID_DispHTMLStyle,
     &DIID_DispHTMLUnknownElement,
     &DIID_DispHTMLWindow2,
     &IID_IHTMLCommentElement,
@@ -74,6 +75,7 @@ static REFIID tid_ids[] = {
     &IID_IHTMLElementCollection,
     &IID_IHTMLInputElement,
     &IID_IHTMLOptionElement,
+    &IID_IHTMLStyle,
     &IID_IHTMLWindow2,
     &IID_IHTMLWindow3,
     &IID_IOmNavigator
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index a955a56..01aa391 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -33,6 +33,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 typedef struct {
+    DispatchEx dispex;
     const IHTMLStyleVtbl *lpHTMLStyleVtbl;
 
     LONG ref;
@@ -40,7 +41,7 @@ typedef struct {
     nsIDOMCSSStyleDeclaration *nsstyle;
 } HTMLStyle;
 
-#define HTMLSTYLE(x)  ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl);
+#define HTMLSTYLE(x)  ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl)
 
 static const WCHAR attrBackgroundColor[] =
     {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
@@ -213,6 +214,9 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
         *ppv = HTMLSTYLE(This);
+    }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
+        TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
+        *ppv = DISPATCHEX(&This->dispex);
     }else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
         TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
         *ppv = HTMLSTYLE(This);
@@ -1841,6 +1845,16 @@ static const IHTMLStyleVtbl HTMLStyleVtbl = {
     HTMLStyle_toString
 };
 
+static dispex_static_data_t HTMLStyle_dispex = {
+    NULL,
+    DispHTMLStyle_tid,
+    NULL,
+    {
+        IHTMLStyle_tid,
+        0
+    }
+};
+
 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
 {
     HTMLStyle *ret = heap_alloc(sizeof(HTMLStyle));
@@ -1851,5 +1865,7 @@ IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
 
     nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
 
+    init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret),  &HTMLStyle_dispex);
+
     return HTMLSTYLE(ret);
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 78f7e05..8ec0497 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -68,6 +68,7 @@ typedef enum {
     DispHTMLElementCollection_tid,
     DispHTMLInputElement_tid,
     DispHTMLOptionElement_tid,
+    DispHTMLStyle_tid,
     DispHTMLUnknownElement_tid,
     DispHTMLWindow2_tid,
     IHTMLCommentElement_tid,
@@ -84,6 +85,7 @@ typedef enum {
     IHTMLElementCollection_tid,
     IHTMLInputElement_tid,
     IHTMLOptionElement_tid,
+    IHTMLStyle_tid,
     IHTMLWindow2_tid,
     IHTMLWindow3_tid,
     IOmNavigator_tid,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index f1c2548..1039ab5 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1290,6 +1290,8 @@ static void test_default_style(IHTMLStyle *style)
     BSTR str;
     HRESULT hres;
 
+    test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
+
     str = (void*)0xdeadbeef;
     hres = IHTMLStyle_get_fontFamily(style, &str);
     ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);




More information about the wine-cvs mailing list