Jacek Caban : mshtml: Added IHTMLElement::put_title implementation.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 04:47:12 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jun 24 15:24:06 2008 -0500

mshtml: Added IHTMLElement::put_title implementation.

---

 dlls/mshtml/htmlelem.c  |   14 ++++++++++++--
 dlls/mshtml/tests/dom.c |   17 +++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 3ab3ac1..9be2964 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -594,8 +594,18 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
 {
     HTMLElement *This = HTMLELEM_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString title_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    nsAString_Init(&title_str, v);
+    nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
+    nsAString_Finish(&title_str);
+    if(NS_FAILED(nsres))
+        ERR("SetTitle failed: %08x\n", nsres);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index e8f8468..07708b9 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1108,6 +1108,21 @@ static void _test_elem_title(unsigned line, IUnknown *unk, const char *extitle)
     SysFreeString(title);
 }
 
+#define test_elem_set_title(u,t) _test_elem_set_title(__LINE__,u,t)
+static void _test_elem_set_title(unsigned line, IUnknown *unk, const char *title)
+{
+    IHTMLElement *elem = _get_elem_iface(line, unk);
+    BSTR tmp;
+    HRESULT hres;
+
+    tmp = a2bstr(title);
+    hres = IHTMLElement_put_title(elem, tmp);
+    ok_(__FILE__,line) (hres == S_OK, "get_title failed: %08x\n", hres);
+
+    IHTMLElement_Release(elem);
+    SysFreeString(tmp);
+}
+
 #define test_node_get_value_str(u,e) _test_node_get_value_str(__LINE__,u,e)
 static void _test_node_get_value_str(unsigned line, IUnknown *unk, const char *exval)
 {
@@ -2004,6 +2019,8 @@ static void test_elems(IHTMLDocument2 *doc)
         test_select_elem(select);
 
         test_elem_title((IUnknown*)select, NULL);
+        test_elem_set_title((IUnknown*)select, "Title");
+        test_elem_title((IUnknown*)select, "Title");
 
         node = get_first_child((IUnknown*)select);
         ok(node != NULL, "node == NULL\n");




More information about the wine-cvs mailing list