mshtml: Implement IHTMLDocument2 get_anchors.
This commit is contained in:
parent
e760812a62
commit
75b9c0508a
|
@ -466,8 +466,33 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
|
|||
static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
||||
{
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMHTMLCollection *nscoll = NULL;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
if(!p)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*p = NULL;
|
||||
|
||||
if(!This->nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsres = nsIDOMHTMLDocument_GetAnchors(This->nsdoc, &nscoll);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetAnchors failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(nscoll) {
|
||||
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
|
||||
nsIDOMElement_Release(nscoll);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
|
||||
|
|
|
@ -2823,6 +2823,17 @@ static void test_defaults(IHTMLDocument2 *doc)
|
|||
IHTMLElementCollection_Release(collection);
|
||||
}
|
||||
|
||||
hres = IHTMLDocument2_get_anchors(doc, NULL);
|
||||
ok(hres == E_INVALIDARG, "hres %08x\n", hres);
|
||||
|
||||
hres = IHTMLDocument2_get_anchors(doc, &collection);
|
||||
ok(hres == S_OK, "get_anchors failed: %08x\n", hres);
|
||||
if(hres == S_OK)
|
||||
{
|
||||
test_elem_collection((IUnknown*)collection, NULL, 0);
|
||||
IHTMLElementCollection_Release(collection);
|
||||
}
|
||||
|
||||
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body);
|
||||
ok(hres == S_OK, "Could not get IHTMBodyElement: %08x\n", hres);
|
||||
test_default_body(body);
|
||||
|
@ -3172,6 +3183,16 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
IHTMLElementCollection_Release(collection);
|
||||
}
|
||||
|
||||
hres = IHTMLDocument2_get_anchors(doc, &collection);
|
||||
ok(hres == S_OK, "get_anchors failed: %08x\n", hres);
|
||||
if(hres == S_OK)
|
||||
{
|
||||
static const elem_type_t anchor_types[] = {ET_A};
|
||||
test_elem_collection((IUnknown*)collection, anchor_types, 1);
|
||||
|
||||
IHTMLElementCollection_Release(collection);
|
||||
}
|
||||
|
||||
elem = get_doc_elem(doc);
|
||||
ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
|
||||
hres = IHTMLElement_get_all(elem, &disp);
|
||||
|
|
Loading…
Reference in New Issue