Jacek Caban : mshtml: Added IHTMLElement::put_className implementation.
Alexandre Julliard
julliard at winehq.org
Mon Jun 23 16:03:59 CDT 2008
Module: wine
Branch: master
Commit: 47d835206708bdedb63d779614056dca17ace71f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=47d835206708bdedb63d779614056dca17ace71f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Jun 23 09:52:17 2008 -0500
mshtml: Added IHTMLElement::put_className implementation.
---
dlls/mshtml/htmlelem.c | 19 +++++++++++++++++--
dlls/mshtml/tests/dom.c | 18 ++++++++++++++++++
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 8956065..ce93399 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -252,8 +252,23 @@ static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strA
static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = HTMLELEM_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ nsAString classname_str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ if(!This->nselem) {
+ FIXME("NULL nselem\n");
+ return E_NOTIMPL;
+ }
+
+ nsAString_Init(&classname_str, v);
+ nsres = nsIDOMHTMLElement_SetClassName(This->nselem, &classname_str);
+ nsAString_Finish(&classname_str);
+ if(NS_FAILED(nsres))
+ ERR("SetClassName failed: %08x\n", nsres);
+
+ return S_OK;
}
static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index e67ca76..5624020 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -935,6 +935,22 @@ static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass)
SysFreeString(class);
}
+#define test_elem_set_class(u,c) _test_elem_set_class(__LINE__,u,c)
+static void _test_elem_set_class(unsigned line, IUnknown *unk, const char *class)
+{
+ IHTMLElement *elem = _get_elem_iface(line, unk);
+ BSTR tmp;
+ HRESULT hres;
+
+ tmp = class ? a2bstr(class) : NULL;
+ hres = IHTMLElement_put_className(elem, tmp);
+ IHTMLElement_Release(elem);
+ ok_(__FILE__,line) (hres == S_OK, "put_className failed: %08x\n", hres);
+ SysFreeString(tmp);
+
+ _test_elem_class(line, unk, class);
+}
+
#define get_child_item(c,i) _get_child_item(__LINE__,c,i)
static IHTMLDOMNode *_get_child_item(unsigned line, IHTMLDOMChildrenCollection *col, long idx)
{
@@ -1804,6 +1820,8 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_attr(elem, xxxW, NULL);
test_elem_attr(elem, idW, sW);
test_elem_class((IUnknown*)elem, NULL);
+ test_elem_set_class((IUnknown*)elem, "cl");
+ test_elem_set_class((IUnknown*)elem, NULL);
IHTMLElement_Release(elem);
}
More information about the wine-cvs
mailing list