mshtml: Added IHTMLTxtRange::moveToElementText implementation.

This commit is contained in:
Jacek Caban 2014-11-12 16:25:13 +01:00 committed by Alexandre Julliard
parent f1786a2068
commit 41e3de93c3
2 changed files with 27 additions and 2 deletions

View File

@ -4823,6 +4823,7 @@ static void test_txtrange(IHTMLDocument2 *doc)
IHTMLTxtRange *body_range, *range, *range2;
IHTMLSelectionObject *selection;
IDispatch *disp_range;
IHTMLElement *body;
HRESULT hres;
body_range = test_create_body_range(doc);
@ -5008,6 +5009,16 @@ static void test_txtrange(IHTMLDocument2 *doc)
test_range_moveend(range, characterW, 2, 2);
test_range_text(range, "ab");
body = doc_get_body(doc);
hres = IHTMLTxtRange_moveToElementText(range, body);
ok(hres == S_OK, "moveToElementText failed: %08x\n", hres);
test_range_text(range, "abc xyz abc 123\r\nit's text");
test_range_parent(range, ET_BODY);
IHTMLElement_Release(body);
IHTMLTxtRange_Release(range);
}

View File

@ -1579,8 +1579,22 @@ static HRESULT WINAPI HTMLTxtRange_pasteHTML(IHTMLTxtRange *iface, BSTR html)
static HRESULT WINAPI HTMLTxtRange_moveToElementText(IHTMLTxtRange *iface, IHTMLElement *element)
{
HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
FIXME("(%p)->(%p)\n", This, element);
return E_NOTIMPL;
HTMLElement *elem;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, element);
elem = unsafe_impl_from_IHTMLElement(element);
if(!elem)
return E_INVALIDARG;
nsres = nsIDOMRange_SelectNodeContents(This->nsrange, elem->node.nsnode);
if(NS_FAILED(nsres)) {
ERR("SelectNodeContents failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLTxtRange_setEndPoint(IHTMLTxtRange *iface, BSTR how,