Jacek Caban : mshtml: Use stored nsdoc in createRange.

Alexandre Julliard julliard at winehq.org
Thu Oct 9 07:42:45 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct  8 13:27:52 2008 -0500

mshtml: Use stored nsdoc in createRange.

---

 dlls/mshtml/selection.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c
index 5eca8e3..53151a1 100644
--- a/dlls/mshtml/selection.c
+++ b/dlls/mshtml/selection.c
@@ -150,23 +150,16 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
 
         nsISelection_GetRangeCount(This->nsselection, &nsrange_cnt);
         if(!nsrange_cnt) {
-            nsIDOMDocument *nsdoc;
-            nsIDOMHTMLDocument *nshtmldoc;
             nsIDOMHTMLElement *nsbody = NULL;
 
             TRACE("nsrange_cnt = 0\n");
 
-            nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc);
-            if(NS_FAILED(nsres) || !nsdoc) {
-                ERR("GetDocument failed: %08x\n", nsres);
-                return E_FAIL;
+            if(!This->doc->nsdoc) {
+                WARN("nsdoc is NULL\n");
+                return E_UNEXPECTED;
             }
 
-            nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
-            nsIDOMDocument_Release(nsdoc);
-
-            nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody);
-            nsIDOMHTMLDocument_Release(nshtmldoc);
+            nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
             if(NS_FAILED(nsres) || !nsbody) {
                 ERR("Could not get body: %08x\n", nsres);
                 return E_FAIL;




More information about the wine-cvs mailing list