Commit 67f07ffb authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Use nsIDOMDocument instead of nsIDOMHTMLDocument where possible.

parent 819a848a
......@@ -183,8 +183,13 @@ static DWORD query_align_status(HTMLDocumentNode *doc, const WCHAR *align)
if(doc->browser->usermode != EDITMODE || doc->outer_window->readystate < READYSTATE_INTERACTIVE)
return OLECMDF_SUPPORTED;
if(!doc->html_document) {
FIXME("Not implemented for XML document\n");
return E_NOTIMPL;
}
nsAString_Init(&justify_str, align);
nsres = nsIDOMHTMLDocument_QueryCommandState(doc->nsdoc, &justify_str, &b);
nsres = nsIDOMHTMLDocument_QueryCommandState(doc->html_document, &justify_str, &b);
nsAString_Finish(&justify_str);
if(NS_SUCCEEDED(nsres) && b)
ret |= OLECMDF_LATCHED;
......@@ -1081,8 +1086,8 @@ static HRESULT exec_hyperlink(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *
return OLECMDERR_E_CANCELED;
}
if(!doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
......@@ -1105,7 +1110,7 @@ static HRESULT exec_hyperlink(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *
nsIDOMNode *unused_node;
nsIDOMText *text_node;
nsIDOMHTMLDocument_CreateTextNode(doc->nsdoc, &ns_url, &text_node);
nsIDOMDocument_CreateTextNode(doc->dom_document, &ns_url, &text_node);
/* wrap the <a> tags around the text element */
nsIDOMElement_AppendChild(anchor_elem, (nsIDOMNode*)text_node, &unused_node);
......
......@@ -669,12 +669,12 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
TRACE("(%p)->(%p)\n", This, range);
if(!This->element.node.doc->nsdoc) {
WARN("No nsdoc\n");
if(!This->element.node.doc->dom_document) {
WARN("No dom_document\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_CreateRange(This->element.node.doc->nsdoc, &nsrange);
nsres = nsIDOMDocument_CreateRange(This->element.node.doc->dom_document, &nsrange);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMRange_SelectNodeContents(nsrange, This->element.node.nsnode);
if(NS_FAILED(nsres))
......
......@@ -1316,12 +1316,12 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
HTMLCurrentStyle *ret;
nsresult nsres;
if(!elem->node.doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!elem->node.doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetDefaultView(elem->node.doc->nsdoc, &nsview);
nsres = nsIDOMDocument_GetDefaultView(elem->node.doc->dom_document, &nsview);
if(NS_FAILED(nsres)) {
ERR("GetDefaultView failed: %08lx\n", nsres);
return E_FAIL;
......
......@@ -181,7 +181,7 @@ static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
return NULL;
}
HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
HRESULT replace_node_by_html(nsIDOMDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
{
nsIDOMDocumentFragment *nsfragment;
nsIDOMNode *nsparent;
......@@ -190,7 +190,7 @@ HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, cons
nsresult nsres;
HRESULT hres = S_OK;
nsres = nsIDOMHTMLDocument_CreateRange(nsdoc, &range);
nsres = nsIDOMDocument_CreateRange(nsdoc, &range);
if(NS_FAILED(nsres)) {
ERR("CreateRange failed: %08lx\n", nsres);
return E_FAIL;
......@@ -410,8 +410,8 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID
if(!p || p[1] || wcschr(tag + 1, '<'))
return E_FAIL;
if(!doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
......@@ -430,7 +430,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID
size = (p + 2 - (tag + 1 + name_len)) * sizeof(WCHAR);
/* Parse the input via a contextual fragment, using a dummy unknown tag */
nsres = nsIDOMHTMLDocument_CreateRange(doc->nsdoc, &nsrange);
nsres = nsIDOMDocument_CreateRange(doc->dom_document, &nsrange);
if(NS_FAILED(nsres))
return map_nsresult(nsres);
......@@ -467,7 +467,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID
p[name_len] = '\0';
nsAString_InitDepend(&str, p);
nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &str, ret);
nsres = nsIDOMDocument_CreateElement(doc->dom_document, &str, ret);
nsAString_Finish(&str);
heap_free(p);
......@@ -488,13 +488,13 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **r
nsAString tag_str;
nsresult nsres;
if(!doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
nsAString_InitDepend(&tag_str, tag);
nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
nsres = nsIDOMDocument_CreateElement(doc->dom_document, &tag_str, ret);
nsAString_Finish(&tag_str);
if(NS_FAILED(nsres)) {
ERR("CreateElement failed: %08lx\n", nsres);
......@@ -510,7 +510,7 @@ HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **re
HRESULT hres;
/* Use owner doc if called on document fragment */
if(!doc->nsdoc)
if(!doc->dom_document)
doc = doc->node.doc;
/* IE8 and below allow creating elements with attributes, such as <div class="a"> */
......@@ -2223,7 +2223,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
}
nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->dom_document, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08lx\n", nsres);
......@@ -2255,7 +2255,7 @@ static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
return replace_node_by_html(This->node.doc->nsdoc, This->node.nsnode, v);
return replace_node_by_html(This->node.doc->dom_document, This->node.nsnode, v);
}
static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
......@@ -2298,20 +2298,20 @@ static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
return 0x800a0258; /* undocumented error code */
}
if(!This->node.doc->nsdoc) {
FIXME("NULL nsdoc\n");
if(!This->node.doc->dom_document) {
FIXME("NULL dom_document\n");
return E_FAIL;
}
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->dom_document, &nsstr, &text_node);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed\n");
return E_FAIL;
}
nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
nsres = nsIDOMDocument_CreateRange(This->node.doc->dom_document, &range);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMRange_SelectNode(range, This->node.nsnode);
if(NS_SUCCEEDED(nsres))
......@@ -2422,12 +2422,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->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->node.doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
nsres = nsIDOMDocument_CreateRange(This->node.doc->dom_document, &range);
if(NS_FAILED(nsres))
{
ERR("CreateRange failed: %08lx\n", nsres);
......@@ -2463,14 +2463,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->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->node.doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
nsAString_InitDepend(&ns_text, text);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->dom_document, &ns_text, (nsIDOMText **)&nsnode);
nsAString_Finish(&ns_text);
if(NS_FAILED(nsres) || !nsnode)
......
......@@ -3085,7 +3085,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM
unsigned i;
nsAString_InitDepend(&nsstr, type);
nsres = nsIDOMHTMLDocument_CreateEvent(doc->nsdoc, &nsstr, &nsevent);
nsres = nsIDOMDocument_CreateEvent(doc->dom_document, &nsstr, &nsevent);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
FIXME("CreateEvent(%s) failed: %08lx\n", debugstr_w(type), nsres);
......@@ -3117,7 +3117,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven
nsresult nsres;
nsAString_InitDepend(&nsstr, event_types[event_info[event_id].type]);
nsres = nsIDOMHTMLDocument_CreateEvent(doc->nsdoc, &nsstr, &nsevent);
nsres = nsIDOMDocument_CreateEvent(doc->dom_document, &nsstr, &nsevent);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
FIXME("CreateEvent(%s) failed: %08lx\n", debugstr_w(event_types[event_info[event_id].type]), nsres);
......@@ -3665,7 +3665,7 @@ HRESULT ensure_doc_nsevent_handler(HTMLDocumentNode *doc, nsIDOMNode *nsnode, ev
{
TRACE("%s\n", debugstr_w(event_info[eid].name));
if(!doc->nsdoc)
if(!doc->dom_document)
return S_OK;
switch(eid) {
......
......@@ -252,8 +252,8 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->element.node.doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->element.node.doc->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
......@@ -275,7 +275,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
}
nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
nsres = nsIDOMDocument_CreateTextNode(This->element.node.doc->dom_document, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08lx\n", nsres);
......
......@@ -4143,7 +4143,6 @@ HRESULT update_window_doc(HTMLInnerWindow *window)
{
HTMLOuterWindow *outer_window = window->base.outer_window;
compat_mode_t parent_mode = COMPAT_MODE_QUIRKS;
nsIDOMHTMLDocument *nshtmldoc;
nsIDOMDocument *nsdoc;
nsresult nsres;
HRESULT hres;
......@@ -4159,18 +4158,11 @@ HRESULT update_window_doc(HTMLInnerWindow *window)
return E_FAIL;
}
nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
nsIDOMDocument_Release(nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLDocument iface: %08lx\n", nsres);
return E_FAIL;
}
if(outer_window->parent)
parent_mode = outer_window->parent->base.inner_window->doc->document_mode;
hres = create_document_node(nshtmldoc, outer_window->browser, window, parent_mode, &window->doc);
nsIDOMHTMLDocument_Release(nshtmldoc);
hres = create_document_node(nsdoc, outer_window->browser, window, parent_mode, &window->doc);
nsIDOMDocument_Release(nsdoc);
if(FAILED(hres))
return hres;
......
......@@ -921,7 +921,8 @@ struct HTMLDocumentNode {
compat_mode_t document_mode;
BOOL document_mode_locked;
nsIDOMHTMLDocument *nsdoc;
nsIDOMDocument *dom_document;
nsIDOMHTMLDocument *html_document;
BOOL content_ready;
IHTMLDOMImplementation *dom_implementation;
......@@ -949,7 +950,7 @@ struct HTMLDocumentNode {
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT create_document_node(nsIDOMHTMLDocument*,GeckoBrowser*,HTMLInnerWindow*,
HRESULT create_document_node(nsIDOMDocument*,GeckoBrowser*,HTMLInnerWindow*,
compat_mode_t,HTMLDocumentNode**) DECLSPEC_HIDDEN;
HRESULT create_doctype_node(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
......@@ -997,7 +998,7 @@ compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
JSContext *get_context_from_document(nsIDOMDocument*) DECLSPEC_HIDDEN;
void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
......@@ -1082,7 +1083,7 @@ void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
HRESULT replace_node_by_html(nsIDOMDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
......
......@@ -211,7 +211,7 @@ static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_i
if(replace_html) {
HRESULT hres;
hres = replace_node_by_html(doc->nsdoc, (nsIDOMNode*)nscomment, replace_html);
hres = replace_node_by_html(doc->dom_document, (nsIDOMNode*)nscomment, replace_html);
heap_free(replace_html);
if(FAILED(hres))
nsres = NS_ERROR_FAILURE;
......@@ -971,7 +971,7 @@ void init_document_mutation(HTMLDocumentNode *doc)
doc->nsIDocumentObserver_iface.lpVtbl = &nsDocumentObserverVtbl;
nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
nsres = nsIDOMDocument_QueryInterface(doc->dom_document, &IID_nsIDocument, (void**)&nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocument: %08lx\n", nsres);
return;
......@@ -986,7 +986,7 @@ void release_document_mutation(HTMLDocumentNode *doc)
nsIDocument *nsdoc;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
nsres = nsIDOMDocument_QueryInterface(doc->dom_document, &IID_nsIDocument, (void**)&nsdoc);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocument: %08lx\n", nsres);
return;
......@@ -996,13 +996,13 @@ void release_document_mutation(HTMLDocumentNode *doc)
nsIDocument_Release(nsdoc);
}
JSContext *get_context_from_document(nsIDOMHTMLDocument *nsdoc)
JSContext *get_context_from_document(nsIDOMDocument *nsdoc)
{
nsIDocument *doc;
JSContext *ctx;
nsresult nsres;
nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDocument, (void**)&doc);
nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDocument, (void**)&doc);
assert(nsres == NS_OK);
ctx = nsIContentUtils_GetContextFromDocument(content_utils, doc);
......
......@@ -2152,7 +2152,7 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri)
swprintf(selector, ARRAY_SIZE(selector_formatW)+SysStringLen(frag), selector_formatW, frag);
nsAString_InitDepend(&selector_str, selector);
/* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */
nsres = nsIDOMHTMLDocument_QuerySelector(window->base.inner_window->doc->nsdoc, &selector_str, &nselem);
nsres = nsIDOMDocument_QuerySelector(window->base.inner_window->doc->dom_document, &selector_str, &nselem);
nsAString_Finish(&selector_str);
heap_free(selector);
if(NS_SUCCEEDED(nsres) && nselem) {
......
......@@ -1683,7 +1683,12 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
case CONTEXT_TEXT: {
nsISelection *selection;
nsres = nsIDOMHTMLDocument_GetSelection(This->doc->doc_node->nsdoc, &selection);
if(!This->doc->doc_node->html_document) {
FIXME("Not implemented for XML document\n");
break;
}
nsres = nsIDOMHTMLDocument_GetSelection(This->doc->doc_node->html_document, &selection);
if(NS_SUCCEEDED(nsres) && selection) {
cpp_bool is_collapsed;
......
......@@ -258,14 +258,14 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service,
&doc->outer_window->base.IHTMLWindow2_iface, 0);
if(doc->nsdoc) {
if(doc->dom_document) {
hres = create_document_event(doc, EVENTID_LOAD, &load_event);
if(SUCCEEDED(hres)) {
dispatch_event(&doc->node.event_target, load_event);
IDOMEvent_Release(&load_event->IDOMEvent_iface);
}
}else {
WARN("no nsdoc\n");
WARN("no dom_document\n");
}
if(doc->window) {
......@@ -383,7 +383,7 @@ static nsIDOMEventTarget *get_default_document_target(HTMLDocumentNode *doc)
nsISupports *target_iface;
nsresult nsres;
target_iface = doc->window ? (nsISupports*)doc->outer_window->nswindow : (nsISupports*)doc->nsdoc;
target_iface = doc->window ? (nsISupports*)doc->outer_window->nswindow : (nsISupports*)doc->dom_document;
nsres = nsISupports_QueryInterface(target_iface, &IID_nsIDOMEventTarget, (void**)&target);
return NS_SUCCEEDED(nsres) ? target : NULL;
}
......
......@@ -242,7 +242,6 @@ static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplemen
{
HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
HTMLDocumentNode *new_document_node;
nsIDOMHTMLDocument *html_doc;
nsIDOMDocument *doc;
nsAString title_str;
nsresult nsres;
......@@ -261,12 +260,8 @@ static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplemen
return E_FAIL;
}
nsres = nsIDOMDocument_QueryInterface(doc, &IID_nsIDOMHTMLDocument, (void**)&html_doc);
hres = create_document_node(doc, This->browser, NULL, dispex_compat_mode(&This->dispex), &new_document_node);
nsIDOMDocument_Release(doc);
assert(nsres == NS_OK);
hres = create_document_node(html_doc, This->browser, NULL, dispex_compat_mode(&This->dispex), &new_document_node);
nsIDOMHTMLDocument_Release(html_doc);
if(FAILED(hres))
return hres;
......@@ -337,7 +332,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa
init_dispatch(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface,
&HTMLDOMImplementation_dispex, doc_node->document_mode);
nsres = nsIDOMHTMLDocument_GetImplementation(doc_node->nsdoc, &dom_implementation->implementation);
nsres = nsIDOMDocument_GetImplementation(doc_node->dom_document, &dom_implementation->implementation);
if(NS_FAILED(nsres)) {
ERR("GetDOMImplementation failed: %08lx\n", nsres);
IHTMLDOMImplementation_Release(&dom_implementation->IHTMLDOMImplementation_iface);
......
......@@ -503,12 +503,12 @@ static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
nsresult nsres;
HRESULT hres;
if(!This->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->dom_document) {
WARN("NULL dom_document\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
nsres = nsIDOMDocument_QueryInterface(This->dom_document, &IID_nsIDOMNode, (void**)&nsnode);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNode failed: %08lx\n", nsres);
return E_FAIL;
......
......@@ -949,7 +949,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
return MSHTML_E_NODOC;
nsAString_InitDepend(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
nsres = nsIDOMDocument_CreateTextNode(This->doc->dom_document, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08lx\n", nsres);
......@@ -1159,7 +1159,12 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
nsIDOMHTMLElement *nsbody = NULL;
nsresult nsres;
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
if(!This->doc->html_document) {
FIXME("Not implemented for XML document\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLDocument_GetBody(This->doc->html_document, &nsbody);
if(NS_FAILED(nsres) || !nsbody) {
ERR("Could not get body: %08lx\n", nsres);
break;
......@@ -1657,8 +1662,8 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
TRACE("(%p)->(%p %p)\n", This, in, out);
if(!This->doc->nsdoc) {
WARN("NULL nsdoc\n");
if(!This->doc->dom_document) {
WARN("NULL dom_document\n");
return E_NOTIMPL;
}
......
......@@ -1596,11 +1596,11 @@ void bind_event_scripts(HTMLDocumentNode *doc)
TRACE("%p\n", doc);
if(!doc->nsdoc)
if(!doc->dom_document)
return;
nsAString_InitDepend(&selector_str, L"script[event]");
nsres = nsIDOMHTMLDocument_QuerySelectorAll(doc->nsdoc, &selector_str, &node_list);
nsres = nsIDOMDocument_QuerySelectorAll(doc->dom_document, &selector_str, &node_list);
nsAString_Finish(&selector_str);
if(NS_FAILED(nsres)) {
ERR("QuerySelectorAll failed: %08lx\n", nsres);
......
......@@ -160,12 +160,17 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
TRACE("nsrange_cnt = 0\n");
if(!This->doc->nsdoc) {
WARN("nsdoc is NULL\n");
if(!This->doc->dom_document) {
WARN("dom_document is NULL\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
if(!This->doc->html_document) {
FIXME("Not implemented for XML document\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLDocument_GetBody(This->doc->html_document, &nsbody);
if(NS_FAILED(nsres) || !nsbody) {
ERR("Could not get body: %08lx\n", nsres);
return E_FAIL;
......
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