Jacek Caban : mshtml: Use stored nsdoc in IHTMLDocument2::get_styleSheets.

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


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

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

mshtml: Use stored nsdoc in IHTMLDocument2::get_styleSheets.

---

 dlls/mshtml/htmldoc.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index e48e1df..b757a80 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1188,30 +1188,24 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
     HTMLDocument *This = HTMLDOC_THIS(iface);
     nsIDOMStyleSheetList *nsstylelist;
     nsIDOMDocumentStyle *nsdocstyle;
-    nsIDOMDocument *nsdoc;
     nsresult nsres;
 
     TRACE("(%p)->(%p)\n", This, p);
 
     *p = NULL;
 
-    if(!This->nscontainer)
-        return S_OK;
-
-    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
-    if(NS_FAILED(nsres)) {
-        ERR("GetDocument failed: %08x\n", nsres);
-        return S_OK;
+    if(!This->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
     }
 
-    if(NS_FAILED(nsres) || !nsdoc)
-        return S_OK;
-
-    nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
-    nsIDOMDocument_Release(nsdoc);
-
-    nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
+    nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
+    nsres = nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
     nsIDOMDocumentStyle_Release(nsdocstyle);
+    if(NS_FAILED(nsres)) {
+        ERR("GetStyleSheets failed: %08x\n", nsres);
+        return E_FAIL;
+    }
 
     *p = HTMLStyleSheetsCollection_Create(nsstylelist);
     nsIDOMDocumentStyle_Release(nsstylelist);




More information about the wine-cvs mailing list