Jacek Caban : mshtml: Fix range pos after put_text call.

Alexandre Julliard julliard at winehq.org
Mon Oct 15 11:27:51 CDT 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct 12 11:11:24 2007 +0200

mshtml: Fix range pos after put_text call.

---

 dlls/mshtml/tests/dom.c |    3 +++
 dlls/mshtml/txtrange.c  |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 966831e..93d134a 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -361,6 +361,9 @@ static void test_txtrange(IHTMLDocument2 *doc)
     test_range_expand(range, wordW, VARIANT_TRUE, "test ");
     test_range_put_text(range, wordW);
     test_range_text(body_range, "wordabc 123\r\nit's text");
+    test_range_text(range, NULL);
+    test_range_moveend(range, characterW, 3, 3);
+    test_range_text(range, "abc");
 
     IHTMLTxtRange_Release(range);
     IHTMLTxtRange_Release(body_range);
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 4e67af9..1323540 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -893,7 +893,11 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
     if(NS_FAILED(nsres))
         ERR("InsertNode failed: %08x\n", nsres);
 
-    return S_OK;
+    nsres = nsIDOMRange_SetEndAfter(This->nsrange, (nsIDOMNode*)text_node);
+    if(NS_FAILED(nsres))
+        ERR("SetEndAfter failed: %08x\n", nsres);
+
+    return IHTMLTxtRange_collapse(HTMLTXTRANGE(This), VARIANT_FALSE);
 }
 
 static HRESULT WINAPI HTMLTxtRange_get_text(IHTMLTxtRange *iface, BSTR *p)




More information about the wine-cvs mailing list