Alistair Leslie-Hughes : mshtml: Implement IHTMLDocument2 get_forms.

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


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

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

mshtml: Implement IHTMLDocument2 get_forms.

---

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

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 28f6fa8..04ac847 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -434,8 +434,33 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
 static HRESULT WINAPI HTMLDocument_get_forms(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_GetForms(This->nsdoc, &nscoll);
+    if(NS_FAILED(nsres)) {
+        ERR("GetForms 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_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index d22b22c..301ad71 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2812,6 +2812,17 @@ static void test_defaults(IHTMLDocument2 *doc)
         IHTMLElementCollection_Release(collection);
     }
 
+    hres = IHTMLDocument2_get_forms(doc, NULL);
+    ok(hres == E_INVALIDARG, "hres %08x\n", hres);
+
+    hres = IHTMLDocument2_get_forms(doc, &collection);
+    ok(hres == S_OK, "get_forms 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);




More information about the wine-cvs mailing list