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(HTMLDOMNODE(&This->framebase.element.node), riid, ppv);
52 static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
54 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
56 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->framebase.element.node));
59 static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
61 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
63 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->framebase.element.node));
66 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
68 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
69 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->framebase.element.node.dispex), pctinfo);
72 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
73 LCID lcid, ITypeInfo **ppTInfo)
75 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
76 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->framebase.element.node.dispex), iTInfo, lcid, ppTInfo);
79 static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
80 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
82 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
83 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->framebase.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
86 static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
87 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
88 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
90 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
91 return IDispatchEx_Invoke(DISPATCHEX(&This->framebase.element.node.dispex), dispIdMember, riid,
92 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
95 static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
97 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
101 TRACE("(%p)->(%p)\n", This, p);
103 if(!This->framebase.content_window) {
104 FIXME("NULL window\n");
108 hres = IHTMLWindow2_get_document(&This->framebase.content_window->IHTMLWindow2_iface, &doc);
112 *p = doc ? (IDispatch*)doc : NULL;
116 static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
118 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
119 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
123 static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
125 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
126 FIXME("(%p)->(%p)\n", This, p);
130 static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
132 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
133 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
137 static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
139 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
140 FIXME("(%p)->(%p)\n", This, p);
144 static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
146 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
147 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
151 static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
153 HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
154 FIXME("(%p)->(%p)\n", This, p);
158 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
159 HTMLFrameElement3_QueryInterface,
160 HTMLFrameElement3_AddRef,
161 HTMLFrameElement3_Release,
162 HTMLFrameElement3_GetTypeInfoCount,
163 HTMLFrameElement3_GetTypeInfo,
164 HTMLFrameElement3_GetIDsOfNames,
165 HTMLFrameElement3_Invoke,
166 HTMLFrameElement3_get_contentDocument,
167 HTMLFrameElement3_put_src,
168 HTMLFrameElement3_get_src,
169 HTMLFrameElement3_put_longDesc,
170 HTMLFrameElement3_get_longDesc,
171 HTMLFrameElement3_put_frameBorder,
172 HTMLFrameElement3_get_frameBorder
175 #define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
177 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
179 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
181 if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
182 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
183 *ppv = &This->IHTMLFrameElement3_iface;
185 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
188 IUnknown_AddRef((IUnknown*)*ppv);
192 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
194 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
196 HTMLFrameBase_destructor(&This->framebase);
199 static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
201 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
203 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
208 *p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
209 IDispatch_AddRef(*p);
213 static HRESULT HTMLFrameElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
215 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
217 return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This->framebase), p);
220 static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
221 DWORD grfdex, DISPID *pid)
223 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
225 if(!This->framebase.content_window)
226 return DISP_E_UNKNOWNNAME;
228 return search_window_props(This->framebase.content_window, name, grfdex, pid);
231 static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
232 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
234 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
236 if(!This->framebase.content_window) {
237 ERR("no content window to invoke on\n");
241 return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller);
244 static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
246 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
247 nsIDOMDocument *nsdoc;
251 nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
252 if(NS_FAILED(nsres) || !nsdoc) {
253 ERR("GetContentDocument failed: %08x\n", nsres);
257 hres = set_frame_doc(&This->framebase, nsdoc);
258 nsIDOMDocument_Release(nsdoc);
262 #undef HTMLFRAME_NODE_THIS
264 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
266 HTMLFrameElement_destructor,
272 HTMLFrameElement_get_document,
273 HTMLFrameElement_get_readystate,
274 HTMLFrameElement_get_dispid,
275 HTMLFrameElement_invoke,
276 HTMLFrameElement_bind_to_tree
279 static const tid_t HTMLFrameElement_iface_tids[] = {
283 IHTMLFrameElement3_tid,
287 static dispex_static_data_t HTMLFrameElement_dispex = {
289 DispHTMLFrameElement_tid,
291 HTMLFrameElement_iface_tids
294 HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
296 HTMLFrameElement *ret;
298 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
300 return E_OUTOFMEMORY;
302 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
303 ret->IHTMLFrameElement3_iface.lpVtbl = &HTMLFrameElement3Vtbl;
305 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
307 *elem = &ret->framebase.element;