mshtml: Added IHTMLTextNode2::appendData implementation.

This commit is contained in:
Jacek Caban 2014-11-21 13:02:17 +01:00 committed by Alexandre Julliard
parent f6f55058e4
commit 5ecea72a50
2 changed files with 44 additions and 2 deletions

View File

@ -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)

View File

@ -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);