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_readystate(HTMLDOMNode *iface, BSTR *p)
216 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
218 return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This->framebase), p);
221 static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
222 DWORD grfdex, DISPID *pid)
224 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
226 if(!This->framebase.content_window)
227 return DISP_E_UNKNOWNNAME;
229 return search_window_props(This->framebase.content_window, name, grfdex, pid);
232 static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
233 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
235 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
237 if(!This->framebase.content_window) {
238 ERR("no content window to invoke on\n");
242 return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller);
245 static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
247 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
248 nsIDOMDocument *nsdoc;
252 nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
253 if(NS_FAILED(nsres) || !nsdoc) {
254 ERR("GetContentDocument failed: %08x\n", nsres);
258 hres = set_frame_doc(&This->framebase, nsdoc);
259 nsIDOMDocument_Release(nsdoc);
263 #undef HTMLFRAME_NODE_THIS
265 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
267 HTMLFrameElement_destructor,
273 HTMLFrameElement_get_document,
274 HTMLFrameElement_get_readystate,
275 HTMLFrameElement_get_dispid,
276 HTMLFrameElement_invoke,
277 HTMLFrameElement_bind_to_tree
280 static const tid_t HTMLFrameElement_iface_tids[] = {
284 IHTMLFrameElement3_tid,
288 static dispex_static_data_t HTMLFrameElement_dispex = {
290 DispHTMLFrameElement_tid,
292 HTMLFrameElement_iface_tids
295 HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
297 HTMLFrameElement *ret;
299 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
301 return E_OUTOFMEMORY;
303 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
304 ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl;
306 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
308 *elem = &ret->framebase.element;