Commit 39c7951c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLDocument3::createTextNode implementation.

parent 19803de2
......@@ -108,8 +108,31 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
IHTMLDOMNode **newTextNode)
{
HTMLDocument *This = HTMLDOC3_THIS(iface);
FIXME("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
return E_NOTIMPL;
nsIDOMDocument *nsdoc;
nsIDOMText *nstext;
HTMLDOMNode *node;
nsAString text_str;
nsresult nsres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
nsAString_Init(&text_str, text);
nsres = nsIDOMDocument_CreateTextNode(nsdoc, &text_str, &nstext);
nsAString_Finish(&text_str);
nsIDOMDocument_Release(nsdoc);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
return E_FAIL;
}
node = HTMLDOMTextNode_Create(This, (nsIDOMNode*)nstext);
nsIDOMElement_Release(nstext);
*newTextNode = HTMLDOMNODE(node);
IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
return S_OK;
}
static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
......
......@@ -1035,6 +1035,26 @@ static IHTMLElement *_test_create_elem(unsigned line, IHTMLDocument2 *doc, const
return elem;
}
#define test_create_text(d,t) _test_create_text(__LINE__,d,t)
static IHTMLDOMNode *_test_create_text(unsigned line, IHTMLDocument2 *doc, const char *text)
{
IHTMLDocument3 *doc3;
IHTMLDOMNode *node = NULL;
BSTR tmp;
HRESULT hres;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDocument3: %08x\n", hres);
tmp = a2bstr(text);
hres = IHTMLDocument3_createTextNode(doc3, tmp, &node);
IHTMLDocument3_Release(doc3);
ok_(__FILE__,line) (hres == S_OK, "createElement failed: %08x\n", hres);
ok_(__FILE__,line) (node != NULL, "node == NULL\n");
return node;
}
#define test_node_append_child(n,c) _test_node_append_child(__LINE__,n,c)
static IHTMLDOMNode *_test_node_append_child(unsigned line, IUnknown *node_unk, IUnknown *child_unk)
{
......@@ -1932,6 +1952,11 @@ static void test_create_elems(IHTMLDocument2 *doc)
IHTMLElement_Release(elem2);
IHTMLElement_Release(body);
IHTMLElement_Release(elem);
node = test_create_text(doc, "test");
test_ifaces((IUnknown*)node, text_iids);
test_disp((IUnknown*)node, &DIID_DispHTMLDOMTextNode);
IHTMLDOMNode_Release(node);
}
static void test_exec(IUnknown *unk, const GUID *grpid, DWORD cmdid, VARIANT *in, VARIANT *out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment