2008-10-07 21:44:36 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
|
|
|
typedef struct {
|
2009-11-01 19:17:17 +01:00
|
|
|
HTMLFrameBase framebase;
|
2008-10-07 21:44:36 +02:00
|
|
|
const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
|
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
nsIDOMHTMLIFrameElement *nsiframe;
|
|
|
|
} HTMLIFrame;
|
|
|
|
|
2009-02-16 09:53:46 +01:00
|
|
|
#define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl)
|
2008-10-07 21:44:36 +02:00
|
|
|
|
|
|
|
#define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->framebase.element.node), riid, ppv);
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLIFrameBase2_AddRef(IHTMLFrameBase2 *iface)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->framebase.element.node));
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLIFrameBase2_Release(IHTMLFrameBase2 *iface)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->framebase.element.node));
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
2008-10-10 22:48:32 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2009-11-01 19:18:38 +01:00
|
|
|
if(This->framebase.content_window) {
|
|
|
|
IHTMLWindow2_AddRef(HTMLWINDOW2(This->framebase.content_window));
|
|
|
|
*p = HTMLWINDOW2(This->framebase.content_window);
|
2009-11-01 19:17:58 +01:00
|
|
|
}else {
|
|
|
|
WARN("NULL content window\n");
|
|
|
|
*p = NULL;
|
2008-10-10 22:48:32 +02:00
|
|
|
}
|
2009-09-16 22:08:41 +02:00
|
|
|
return S_OK;
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%x)\n", This, v);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLIFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef HTMLFRAMEBASE2_THIS
|
|
|
|
|
|
|
|
static const IHTMLFrameBase2Vtbl HTMLIFrameBase2Vtbl = {
|
|
|
|
HTMLIFrameBase2_QueryInterface,
|
|
|
|
HTMLIFrameBase2_AddRef,
|
|
|
|
HTMLIFrameBase2_Release,
|
|
|
|
HTMLIFrameBase2_GetTypeInfoCount,
|
|
|
|
HTMLIFrameBase2_GetTypeInfo,
|
|
|
|
HTMLIFrameBase2_GetIDsOfNames,
|
|
|
|
HTMLIFrameBase2_Invoke,
|
|
|
|
HTMLIFrameBase2_get_contentWindow,
|
|
|
|
HTMLIFrameBase2_put_onload,
|
|
|
|
HTMLIFrameBase2_get_onload,
|
|
|
|
HTMLIFrameBase2_put_onreadystatechange,
|
|
|
|
HTMLIFrameBase2_get_onreadystatechange,
|
|
|
|
HTMLIFrameBase2_get_readyState,
|
|
|
|
HTMLIFrameBase2_put_allowTransparency,
|
|
|
|
HTMLIFrameBase2_get_allowTransparency
|
|
|
|
};
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
#define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, framebase.element.node, iface)
|
2008-10-07 21:44:36 +02:00
|
|
|
|
|
|
|
static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
|
2008-10-07 21:44:36 +02:00
|
|
|
TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
|
|
|
|
*ppv = HTMLFRAMEBASE2(This);
|
|
|
|
}else {
|
2009-11-01 19:17:17 +01:00
|
|
|
return HTMLFrameBase_QI(&This->framebase, riid, ppv);
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void HTMLIFrame_destructor(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
|
|
|
|
|
|
|
|
if(This->nsiframe)
|
|
|
|
nsIDOMHTMLIFrameElement_Release(This->nsiframe);
|
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
HTMLFrameBase_destructor(&This->framebase);
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef HTMLIFRAME_NODE_THIS
|
|
|
|
|
|
|
|
static const NodeImplVtbl HTMLIFrameImplVtbl = {
|
|
|
|
HTMLIFrame_QI,
|
|
|
|
HTMLIFrame_destructor
|
|
|
|
};
|
|
|
|
|
2008-10-07 21:44:50 +02:00
|
|
|
static const tid_t HTMLIFrame_iface_tids[] = {
|
|
|
|
IHTMLDOMNode_tid,
|
|
|
|
IHTMLDOMNode2_tid,
|
|
|
|
IHTMLElement_tid,
|
|
|
|
IHTMLElement2_tid,
|
|
|
|
IHTMLElement3_tid,
|
2009-10-13 20:49:34 +02:00
|
|
|
IHTMLFrameBase_tid,
|
2008-10-07 21:44:50 +02:00
|
|
|
IHTMLFrameBase2_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLIFrame_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLIFrame_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLIFrame_iface_tids
|
|
|
|
};
|
|
|
|
|
2009-11-01 19:17:58 +01:00
|
|
|
static HTMLWindow *get_content_window(nsIDOMHTMLIFrameElement *nsiframe)
|
|
|
|
{
|
|
|
|
HTMLWindow *ret;
|
|
|
|
nsIDOMWindow *nswindow;
|
|
|
|
nsIDOMDocument *nsdoc;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLIFrameElement_GetContentDocument(nsiframe, &nsdoc);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetContentDocument failed: %08x\n", nsres);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!nsdoc) {
|
|
|
|
FIXME("NULL contentDocument\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nswindow = get_nsdoc_window(nsdoc);
|
|
|
|
nsIDOMDocument_Release(nsdoc);
|
|
|
|
if(!nswindow)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ret = nswindow_to_window(nswindow);
|
|
|
|
nsIDOMWindow_Release(nswindow);
|
|
|
|
if(!ret)
|
|
|
|
ERR("Could not get window object\n");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
|
2008-10-07 21:44:36 +02:00
|
|
|
{
|
|
|
|
HTMLIFrame *ret;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
ret = heap_alloc_zero(sizeof(HTMLIFrame));
|
|
|
|
|
|
|
|
ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
|
2009-11-01 19:17:17 +01:00
|
|
|
ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
|
2008-10-07 21:44:36 +02:00
|
|
|
|
|
|
|
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
|
|
|
|
|
2009-11-01 19:17:58 +01:00
|
|
|
if(!content_window)
|
|
|
|
content_window = get_content_window(ret->nsiframe);
|
|
|
|
|
2009-11-01 19:18:38 +01:00
|
|
|
HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, &HTMLIFrame_dispex);
|
2009-11-01 19:17:58 +01:00
|
|
|
|
2009-11-01 19:17:17 +01:00
|
|
|
return &ret->framebase.element;
|
2008-10-07 21:44:36 +02:00
|
|
|
}
|