Jacek Caban : mshtml: Added IDispatchEx support to HTMLElementCollection object.
Alexandre Julliard
julliard at winehq.org
Thu Apr 24 15:56:47 CDT 2008
Module: wine
Branch: master
Commit: 989574510cdc8627b09b6ee94d1120ed1f334f73
URL: http://source.winehq.org/git/wine.git/?a=commit;h=989574510cdc8627b09b6ee94d1120ed1f334f73
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Apr 24 18:26:56 2008 +0200
mshtml: Added IDispatchEx support to HTMLElementCollection object.
---
dlls/mshtml/dispex.c | 2 ++
dlls/mshtml/htmlelem.c | 15 +++++++++++++++
dlls/mshtml/mshtml_private.h | 2 ++
dlls/mshtml/tests/dom.c | 2 ++
4 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index eb973b8..153d864 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -53,6 +53,7 @@ static REFIID tid_ids[] = {
&IID_NULL,
&DIID_DispHTMLDocument,
&DIID_DispHTMLDOMTextNode,
+ &DIID_DispHTMLElementCollection,
&DIID_DispHTMLUnknownElement,
&DIID_DispHTMLWindow2,
&IID_IHTMLDocument2,
@@ -64,6 +65,7 @@ static REFIID tid_ids[] = {
&IID_IHTMLDOMTextNode,
&IID_IHTMLElement,
&IID_IHTMLElement2,
+ &IID_IHTMLElementCollection,
&IID_IHTMLWindow2,
&IID_IHTMLWindow3,
&IID_IOmNavigator
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 82acb53..c44e2e5 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1363,6 +1363,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
}
typedef struct {
+ DispatchEx dispex;
const IHTMLElementCollectionVtbl *lpHTMLElementCollectionVtbl;
IUnknown *ref_unk;
@@ -1389,6 +1390,9 @@ static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollectio
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This);
+ }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
+ TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
+ *ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IHTMLElementCollection, riid)) {
TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This);
@@ -1664,6 +1668,15 @@ static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl = {
HTMLElementCollection_tags
};
+static dispex_static_data_t HTMLElementCollection_dispex = {
+ DispHTMLElementCollection_tid,
+ NULL,
+ {
+ IHTMLElementCollection_tid,
+ 0
+ }
+};
+
IHTMLElementCollection *create_all_collection(HTMLDOMNode *node)
{
elem_vector buf = {NULL, 0, 8};
@@ -1687,6 +1700,8 @@ static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
ret->elems = elems;
ret->len = len;
+ init_dispex(&ret->dispex, (IUnknown*)HTMLELEMCOL(ret), &HTMLElementCollection_dispex);
+
IUnknown_AddRef(ref_unk);
ret->ref_unk = ref_unk;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index e6041a0..126bc2e 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -63,6 +63,7 @@ typedef enum {
NULL_tid,
DispHTMLDocument_tid,
DispHTMLDOMTextNode_tid,
+ DispHTMLElementCollection_tid,
DispHTMLUnknownElement_tid,
DispHTMLWindow2_tid,
IHTMLDocument2_tid,
@@ -74,6 +75,7 @@ typedef enum {
IHTMLDOMTextNode_tid,
IHTMLElement_tid,
IHTMLElement2_tid,
+ IHTMLElementCollection_tid,
IHTMLWindow2_tid,
IHTMLWindow3_tid,
IOmNavigator_tid,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 620ad97..8c6f60f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -709,6 +709,8 @@ static void _test_elem_collection(unsigned line, IHTMLElementCollection *col,
IDispatch *disp;
HRESULT hres;
+ test_disp((IUnknown*)col, &DIID_DispHTMLElementCollection);
+
hres = IHTMLElementCollection_get_length(col, &len);
ok_(__FILE__,line) (hres == S_OK, "get_length failed: %08x\n", hres);
ok_(__FILE__,line) (len == exlen, "len=%ld, expected %ld\n", len, exlen);
More information about the wine-cvs
mailing list