Commit 01536b50 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

mshtml: Implement IHTMLDocument2_get_images.

parent 8745dd26
...@@ -338,8 +338,33 @@ static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTM ...@@ -338,8 +338,33 @@ static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTM
static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p) static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
{ {
HTMLDocument *This = HTMLDOC_THIS(iface); HTMLDocument *This = HTMLDOC_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); nsIDOMHTMLCollection *nscoll = NULL;
return E_NOTIMPL; 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_GetImages(This->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetImages 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_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p) static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
......
...@@ -2765,10 +2765,22 @@ static void test_defaults(IHTMLDocument2 *doc) ...@@ -2765,10 +2765,22 @@ static void test_defaults(IHTMLDocument2 *doc)
IHTMLStyle *style; IHTMLStyle *style;
long l; long l;
HRESULT hres; HRESULT hres;
IHTMLElementCollection *colimages;
hres = IHTMLDocument2_get_body(doc, &elem); hres = IHTMLDocument2_get_body(doc, &elem);
ok(hres == S_OK, "get_body failed: %08x\n", hres); ok(hres == S_OK, "get_body failed: %08x\n", hres);
hres = IHTMLDocument2_get_images(doc, NULL);
ok(hres == E_INVALIDARG, "hres %08x\n", hres);
hres = IHTMLDocument2_get_images(doc, &colimages);
ok(hres == S_OK, "get_images failed: %08x\n", hres);
if(hres == S_OK)
{
test_elem_collection((IUnknown*)colimages, NULL, 0);
IHTMLElementCollection_Release(colimages);
}
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body); hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body);
ok(hres == S_OK, "Could not get IHTMBodyElement: %08x\n", hres); ok(hres == S_OK, "Could not get IHTMBodyElement: %08x\n", hres);
test_default_body(body); test_default_body(body);
...@@ -3049,6 +3061,7 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -3049,6 +3061,7 @@ static void test_elems(IHTMLDocument2 *doc)
IDispatch *disp; IDispatch *disp;
long type; long type;
HRESULT hres; HRESULT hres;
IHTMLElementCollection *colimages;
static const WCHAR imgidW[] = {'i','m','g','i','d',0}; static const WCHAR imgidW[] = {'i','m','g','i','d',0};
static const WCHAR inW[] = {'i','n',0}; static const WCHAR inW[] = {'i','n',0};
...@@ -3097,6 +3110,16 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -3097,6 +3110,16 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_col_item(col, xW, item_types, sizeof(item_types)/sizeof(item_types[0])); test_elem_col_item(col, xW, item_types, sizeof(item_types)/sizeof(item_types[0]));
IHTMLElementCollection_Release(col); IHTMLElementCollection_Release(col);
hres = IHTMLDocument2_get_images(doc, &colimages);
ok(hres == S_OK, "get_images failed: %08x\n", hres);
if(hres == S_OK)
{
static const elem_type_t images_types[] = {ET_IMG};
test_elem_collection((IUnknown*)colimages, images_types, 1);
IHTMLElementCollection_Release(colimages);
}
elem = get_doc_elem(doc); elem = get_doc_elem(doc);
ok(hres == S_OK, "get_documentElement failed: %08x\n", hres); ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
hres = IHTMLElement_get_all(elem, &disp); hres = IHTMLElement_get_all(elem, &disp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment