2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
35 HTMLFrameBase framebase
;
36 const IHTMLIFrameElementVtbl
*lpIHTMLIFrameElementVtbl
;
39 #define HTMLIFRAMEELEM(x) ((IHTMLIFrameElement*) &(x)->lpIHTMLIFrameElementVtbl)
41 #define HTMLIFRAME_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLIFrameElement, iface)
43 static HRESULT WINAPI
HTMLIFrameElement_QueryInterface(IHTMLIFrameElement
*iface
,
44 REFIID riid
, void **ppv
)
46 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
48 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This
->framebase
.element
.node
), riid
, ppv
);
51 static ULONG WINAPI
HTMLIFrameElement_AddRef(IHTMLIFrameElement
*iface
)
53 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
55 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This
->framebase
.element
.node
));
58 static ULONG WINAPI
HTMLIFrameElement_Release(IHTMLIFrameElement
*iface
)
60 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
62 return IHTMLDOMNode_Release(HTMLDOMNODE(&This
->framebase
.element
.node
));
65 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfoCount(IHTMLIFrameElement
*iface
, UINT
*pctinfo
)
67 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
68 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->framebase
.element
.node
.dispex
), pctinfo
);
71 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfo(IHTMLIFrameElement
*iface
, UINT iTInfo
,
72 LCID lcid
, ITypeInfo
**ppTInfo
)
74 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
75 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->framebase
.element
.node
.dispex
), iTInfo
, lcid
, ppTInfo
);
78 static HRESULT WINAPI
HTMLIFrameElement_GetIDsOfNames(IHTMLIFrameElement
*iface
, REFIID riid
,
79 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
81 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
82 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->framebase
.element
.node
.dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
85 static HRESULT WINAPI
HTMLIFrameElement_Invoke(IHTMLIFrameElement
*iface
, DISPID dispIdMember
,
86 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
87 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
89 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
90 return IDispatchEx_Invoke(DISPATCHEX(&This
->framebase
.element
.node
.dispex
), dispIdMember
, riid
,
91 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
94 static HRESULT WINAPI
HTMLIFrameElement_put_vspace(IHTMLIFrameElement
*iface
, LONG v
)
96 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
97 FIXME("(%p)->(%d)\n", This
, v
);
101 static HRESULT WINAPI
HTMLIFrameElement_get_vspace(IHTMLIFrameElement
*iface
, LONG
*p
)
103 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
104 FIXME("(%p)->(%p)\n", This
, p
);
108 static HRESULT WINAPI
HTMLIFrameElement_put_hspace(IHTMLIFrameElement
*iface
, LONG v
)
110 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
111 FIXME("(%p)->(%d)\n", This
, v
);
115 static HRESULT WINAPI
HTMLIFrameElement_get_hspace(IHTMLIFrameElement
*iface
, LONG
*p
)
117 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
118 FIXME("(%p)->(%p)\n", This
, p
);
122 static HRESULT WINAPI
HTMLIFrameElement_put_align(IHTMLIFrameElement
*iface
, BSTR v
)
124 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
125 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
129 static HRESULT WINAPI
HTMLIFrameElement_get_align(IHTMLIFrameElement
*iface
, BSTR
*p
)
131 HTMLIFrame
*This
= HTMLIFRAME_THIS(iface
);
132 FIXME("(%p)->(%p)\n", This
, p
);
136 #undef HTMLIFRAME_THIS
138 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl
= {
139 HTMLIFrameElement_QueryInterface
,
140 HTMLIFrameElement_AddRef
,
141 HTMLIFrameElement_Release
,
142 HTMLIFrameElement_GetTypeInfoCount
,
143 HTMLIFrameElement_GetTypeInfo
,
144 HTMLIFrameElement_GetIDsOfNames
,
145 HTMLIFrameElement_Invoke
,
146 HTMLIFrameElement_put_vspace
,
147 HTMLIFrameElement_get_vspace
,
148 HTMLIFrameElement_put_hspace
,
149 HTMLIFrameElement_get_hspace
,
150 HTMLIFrameElement_put_align
,
151 HTMLIFrameElement_get_align
154 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, framebase.element.node, iface)
156 static HRESULT
HTMLIFrame_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
158 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
160 if(IsEqualGUID(&IID_IHTMLIFrameElement
, riid
)) {
161 TRACE("(%p)->(IID_IHTMLIFrameElement %p)\n", This
, ppv
);
162 *ppv
= HTMLIFRAMEELEM(This
);
164 return HTMLFrameBase_QI(&This
->framebase
, riid
, ppv
);
167 IUnknown_AddRef((IUnknown
*)*ppv
);
171 static void HTMLIFrame_destructor(HTMLDOMNode
*iface
)
173 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
175 HTMLFrameBase_destructor(&This
->framebase
);
178 static HRESULT
HTMLIFrame_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
180 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
182 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->doc
) {
187 *p
= (IDispatch
*)HTMLDOC(&This
->framebase
.content_window
->doc
->basedoc
);
188 IDispatch_AddRef(*p
);
192 static HRESULT
HTMLIFrame_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
193 DWORD grfdex
, DISPID
*pid
)
195 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
197 if(!This
->framebase
.content_window
)
198 return DISP_E_UNKNOWNNAME
;
200 return search_window_props(This
->framebase
.content_window
, name
, grfdex
, pid
);
203 static HRESULT
HTMLIFrame_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
204 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
206 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
208 if(!This
->framebase
.content_window
) {
209 ERR("no content window to invoke on\n");
213 return IDispatchEx_InvokeEx(DISPATCHEX(This
->framebase
.content_window
), id
, lcid
, flags
, params
, res
, ei
, caller
);
216 static HRESULT
HTMLIFrame_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
218 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
220 return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This
->framebase
), p
);
223 static HRESULT
HTMLIFrame_bind_to_tree(HTMLDOMNode
*iface
)
225 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
226 nsIDOMDocument
*nsdoc
;
230 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->framebase
.nsiframe
, &nsdoc
);
231 if(NS_FAILED(nsres
) || !nsdoc
) {
232 ERR("GetContentDocument failed: %08x\n", nsres
);
236 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
237 nsIDOMDocument_Release(nsdoc
);
241 #undef HTMLIFRAME_NODE_THIS
243 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
245 HTMLIFrame_destructor
,
251 HTMLIFrame_get_document
,
252 HTMLIFrame_get_readystate
,
253 HTMLIFrame_get_dispid
,
255 HTMLIFrame_bind_to_tree
258 static const tid_t HTMLIFrame_iface_tids
[] = {
262 IHTMLIFrameElement_tid
,
266 static dispex_static_data_t HTMLIFrame_dispex
= {
270 HTMLIFrame_iface_tids
273 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
)
277 ret
= heap_alloc_zero(sizeof(HTMLIFrame
));
279 ret
->lpIHTMLIFrameElementVtbl
= &HTMLIFrameElementVtbl
;
280 ret
->framebase
.element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
282 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLIFrame_dispex
);
284 return &ret
->framebase
.element
;