Jacek Caban : mshtml: Added IHTMLTxtRange:: moveToElementText implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 13 07:40:25 CST 2014


Module: wine
Branch: master
Commit: 41e3de93c3459c6c61820c2f81ad90605faea456
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=41e3de93c3459c6c61820c2f81ad90605faea456

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov 12 16:25:13 2014 +0100

mshtml: Added IHTMLTxtRange::moveToElementText implementation.

---

 dlls/mshtml/tests/dom.c | 11 +++++++++++
 dlls/mshtml/txtrange.c  | 18 ++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 5dc0c4c..a4bc01f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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);
 }
 
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 6b57eb2..886f596 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -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,




More information about the wine-cvs mailing list