From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/editor.c | 9 +- dlls/mshtml/htmlbody.c | 2 +- dlls/mshtml/htmlcurstyle.c | 2 +- dlls/mshtml/htmldoc.c | 251 ++++++++++++++++++++++++----------- dlls/mshtml/htmlelem.c | 20 +-- dlls/mshtml/htmlevent.c | 4 +- dlls/mshtml/htmlselect.c | 2 +- dlls/mshtml/htmlwindow.c | 12 +- dlls/mshtml/mshtml_private.h | 9 +- dlls/mshtml/mutation.c | 8 +- dlls/mshtml/navigate.c | 2 +- dlls/mshtml/nsembed.c | 7 +- dlls/mshtml/omnavigator.c | 9 +- dlls/mshtml/persist.c | 2 +- dlls/mshtml/range.c | 9 +- dlls/mshtml/script.c | 2 +- dlls/mshtml/selection.c | 7 +- 17 files changed, 229 insertions(+), 128 deletions(-)
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index b176eb8763b..e03bd5db39f 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -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->nshtmldoc) { + 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->nshtmldoc, &justify_str, &b); nsAString_Finish(&justify_str); if(NS_SUCCEEDED(nsres) && b) ret |= OLECMDF_LATCHED; @@ -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->nsdoc, &ns_url, &text_node);
/* wrap the <a> tags around the text element */ nsIDOMElement_AppendChild(anchor_elem, (nsIDOMNode*)text_node, &unused_node); diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index 163099114c5..b02fcfb2f65 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -674,7 +674,7 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_CreateRange(This->element.node.doc->nsdoc, &nsrange); + nsres = nsIDOMDocument_CreateRange(This->element.node.doc->nsdoc, &nsrange); if(NS_SUCCEEDED(nsres)) { nsres = nsIDOMRange_SelectNodeContents(nsrange, This->element.node.nsnode); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index 852b9059917..40447317f81 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -1321,7 +1321,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetDefaultView(elem->node.doc->nsdoc, &nsview); + nsres = nsIDOMDocument_GetDefaultView(elem->node.doc->nsdoc, &nsview); if(NS_FAILED(nsres)) { ERR("GetDefaultView failed: %08lx\n", nsres); return E_FAIL; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 0988d34f85b..dd5e96aa3a5 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -44,8 +44,8 @@ static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *do HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret) { nsIDOMNodeList *nsnode_list; + nsIDOMNode *nsnode = NULL; nsIDOMElement *nselem; - nsIDOMNode *nsnode; nsAString id_str; nsresult nsres; HRESULT hres; @@ -57,7 +57,7 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement *
nsAString_InitDepend(&id_str, id); /* get element by id attribute */ - nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem); + nsres = nsIDOMDocument_GetElementById(doc->nsdoc, &id_str, &nselem); if(FAILED(nsres)) { ERR("GetElementById failed: %08lx\n", nsres); nsAString_Finish(&id_str); @@ -65,18 +65,20 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement * }
/* get first element by name attribute */ - nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list); - nsAString_Finish(&id_str); - if(FAILED(nsres)) { - ERR("getElementsByName failed: %08lx\n", nsres); - if(nselem) - nsIDOMElement_Release(nselem); - return E_FAIL; - } + if(doc->nshtmldoc) { + nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nshtmldoc, &id_str, &nsnode_list); + nsAString_Finish(&id_str); + if(FAILED(nsres)) { + ERR("getElementsByName failed: %08lx\n", nsres); + if(nselem) + nsIDOMElement_Release(nselem); + return E_FAIL; + }
- nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode); - nsIDOMNodeList_Release(nsnode_list); - assert(nsres == NS_OK); + nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode); + nsIDOMNodeList_Release(nsnode_list); + assert(nsres == NS_OK); + }
if(nsnode && nselem) { UINT16 pos; @@ -124,7 +126,7 @@ UINT get_document_charset(HTMLDocumentNode *doc) return doc->charset;
nsAString_Init(&charset_str, NULL); - nsres = nsIDOMHTMLDocument_GetCharacterSet(doc->nsdoc, &charset_str); + nsres = nsIDOMDocument_GetCharacterSet(doc->nsdoc, &charset_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *charset;
@@ -496,7 +498,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem); + nsres = nsIDOMDocument_GetDocumentElement(This->nsdoc, &nselem); if(NS_FAILED(nsres)) { ERR("GetDocumentElement failed: %08lx\n", nsres); return E_FAIL; @@ -526,10 +528,10 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
TRACE("(%p)->(%p)\n", This, p);
- if(This->nsdoc) { + if(This->nshtmldoc) { nsresult nsres;
- nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody); + nsres = nsIDOMHTMLDocument_GetBody(This->nshtmldoc, &nsbody); if(NS_FAILED(nsres)) { TRACE("Could not get body: %08lx\n", nsres); return E_UNEXPECTED; @@ -569,7 +571,7 @@ static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTM * NOTE: Gecko may return an active element even if the document is not visible. * IE returns NULL in this case. */ - nsres = nsIDOMHTMLDocument_GetActiveElement(This->nsdoc, &nselem); + nsres = nsIDOMDocument_GetActiveElement(This->nsdoc, &nselem); if(NS_FAILED(nsres)) { ERR("GetActiveElement failed: %08lx\n", nsres); return E_FAIL; @@ -607,7 +609,12 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetImages(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetImages(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetImages failed: %08lx\n", nsres); return E_FAIL; @@ -639,7 +646,12 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetApplets(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetApplets(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetApplets failed: %08lx\n", nsres); return E_FAIL; @@ -671,7 +683,12 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetLinks(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetLinks(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetLinks failed: %08lx\n", nsres); return E_FAIL; @@ -703,7 +720,12 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetForms(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetForms(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetForms failed: %08lx\n", nsres); return E_FAIL; @@ -735,7 +757,12 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetAnchors(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetAnchors(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetAnchors failed: %08lx\n", nsres); return E_FAIL; @@ -763,7 +790,7 @@ static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v) }
nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMHTMLDocument_SetTitle(This->nsdoc, &nsstr); + nsres = nsIDOMDocument_SetTitle(This->nsdoc, &nsstr); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) ERR("SetTitle failed: %08lx\n", nsres); @@ -787,7 +814,7 @@ static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
nsAString_Init(&nsstr, NULL); - nsres = nsIDOMHTMLDocument_GetTitle(This->nsdoc, &nsstr); + nsres = nsIDOMDocument_GetTitle(This->nsdoc, &nsstr); if (NS_SUCCEEDED(nsres)) { nsAString_GetData(&nsstr, &ret); *p = SysAllocString(ret); @@ -820,7 +847,12 @@ static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLEleme return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetScripts(This->nsdoc, &nscoll); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetScripts(This->nshtmldoc, &nscoll); if(NS_FAILED(nsres)) { ERR("GetImages failed: %08lx\n", nsres); return E_FAIL; @@ -875,7 +907,12 @@ static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSel
TRACE("(%p)->(%p)\n", This, p);
- nsres = nsIDOMHTMLDocument_GetSelection(This->nsdoc, &nsselection); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetSelection(This->nshtmldoc, &nsselection); if(NS_FAILED(nsres)) { ERR("GetSelection failed: %08lx\n", nsres); return E_FAIL; @@ -984,8 +1021,13 @@ static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p return E_UNEXPECTED; }
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + nsAString_Init(&nsstr, NULL); - nsres = nsIDOMHTMLDocument_GetBgColor(This->nsdoc, &nsstr); + nsres = nsIDOMHTMLDocument_GetBgColor(This->nshtmldoc, &nsstr); hres = return_nsstr_variant(nsres, &nsstr, NSSTR_COLOR, p); if(hres == S_OK && V_VT(p) == VT_BSTR && !V_BSTR(p)) { TRACE("default #ffffff\n"); @@ -1046,7 +1088,7 @@ static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p) TRACE("(%p)->(%p)\n", This, p);
nsAString_InitDepend(&nsstr, NULL); - nsres = nsIDOMHTMLDocument_GetReferrer(This->nsdoc, &nsstr); + nsres = nsIDOMDocument_GetReferrer(This->nsdoc, &nsstr); return return_nsstr(nsres, &nsstr, p); }
@@ -1103,8 +1145,13 @@ static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMHTMLDocument_SetDomain(This->nsdoc, &nsstr); + nsres = nsIDOMHTMLDocument_SetDomain(This->nshtmldoc, &nsstr); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { ERR("SetDomain failed: %08lx\n", nsres); @@ -1122,8 +1169,13 @@ static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + nsAString_Init(&nsstr, NULL); - nsres = nsIDOMHTMLDocument_GetDomain(This->nsdoc, &nsstr); + nsres = nsIDOMHTMLDocument_GetDomain(This->nshtmldoc, &nsstr); if(NS_SUCCEEDED(nsres) && This->outer_window && This->outer_window->uri) { const PRUnichar *str; HRESULT hres; @@ -1261,7 +1313,7 @@ static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p) return (*p = SysAllocString(L"")) ? S_OK : E_FAIL;
nsAString_InitDepend(&nsstr, NULL); - nsres = nsIDOMHTMLDocument_GetContentType(This->nsdoc, &nsstr); + nsres = nsIDOMDocument_GetContentType(This->nsdoc, &nsstr); if(NS_FAILED(nsres)) return map_nsresult(nsres);
@@ -1334,6 +1386,11 @@ static HRESULT document_write(HTMLDocumentNode *This, SAFEARRAY *psarray, BOOL l return E_UNEXPECTED; }
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + if (!psarray) return S_OK;
@@ -1365,9 +1422,9 @@ static HRESULT document_write(HTMLDocumentNode *This, SAFEARRAY *psarray, BOOL l }
if(!ln || i != argc-1) - nsres = nsIDOMHTMLDocument_Write(This->nsdoc, &nsstr, jsctx); + nsres = nsIDOMHTMLDocument_Write(This->nshtmldoc, &nsstr, jsctx); else - nsres = nsIDOMHTMLDocument_Writeln(This->nsdoc, &nsstr, jsctx); + nsres = nsIDOMHTMLDocument_Writeln(This->nshtmldoc, &nsstr, jsctx); nsAString_Finish(&nsstr); if(V_VT(var+i) != VT_BSTR) VariantClear(&tmp); @@ -1421,11 +1478,16 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT return E_NOTIMPL; }
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + if(!url || wcscmp(url, L"text/html") || V_VT(&name) != VT_ERROR || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR) FIXME("unsupported args\n");
- nsres = nsIDOMHTMLDocument_Open(This->nsdoc, NULL, NULL, NULL, + nsres = nsIDOMHTMLDocument_Open(This->nshtmldoc, NULL, NULL, NULL, get_context_from_document(This->nsdoc), 0, &tmp); if(NS_FAILED(nsres)) { ERR("Open failed: %08lx\n", nsres); @@ -1452,7 +1514,12 @@ static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface) return E_NOTIMPL; }
- nsres = nsIDOMHTMLDocument_Close(This->nsdoc); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_Close(This->nshtmldoc); if(NS_FAILED(nsres)) { ERR("Close failed: %08lx\n", nsres); return E_FAIL; @@ -1468,7 +1535,12 @@ static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
TRACE("(%p)\n", This);
- nsres = nsIDOMHTMLDocument_Clear(This->nsdoc); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_Clear(This->nshtmldoc); if(NS_FAILED(nsres)) { ERR("Clear failed: %08lx\n", nsres); return E_FAIL; @@ -1910,7 +1982,7 @@ static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG
TRACE("(%p)->(%ld %ld %p)\n", This, x, y, elementHit);
- nsres = nsIDOMHTMLDocument_ElementFromPoint(This->nsdoc, x, y, &nselem); + nsres = nsIDOMDocument_ElementFromPoint(This->nsdoc, x, y, &nselem); if(NS_FAILED(nsres)) { ERR("ElementFromPoint failed: %08lx\n", nsres); return E_FAIL; @@ -1958,7 +2030,7 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetStyleSheets(This->nsdoc, &nsstylelist); + nsres = nsIDOMDocument_GetStyleSheets(This->nsdoc, &nsstylelist); if(NS_FAILED(nsres)) { ERR("GetStyleSheets failed: %08lx\n", nsres); return map_nsresult(nsres); @@ -2024,6 +2096,11 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR return E_NOTIMPL; }
+ if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + if(lIndex != -1) FIXME("Unsupported lIndex %ld\n", lIndex);
@@ -2037,7 +2114,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR if(FAILED(hres)) return hres;
- nsres = nsIDOMHTMLDocument_GetHead(This->nsdoc, &head_elem); + nsres = nsIDOMHTMLDocument_GetHead(This->nshtmldoc, &head_elem); if(NS_SUCCEEDED(nsres)) { nsIDOMNode *head_node, *tmp_node;
@@ -2268,7 +2345,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t }
nsAString_InitDepend(&text_str, text); - nsres = nsIDOMHTMLDocument_CreateTextNode(This->nsdoc, &text_str, &nstext); + nsres = nsIDOMDocument_CreateTextNode(This->nsdoc, &text_str, &nstext); nsAString_Finish(&text_str); if(NS_FAILED(nsres)) { ERR("CreateTextNode failed: %08lx\n", nsres); @@ -2304,7 +2381,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem); + nsres = nsIDOMDocument_GetDocumentElement(This->nsdoc, &nselem); if(NS_FAILED(nsres)) { ERR("GetDocumentElement failed: %08lx\n", nsres); return E_FAIL; @@ -2464,7 +2541,7 @@ static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v) }
nsAString_InitDepend(&dir_str, v); - nsres = nsIDOMHTMLDocument_SetDir(This->nsdoc, &dir_str); + nsres = nsIDOMDocument_SetDir(This->nsdoc, &dir_str); nsAString_Finish(&dir_str); if(NS_FAILED(nsres)) { ERR("SetDir failed: %08lx\n", nsres); @@ -2488,7 +2565,7 @@ static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p) }
nsAString_Init(&dir_str, NULL); - nsres = nsIDOMHTMLDocument_GetDir(This->nsdoc, &dir_str); + nsres = nsIDOMDocument_GetDir(This->nsdoc, &dir_str); return return_nsstr(nsres, &dir_str, p); }
@@ -2539,7 +2616,7 @@ static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface return E_NOTIMPL; }
- nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->nsdoc, &doc_frag); + nsres = nsIDOMDocument_CreateDocumentFragment(This->nsdoc, &doc_frag); if(NS_FAILED(nsres)) { ERR("CreateDocumentFragment failed: %08lx\n", nsres); return E_FAIL; @@ -2655,7 +2732,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST * types and search should be case insensitive. Those are currently not supported properly. */ nsAString_InitDepend(&selector_str, selector); - nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->nsdoc, &selector_str, &node_list); + nsres = nsIDOMDocument_QuerySelectorAll(This->nsdoc, &selector_str, &node_list); nsAString_Finish(&selector_str); heap_free(selector); if(NS_FAILED(nsres)) { @@ -2700,7 +2777,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
if(This->nsdoc) { nsAString_InitDepend(&id_str, v); - nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->nsdoc, &id_str, &nslist); + nsres = nsIDOMDocument_GetElementsByTagName(This->nsdoc, &id_str, &nslist); nsAString_Finish(&id_str); if(FAILED(nsres)) { ERR("GetElementByName failed: %08lx\n", nsres); @@ -2853,7 +2930,12 @@ static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
TRACE("(%p)->()\n", This);
- nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetBody(This->nshtmldoc, &nsbody); if(NS_FAILED(nsres) || !nsbody) { ERR("GetBody failed: %08lx\n", nsres); return E_FAIL; @@ -2882,7 +2964,7 @@ static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL return E_NOTIMPL; }
- nsres = nsIDOMHTMLDocument_HasFocus(This->nsdoc, &has_focus); + nsres = nsIDOMDocument_HasFocus(This->nsdoc, &has_focus); assert(nsres == NS_OK);
*pfFocus = variant_bool(has_focus); @@ -3111,7 +3193,7 @@ static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMN return S_OK; }
- nsres = nsIDOMHTMLDocument_GetDoctype(This->nsdoc, &nsdoctype); + nsres = nsIDOMDocument_GetDoctype(This->nsdoc, &nsdoctype); if(NS_FAILED(nsres)) return map_nsresult(nsres); if(!nsdoctype) { @@ -3181,7 +3263,7 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs }
nsAString_InitDepend(&str, bstrdata); - nsres = nsIDOMHTMLDocument_CreateComment(This->nsdoc, &str, &nscomment); + nsres = nsIDOMDocument_CreateComment(This->nsdoc, &str, &nscomment); nsAString_Finish(&str); if(NS_FAILED(nsres)) { ERR("CreateTextNode failed: %08lx\n", nsres); @@ -3459,7 +3541,7 @@ static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, }
nsAString_InitDepend(&nsstr, bstrId); - nsres = nsIDOMHTMLDocument_GetElementById(This->nsdoc, &nsstr, &nselem); + nsres = nsIDOMDocument_GetElementById(This->nsdoc, &nsstr, &nselem); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { ERR("GetElementById failed: %08lx\n", nsres); @@ -3614,7 +3696,7 @@ static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIA
nsAString_InitDepend(&ns, pvarNS && V_VT(pvarNS) == VT_BSTR ? V_BSTR(pvarNS) : NULL); nsAString_InitDepend(&tag, bstrTag); - nsres = nsIDOMHTMLDocument_CreateElementNS(This->nsdoc, &ns, &tag, &dom_element); + nsres = nsIDOMDocument_CreateElementNS(This->nsdoc, &ns, &tag, &dom_element); nsAString_Finish(&ns); nsAString_Finish(&tag); if(NS_FAILED(nsres)) { @@ -3669,7 +3751,7 @@ static HRESULT WINAPI HTMLDocument7_get_characterSet(IHTMLDocument7 *iface, BSTR }
nsAString_Init(&charset_str, NULL); - nsres = nsIDOMHTMLDocument_GetCharacterSet(This->nsdoc, &charset_str); + nsres = nsIDOMDocument_GetCharacterSet(This->nsdoc, &charset_str); return return_nsstr(nsres, &charset_str, p); }
@@ -3706,7 +3788,7 @@ static HRESULT WINAPI HTMLDocument7_getElementsByClassName(IHTMLDocument7 *iface }
nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMHTMLDocument_GetElementsByClassName(This->nsdoc, &nsstr, &nslist); + nsres = nsIDOMDocument_GetElementsByClassName(This->nsdoc, &nsstr, &nslist); nsAString_Finish(&nsstr); if(FAILED(nsres)) { ERR("GetElementByClassName failed: %08lx\n", nsres); @@ -4392,7 +4474,7 @@ static HRESULT WINAPI HTMLDocument7_importNode(IHTMLDocument7 *iface, IHTMLDOMNo return E_FAIL; }
- nsres = nsIDOMHTMLDocument_ImportNode(This->nsdoc, node->nsnode, !!fDeep, 1, &nsnode); + nsres = nsIDOMDocument_ImportNode(This->nsdoc, node->nsnode, !!fDeep, 1, &nsnode); if(NS_FAILED(nsres)) { ERR("ImportNode failed: %08lx\n", nsres); return map_nsresult(nsres); @@ -4453,7 +4535,12 @@ static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement return E_FAIL; }
- nsres = nsIDOMHTMLDocument_GetHead(This->nsdoc, &nshead); + if(!This->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetHead(This->nshtmldoc, &nshead); assert(nsres == NS_OK);
if(!nshead) { @@ -4652,7 +4739,7 @@ static HRESULT WINAPI DocumentSelector_querySelector(IDocumentSelector *iface, B TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMHTMLDocument_QuerySelector(This->nsdoc, &nsstr, &nselem); + nsres = nsIDOMDocument_QuerySelector(This->nsdoc, &nsstr, &nselem); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { ERR("QuerySelector failed: %08lx\n", nsres); @@ -4683,7 +4770,7 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v); - hres = map_nsresult(nsIDOMHTMLDocument_QuerySelectorAll(This->nsdoc, &nsstr, &node_list)); + hres = map_nsresult(nsIDOMDocument_QuerySelectorAll(This->nsdoc, &nsstr, &node_list)); nsAString_Finish(&nsstr); if(FAILED(hres)) { ERR("QuerySelectorAll failed: %08lx\n", hres); @@ -4828,7 +4915,7 @@ static inline HTMLDocumentNode *impl_from_IDispatchEx(IDispatchEx *iface) return CONTAINING_RECORD(iface, HTMLDocumentNode, IDispatchEx_iface); }
-static HRESULT has_elem_name(nsIDOMHTMLDocument *nsdoc, const WCHAR *name) +static HRESULT has_elem_name(nsIDOMHTMLDocument *nshtmldoc, const WCHAR *name) { static const WCHAR fmt[] = L":-moz-any(applet,embed,form,iframe,img,object)[name="%s"]"; WCHAR buf[128], *selector = buf; @@ -4843,7 +4930,7 @@ static HRESULT has_elem_name(nsIDOMHTMLDocument *nsdoc, const WCHAR *name) swprintf(selector, len, fmt, name);
nsAString_InitDepend(&selector_str, selector); - nsres = nsIDOMHTMLDocument_QuerySelector(nsdoc, &selector_str, &nselem); + nsres = nsIDOMHTMLDocument_QuerySelector(nshtmldoc, &selector_str, &nselem); nsAString_Finish(&selector_str); if(selector != buf) heap_free(selector); @@ -4856,7 +4943,7 @@ static HRESULT has_elem_name(nsIDOMHTMLDocument *nsdoc, const WCHAR *name) return S_OK; }
-static HRESULT get_elem_by_name_or_id(nsIDOMHTMLDocument *nsdoc, const WCHAR *name, nsIDOMElement **ret) +static HRESULT get_elem_by_name_or_id(nsIDOMHTMLDocument *nshtmldoc, const WCHAR *name, nsIDOMElement **ret) { static const WCHAR fmt[] = L":-moz-any(embed,form,iframe,img):-moz-any([name="%s"],[id="%s"][name])," L":-moz-any(applet,object):-moz-any([name="%s"],[id="%s"])"; @@ -4872,7 +4959,7 @@ static HRESULT get_elem_by_name_or_id(nsIDOMHTMLDocument *nsdoc, const WCHAR *na swprintf(selector, len, fmt, name, name, name, name);
nsAString_InitDepend(&selector_str, selector); - nsres = nsIDOMHTMLDocument_QuerySelector(nsdoc, &selector_str, &nselem); + nsres = nsIDOMHTMLDocument_QuerySelector(nshtmldoc, &selector_str, &nselem); nsAString_Finish(&selector_str); if(selector != buf) heap_free(selector); @@ -4995,8 +5082,8 @@ static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, if(hres != DISP_E_UNKNOWNNAME) return hres;
- if(This->nsdoc) { - hres = get_elem_by_name_or_id(This->nsdoc, bstrName, NULL); + if(This->nshtmldoc) { + hres = get_elem_by_name_or_id(This->nshtmldoc, bstrName, NULL); if(SUCCEEDED(hres)) hres = dispid_from_elem_name(This, bstrName, pid); } @@ -5575,7 +5662,7 @@ static HRESULT WINAPI DocumentRange_createRange(IDocumentRange *iface, IHTMLDOMR return E_UNEXPECTED; }
- if(NS_FAILED(nsIDOMHTMLDocument_CreateRange(This->nsdoc, &nsrange))) + if(NS_FAILED(nsIDOMDocument_CreateRange(This->nsdoc, &nsrange))) return E_FAIL;
hres = create_dom_range(nsrange, dispex_compat_mode(&This->node.event_target.dispex), p); @@ -5799,12 +5886,13 @@ static void HTMLDocumentNode_unlink(HTMLDOMNode *iface) HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
if(This->nsdoc) { - nsIDOMHTMLDocument *nsdoc = This->nsdoc; + nsIDOMDocument *nsdoc = This->nsdoc;
release_document_mutation(This); detach_document_node(This); This->nsdoc = NULL; - nsIDOMHTMLDocument_Release(nsdoc); + This->nshtmldoc = NULL; + nsIDOMDocument_Release(nsdoc); This->window = NULL; } } @@ -5874,10 +5962,10 @@ static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
i = id - MSHTML_DISPID_CUSTOM_MIN;
- if(!This->nsdoc || i >= This->elem_vars_cnt) + if(!This->nshtmldoc || i >= This->elem_vars_cnt) return DISP_E_MEMBERNOTFOUND;
- hres = get_elem_by_name_or_id(This->nsdoc, This->elem_vars[i], &nselem); + hres = get_elem_by_name_or_id(This->nshtmldoc, This->elem_vars[i], &nselem); if(FAILED(hres)) return hres; if(!nselem) @@ -5906,11 +5994,11 @@ static HRESULT HTMLDocumentNode_next_dispid(DispatchEx *dispex, DISPID id, DISPI HRESULT hres; UINT32 i;
- if(!This->nsdoc) + if(!This->nshtmldoc) return S_FALSE;
while(idx < This->elem_vars_cnt) { - hres = has_elem_name(This->nsdoc, This->elem_vars[idx]); + hres = has_elem_name(This->nshtmldoc, This->elem_vars[idx]); if(SUCCEEDED(hres)) { *pid = idx + MSHTML_DISPID_CUSTOM_MIN; return S_OK; @@ -5922,7 +6010,7 @@ static HRESULT HTMLDocumentNode_next_dispid(DispatchEx *dispex, DISPID id, DISPI
/* Populate possibly missing DISPIDs */ nsAString_InitDepend(&nsstr, L":-moz-any(applet,embed,form,iframe,img,object)[name]"); - nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->nsdoc, &nsstr, &node_list); + nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->nshtmldoc, &nsstr, &node_list); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) return map_nsresult(nsres); @@ -6136,7 +6224,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo return doc; }
-HRESULT create_document_node(nsIDOMHTMLDocument *nsdoc, GeckoBrowser *browser, HTMLInnerWindow *window, +HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLInnerWindow *window, compat_mode_t parent_mode, HTMLDocumentNode **ret) { HTMLDocumentObj *doc_obj = browser->doc; @@ -6155,10 +6243,15 @@ HRESULT create_document_node(nsIDOMHTMLDocument *nsdoc, GeckoBrowser *browser, H if(!doc_obj->window || (window && is_main_content_window(window->base.outer_window))) doc->cp_container.forward_container = &doc_obj->cp_container;
- HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc, &HTMLDocumentNode_dispex); + if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&doc->nshtmldoc))) + doc->nsdoc = (nsIDOMDocument*)doc->nshtmldoc; + else { + nsIDOMDocument_AddRef(nsdoc); + doc->nsdoc = nsdoc; + doc->nshtmldoc = NULL; + }
- nsIDOMHTMLDocument_AddRef(nsdoc); - doc->nsdoc = nsdoc; + HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)doc->nsdoc, &HTMLDocumentNode_dispex);
init_document_mutation(doc); doc_init_events(doc); @@ -6168,12 +6261,12 @@ HRESULT create_document_node(nsIDOMHTMLDocument *nsdoc, GeckoBrowser *browser, H list_add_head(&browser->document_nodes, &doc->browser_entry); doc->browser = browser;
- if(browser->usermode == EDITMODE) { + if(browser->usermode == EDITMODE && doc->nshtmldoc) { nsAString mode_str; nsresult nsres;
nsAString_InitDepend(&mode_str, L"on"); - nsres = nsIDOMHTMLDocument_SetDesignMode(doc->nsdoc, &mode_str); + nsres = nsIDOMHTMLDocument_SetDesignMode(doc->nshtmldoc, &mode_str); nsAString_Finish(&mode_str); if(NS_FAILED(nsres)) ERR("SetDesignMode failed: %08lx\n", nsres); diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 4d92929b985..494ce2aaa42 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -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; @@ -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->nsdoc, &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->nsdoc, &str, ret); nsAString_Finish(&str); heap_free(p);
@@ -494,7 +494,7 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **r }
nsAString_InitDepend(&tag_str, tag); - nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret); + nsres = nsIDOMDocument_CreateElement(doc->nsdoc, &tag_str, ret); nsAString_Finish(&tag_str); if(NS_FAILED(nsres)) { ERR("CreateElement failed: %08lx\n", nsres); @@ -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->nsdoc, &text_str, &text_node); nsAString_Finish(&text_str); if(NS_FAILED(nsres)) { ERR("CreateTextNode failed: %08lx\n", nsres); @@ -2304,14 +2304,14 @@ static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v) }
nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node); + nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &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->nsdoc, &range); if(NS_SUCCEEDED(nsres)) { nsres = nsIDOMRange_SelectNode(range, This->node.nsnode); if(NS_SUCCEEDED(nsres)) @@ -2427,7 +2427,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range); + nsres = nsIDOMDocument_CreateRange(This->node.doc->nsdoc, &range); if(NS_FAILED(nsres)) { ERR("CreateRange failed: %08lx\n", nsres); @@ -2470,7 +2470,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
nsAString_InitDepend(&ns_text, text); - nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->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) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 835e11c74aa..f1bbbbbebf7 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -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->nsdoc, &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->nsdoc, &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); diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index f8305542fae..147e486fcbd 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -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->nsdoc, &text_str, &text_node); nsAString_Finish(&text_str); if(NS_FAILED(nsres)) { ERR("CreateTextNode failed: %08lx\n", nsres); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 14fa17ace1b..7014a4cd4b4 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -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;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 23eeb0ec11b..c12b0299e22 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -921,7 +921,8 @@ struct HTMLDocumentNode { compat_mode_t document_mode; BOOL document_mode_locked;
- nsIDOMHTMLDocument *nsdoc; + nsIDOMDocument *nsdoc; + nsIDOMHTMLDocument *nshtmldoc; 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; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 605f6fd7565..549025581e2 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -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->nsdoc, &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->nsdoc, &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); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 68f249d914a..e8d6f295bd3 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -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->nsdoc, &selector_str, &nselem); nsAString_Finish(&selector_str); heap_free(selector); if(NS_SUCCEEDED(nsres) && nselem) { diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 0b16cd90306..dbab89ca1b3 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -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->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + break; + } + + nsres = nsIDOMHTMLDocument_GetSelection(This->doc->doc_node->nshtmldoc, &selection); if(NS_SUCCEEDED(nsres) && selection) { cpp_bool is_collapsed;
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index d3ffc29af4b..0e2db1ebc5a 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -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->nsdoc, &dom_implementation->implementation); if(NS_FAILED(nsres)) { ERR("GetDOMImplementation failed: %08lx\n", nsres); IHTMLDOMImplementation_Release(&dom_implementation->IHTMLDOMImplementation_iface); diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 12a74393739..8fedbde0af8 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -508,7 +508,7 @@ static HRESULT get_doc_string(HTMLDocumentNode *This, char **str) return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode); + nsres = nsIDOMDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode); if(NS_FAILED(nsres)) { ERR("Could not get nsIDOMNode failed: %08lx\n", nsres); return E_FAIL; diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index c98ba331b12..196afa07ab9 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -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->nsdoc, &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->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetBody(This->doc->nshtmldoc, &nsbody); if(NS_FAILED(nsres) || !nsbody) { ERR("Could not get body: %08lx\n", nsres); break; diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 1d555706e6a..f6f6a1cfcb7 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -1600,7 +1600,7 @@ void bind_event_scripts(HTMLDocumentNode *doc) return;
nsAString_InitDepend(&selector_str, L"script[event]"); - nsres = nsIDOMHTMLDocument_QuerySelectorAll(doc->nsdoc, &selector_str, &node_list); + nsres = nsIDOMDocument_QuerySelectorAll(doc->nsdoc, &selector_str, &node_list); nsAString_Finish(&selector_str); if(NS_FAILED(nsres)) { ERR("QuerySelectorAll failed: %08lx\n", nsres); diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 307b7c922a0..42236f9f4d0 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -165,7 +165,12 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac return E_UNEXPECTED; }
- nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody); + if(!This->doc->nshtmldoc) { + FIXME("Not implemented for XML document\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_GetBody(This->doc->nshtmldoc, &nsbody); if(NS_FAILED(nsres) || !nsbody) { ERR("Could not get body: %08lx\n", nsres); return E_FAIL;