Jacek Caban : mshtml: Use stored nswindow in IHTMLTxtRange::select.

Alexandre Julliard julliard at winehq.org
Thu Sep 17 13:52:23 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 16 22:08:57 2009 +0200

mshtml: Use stored nswindow in IHTMLTxtRange::select.

---

 dlls/mshtml/txtrange.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 509d938..e6a6ff2 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -1545,23 +1545,20 @@ static HRESULT WINAPI HTMLTxtRange_moveEnd(IHTMLTxtRange *iface, BSTR Unit,
 static HRESULT WINAPI HTMLTxtRange_select(IHTMLTxtRange *iface)
 {
     HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
+    nsISelection *nsselection;
+    nsresult nsres;
 
     TRACE("(%p)\n", This);
 
-    if(This->doc->nscontainer) {
-        nsIDOMWindow *dom_window = NULL;
-        nsISelection *nsselection;
-
-        nsIWebBrowser_GetContentDOMWindow(This->doc->nscontainer->webbrowser, &dom_window);
-        nsIDOMWindow_GetSelection(dom_window, &nsselection);
-        nsIDOMWindow_Release(dom_window);
-
-        nsISelection_RemoveAllRanges(nsselection);
-        nsISelection_AddRange(nsselection, This->nsrange);
-
-        nsISelection_Release(nsselection);
+    nsres = nsIDOMWindow_GetSelection(This->doc->window->nswindow, &nsselection);
+    if(NS_FAILED(nsres)) {
+        ERR("GetSelection failed: %08x\n", nsres);
+        return E_FAIL;
     }
 
+    nsISelection_RemoveAllRanges(nsselection);
+    nsISelection_AddRange(nsselection, This->nsrange);
+    nsISelection_Release(nsselection);
     return S_OK;
 }
 




More information about the wine-cvs mailing list