From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 187 +++++++++++++++++++++-------------- dlls/mshtml/mshtml_private.h | 3 +- 2 files changed, 113 insertions(+), 77 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 25fea413c73..4a55bb38180 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4231,126 +4231,118 @@ static const IHTMLDocument5Vtbl DocObjHTMLDocument5Vtbl = { DocObjHTMLDocument5_get_compatMode };
-static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface) +static inline HTMLDocumentNode *HTMLDocumentNode_from_IHTMLDocument6(IHTMLDocument6 *iface) { - return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface); + return CONTAINING_RECORD(iface, HTMLDocumentNode, IHTMLDocument6_iface); }
-static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface, - REFIID riid, void **ppv) +static HRESULT WINAPI DocNodeHTMLDocument6_QueryInterface(IHTMLDocument6 *iface, REFIID riid, void **ppv) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_query_interface(This, riid, ppv); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return htmldoc_query_interface(&This->basedoc, riid, ppv); }
-static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface) +static ULONG WINAPI DocNodeHTMLDocument6_AddRef(IHTMLDocument6 *iface) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_addref(This); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return htmldoc_addref(&This->basedoc); }
-static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface) +static ULONG WINAPI DocNodeHTMLDocument6_Release(IHTMLDocument6 *iface) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_release(This); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return htmldoc_release(&This->basedoc); }
-static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo) +static HRESULT WINAPI DocNodeHTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return IDispatchEx_GetTypeInfoCount(&This->basedoc.IDispatchEx_iface, pctinfo); }
-static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo, - LCID lcid, ITypeInfo **ppTInfo) +static HRESULT WINAPI DocNodeHTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo, LCID lcid, + ITypeInfo **ppTInfo) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return IDispatchEx_GetTypeInfo(&This->basedoc.IDispatchEx_iface, iTInfo, lcid, ppTInfo); }
-static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +static HRESULT WINAPI DocNodeHTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid, LPOLESTR *rgszNames, + UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, - rgDispId); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return IDispatchEx_GetIDsOfNames(&This->basedoc.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); }
-static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +static HRESULT WINAPI DocNodeHTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + return IDispatchEx_Invoke(&This->basedoc.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); }
-static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface, +static HRESULT WINAPI DocNodeHTMLDocument6_get_compatible(IHTMLDocument6 *iface, IHTMLDocumentCompatibleInfoCollection **p) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; }
-static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface, VARIANT *p) +static HRESULT WINAPI DocNodeHTMLDocument6_get_documentMode(IHTMLDocument6 *iface, VARIANT *p) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface);
TRACE("(%p)->(%p)\n", This, p);
- if(!This->doc_node) { - FIXME("NULL doc_node\n"); - return E_UNEXPECTED; - } - V_VT(p) = VT_R4; - V_R4(p) = compat_mode_info[This->doc_node->document_mode].document_mode; + V_R4(p) = compat_mode_info[This->document_mode].document_mode; return S_OK; }
-static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface, +static HRESULT WINAPI DocNodeHTMLDocument6_get_onstorage(IHTMLDocument6 *iface, VARIANT *p) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface);
TRACE("(%p)->(%p)\n", This, p);
- return get_doc_event(This, EVENTID_STORAGE, p); + return get_doc_event(&This->basedoc, EVENTID_STORAGE, p); }
-static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v) +static HRESULT WINAPI DocNodeHTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface);
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
- return set_doc_event(This, EVENTID_STORAGE, &v); + return set_doc_event(&This->basedoc, EVENTID_STORAGE, &v); }
-static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface, +static HRESULT WINAPI DocNodeHTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface, VARIANT *p) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface);
TRACE("(%p)->(%p)\n", This, p);
- return get_doc_event(This, EVENTID_STORAGECOMMIT, p); + return get_doc_event(&This->basedoc, EVENTID_STORAGECOMMIT, p); }
-static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v) +static HRESULT WINAPI DocNodeHTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface);
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
- return set_doc_event(This, EVENTID_STORAGECOMMIT, &v); + return set_doc_event(&This->basedoc, EVENTID_STORAGECOMMIT, &v); }
-static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, +static HRESULT WINAPI DocNodeHTMLDocument6_getElementById(IHTMLDocument6 *iface, BSTR bstrId, IHTMLElement2 **p) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); nsIDOMElement *nselem; HTMLElement *elem; nsAString nsstr; @@ -4364,13 +4356,13 @@ static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, * not search for name attributes, so we may simply let Gecko do the right thing. */
- if(!This->doc_node->nsdoc) { + if(!This->nsdoc) { FIXME("Not a document\n"); return E_FAIL; }
nsAString_InitDepend(&nsstr, bstrId); - nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &nsstr, &nselem); + nsres = nsIDOMHTMLDocument_GetElementById(This->nsdoc, &nsstr, &nselem); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { ERR("GetElementById failed: %08lx\n", nsres); @@ -4391,29 +4383,69 @@ static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, return S_OK; }
-static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface) +static HRESULT WINAPI DocNodeHTMLDocument6_updateSettings(IHTMLDocument6 *iface) +{ + HTMLDocumentNode *This = HTMLDocumentNode_from_IHTMLDocument6(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static const IHTMLDocument6Vtbl DocNodeHTMLDocument6Vtbl = { + DocNodeHTMLDocument6_QueryInterface, + DocNodeHTMLDocument6_AddRef, + DocNodeHTMLDocument6_Release, + DocNodeHTMLDocument6_GetTypeInfoCount, + DocNodeHTMLDocument6_GetTypeInfo, + DocNodeHTMLDocument6_GetIDsOfNames, + DocNodeHTMLDocument6_Invoke, + DocNodeHTMLDocument6_get_compatible, + DocNodeHTMLDocument6_get_documentMode, + DocNodeHTMLDocument6_put_onstorage, + DocNodeHTMLDocument6_get_onstorage, + DocNodeHTMLDocument6_put_onstoragecommit, + DocNodeHTMLDocument6_get_onstoragecommit, + DocNodeHTMLDocument6_getElementById, + DocNodeHTMLDocument6_updateSettings +}; + +static inline HTMLDocumentObj *HTMLDocumentObj_from_IHTMLDocument6(IHTMLDocument6 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocumentObj, IHTMLDocument6_iface); +} + +HTMLDOCUMENTOBJ_IDISPATCH_METHODS(HTMLDocument6) + +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, get_compatible, IHTMLDocumentCompatibleInfoCollection**) +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, get_documentMode, VARIANT*) +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, put_onstorage, VARIANT) +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, get_onstorage, VARIANT*) +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, put_onstoragecommit, VARIANT) +HTMLDOCUMENTOBJ_FWD_TO_NODE_1(HTMLDocument6, get_onstoragecommit, VARIANT*) +HTMLDOCUMENTOBJ_FWD_TO_NODE_2(HTMLDocument6, getElementById, BSTR,IHTMLElement2**) + +static HRESULT WINAPI DocObjHTMLDocument6_updateSettings(IHTMLDocument6 *iface) { - HTMLDocument *This = impl_from_IHTMLDocument6(iface); + HTMLDocumentObj *This = HTMLDocumentObj_from_IHTMLDocument6(iface); FIXME("(%p)->()\n", This); return E_NOTIMPL; }
-static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = { - HTMLDocument6_QueryInterface, - HTMLDocument6_AddRef, - HTMLDocument6_Release, - HTMLDocument6_GetTypeInfoCount, - HTMLDocument6_GetTypeInfo, - HTMLDocument6_GetIDsOfNames, - HTMLDocument6_Invoke, - HTMLDocument6_get_compatible, - HTMLDocument6_get_documentMode, - HTMLDocument6_put_onstorage, - HTMLDocument6_get_onstorage, - HTMLDocument6_put_onstoragecommit, - HTMLDocument6_get_onstoragecommit, - HTMLDocument6_getElementById, - HTMLDocument6_updateSettings +static const IHTMLDocument6Vtbl DocObjHTMLDocument6Vtbl = { + DocObjHTMLDocument6_QueryInterface, + DocObjHTMLDocument6_AddRef, + DocObjHTMLDocument6_Release, + DocObjHTMLDocument6_GetTypeInfoCount, + DocObjHTMLDocument6_GetTypeInfo, + DocObjHTMLDocument6_GetIDsOfNames, + DocObjHTMLDocument6_Invoke, + DocObjHTMLDocument6_get_compatible, + DocObjHTMLDocument6_get_documentMode, + DocObjHTMLDocument6_put_onstorage, + DocObjHTMLDocument6_get_onstorage, + DocObjHTMLDocument6_put_onstoragecommit, + DocObjHTMLDocument6_get_onstoragecommit, + DocObjHTMLDocument6_getElementById, + DocObjHTMLDocument6_updateSettings };
static inline HTMLDocument *impl_from_IHTMLDocument7(IHTMLDocument7 *iface) @@ -6878,8 +6910,6 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) *ppv = &This->IDispatchEx_iface; else if(IsEqualGUID(&IID_IDispatchEx, riid)) *ppv = &This->IDispatchEx_iface; - else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) - *ppv = &This->IHTMLDocument6_iface; else if(IsEqualGUID(&IID_IHTMLDocument7, riid)) *ppv = &This->IHTMLDocument7_iface; else @@ -6903,7 +6933,6 @@ static const cpc_entry_t HTMLDocumentNode_cpc[] = {
static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex) { - doc->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl; doc->IHTMLDocument7_iface.lpVtbl = &HTMLDocument7Vtbl; doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
@@ -6935,6 +6964,8 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) *ppv = &This->IHTMLDocument4_iface; else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) *ppv = &This->IHTMLDocument5_iface; + else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) + *ppv = &This->IHTMLDocument6_iface; else if(IsEqualGUID(&IID_IDocumentSelector, riid)) *ppv = &This->IDocumentSelector_iface; else if(IsEqualGUID(&IID_IDocumentEvent, riid)) @@ -7403,6 +7434,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo doc->IHTMLDocument3_iface.lpVtbl = &DocNodeHTMLDocument3Vtbl; doc->IHTMLDocument4_iface.lpVtbl = &DocNodeHTMLDocument4Vtbl; doc->IHTMLDocument5_iface.lpVtbl = &DocNodeHTMLDocument5Vtbl; + doc->IHTMLDocument6_iface.lpVtbl = &DocNodeHTMLDocument6Vtbl; doc->IDocumentSelector_iface.lpVtbl = &DocNodeDocumentSelectorVtbl; doc->IDocumentEvent_iface.lpVtbl = &DocNodeDocumentEventVtbl; doc->ISupportErrorInfo_iface.lpVtbl = &DocNodeSupportErrorInfoVtbl; @@ -7540,6 +7572,8 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii *ppv = &This->IHTMLDocument4_iface; }else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) { *ppv = &This->IHTMLDocument5_iface; + }else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) { + *ppv = &This->IHTMLDocument6_iface; }else if(IsEqualGUID(&IID_ICustomDoc, riid)) { *ppv = &This->ICustomDoc_iface; }else if(IsEqualGUID(&IID_IDocumentSelector, riid)) { @@ -7854,6 +7888,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii doc->IHTMLDocument3_iface.lpVtbl = &DocObjHTMLDocument3Vtbl; doc->IHTMLDocument4_iface.lpVtbl = &DocObjHTMLDocument4Vtbl; doc->IHTMLDocument5_iface.lpVtbl = &DocObjHTMLDocument5Vtbl; + doc->IHTMLDocument6_iface.lpVtbl = &DocObjHTMLDocument6Vtbl; doc->IDocumentSelector_iface.lpVtbl = &DocObjDocumentSelectorVtbl; doc->IDocumentEvent_iface.lpVtbl = &DocObjDocumentEventVtbl; doc->ISupportErrorInfo_iface.lpVtbl = &DocObjSupportErrorInfoVtbl; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index a6a0159f4ac..de572a627d9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -640,7 +640,6 @@ struct ConnectionPoint { };
struct HTMLDocument { - IHTMLDocument6 IHTMLDocument6_iface; IHTMLDocument7 IHTMLDocument7_iface; IDispatchEx IDispatchEx_iface;
@@ -677,6 +676,7 @@ struct HTMLDocumentObj { IHTMLDocument3 IHTMLDocument3_iface; IHTMLDocument4 IHTMLDocument4_iface; IHTMLDocument5 IHTMLDocument5_iface; + IHTMLDocument6 IHTMLDocument6_iface; IDocumentSelector IDocumentSelector_iface; IDocumentEvent IDocumentEvent_iface; ISupportErrorInfo ISupportErrorInfo_iface; @@ -900,6 +900,7 @@ struct HTMLDocumentNode { IHTMLDocument3 IHTMLDocument3_iface; IHTMLDocument4 IHTMLDocument4_iface; IHTMLDocument5 IHTMLDocument5_iface; + IHTMLDocument6 IHTMLDocument6_iface; IDocumentSelector IDocumentSelector_iface; IDocumentEvent IDocumentEvent_iface; ISupportErrorInfo ISupportErrorInfo_iface;