Jacek Caban : mshtml: Added IHTMLObjectElement:: name property implementation.

Alexandre Julliard julliard at winehq.org
Wed Nov 7 14:02:28 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov  7 12:55:28 2012 +0100

mshtml: Added IHTMLObjectElement::name property implementation.

---

 dlls/mshtml/htmlobject.c |   21 +++++++++++++++++----
 dlls/mshtml/tests/dom.c  |   39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c
index fc22419..9e9bbdd 100644
--- a/dlls/mshtml/htmlobject.c
+++ b/dlls/mshtml/htmlobject.c
@@ -162,15 +162,28 @@ static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BST
 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
 {
     HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    nsAString_InitDepend(&nsstr, v);
+    nsres = nsIDOMHTMLObjectElement_SetName(This->nsobject, &nsstr);
+    nsAString_Finish(&nsstr);
+    return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
 }
 
 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
 {
     HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&nsstr, NULL);
+    nsres = nsIDOMHTMLObjectElement_GetName(This->nsobject, &nsstr);
+    return return_nsstr(nsres, &nsstr, p);
 }
 
 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 26567d2..3f9bd5f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -56,7 +56,7 @@ static const char elem_test_str[] =
     "<textarea id=\"X\">text text</textarea>"
     "<table id=\"tbl\"><tbody><tr></tr><tr id=\"row2\"><td>td1 text</td><td>td2 text</td></tr></tbody></table>"
     "<script id=\"sc\" type=\"text/javascript\"><!--\nfunction Testing() {}\n// -->\n</script>"
-    "<test /><object id=\"objid\" vspace=100></object><embed />"
+    "<test /><object id=\"objid\" name=\"objname\" vspace=100></object><embed />"
     "<img id=\"imgid\" name=\"WineImg\"/>"
     "<iframe src=\"about:blank\" id=\"ifr\"></iframe>"
     "<form id=\"frm\"></form>"
@@ -1573,6 +1573,40 @@ static void _test_object_vspace(unsigned line, IUnknown *unk, LONG exl)
     IHTMLObjectElement_Release(object);
 }
 
+#define test_object_name(a,b) _test_object_name(__LINE__,a,b)
+static void _test_object_name(unsigned line, IHTMLElement *elem, const char *exname)
+{
+    IHTMLObjectElement *object = _get_object_iface(line, (IUnknown*)elem);
+    BSTR str;
+    HRESULT hres;
+
+    str = (void*)0xdeadbeef;
+    hres = IHTMLObjectElement_get_name(object, &str);
+    ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres);
+    if(exname)
+        ok_(__FILE__,line)(!strcmp_wa(str, exname), "name=%s, expected %s\n", wine_dbgstr_w(str), exname);
+    else
+        ok_(__FILE__,line)(!str, "name=%s, expected NULL\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+    IHTMLObjectElement_Release(object);
+}
+
+#define set_object_name(a,b) _set_object_name(__LINE__,a,b)
+static void _set_object_name(unsigned line, IHTMLElement *elem, const char *name)
+{
+    IHTMLObjectElement *object = _get_object_iface(line, (IUnknown*)elem);
+    BSTR str;
+    HRESULT hres;
+
+    str = a2bstr(name);
+    hres = IHTMLObjectElement_put_name(object, str);
+    ok_(__FILE__,line)(hres == S_OK, "put_name failed: %08x\n", hres);
+    SysFreeString(str);
+    IHTMLObjectElement_Release(object);
+
+    _test_object_name(line, elem, name);
+}
+
 #define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v)
 static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *doc,
         const char *txt, const char *val)
@@ -5914,6 +5948,9 @@ static void test_elems(IHTMLDocument2 *doc)
     ok(elem != NULL, "elem == NULL\n");
     if(elem) {
         test_object_vspace((IUnknown*)elem, 100);
+        test_object_name(elem, "objname");
+        set_object_name(elem, "test");
+        set_object_name(elem, NULL);
         IHTMLElement_Release(elem);
     }
 




More information about the wine-cvs mailing list