mshtml: Added IDispatchEx support to HTMLElementCollection object.

oldstable
Jacek Caban 2008-04-24 18:26:56 +02:00 committed by Alexandre Julliard
parent 74c571a441
commit 989574510c
4 changed files with 21 additions and 0 deletions

View File

@ -53,6 +53,7 @@ static REFIID tid_ids[] = {
&IID_NULL, &IID_NULL,
&DIID_DispHTMLDocument, &DIID_DispHTMLDocument,
&DIID_DispHTMLDOMTextNode, &DIID_DispHTMLDOMTextNode,
&DIID_DispHTMLElementCollection,
&DIID_DispHTMLUnknownElement, &DIID_DispHTMLUnknownElement,
&DIID_DispHTMLWindow2, &DIID_DispHTMLWindow2,
&IID_IHTMLDocument2, &IID_IHTMLDocument2,
@ -64,6 +65,7 @@ static REFIID tid_ids[] = {
&IID_IHTMLDOMTextNode, &IID_IHTMLDOMTextNode,
&IID_IHTMLElement, &IID_IHTMLElement,
&IID_IHTMLElement2, &IID_IHTMLElement2,
&IID_IHTMLElementCollection,
&IID_IHTMLWindow2, &IID_IHTMLWindow2,
&IID_IHTMLWindow3, &IID_IHTMLWindow3,
&IID_IOmNavigator &IID_IOmNavigator

View File

@ -1363,6 +1363,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
} }
typedef struct { typedef struct {
DispatchEx dispex;
const IHTMLElementCollectionVtbl *lpHTMLElementCollectionVtbl; const IHTMLElementCollectionVtbl *lpHTMLElementCollectionVtbl;
IUnknown *ref_unk; IUnknown *ref_unk;
@ -1389,6 +1390,9 @@ static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollectio
}else if(IsEqualGUID(&IID_IDispatch, riid)) { }else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This); *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)) { }else if(IsEqualGUID(&IID_IHTMLElementCollection, riid)) {
TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv); TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv);
*ppv = HTMLELEMCOL(This); *ppv = HTMLELEMCOL(This);
@ -1664,6 +1668,15 @@ static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl = {
HTMLElementCollection_tags HTMLElementCollection_tags
}; };
static dispex_static_data_t HTMLElementCollection_dispex = {
DispHTMLElementCollection_tid,
NULL,
{
IHTMLElementCollection_tid,
0
}
};
IHTMLElementCollection *create_all_collection(HTMLDOMNode *node) IHTMLElementCollection *create_all_collection(HTMLDOMNode *node)
{ {
elem_vector buf = {NULL, 0, 8}; elem_vector buf = {NULL, 0, 8};
@ -1687,6 +1700,8 @@ static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
ret->elems = elems; ret->elems = elems;
ret->len = len; ret->len = len;
init_dispex(&ret->dispex, (IUnknown*)HTMLELEMCOL(ret), &HTMLElementCollection_dispex);
IUnknown_AddRef(ref_unk); IUnknown_AddRef(ref_unk);
ret->ref_unk = ref_unk; ret->ref_unk = ref_unk;

View File

@ -63,6 +63,7 @@ typedef enum {
NULL_tid, NULL_tid,
DispHTMLDocument_tid, DispHTMLDocument_tid,
DispHTMLDOMTextNode_tid, DispHTMLDOMTextNode_tid,
DispHTMLElementCollection_tid,
DispHTMLUnknownElement_tid, DispHTMLUnknownElement_tid,
DispHTMLWindow2_tid, DispHTMLWindow2_tid,
IHTMLDocument2_tid, IHTMLDocument2_tid,
@ -74,6 +75,7 @@ typedef enum {
IHTMLDOMTextNode_tid, IHTMLDOMTextNode_tid,
IHTMLElement_tid, IHTMLElement_tid,
IHTMLElement2_tid, IHTMLElement2_tid,
IHTMLElementCollection_tid,
IHTMLWindow2_tid, IHTMLWindow2_tid,
IHTMLWindow3_tid, IHTMLWindow3_tid,
IOmNavigator_tid, IOmNavigator_tid,

View File

@ -709,6 +709,8 @@ static void _test_elem_collection(unsigned line, IHTMLElementCollection *col,
IDispatch *disp; IDispatch *disp;
HRESULT hres; HRESULT hres;
test_disp((IUnknown*)col, &DIID_DispHTMLElementCollection);
hres = IHTMLElementCollection_get_length(col, &len); hres = IHTMLElementCollection_get_length(col, &len);
ok_(__FILE__,line) (hres == S_OK, "get_length failed: %08x\n", hres); ok_(__FILE__,line) (hres == S_OK, "get_length failed: %08x\n", hres);
ok_(__FILE__,line) (len == exlen, "len=%ld, expected %ld\n", len, exlen); ok_(__FILE__,line) (len == exlen, "len=%ld, expected %ld\n", len, exlen);