Commit e5214b24 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: Use ifaces instead of vtbl pointers in HTMLDocumentNode.

parent 6b793e94
......@@ -1886,7 +1886,7 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid)) {
TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This, ppv);
*ppv = HOSTSECMGR(This);
*ppv = &This->IInternetHostSecurityManager_iface;
}else {
return HTMLDOMNode_QI(&This->node, riid, ppv);
}
......
......@@ -597,10 +597,10 @@ struct HTMLDocumentNode {
HTMLDOMNode node;
HTMLDocument basedoc;
const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
IInternetHostSecurityManager IInternetHostSecurityManager_iface;
const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
const nsIRunnableVtbl *lpIRunnableVtbl;
nsIDocumentObserver nsIDocumentObserver_iface;
nsIRunnable nsIRunnable_iface;
LONG ref;
......@@ -629,10 +629,6 @@ struct HTMLDocumentNode {
#define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
#define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
#define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
#define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
......@@ -643,8 +639,6 @@ struct HTMLDocumentNode {
#define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
#define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
#define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
......
......@@ -193,23 +193,26 @@ static void add_script_runner(HTMLDocumentNode *This)
return;
}
nsIDOMNSDocument_WineAddScriptRunner(nsdoc, NSRUNNABLE(This));
nsIDOMNSDocument_WineAddScriptRunner(nsdoc, &This->nsIRunnable_iface);
nsIDOMNSDocument_Release(nsdoc);
}
#define NSRUNNABLE_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IRunnable, iface)
static inline HTMLDocumentNode *impl_from_nsIRunnable(nsIRunnable *iface)
{
return CONTAINING_RECORD(iface, HTMLDocumentNode, nsIRunnable_iface);
}
static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
nsIIDRef riid, void **result)
{
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIRunnable(iface);
if(IsEqualGUID(riid, &IID_nsISupports)) {
TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
*result = NSRUNNABLE(This);
*result = &This->nsIRunnable_iface;
}else if(IsEqualGUID(riid, &IID_nsIRunnable)) {
TRACE("(%p)->(IID_nsIRunnable %p)\n", This, result);
*result = NSRUNNABLE(This);
*result = &This->nsIRunnable_iface;
}else {
*result = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
......@@ -222,13 +225,13 @@ static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
{
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIRunnable(iface);
return htmldoc_addref(&This->basedoc);
}
static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
{
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIRunnable(iface);
return htmldoc_release(&This->basedoc);
}
......@@ -349,7 +352,7 @@ static void handle_end_load(HTMLDocumentNode *This)
static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
{
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIRunnable(iface);
nsresult nsres;
TRACE("(%p)\n", This);
......@@ -436,8 +439,6 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
return S_OK;
}
#undef NSRUNNABLE_THIS
static const nsIRunnableVtbl nsRunnableVtbl = {
nsRunnable_QueryInterface,
nsRunnable_AddRef,
......@@ -445,22 +446,25 @@ static const nsIRunnableVtbl nsRunnableVtbl = {
nsRunnable_Run
};
#define NSDOCOBS_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IDocumentObserver, iface)
static inline HTMLDocumentNode *impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
{
return CONTAINING_RECORD(iface, HTMLDocumentNode, nsIDocumentObserver_iface);
}
static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *iface,
nsIIDRef riid, void **result)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
if(IsEqualGUID(&IID_nsISupports, riid)) {
TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
*result = NSDOCOBS(This);
*result = &This->nsIDocumentObserver_iface;
}else if(IsEqualGUID(&IID_nsIMutationObserver, riid)) {
TRACE("(%p)->(IID_nsIMutationObserver %p)\n", This, result);
*result = NSDOCOBS(This);
*result = &This->nsIDocumentObserver_iface;
}else if(IsEqualGUID(&IID_nsIDocumentObserver, riid)) {
TRACE("(%p)->(IID_nsIDocumentObserver %p)\n", This, result);
*result = NSDOCOBS(This);
*result = &This->nsIDocumentObserver_iface;
}else {
*result = NULL;
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
......@@ -473,13 +477,13 @@ static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *ifa
static nsrefcnt NSAPI nsDocumentObserver_AddRef(nsIDocumentObserver *iface)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
return htmldoc_addref(&This->basedoc);
}
static nsrefcnt NSAPI nsDocumentObserver_Release(nsIDocumentObserver *iface)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
return htmldoc_release(&This->basedoc);
}
......@@ -543,7 +547,7 @@ static void NSAPI nsDocumentObserver_BeginLoad(nsIDocumentObserver *iface, nsIDo
static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
TRACE("\n");
......@@ -597,7 +601,7 @@ static void NSAPI nsDocumentObserver_StyleRuleRemoved(nsIDocumentObserver *iface
static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDocument *aDocument,
nsIContent *aContent)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
nsIDOMHTMLIFrameElement *nsiframe;
nsIDOMHTMLFrameElement *nsframe;
nsIDOMComment *nscomment;
......@@ -640,7 +644,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
static void NSAPI nsDocumentObserver_DoneAddingChildren(nsIDocumentObserver *iface, nsIContent *aContent,
PRBool aHaveNotified)
{
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
HTMLDocumentNode *This = impl_from_nsIDocumentObserver(iface);
nsIDOMHTMLScriptElement *nsscript;
nsresult nsres;
......@@ -691,8 +695,8 @@ void init_mutation(HTMLDocumentNode *doc)
nsIDOMNSDocument *nsdoc;
nsresult nsres;
doc->lpIDocumentObserverVtbl = &nsDocumentObserverVtbl;
doc->lpIRunnableVtbl = &nsRunnableVtbl;
doc->nsIDocumentObserver_iface.lpVtbl = &nsDocumentObserverVtbl;
doc->nsIRunnable_iface.lpVtbl = &nsRunnableVtbl;
nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
if(NS_FAILED(nsres)) {
......@@ -700,7 +704,7 @@ void init_mutation(HTMLDocumentNode *doc)
return;
}
nsIDOMNSDocument_WineAddObserver(nsdoc, NSDOCOBS(doc));
nsIDOMNSDocument_WineAddObserver(nsdoc, &doc->nsIDocumentObserver_iface);
nsIDOMNSDocument_Release(nsdoc);
}
......@@ -715,6 +719,6 @@ void release_mutation(HTMLDocumentNode *doc)
return;
}
nsIDOMNSDocument_WineRemoveObserver(nsdoc, NSDOCOBS(doc));
nsIDOMNSDocument_WineRemoveObserver(nsdoc, &doc->nsIDocumentObserver_iface);
nsIDOMNSDocument_Release(nsdoc);
}
......@@ -219,8 +219,8 @@ static IUnknown *create_activex_object(HTMLWindow *window, nsIDOMElement *nselem
TRACE("clsid %s\n", debugstr_guid(clsid));
policy = 0;
hres = IInternetHostSecurityManager_ProcessUrlAction(HOSTSECMGR(window->doc), URLACTION_ACTIVEX_RUN,
(BYTE*)&policy, sizeof(policy), (BYTE*)clsid, sizeof(GUID), 0, 0);
hres = IInternetHostSecurityManager_ProcessUrlAction(&window->doc->IInternetHostSecurityManager_iface,
URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy), (BYTE*)clsid, sizeof(GUID), 0, 0);
if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
WARN("ProcessUrlAction returned %08x %x\n", hres, policy);
return NULL;
......
......@@ -51,7 +51,7 @@ static BOOL check_load_safety(PluginHost *host)
cs.pUnk = host->plugin_unk;
cs.dwFlags = CONFIRMSAFETYACTION_LOADOBJECT;
hres = IInternetHostSecurityManager_QueryCustomPolicy(HOSTSECMGR(host->doc),
hres = IInternetHostSecurityManager_QueryCustomPolicy(&host->doc->IInternetHostSecurityManager_iface,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY, &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
if(FAILED(hres))
return FALSE;
......@@ -75,7 +75,7 @@ static BOOL check_script_safety(PluginHost *host)
cs.pUnk = host->plugin_unk;
cs.dwFlags = 0;
hres = IInternetHostSecurityManager_QueryCustomPolicy(HOSTSECMGR(host->doc),
hres = IInternetHostSecurityManager_QueryCustomPolicy(&host->doc->IInternetHostSecurityManager_iface,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY, &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
if(FAILED(hres))
return FALSE;
......
......@@ -576,7 +576,8 @@ static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, RE
if(!This->window || !This->window->doc)
return E_NOINTERFACE;
return IInternetHostSecurityManager_QueryInterface(HOSTSECMGR(This->window->doc), riid, ppv);
return IInternetHostSecurityManager_QueryInterface(&This->window->doc->IInternetHostSecurityManager_iface,
riid, ppv);
}
FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
......
......@@ -42,30 +42,33 @@ static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k'
const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
{0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
#define HOSTSECMGR_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IInternetHostSecurityManager, iface)
static inline HTMLDocumentNode *impl_from_IInternetHostSecurityManager(IInternetHostSecurityManager *iface)
{
return CONTAINING_RECORD(iface, HTMLDocumentNode, IInternetHostSecurityManager_iface);
}
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
}
static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
}
static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
}
static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId,
DWORD *pcbSecurityId, DWORD_PTR dwReserved)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
FIXME("(%p)->(%p %p %lx)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
return E_NOTIMPL;
}
......@@ -73,7 +76,7 @@ static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSec
static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction,
BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
const WCHAR *url;
TRACE("(%p)->(%d %p %d %p %d %x %x)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
......@@ -176,7 +179,7 @@ static HRESULT confirm_safety(HTMLDocumentNode *This, const WCHAR *url, struct C
static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey,
BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved)
{
HTMLDocumentNode *This = HOSTSECMGR_THIS(iface);
HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
const WCHAR *url;
HRESULT hres;
......@@ -227,8 +230,6 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
return hres;
}
#undef HOSTSECMGR_THIS
static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl = {
InternetHostSecurityManager_QueryInterface,
InternetHostSecurityManager_AddRef,
......@@ -240,5 +241,5 @@ static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl =
void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode *This)
{
This->lpIInternetHostSecurityManagerVtbl = &InternetHostSecurityManagerVtbl;
This->IInternetHostSecurityManager_iface.lpVtbl = &InternetHostSecurityManagerVtbl;
}
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