Commit 408024a2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use stored nsdoc in createTextRange.

parent 7c7b7f0a
......@@ -544,18 +544,23 @@ static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
{
HTMLBodyElement *This = HTMLBODY_THIS(iface);
nsIDOMDocumentRange *nsdocrange;
nsIDOMRange *nsrange = NULL;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, range);
if(This->textcont.element.node.doc->nscontainer) {
nsIDOMDocument *nsdoc;
nsIDOMDocumentRange *nsdocrange;
nsresult nsres;
if(!This->textcont.element.node.doc->nsdoc) {
WARN("No nsdoc\n");
return E_UNEXPECTED;
}
nsIWebNavigation_GetDocument(This->textcont.element.node.doc->nscontainer->navigation, &nsdoc);
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange);
nsIDOMDocument_Release(nsdoc);
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->nsdoc, &IID_nsIDOMDocumentRange,
(void**)&nsdocrange);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
if(NS_SUCCEEDED(nsres)) {
......@@ -567,7 +572,6 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
}
nsIDOMDocumentRange_Release(nsdocrange);
}
*range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment