2 * Copyright 2010 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 IHTMLFrameElement3 IHTMLFrameElement3_iface;
39 static inline HTMLFrameElement *impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
41 return CONTAINING_RECORD(iface, HTMLFrameElement, IHTMLFrameElement3_iface);
44 static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
45 REFIID riid, void **ppv)
47 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
49 return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
52 static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
54 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
56 return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
59 static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
61 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
63 return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
66 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
68 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
69 return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.dispex.IDispatchEx_iface,
73 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
74 LCID lcid, ITypeInfo **ppTInfo)
76 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
77 return IDispatchEx_GetTypeInfo(&This->framebase.element.node.dispex.IDispatchEx_iface, iTInfo,
81 static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
82 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
84 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
85 return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.dispex.IDispatchEx_iface, riid,
86 rgszNames, cNames, lcid, rgDispId);
89 static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
90 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
91 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
94 return IDispatchEx_Invoke(&This->framebase.element.node.dispex.IDispatchEx_iface, dispIdMember,
95 riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
98 static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
100 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
104 TRACE("(%p)->(%p)\n", This, p);
106 if(!This->framebase.content_window) {
107 FIXME("NULL window\n");
111 hres = IHTMLWindow2_get_document(&This->framebase.content_window->IHTMLWindow2_iface, &doc);
115 *p = doc ? (IDispatch*)doc : NULL;
119 static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
121 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
122 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
126 static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
128 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
129 FIXME("(%p)->(%p)\n", This, p);
133 static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
135 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
136 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
140 static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
142 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
143 FIXME("(%p)->(%p)\n", This, p);
147 static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
149 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
150 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
154 static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
156 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
157 FIXME("(%p)->(%p)\n", This, p);
161 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
162 HTMLFrameElement3_QueryInterface,
163 HTMLFrameElement3_AddRef,
164 HTMLFrameElement3_Release,
165 HTMLFrameElement3_GetTypeInfoCount,
166 HTMLFrameElement3_GetTypeInfo,
167 HTMLFrameElement3_GetIDsOfNames,
168 HTMLFrameElement3_Invoke,
169 HTMLFrameElement3_get_contentDocument,
170 HTMLFrameElement3_put_src,
171 HTMLFrameElement3_get_src,
172 HTMLFrameElement3_put_longDesc,
173 HTMLFrameElement3_get_longDesc,
174 HTMLFrameElement3_put_frameBorder,
175 HTMLFrameElement3_get_frameBorder
178 static inline HTMLFrameElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
180 return CONTAINING_RECORD(iface, HTMLFrameElement, framebase.element.node);
183 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
185 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
187 if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
188 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
189 *ppv = &This->IHTMLFrameElement3_iface;
191 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
194 IUnknown_AddRef((IUnknown*)*ppv);
198 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
200 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
202 HTMLFrameBase_destructor(&This->framebase);
205 static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
207 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
209 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
214 *p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
215 IDispatch_AddRef(*p);
219 static HRESULT HTMLFrameElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
221 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
223 return IHTMLFrameBase2_get_readyState(&This->framebase.IHTMLFrameBase2_iface, p);
226 static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
227 DWORD grfdex, DISPID *pid)
229 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
231 if(!This->framebase.content_window)
232 return DISP_E_UNKNOWNNAME;
234 return search_window_props(This->framebase.content_window, name, grfdex, pid);
237 static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
238 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
240 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
242 if(!This->framebase.content_window) {
243 ERR("no content window to invoke on\n");
247 return IDispatchEx_InvokeEx(&This->framebase.content_window->IDispatchEx_iface, id, lcid,
248 flags, params, res, ei, caller);
251 static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
253 HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
254 nsIDOMDocument *nsdoc;
258 nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
259 if(NS_FAILED(nsres) || !nsdoc) {
260 ERR("GetContentDocument failed: %08x\n", nsres);
264 hres = set_frame_doc(&This->framebase, nsdoc);
265 nsIDOMDocument_Release(nsdoc);
269 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
271 HTMLFrameElement_destructor,
278 HTMLFrameElement_get_document,
279 HTMLFrameElement_get_readystate,
280 HTMLFrameElement_get_dispid,
281 HTMLFrameElement_invoke,
282 HTMLFrameElement_bind_to_tree
285 static const tid_t HTMLFrameElement_iface_tids[] = {
289 IHTMLFrameElement3_tid,
293 static dispex_static_data_t HTMLFrameElement_dispex = {
295 DispHTMLFrameElement_tid,
297 HTMLFrameElement_iface_tids
300 HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
302 HTMLFrameElement *ret;
304 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
306 return E_OUTOFMEMORY;
308 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
309 ret->IHTMLFrameElement3_iface.lpVtbl = &HTMLFrameElement3Vtbl;
311 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
313 *elem = &ret->framebase.element;