mshtml: Added IHTMLDOMTextNode::splitText implementation.

This commit is contained in:
Jacek Caban 2014-12-21 16:32:48 +01:00 committed by Alexandre Julliard
parent 998d346487
commit b69550ab34
2 changed files with 41 additions and 2 deletions

View File

@ -152,8 +152,31 @@ static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *
static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode)
{
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
FIXME("(%p)->(%d %p)\n", This, offset, pRetNode);
return E_NOTIMPL;
HTMLDOMNode *node;
nsIDOMText *text;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%d %p)\n", This, offset, pRetNode);
nsres = nsIDOMText_SplitText(This->nstext, offset, &text);
if(NS_FAILED(nsres)) {
ERR("SplitText failed: %x08x\n", nsres);
return E_FAIL;
}
if(!text) {
*pRetNode = NULL;
return S_OK;
}
hres = get_node(This->node.doc, (nsIDOMNode*)text, TRUE, &node);
nsIDOMText_Release(text);
if(FAILED(hres))
return hres;
*pRetNode = &node->IHTMLDOMNode_iface;
return S_OK;
}
static const IHTMLDOMTextNodeVtbl HTMLDOMTextNodeVtbl = {

View File

@ -339,6 +339,21 @@ function test_language_attribute() {
ok(elem.language === "1", "elem.language = " + elem.language);
}
function test_text_node() {
document.body.innerHTML = 'testing text';
var text = document.body.childNodes[0], text2;
ok(text.data == "testing text", "text.data = " + text.data);
text2 = text.splitText(7);
ok(text.data == "testing", "text.data = " + text.data);
ok(text2.data == " text", "text2.data = " + text2.data);
ok(text.nextSibling === text2, "text.nextSibling !== text2");
text2 = text.splitText(0);
ok(text.data == "", "text.data = " + text.data);
ok(text2.data == "testing", "text2.data = " + text2.data);
}
var globalVar = false;
function runTests() {
@ -363,6 +378,7 @@ function runTests() {
test_customtag();
test_whitespace_nodes();
test_language_attribute();
test_text_node();
var r = window.execScript("globalVar = true;");
ok(r === undefined, "execScript returned " + r);