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 const IHTMLFrameElement3Vtbl *lpIHTMLFrameElement3Vtbl;
39 #define HTMLFRAMEELEM3(x) ((IHTMLFrameElement3*) &(x)->lpIHTMLFrameElement3Vtbl)
41 #define HTMLFRAME3_THIS(iface) DEFINE_THIS(HTMLFrameElement, IHTMLFrameElement3, iface)
43 static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
44 REFIID riid, void **ppv)
46 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
48 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->framebase.element.node), riid, ppv);
51 static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
53 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
55 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->framebase.element.node));
58 static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
60 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
62 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->framebase.element.node));
65 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
67 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
68 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->framebase.element.node.dispex), pctinfo);
71 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
72 LCID lcid, ITypeInfo **ppTInfo)
74 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
75 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->framebase.element.node.dispex), iTInfo, lcid, ppTInfo);
78 static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
79 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
81 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
82 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->framebase.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
85 static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
86 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
87 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
89 HTMLFrameElement *This = HTMLFRAME3_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 HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
96 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
100 TRACE("(%p)->(%p)\n", This, p);
102 if(!This->framebase.content_window) {
103 FIXME("NULL window\n");
107 hres = IHTMLWindow2_get_document(HTMLWINDOW2(This->framebase.content_window), &doc);
111 *p = doc ? (IDispatch*)doc : NULL;
115 static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
117 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
118 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
122 static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
124 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
125 FIXME("(%p)->(%p)\n", This, p);
129 static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
131 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
132 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
136 static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
138 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
139 FIXME("(%p)->(%p)\n", This, p);
143 static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
145 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
146 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
150 static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
152 HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
153 FIXME("(%p)->(%p)\n", This, p);
157 #undef HTMLFRAME3_THIS
159 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
160 HTMLFrameElement3_QueryInterface,
161 HTMLFrameElement3_AddRef,
162 HTMLFrameElement3_Release,
163 HTMLFrameElement3_GetTypeInfoCount,
164 HTMLFrameElement3_GetTypeInfo,
165 HTMLFrameElement3_GetIDsOfNames,
166 HTMLFrameElement3_Invoke,
167 HTMLFrameElement3_get_contentDocument,
168 HTMLFrameElement3_put_src,
169 HTMLFrameElement3_get_src,
170 HTMLFrameElement3_put_longDesc,
171 HTMLFrameElement3_get_longDesc,
172 HTMLFrameElement3_put_frameBorder,
173 HTMLFrameElement3_get_frameBorder
176 #define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
178 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
180 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
182 if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
183 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
184 *ppv = HTMLFRAMEELEM3(This);
186 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
189 IUnknown_AddRef((IUnknown*)*ppv);
193 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
195 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
197 HTMLFrameBase_destructor(&This->framebase);
200 static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
202 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
204 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
209 *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
210 IDispatch_AddRef(*p);
214 static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
215 DWORD grfdex, DISPID *pid)
217 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
219 if(!This->framebase.content_window)
220 return DISP_E_UNKNOWNNAME;
222 return search_window_props(This->framebase.content_window, name, grfdex, pid);
225 static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
226 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
228 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
230 if(!This->framebase.content_window) {
231 ERR("no content window to invoke on\n");
235 return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller);
238 static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
240 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
241 nsIDOMDocument *nsdoc;
245 nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
246 if(NS_FAILED(nsres) || !nsdoc) {
247 ERR("GetContentDocument failed: %08x\n", nsres);
251 hres = set_frame_doc(&This->framebase, nsdoc);
252 nsIDOMDocument_Release(nsdoc);
256 #undef HTMLFRAME_NODE_THIS
258 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
260 HTMLFrameElement_destructor,
265 HTMLFrameElement_get_document,
267 HTMLFrameElement_get_dispid,
268 HTMLFrameElement_invoke,
269 HTMLFrameElement_bind_to_tree
272 static const tid_t HTMLFrameElement_iface_tids[] = {
276 IHTMLFrameElement3_tid,
280 static dispex_static_data_t HTMLFrameElement_dispex = {
282 DispHTMLFrameElement_tid,
284 HTMLFrameElement_iface_tids
287 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
289 HTMLFrameElement *ret;
291 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
293 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
294 ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl;
296 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
298 return &ret->framebase.element;