mshtml: Use stored nsdoc in createTextRange.
This commit is contained in:
parent
7c7b7f0ae7
commit
408024a2d1
@ -544,18 +544,23 @@ static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface
|
|||||||
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
|
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
|
||||||
{
|
{
|
||||||
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
||||||
|
nsIDOMDocumentRange *nsdocrange;
|
||||||
nsIDOMRange *nsrange = NULL;
|
nsIDOMRange *nsrange = NULL;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, range);
|
TRACE("(%p)->(%p)\n", This, range);
|
||||||
|
|
||||||
if(This->textcont.element.node.doc->nscontainer) {
|
if(!This->textcont.element.node.doc->nsdoc) {
|
||||||
nsIDOMDocument *nsdoc;
|
WARN("No nsdoc\n");
|
||||||
nsIDOMDocumentRange *nsdocrange;
|
return E_UNEXPECTED;
|
||||||
nsresult nsres;
|
}
|
||||||
|
|
||||||
nsIWebNavigation_GetDocument(This->textcont.element.node.doc->nscontainer->navigation, &nsdoc);
|
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->nsdoc, &IID_nsIDOMDocumentRange,
|
||||||
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange);
|
(void**)&nsdocrange);
|
||||||
nsIDOMDocument_Release(nsdoc);
|
if(NS_FAILED(nsres)) {
|
||||||
|
ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
|
nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
|
||||||
if(NS_SUCCEEDED(nsres)) {
|
if(NS_SUCCEEDED(nsres)) {
|
||||||
@ -567,7 +572,6 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMDocumentRange_Release(nsdocrange);
|
nsIDOMDocumentRange_Release(nsdocrange);
|
||||||
}
|
|
||||||
|
|
||||||
*range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
|
*range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user