Jacek Caban : mshtml: Use stored nselem in get_documentElement.
Alexandre Julliard
julliard at winehq.org
Thu Oct 9 07:42:51 CDT 2008
Module: wine
Branch: master
Commit: 08257acea2ce942692822d8b6849ba3d44c46906
URL: http://source.winehq.org/git/wine.git/?a=commit;h=08257acea2ce942692822d8b6849ba3d44c46906
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Oct 8 13:29:47 2008 -0500
mshtml: Use stored nselem in get_documentElement.
---
dlls/mshtml/htmldoc3.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/dlls/mshtml/htmldoc3.c b/dlls/mshtml/htmldoc3.c
index 2dc5a58..d636834 100644
--- a/dlls/mshtml/htmldoc3.c
+++ b/dlls/mshtml/htmldoc3.c
@@ -134,31 +134,26 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
{
HTMLDocument *This = HTMLDOC3_THIS(iface);
- nsIDOMDocument *nsdoc;
- HTMLDOMNode *node;
nsIDOMElement *nselem = NULL;
+ HTMLDOMNode *node;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
- if(!This->nscontainer) {
- *p = NULL;
- return S_OK;
+ if(!This->nsdoc) {
+ WARN("NULL nsdoc\n");
+ return E_UNEXPECTED;
}
- nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
- if(NS_FAILED(nsres))
- ERR("GetDocument failed: %08x\n", nsres);
-
- if(nsdoc) {
- nsres = nsIDOMHTMLDocument_GetDocumentElement(nsdoc, &nselem);
- if(NS_FAILED(nsres))
- ERR("GetDocumentElement failed: %08x\n", nsres);
+ nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem);
+ if(NS_FAILED(nsres)) {
+ ERR("GetDocumentElement failed: %08x\n", nsres);
+ return E_FAIL;
}
+
if(nselem) {
node = get_node(This, (nsIDOMNode *)nselem, TRUE);
- nsIDOMDocument_Release(nsdoc);
-
+ nsIDOMElement_Release(nselem);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
}else {
*p = NULL;
More information about the wine-cvs
mailing list