Zhenbo Li : mshtml: Added IHTMLImgElement::isMap property implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 18 16:08:49 CDT 2014


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

Author: Zhenbo Li <litimetal at gmail.com>
Date:   Mon Aug 18 17:01:55 2014 +0800

mshtml: Added IHTMLImgElement::isMap property implementation.

---

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

diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 212d01e..a793397 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -102,15 +102,37 @@ static HRESULT WINAPI HTMLImgElement_Invoke(IHTMLImgElement *iface, DISPID dispI
 static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
 {
     HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%x)\n", This, v);
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%x)\n", This, v);
+
+    nsres = nsIDOMHTMLImageElement_SetIsMap(This->nsimg, v != VARIANT_FALSE);
+    if (NS_FAILED(nsres)) {
+        ERR("Set IsMap failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
 {
     HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    cpp_bool b;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if (p == NULL)
+        return E_INVALIDARG;
+
+    nsres = nsIDOMHTMLImageElement_GetIsMap(This->nsimg, &b);
+    if (NS_FAILED(nsres)) {
+        ERR("Get IsMap failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+    *p = b ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index cfde7ac..86a9aa3 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2810,6 +2810,25 @@ static void _test_img_complete(unsigned line, IHTMLElement *elem, VARIANT_BOOL e
     IHTMLImgElement_Release(img);
 }
 
+#define test_img_isMap(u, c) _test_img_isMap(__LINE__,u, c)
+static void _test_img_isMap(unsigned line, IUnknown *unk, VARIANT_BOOL v)
+{
+    IHTMLImgElement *img = _get_img_iface(line, unk);
+    VARIANT_BOOL b = 100;
+    HRESULT hres;
+
+    hres = IHTMLImgElement_put_isMap(img, v);
+    ok_(__FILE__,line) (hres == S_OK, "put_isMap failed: %08x\n", hres);
+
+    hres = IHTMLImgElement_get_isMap(img, &b);
+    ok_(__FILE__,line) (hres == S_OK, "get_isMap failed: %08x\n", hres);
+    ok_(__FILE__,line) (b == v, "isMap = %x, expected %x\n", b, v);
+
+    hres = IHTMLImgElement_get_isMap(img, NULL);
+    ok_(__FILE__,line) (hres == E_INVALIDARG, "ret = %08x, expected E_INVALIDARG\n", hres);
+    IHTMLImgElement_Release(img);
+}
+
 static void test_dynamic_properties(IHTMLElement *elem)
 {
     static const WCHAR attr1W[] = {'a','t','t','r','1',0};
@@ -6958,6 +6977,8 @@ static void test_elems(IHTMLDocument2 *doc)
         test_img_set_alt((IUnknown*)elem, "alt test");
         test_img_name((IUnknown*)elem, "WineImg");
         test_img_complete(elem, VARIANT_FALSE);
+        test_img_isMap((IUnknown*)elem, VARIANT_TRUE);
+        test_img_isMap((IUnknown*)elem, VARIANT_FALSE);
         IHTMLElement_Release(elem);
     }
 




More information about the wine-cvs mailing list