From d3e6bf64ec1698df4407219aaf8a5a5349d7d2ac Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 16 Sep 2009 22:08:57 +0200 Subject: [PATCH] mshtml: Use stored nswindow in IHTMLTxtRange::select. --- dlls/mshtml/txtrange.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c index 509d9382033..e6a6ff2cd2a 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; }