mshtml: Added get_firstChild implementation.

This commit is contained in:
Jacek Caban 2008-04-24 18:24:59 +02:00 committed by Alexandre Julliard
parent 1cb633a5cc
commit 6bf5ffbc3b
2 changed files with 38 additions and 2 deletions

View File

@ -246,8 +246,19 @@ static HRESULT WINAPI HTMLDOMNode_get_nodeValue(IHTMLDOMNode *iface, VARIANT *p)
static HRESULT WINAPI HTMLDOMNode_get_firstChild(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMNode *nschild = NULL;
TRACE("(%p)->(%p)\n", This, p);
nsIDOMNode_GetFirstChild(This->nsnode, &nschild);
if(nschild) {
*p = HTMLDOMNODE(get_node(This->doc, nschild, TRUE));
IHTMLDOMNode_AddRef(*p);
}else {
*p = NULL;
}
return S_OK;
}
static HRESULT WINAPI HTMLDOMNode_get_lastChild(IHTMLDOMNode *iface, IHTMLDOMNode **p)

View File

@ -738,6 +738,23 @@ static void _test_elem_collection(unsigned line, IHTMLElementCollection *col,
ok_(__FILE__,line) (disp == NULL, "disp != NULL\n");
}
#define get_first_child(n) _get_first_child(__LINE__,n)
static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node, *child = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&node);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMNode: %08x\n", hres);
if(FAILED(hres))
return NULL;
hres = IHTMLDOMNode_get_firstChild(node, &child);
ok_(__FILE__,line) (hres == S_OK, "get_firstChild failed: %08x\n", hres);
return child;
}
static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n,
const elem_type_t *elem_types, long len)
{
@ -1379,6 +1396,7 @@ static void test_elems(IHTMLDocument2 *doc)
{
IHTMLElementCollection *col;
IHTMLElement *elem;
IHTMLDOMNode *node;
IDispatch *disp;
HRESULT hres;
@ -1451,6 +1469,13 @@ static void test_elems(IHTMLDocument2 *doc)
test_select_elem(select);
node = get_first_child((IUnknown*)select);
ok(node != NULL, "node == NULL\n");
if(node) {
test_elem_type((IUnknown*)node, ET_OPTION);
IHTMLDOMNode_Release(node);
}
IHTMLSelectElement_Release(select);
IHTMLElement_Release(elem);
}