From: Zhenbo Li Subject: mshtml: Added IHTMLImgElement::isMap property implementation. Message-Id: <53DA1F5E.7070507@gmail.com> Date: Thu, 31 Jul 2014 18:50:06 +0800 --- dlls/mshtml/htmlimg.c | 27 +++++++++++++++++++++++---- dlls/mshtml/tests/dom.c | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index 212d01e..884da19 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -102,15 +102,34 @@ 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 ? TRUE : 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); + + nsres = nsIDOMHTMLImageElement_SetIsMap(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 33645c8..e650c5c 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2810,6 +2810,22 @@ 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); + IHTMLImgElement_Release(img); +} + static void test_dynamic_properties(IHTMLElement *elem) { static const WCHAR attr1W[] = {'a','t','t','r','1',0}; @@ -6878,6 +6894,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); }