Alistair Leslie-Hughes : mshtml: Implement IHTMLDocument2 get_applets.

Alexandre Julliard julliard at winehq.org
Wed Nov 26 07:32:35 CST 2008


Module: wine
Branch: master
Commit: 6e46a9fdbafdc6482f3bcf860f70cb73f75db9d7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6e46a9fdbafdc6482f3bcf860f70cb73f75db9d7

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Sun Nov 23 21:01:17 2008 +1100

mshtml: Implement IHTMLDocument2 get_applets.

---

 dlls/mshtml/htmldoc.c   |   29 +++++++++++++++++++++++++++--
 dlls/mshtml/tests/dom.c |   19 +++++++++++++++----
 2 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 0d9a0a8..64efea8 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -370,8 +370,33 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
 static HRESULT WINAPI HTMLDocument_get_applets(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_GetApplets(This->nsdoc, &nscoll);
+    if(NS_FAILED(nsres)) {
+        ERR("GetApplets 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_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 8c7a113..ecb2f17 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2774,7 +2774,7 @@ static void test_defaults(IHTMLDocument2 *doc)
     IHTMLStyle *style;
     long l;
     HRESULT hres;
-    IHTMLElementCollection *colimages;
+    IHTMLElementCollection *collection;
 
     hres = IHTMLDocument2_get_body(doc, &elem);
     ok(hres == S_OK, "get_body failed: %08x\n", hres);
@@ -2782,12 +2782,23 @@ static void test_defaults(IHTMLDocument2 *doc)
     hres = IHTMLDocument2_get_images(doc, NULL);
     ok(hres == E_INVALIDARG, "hres %08x\n", hres);
 
-    hres = IHTMLDocument2_get_images(doc, &colimages);
+    hres = IHTMLDocument2_get_images(doc, &collection);
     ok(hres == S_OK, "get_images failed: %08x\n", hres);
     if(hres == S_OK)
     {
-        test_elem_collection((IUnknown*)colimages, NULL, 0);
-        IHTMLElementCollection_Release(colimages);
+        test_elem_collection((IUnknown*)collection, NULL, 0);
+        IHTMLElementCollection_Release(collection);
+    }
+
+    hres = IHTMLDocument2_get_applets(doc, NULL);
+    ok(hres == E_INVALIDARG, "hres %08x\n", hres);
+
+    hres = IHTMLDocument2_get_applets(doc, &collection);
+    ok(hres == S_OK, "get_applets 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);




More information about the wine-cvs mailing list