mshtml: Moved nsdoc to HTMLDocumentNode object.

This commit is contained in:
Jacek Caban 2009-10-21 21:27:42 +02:00 committed by Alexandre Julliard
parent 3abaed0f22
commit f9eff68891
16 changed files with 84 additions and 84 deletions

View File

@ -340,7 +340,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
nsAString size_str;
nsAString val_str;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return;
}
@ -1155,7 +1155,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
return OLECMDERR_E_CANCELED;
}
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
@ -1178,7 +1178,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
if (insert_link_at_caret) {
nsIDOMNode *text_node, *unused_node;
nsIDOMDocument_CreateTextNode(This->nsdoc, &ns_url, (nsIDOMText **)&text_node);
nsIDOMDocument_CreateTextNode(This->doc_node->nsdoc, &ns_url, (nsIDOMText **)&text_node);
/* wrap the <a> tags around the text element */
nsIDOMElement_AppendChild(anchor_elem, text_node, &unused_node);

View File

@ -606,12 +606,12 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
TRACE("(%p)->(%p)\n", This, range);
if(!This->textcont.element.node.doc->basedoc.nsdoc) {
if(!This->textcont.element.node.doc->nsdoc) {
WARN("No nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange,
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);

View File

@ -899,12 +899,12 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
HTMLCurrentStyle *ret;
nsresult nsres;
if(!elem->node.doc->basedoc.nsdoc) {
if(!elem->node.doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
return E_FAIL;

View File

@ -113,12 +113,12 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
TRACE("(%p)->(%p)\n", This, p);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem);
nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
if(NS_FAILED(nsres)) {
ERR("GetDocumentElement failed: %08x\n", nsres);
return E_FAIL;
@ -143,12 +143,12 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
TRACE("(%p)->(%p)\n", This, p);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
if(NS_FAILED(nsres)) {
TRACE("Could not get body: %08x\n", nsres);
return E_UNEXPECTED;
@ -187,12 +187,12 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetImages(This->nsdoc, &nscoll);
nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetImages failed: %08x\n", nsres);
return E_FAIL;
@ -219,12 +219,12 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetApplets(This->nsdoc, &nscoll);
nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetApplets failed: %08x\n", nsres);
return E_FAIL;
@ -251,12 +251,12 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetLinks(This->nsdoc, &nscoll);
nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetLinks failed: %08x\n", nsres);
return E_FAIL;
@ -283,12 +283,12 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetForms(This->nsdoc, &nscoll);
nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetForms failed: %08x\n", nsres);
return E_FAIL;
@ -315,12 +315,12 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetAnchors(This->nsdoc, &nscoll);
nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll);
if(NS_FAILED(nsres)) {
ERR("GetAnchors failed: %08x\n", nsres);
return E_FAIL;
@ -342,13 +342,13 @@ static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&nsstr, v);
nsres = nsIDOMHTMLDocument_SetTitle(This->nsdoc, &nsstr);
nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres))
ERR("SetTitle failed: %08x\n", nsres);
@ -365,14 +365,14 @@ static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLDocument_GetTitle(This->nsdoc, &nsstr);
nsres = nsIDOMHTMLDocument_GetTitle(This->doc_node->nsdoc, &nsstr);
if (NS_SUCCEEDED(nsres)) {
nsAString_GetData(&nsstr, &ret);
*p = SysAllocString(ret);
@ -727,7 +727,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
nsresult nsres;
HRESULT hres;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
@ -750,9 +750,9 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
if(V_VT(var+i) == VT_BSTR) {
nsAString_SetData(&nsstr, V_BSTR(var+i));
if(!ln || i != argc-1)
nsres = nsIDOMHTMLDocument_Write(This->nsdoc, &nsstr);
nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr);
else
nsres = nsIDOMHTMLDocument_Writeln(This->nsdoc, &nsstr);
nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr);
if(NS_FAILED(nsres))
ERR("Write failed: %08x\n", nsres);
}else {
@ -795,7 +795,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
ERR("!nsdoc\n");
return E_NOTIMPL;
}
@ -804,7 +804,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
FIXME("unsupported args\n");
nsres = nsIDOMHTMLDocument_Open(This->nsdoc);
nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc);
if(NS_FAILED(nsres)) {
ERR("Open failed: %08x\n", nsres);
return E_FAIL;
@ -822,12 +822,12 @@ static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
TRACE("(%p)\n", This);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
ERR("!nsdoc\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLDocument_Close(This->nsdoc);
nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
if(NS_FAILED(nsres)) {
ERR("Close failed: %08x\n", nsres);
return E_FAIL;
@ -1222,12 +1222,12 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
*p = NULL;
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
nsres = nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
nsIDOMDocumentStyle_Release(nsdocstyle);
if(NS_FAILED(nsres)) {
@ -1736,9 +1736,6 @@ static void destroy_htmldoc(HTMLDocument *This)
remove_doc_tasks(This);
ConnectionPointContainer_Destroy(&This->cp_container);
if(This->nsdoc)
nsIDOMHTMLDocument_Release(This->nsdoc);
}
#define HTMLDOCNODE_NODE_THIS(iface) DEFINE_THIS2(HTMLDocumentNode, node, iface)
@ -1771,6 +1768,10 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
detach_selection(This);
detach_ranges(This);
release_nodes(This);
if(This->nsdoc)
nsIDOMHTMLDocument_Release(This->nsdoc);
destroy_htmldoc(&This->basedoc);
}
@ -1816,7 +1817,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
doc->ref = 1;
nsIDOMHTMLDocument_AddRef(nsdoc);
doc->basedoc.nsdoc = nsdoc;
doc->nsdoc = nsdoc;
doc->basedoc.window = window;
@ -1885,6 +1886,8 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
set_document_bscallback(&This->basedoc, NULL);
set_current_mon(&This->basedoc, NULL);
if(This->basedoc.doc_node) {
if(This->basedoc.doc_node->nsdoc)
remove_mutation_observer(This->nscontainer, This->basedoc.doc_node->nsdoc);
This->basedoc.doc_node->basedoc.doc_obj = NULL;
IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc));
}
@ -1911,8 +1914,6 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
destroy_htmldoc(&This->basedoc);
release_dispex(&This->dispex);
if(This->basedoc.nsdoc)
remove_mutation_observer(This->nscontainer, This->basedoc.nsdoc);
if(This->nscontainer)
NSContainer_Release(This->nscontainer);
heap_free(This);

View File

@ -111,13 +111,13 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&text_str, text);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->nsdoc, &text_str, &nstext);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
@ -146,12 +146,12 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
return S_OK;
}
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem);
nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
if(NS_FAILED(nsres)) {
ERR("GetDocumentElement failed: %08x\n", nsres);
return E_FAIL;
@ -436,13 +436,13 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&id_str, v);
nsres = nsIDOMHTMLDocument_GetElementById(This->nsdoc, &id_str, &nselem);
nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem);
nsAString_Finish(&id_str);
if(FAILED(nsres)) {
ERR("GetElementById failed: %08x\n", nsres);
@ -473,14 +473,14 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&id_str, v);
nsAString_Init(&ns_str, str);
nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->nsdoc, &ns_str, &id_str, &nslist);
nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
nsAString_Finish(&id_str);
nsAString_Finish(&ns_str);
if(FAILED(nsres)) {
@ -607,7 +607,7 @@ static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
TRACE("(%p)->()\n", This);
nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
if(NS_FAILED(nsres) || !nsbody) {
ERR("GetBody failed: %08x\n", nsres);
return E_FAIL;

View File

@ -131,13 +131,13 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&str, bstrdata);
nsres = nsIDOMHTMLDocument_CreateComment(This->nsdoc, &str, &nscomment);
nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
nsAString_Finish(&str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
@ -246,12 +246,12 @@ static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *
TRACE("(%p)->(%p)\n", This, p);
if(!This->nsdoc) {
if(!This->doc_node->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nshtmldoc);
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nshtmldoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSHTMLDocument: %08x\n", nsres);
return S_OK;

View File

@ -44,13 +44,13 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement
nsAString tag_str;
nsresult nsres;
if(!doc->basedoc.nsdoc) {
if(!doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&tag_str, tag);
nsres = nsIDOMDocument_CreateElement(doc->basedoc.nsdoc, &tag_str, &nselem);
nsres = nsIDOMDocument_CreateElement(doc->nsdoc, &tag_str, &nselem);
nsAString_Finish(&tag_str);
if(NS_FAILED(nsres)) {
ERR("CreateElement failed: %08x\n", nsres);
@ -879,7 +879,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
}
nsAString_Init(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &text_str, &text_node);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
@ -1035,12 +1035,12 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
if(!This->node.doc->basedoc.nsdoc) {
if(!This->node.doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMDocument_QueryInterface(This->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
if(NS_FAILED(nsres))
{
ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
@ -1093,14 +1093,14 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
if(!This->node.doc->basedoc.nsdoc) {
if(!This->node.doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&ns_text, text);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsAString_Finish(&ns_text);
if(NS_FAILED(nsres) || !nsnode)

View File

@ -713,7 +713,7 @@ static IHTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEve
nsIDOMDocumentEvent *doc_event;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(target->doc->basedoc.nsdoc, &IID_nsIDOMDocumentEvent,
nsres = nsIDOMHTMLDocument_QueryInterface(target->doc->nsdoc, &IID_nsIDOMDocumentEvent,
(void**)&doc_event);
if(NS_SUCCEEDED(nsres)) {
nsAString type_str;
@ -827,7 +827,7 @@ void fire_event(HTMLDocumentNode *doc, eventid_t eid, nsIDOMNode *target, nsIDOM
nsIDOMHTMLElement *nsbody;
nsresult nsres;
nsres = nsIDOMHTMLDocument_GetBody(doc->basedoc.nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
if(NS_SUCCEEDED(nsres) && nsbody) {
node = get_node(doc, (nsIDOMNode*)nsbody, FALSE);
if(node)

View File

@ -187,7 +187,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->element.node.doc->basedoc.nsdoc) {
if(!This->element.node.doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
@ -210,7 +210,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
}
nsAString_Init(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->basedoc.nsdoc, &text_str, &text_node);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);

View File

@ -291,7 +291,6 @@ struct HTMLDocument {
HTMLDocumentNode *doc_node;
HTMLWindow *window;
nsIDOMHTMLDocument *nsdoc;
ConnectionPointContainer cp_container;
ConnectionPoint cp_htmldocevents;
@ -485,6 +484,7 @@ struct HTMLDocumentNode {
LONG ref;
nsIDOMHTMLDocument *nsdoc;
HTMLDOMNode *nodes;
BOOL content_ready;

View File

@ -73,7 +73,7 @@ void remove_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nsht
#define IE_MAJOR_VERSION 7
#define IE_MINOR_VERSION 0
static BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment)
static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *comment)
{
DWORD len;
int majorv = 0, minorv = 0;
@ -214,7 +214,7 @@ static void add_script_runner(NSContainer *This)
nsIDOMNSDocument *nsdoc;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc->basedoc.nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc->basedoc.doc_node->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
return;
@ -300,7 +300,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
const PRUnichar *comment;
nsAString_GetData(&comment_str, &comment);
remove_comment = handle_insert_comment(&This->doc->basedoc, comment);
remove_comment = handle_insert_comment(This->doc->basedoc.doc_node, comment);
}
nsAString_Finish(&comment_str);

View File

@ -831,14 +831,13 @@ void update_nsdocument(HTMLDocumentObj *doc)
return;
}
if(nsdoc == doc->basedoc.nsdoc) {
if(doc->basedoc.doc_node && nsdoc == doc->basedoc.doc_node->nsdoc) {
nsIDOMHTMLDocument_Release(nsdoc);
return;
}
if(doc->basedoc.nsdoc) {
remove_mutation_observer(doc->nscontainer, doc->basedoc.nsdoc);
nsIDOMHTMLDocument_Release(doc->basedoc.nsdoc);
if(doc->basedoc.doc_node && doc->basedoc.doc_node->nsdoc) {
remove_mutation_observer(doc->nscontainer, doc->basedoc.doc_node->nsdoc);
doc_node = doc->basedoc.doc_node;
doc_node->basedoc.doc_obj = NULL;
@ -846,8 +845,8 @@ void update_nsdocument(HTMLDocumentObj *doc)
doc->basedoc.doc_node = NULL;
}
doc->basedoc.nsdoc = nsdoc;
if(!nsdoc) {
doc->basedoc.doc_node = NULL;
window_set_docnode(doc->basedoc.window, NULL);
return;
}

View File

@ -148,12 +148,12 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
if(This->doc->usermode == EDITMODE)
handle_edit_load(&This->doc->basedoc);
if(!This->doc->basedoc.nsdoc) {
if(!This->doc->basedoc.doc_node->nsdoc) {
ERR("NULL nsdoc\n");
return NS_ERROR_FAILURE;
}
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.doc_node->nsdoc, &nsbody);
if(nsbody) {
fire_event(This->doc->basedoc.doc_node, EVENTID_LOAD, (nsIDOMNode*)nsbody, event);
nsIDOMHTMLElement_Release(nsbody);

View File

@ -205,7 +205,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
return S_OK;
}
static HRESULT get_doc_string(HTMLDocument *This, char **str)
static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
{
nsIDOMNode *nsnode;
LPCWSTR strw;
@ -462,7 +462,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam
return E_FAIL;
}
hres = get_doc_string(This, &str);
hres = get_doc_string(This->doc_node, &str);
if(SUCCEEDED(hres))
WriteFile(file, str, strlen(str), &written, NULL);
@ -569,7 +569,7 @@ static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM
TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
hres = get_doc_string(This, &str);
hres = get_doc_string(This->doc_node, &str);
if(FAILED(hres))
return hres;

View File

@ -156,12 +156,12 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
TRACE("nsrange_cnt = 0\n");
if(!This->doc->basedoc.nsdoc) {
if(!This->doc->nsdoc) {
WARN("nsdoc is NULL\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
if(NS_FAILED(nsres) || !nsbody) {
ERR("Could not get body: %08x\n", nsres);
return E_FAIL;

View File

@ -342,7 +342,7 @@ static nsIDOMNode *prev_node(HTMLTxtRange *This, nsIDOMNode *iter)
if(!iter) {
nsIDOMHTMLElement *nselem;
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nselem);
nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nselem);
nsIDOMElement_GetLastChild(nselem, &tmp);
if(!tmp)
return (nsIDOMNode*)nselem;
@ -1139,7 +1139,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
return MSHTML_E_NODOC;
nsAString_Init(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->basedoc.nsdoc, &text_str, &text_node);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
@ -1348,7 +1348,7 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
nsIDOMHTMLElement *nsbody = NULL;
nsresult nsres;
nsres = nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
if(NS_FAILED(nsres) || !nsbody) {
ERR("Could not get body: %08x\n", nsres);
break;
@ -1787,7 +1787,7 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
TRACE("(%p)->(%p %p)\n", This, in, out);
if(!This->doc->basedoc.nsdoc) {
if(!This->doc->nsdoc) {
WARN("NULL nsdoc\n");
return E_NOTIMPL;
}