mirror of
https://github.com/reactos/wine.git
synced 2025-02-18 03:48:01 +00:00
mshtml: Added IHTMLElement2::getElementsByTagName implementation.
This commit is contained in:
parent
1de0055cc0
commit
952a54cbd9
@ -1896,6 +1896,31 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node)
|
|||||||
return HTMLElementCollection_Create((IUnknown*)HTMLDOMNODE(node), buf.buf, buf.len);
|
return HTMLElementCollection_Create((IUnknown*)HTMLDOMNODE(node), buf.buf, buf.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnknown *unk, nsIDOMNodeList *nslist)
|
||||||
|
{
|
||||||
|
PRUint32 length = 0, i;
|
||||||
|
elem_vector buf;
|
||||||
|
|
||||||
|
nsIDOMNodeList_GetLength(nslist, &length);
|
||||||
|
|
||||||
|
buf.len = buf.size = length;
|
||||||
|
if(buf.len) {
|
||||||
|
nsIDOMNode *nsnode;
|
||||||
|
|
||||||
|
buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*));
|
||||||
|
|
||||||
|
for(i=0; i<length; i++) {
|
||||||
|
nsIDOMNodeList_Item(nslist, i, &nsnode);
|
||||||
|
buf.buf[i] = HTMLELEM_NODE_THIS(get_node(doc, nsnode, TRUE));
|
||||||
|
nsIDOMNode_Release(nsnode);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
buf.buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HTMLElementCollection_Create(unk, buf.buf, buf.len);
|
||||||
|
}
|
||||||
|
|
||||||
static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
|
static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
|
||||||
HTMLElement **elems, DWORD len)
|
HTMLElement **elems, DWORD len)
|
||||||
{
|
{
|
||||||
|
@ -917,12 +917,27 @@ static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, lon
|
|||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLElement2_getElementByTagName(IHTMLElement2 *iface, BSTR v,
|
static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
|
||||||
IHTMLElementCollection **pelColl)
|
IHTMLElementCollection **pelColl)
|
||||||
{
|
{
|
||||||
HTMLElement *This = HTMLELEM2_THIS(iface);
|
HTMLElement *This = HTMLELEM2_THIS(iface);
|
||||||
FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
|
nsIDOMNodeList *nslist;
|
||||||
return E_NOTIMPL;
|
nsAString tag_str;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
|
||||||
|
|
||||||
|
nsAString_Init(&tag_str, v);
|
||||||
|
nsres = nsIDOMHTMLElement_GetElementsByTagName(This->nselem, &tag_str, &nslist);
|
||||||
|
nsAString_Finish(&tag_str);
|
||||||
|
if(NS_FAILED(nsres)) {
|
||||||
|
ERR("GetElementByTagName failed: %08x\n", nsres);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pelColl = create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nslist);
|
||||||
|
nsIDOMNodeList_Release(nslist);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef HTMLELEM2_THIS
|
#undef HTMLELEM2_THIS
|
||||||
@ -1032,7 +1047,7 @@ static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
|
|||||||
HTMLElement2_put_onbeforeeditfocus,
|
HTMLElement2_put_onbeforeeditfocus,
|
||||||
HTMLElement2_get_onbeforeeditfocus,
|
HTMLElement2_get_onbeforeeditfocus,
|
||||||
HTMLElement2_get_readyStateValue,
|
HTMLElement2_get_readyStateValue,
|
||||||
HTMLElement2_getElementByTagName,
|
HTMLElement2_getElementsByTagName,
|
||||||
};
|
};
|
||||||
|
|
||||||
void HTMLElement2_Init(HTMLElement *This)
|
void HTMLElement2_Init(HTMLElement *This)
|
||||||
|
@ -566,6 +566,7 @@ void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
|
|||||||
IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
|
IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
|
||||||
|
|
||||||
IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
|
IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
|
||||||
|
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user