[PATCH 1/5] mshtml: COM cleanup for the IHTMLDocument3 iface.

Michael Stefaniuc mstefani at redhat.de
Wed Dec 22 03:39:41 CST 2010


---
 dlls/mshtml/htmldoc.c        |    2 +-
 dlls/mshtml/htmldoc3.c       |  108 +++++++++++++++++++++--------------------
 dlls/mshtml/htmlwindow.c     |    6 ++-
 dlls/mshtml/mshtml_private.h |    3 +-
 4 files changed, 61 insertions(+), 58 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 4a895c7..eee3529 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1719,7 +1719,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = &This->IHTMLDocument2_iface;
     }else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) {
         TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppv);
-        *ppv = HTMLDOC3(This);
+        *ppv = &This->IHTMLDocument3_iface;
     }else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
         TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppv);
         *ppv = HTMLDOC4(This);
diff --git a/dlls/mshtml/htmldoc3.c b/dlls/mshtml/htmldoc3.c
index 678abe0..ee863e0 100644
--- a/dlls/mshtml/htmldoc3.c
+++ b/dlls/mshtml/htmldoc3.c
@@ -35,37 +35,40 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
-#define HTMLDOC3_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument3, iface)
+static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface);
+}
 
 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
                                                   REFIID riid, void **ppv)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return htmldoc_release(This);
 }
 
 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
 }
 
 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
                                                 LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
 }
 
@@ -73,7 +76,7 @@ static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID
                                                 LPOLESTR *rgszNames, UINT cNames,
                                                 LCID lcid, DISPID *rgDispId)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
 }
 
@@ -81,21 +84,21 @@ static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdM
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
             pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%x)\n", This, fForce);
     return E_NOTIMPL;
 }
@@ -103,7 +106,7 @@ static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL f
 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
                                                    IHTMLDOMNode **newTextNode)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     nsIDOMText *nstext;
     HTMLDOMNode *node;
     nsAString text_str;
@@ -137,7 +140,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
 
 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     nsIDOMElement *nselem = NULL;
     HTMLDOMNode *node;
     nsresult nsres;
@@ -176,7 +179,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
 
 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -184,7 +187,7 @@ static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
                                                 IDispatch* pDisp, VARIANT_BOOL *pfResult)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
 
     TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
 
@@ -194,7 +197,7 @@ static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR even
 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
                                                 IDispatch *pDisp)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
 
     TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
 
@@ -203,119 +206,119 @@ static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR even
 
 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
 
     TRACE("(%p)->()\n", This);
 
@@ -324,7 +327,7 @@ static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VAR
 
 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -333,14 +336,14 @@ static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VAR
 
 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -348,7 +351,7 @@ static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p
 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
                                                            IHTMLDocument2 **ppNewDoc)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     nsIDOMDocumentFragment *doc_frag;
     HTMLDocumentNode *docnode;
     nsresult nsres;
@@ -379,7 +382,7 @@ static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface
 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
                                                        IHTMLDocument2 **p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -387,7 +390,7 @@ static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
                                                        VARIANT_BOOL v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%x)\n", This, v);
     return E_NOTIMPL;
 }
@@ -395,28 +398,28 @@ static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
                                                        VARIANT_BOOL *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -424,7 +427,7 @@ static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispa
 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
                                                            VARIANT_BOOL v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
@@ -432,21 +435,21 @@ static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface
 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
                                                            VARIANT_BOOL *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -454,7 +457,7 @@ static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface,
 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
                                                       IHTMLElementCollection **ppelColl)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
     return E_NOTIMPL;
 }
@@ -463,7 +466,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST
 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
                                                    IHTMLElement **pel)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     nsIDOMElement *nselem;
     HTMLDOMNode *node;
     nsIDOMNode *nsnode, *nsnode_by_id, *nsnode_by_name;
@@ -552,7 +555,7 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
                                                          IHTMLElementCollection **pelColl)
 {
-    HTMLDocument *This = HTMLDOC3_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument3(iface);
     nsIDOMNodeList *nslist;
     nsAString id_str, ns_str;
     nsresult nsres;
@@ -575,14 +578,13 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
         return E_FAIL;
     }
 
-    *pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This->doc_node, (IUnknown*)HTMLDOC3(This), nslist);
+    *pelColl = create_collection_from_nodelist(This->doc_node,
+                                               (IUnknown*)&This->IHTMLDocument3_iface, nslist);
     nsIDOMNodeList_Release(nslist);
 
     return S_OK;
 }
 
-#undef HTMLDOC3_THIS
-
 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
     HTMLDocument3_QueryInterface,
     HTMLDocument3_AddRef,
@@ -840,6 +842,6 @@ static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
 
 void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This)
 {
-    This->lpHTMLDocument3Vtbl = &HTMLDocument3Vtbl;
+    This->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
     This->lpHTMLDocument4Vtbl = &HTMLDocument4Vtbl;
 }
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 2dc849f..33a60ca 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -1275,7 +1275,8 @@ static HRESULT HTMLWindow_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fla
     case GLOBAL_ELEMENTVAR: {
         IHTMLElement *elem;
 
-        hres = IHTMLDocument3_getElementById(HTMLDOC3(&This->doc->basedoc), prop->name, &elem);
+        hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface,
+                                             prop->name, &elem);
         if(FAILED(hres))
             return hres;
 
@@ -2001,7 +2002,8 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
         global_prop_t *prop;
         IHTMLElement *elem;
 
-        hres = IHTMLDocument3_getElementById(HTMLDOC3(&This->doc->basedoc), bstrName, &elem);
+        hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface,
+                                             bstrName, &elem);
         if(SUCCEEDED(hres) && elem) {
             IHTMLElement_Release(elem);
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 326439f..74a2d8f 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -343,7 +343,7 @@ struct ConnectionPoint {
 
 struct HTMLDocument {
     IHTMLDocument2              IHTMLDocument2_iface;
-    const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
+    IHTMLDocument3              IHTMLDocument3_iface;
     const IHTMLDocument4Vtbl              *lpHTMLDocument4Vtbl;
     const IHTMLDocument5Vtbl              *lpHTMLDocument5Vtbl;
     const IHTMLDocument6Vtbl              *lpHTMLDocument6Vtbl;
@@ -626,7 +626,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW3(x)   ((IHTMLWindow3*)                 &(x)->lpHTMLWindow3Vtbl)
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
 
-#define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
 #define HTMLDOC4(x)      ((IHTMLDocument4*)               &(x)->lpHTMLDocument4Vtbl)
 #define HTMLDOC5(x)      ((IHTMLDocument5*)               &(x)->lpHTMLDocument5Vtbl)
 #define HTMLDOC6(x)      ((IHTMLDocument6*)               &(x)->lpHTMLDocument6Vtbl)
-- 
1.7.2.3



More information about the wine-patches mailing list