From 5ecea72a505f715d2569832e3e8cb1d2c2bc49f0 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 21 Nov 2014 13:02:17 +0100 Subject: [PATCH] mshtml: Added IHTMLTextNode2::appendData implementation. --- dlls/mshtml/htmltextnode.c | 16 ++++++++++++++-- dlls/mshtml/tests/dom.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 66af237ecd5..fd4795b7d82 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -237,8 +237,20 @@ static HRESULT WINAPI HTMLDOMTextNode2_substringData(IHTMLDOMTextNode2 *iface, L static HRESULT WINAPI HTMLDOMTextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR string) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(string)); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(string)); + + nsAString_InitDepend(&nsstr, string); + nsres = nsIDOMText_AppendData(This->nstext, &nsstr); + nsAString_Finish(&nsstr); + if(NS_FAILED(nsres)) { + ERR("AppendData failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLDOMTextNode2_insertData(IHTMLDOMTextNode2 *iface, LONG offset, BSTR string) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index f0896f64fff..a919b3d18e4 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -264,6 +264,7 @@ static const IID * const text_iids[] = { &IID_IHTMLDOMNode, &IID_IHTMLDOMNode2, &IID_IHTMLDOMTextNode, + &IID_IHTMLDOMTextNode2, NULL }; @@ -873,6 +874,17 @@ static IHTMLDOMTextNode *_get_text_iface(unsigned line, IUnknown *unk) return text; } +#define get_text2_iface(u) _get_text2_iface(__LINE__,u) +static IHTMLDOMTextNode2 *_get_text2_iface(unsigned line, IUnknown *unk) +{ + IHTMLDOMTextNode2 *text2; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMTextNode2, (void**)&text2); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDOMTextNode2: %08x\n", hres); + return text2; +} + #define get_comment_iface(u) _get_comment_iface(__LINE__,u) static IHTMLCommentElement *_get_comment_iface(unsigned line, IUnknown *unk) { @@ -2709,6 +2721,19 @@ static void _set_text_data(unsigned line, IUnknown *unk, const char *data) SysFreeString(str); } +#define text_append_data(a,b) _text_append_data(__LINE__,a,b) +static void _text_append_data(unsigned line, IUnknown *unk, const char *data) +{ + IHTMLDOMTextNode2 *text = _get_text2_iface(line, unk); + BSTR str = a2bstr(data); + HRESULT hres; + + hres = IHTMLDOMTextNode2_appendData(text, str); + ok_(__FILE__,line)(hres == S_OK, "appendData failed: %08x\n", hres); + IHTMLDOMTextNode2_Release(text); + SysFreeString(str); +} + #define test_select_set_disabled(i,b) _test_select_set_disabled(__LINE__,i,b) static void _test_select_set_disabled(unsigned line, IHTMLSelectElement *select, VARIANT_BOOL b) { @@ -8155,6 +8180,11 @@ static void test_create_elems(IHTMLDocument2 *doc) test_text_data((IUnknown*)node, "abc"); set_text_data((IUnknown*)node, "test"); test_text_data((IUnknown*)node, "test"); + text_append_data((IUnknown*)node, " append"); + test_text_data((IUnknown*)node, "test append"); + text_append_data((IUnknown*)node, NULL); + test_text_data((IUnknown*)node, "test append"); + set_text_data((IUnknown*)node, "test"); V_VT(&var) = VT_NULL; node2 = test_node_insertbefore((IUnknown*)body, node, &var); -- 2.11.4.GIT