Andrew Eikum : mshtml: Implement HTMLImageElementFactory::create.

Alexandre Julliard julliard at winehq.org
Wed Oct 21 13:14:02 CDT 2009


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Tue Oct 20 16:04:49 2009 -0500

mshtml: Implement HTMLImageElementFactory::create.

---

 dlls/mshtml/htmlimg.c   |   42 +++++++++++++++++++++++++++++++++++++++---
 dlls/mshtml/tests/dom.c |    2 +-
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 56ec3cf..c7b03ea 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -702,11 +702,47 @@ static HRESULT WINAPI HTMLImageElementFactory_Invoke(IHTMLImageElementFactory *i
 }
 
 static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *iface,
-        VARIANT width, VARIANT height, IHTMLImgElement **elem)
+        VARIANT width, VARIANT height, IHTMLImgElement **img_elem)
 {
     HTMLImageElementFactory *This = HTMLIMGFACTORY_THIS(iface);
-    FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(&width), debugstr_variant(&height), elem);
-    return E_NOTIMPL;
+    HTMLElement *elem;
+    nsIDOMHTMLElement *nselem;
+    HRESULT hres;
+
+    static const PRUnichar imgW[] = {'I','M','G',0};
+
+    TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
+            debugstr_variant(&height), img_elem);
+
+    if(!This->window || !This->window->doc) {
+        WARN("NULL doc\n");
+        return E_UNEXPECTED;
+    }
+
+    *img_elem = NULL;
+
+    hres = create_nselem(This->window->doc, imgW, &nselem);
+    if(FAILED(hres))
+        return hres;
+
+    elem = HTMLElement_Create(This->window->doc, (nsIDOMNode*)nselem, FALSE);
+    if(!elem) {
+        ERR("HTMLElement_Create failed\n");
+        return E_FAIL;
+    }
+
+    hres = IHTMLElement_QueryInterface(HTMLELEM(elem), &IID_IHTMLImgElement, (void**)img_elem);
+    if(FAILED(hres)) {
+        ERR("IHTMLElement_QueryInterface failed: 0x%08x\n", hres);
+        return hres;
+    }
+
+    nsIDOMHTMLElement_Release(nselem);
+
+    if(V_VT(&width) != VT_EMPTY || V_VT(&height) != VT_EMPTY)
+        FIXME("Not setting image dimensions\n");
+
+    return S_OK;
 }
 
 #undef HTMLIMGFACTORY_THIS
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 18f70ec..3bce128 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1137,7 +1137,7 @@ static IHTMLImgElement *_create_img_elem(unsigned line, IHTMLDocument2 *doc,
     }
 
     hres = IHTMLImageElementFactory_create(factory, width, height, &img);
-    todo_wine ok_(__FILE__,line) (hres == S_OK, "create failed: %08x\n", hres);
+    ok_(__FILE__,line) (hres == S_OK, "create failed: %08x\n", hres);
 
     IHTMLImageElementFactory_Release(factory);
     VariantClear(&width);




More information about the wine-cvs mailing list