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

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


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

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

mshtml: Added IHTMLImgElement::align property implementation.

---

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

diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index a793397..8c1d324 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -412,15 +412,35 @@ static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p
 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
 {
     HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    nsAString_InitDepend(&str, v);
+
+    nsres = nsIDOMHTMLImageElement_SetAlign(This->nsimg, &str);
+    nsAString_Finish(&str);
+    if (NS_FAILED(nsres)){
+        ERR("Set Align(%s) failed: %08x\n", debugstr_w(v), nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
 {
     HTMLImgElement *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&str, NULL);
+    nsres = nsIDOMHTMLImageElement_GetAlign(This->nsimg, &str);
+
+    return return_nsstr(nsres, &str, p);
 }
 
 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ba0c582..7cae345 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2783,6 +2783,24 @@ static void _test_img_set_alt(unsigned line, IUnknown *unk, const char *alt)
     _test_img_alt(line, unk, alt);
 }
 
+#define test_img_align(u,a) _test_img_align(__LINE__,u,a)
+static void _test_img_align(unsigned line, IUnknown *unk, const char *align)
+{
+    IHTMLImgElement *img = _get_img_iface(line, unk);
+    BSTR tmp;
+    HRESULT hres;
+
+    tmp = a2bstr(align);
+    hres = IHTMLImgElement_put_align(img, tmp);
+    ok_(__FILE__,line) (hres == S_OK, "put_align failed: %08x\n", hres);
+    SysFreeString(tmp);
+
+    hres = IHTMLImgElement_get_align(img, &tmp);
+    ok_(__FILE__,line) (hres == S_OK, "put_align failed: %08x\n", hres);
+    ok_(__FILE__,line) (!strcmp_wa(tmp, align), "Expect %s, got %s\n", align, wine_dbgstr_w(tmp));
+    SysFreeString(tmp);
+}
+
 #define test_img_name(u, c) _test_img_name(__LINE__,u, c)
 static void _test_img_name(unsigned line, IUnknown *unk, const char *pValue)
 {
@@ -7000,6 +7018,8 @@ static void test_elems(IHTMLDocument2 *doc)
 
     elem = get_elem_by_id(doc, "imgid", TRUE);
     if(elem) {
+        test_img_align((IUnknown*)elem, "left");
+        test_img_name((IUnknown*)elem, "WineImg");
         test_img_src((IUnknown*)elem, "", NULL);
         test_img_set_src((IUnknown*)elem, "about:blank");
         test_img_src((IUnknown*)elem, "about:blank", NULL);




More information about the wine-cvs mailing list