2010-01-21 14:47:37 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2010 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 {
|
|
|
|
HTMLFrameBase framebase;
|
2010-12-06 23:31:24 +01:00
|
|
|
IHTMLFrameElement3 IHTMLFrameElement3_iface;
|
2010-01-21 14:47:37 +01:00
|
|
|
} HTMLFrameElement;
|
|
|
|
|
2010-12-06 23:31:24 +01:00
|
|
|
static inline HTMLFrameElement *impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLFrameElement, IHTMLFrameElement3_iface);
|
|
|
|
}
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2010-12-30 01:39:16 +01:00
|
|
|
return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.dispex.IDispatchEx_iface,
|
|
|
|
pctinfo);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->framebase.element.node.dispex.IDispatchEx_iface, iTInfo,
|
|
|
|
lcid, ppTInfo);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.dispex.IDispatchEx_iface, riid,
|
|
|
|
rgszNames, cNames, lcid, rgDispId);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-12-31 11:07:33 +01:00
|
|
|
return IDispatchEx_Invoke(&This->framebase.element.node.dispex.IDispatchEx_iface, dispIdMember,
|
|
|
|
riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:48:11 +01:00
|
|
|
IHTMLDocument2 *doc;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!This->framebase.content_window) {
|
|
|
|
FIXME("NULL window\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
hres = IHTMLWindow2_get_document(&This->framebase.content_window->base.IHTMLWindow2_iface, &doc);
|
2010-01-21 14:48:11 +01:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
*p = doc ? (IDispatch*)doc : NULL;
|
|
|
|
return S_OK;
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
|
|
|
|
{
|
2010-12-06 23:31:24 +01:00
|
|
|
HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
|
|
|
|
HTMLFrameElement3_QueryInterface,
|
|
|
|
HTMLFrameElement3_AddRef,
|
|
|
|
HTMLFrameElement3_Release,
|
|
|
|
HTMLFrameElement3_GetTypeInfoCount,
|
|
|
|
HTMLFrameElement3_GetTypeInfo,
|
|
|
|
HTMLFrameElement3_GetIDsOfNames,
|
|
|
|
HTMLFrameElement3_Invoke,
|
|
|
|
HTMLFrameElement3_get_contentDocument,
|
|
|
|
HTMLFrameElement3_put_src,
|
|
|
|
HTMLFrameElement3_get_src,
|
|
|
|
HTMLFrameElement3_put_longDesc,
|
|
|
|
HTMLFrameElement3_get_longDesc,
|
|
|
|
HTMLFrameElement3_put_frameBorder,
|
|
|
|
HTMLFrameElement3_get_frameBorder
|
|
|
|
};
|
|
|
|
|
2010-12-27 20:13:09 +01:00
|
|
|
static inline HTMLFrameElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLFrameElement, framebase.element.node);
|
|
|
|
}
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
|
2010-12-06 23:31:24 +01:00
|
|
|
*ppv = &This->IHTMLFrameElement3_iface;
|
2010-01-21 14:47:37 +01:00
|
|
|
}else {
|
|
|
|
return HTMLFrameBase_QI(&This->framebase, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
HTMLFrameBase_destructor(&This->framebase);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2012-06-25 14:05:17 +02:00
|
|
|
if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
|
2010-01-21 14:47:37 +01:00
|
|
|
*p = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:05:17 +02:00
|
|
|
*p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
|
2010-01-21 14:47:37 +01:00
|
|
|
IDispatch_AddRef(*p);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-11-14 14:42:00 +01:00
|
|
|
static HRESULT HTMLFrameElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-11-14 14:42:00 +01:00
|
|
|
|
2011-01-03 00:59:45 +01:00
|
|
|
return IHTMLFrameBase2_get_readyState(&This->framebase.IHTMLFrameBase2_iface, p);
|
2010-11-14 14:42:00 +01:00
|
|
|
}
|
|
|
|
|
2010-01-21 14:47:37 +01:00
|
|
|
static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
|
|
|
|
DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
if(!This->framebase.content_window)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
2012-06-25 14:05:48 +02:00
|
|
|
return search_window_props(This->framebase.content_window->base.inner_window, name, grfdex, pid);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
if(!This->framebase.content_window) {
|
|
|
|
ERR("no content window to invoke on\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-06-25 14:04:59 +02:00
|
|
|
return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid,
|
2010-12-31 11:03:45 +01:00
|
|
|
flags, params, res, ei, caller);
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
|
|
|
|
{
|
2010-12-27 20:13:09 +01:00
|
|
|
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
|
2010-01-21 14:47:37 +01:00
|
|
|
nsIDOMDocument *nsdoc;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
|
|
|
|
if(NS_FAILED(nsres) || !nsdoc) {
|
|
|
|
ERR("GetContentDocument failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = set_frame_doc(&This->framebase, nsdoc);
|
|
|
|
nsIDOMDocument_Release(nsdoc);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
|
|
|
|
HTMLFrameElement_QI,
|
|
|
|
HTMLFrameElement_destructor,
|
2010-11-14 14:41:39 +01:00
|
|
|
HTMLElement_clone,
|
2011-08-25 15:23:35 +02:00
|
|
|
HTMLElement_get_attr_col,
|
2010-01-21 14:47:37 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2011-08-02 11:07:56 +02:00
|
|
|
NULL,
|
2010-01-21 14:47:37 +01:00
|
|
|
HTMLFrameElement_get_document,
|
2010-11-14 14:42:00 +01:00
|
|
|
HTMLFrameElement_get_readystate,
|
2010-01-21 14:47:37 +01:00
|
|
|
HTMLFrameElement_get_dispid,
|
|
|
|
HTMLFrameElement_invoke,
|
|
|
|
HTMLFrameElement_bind_to_tree
|
|
|
|
};
|
|
|
|
|
2010-01-21 14:48:43 +01:00
|
|
|
static const tid_t HTMLFrameElement_iface_tids[] = {
|
2010-01-28 02:09:02 +01:00
|
|
|
HTMLELEMENT_TIDS,
|
2010-01-21 14:48:43 +01:00
|
|
|
IHTMLFrameBase_tid,
|
|
|
|
IHTMLFrameBase2_tid,
|
|
|
|
IHTMLFrameElement3_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLFrameElement_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLFrameElement_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLFrameElement_iface_tids
|
|
|
|
};
|
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
|
2010-01-21 14:47:37 +01:00
|
|
|
{
|
|
|
|
HTMLFrameElement *ret;
|
|
|
|
|
|
|
|
ret = heap_alloc_zero(sizeof(HTMLFrameElement));
|
2010-12-01 22:43:14 +01:00
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
2010-01-21 14:47:37 +01:00
|
|
|
|
|
|
|
ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
|
2010-12-06 23:31:24 +01:00
|
|
|
ret->IHTMLFrameElement3_iface.lpVtbl = &HTMLFrameElement3Vtbl;
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2010-01-21 14:48:43 +01:00
|
|
|
HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
|
2010-01-21 14:47:37 +01:00
|
|
|
|
2010-12-01 22:43:14 +01:00
|
|
|
*elem = &ret->framebase.element;
|
|
|
|
return S_OK;
|
2010-01-21 14:47:37 +01:00
|
|
|
}
|