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);
34 #define HTMLFRAMEBASE_THIS(iface) DEFINE_THIS(HTMLFrameBase, IHTMLFrameBase, iface)
36 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
38 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
40 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
43 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
45 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
47 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
50 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
52 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
54 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
57 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
59 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
61 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
64 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
65 LCID lcid, ITypeInfo **ppTInfo)
67 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
69 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
72 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
73 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
75 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
77 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames,
78 cNames, lcid, rgDispId);
81 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
82 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
83 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
85 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
87 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
88 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
91 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
93 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
95 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
97 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
98 FIXME("detached element\n");
102 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->url);
105 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
107 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
108 FIXME("(%p)->(%p)\n", This, p);
112 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
114 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
115 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
119 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
121 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
122 FIXME("(%p)->(%p)\n", This, p);
126 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
128 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
129 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
133 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
135 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
136 FIXME("(%p)->(%p)\n", This, p);
140 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
142 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
143 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
147 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
149 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
150 FIXME("(%p)->(%p)\n", This, p);
154 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
156 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
157 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
161 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
163 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
164 FIXME("(%p)->(%p)\n", This, p);
168 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
170 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
171 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
175 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
177 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
178 FIXME("(%p)->(%p)\n", This, p);
182 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
184 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
185 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
189 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
191 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
192 FIXME("(%p)->(%p)\n", This, p);
196 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
198 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
199 FIXME("(%p)->(%x)\n", This, v);
203 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
205 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
206 FIXME("(%p)->(%p)\n", This, p);
210 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
212 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
213 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
217 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
219 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
220 FIXME("(%p)->(%p)\n", This, p);
224 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
225 HTMLFrameBase_QueryInterface,
226 HTMLFrameBase_AddRef,
227 HTMLFrameBase_Release,
228 HTMLFrameBase_GetTypeInfoCount,
229 HTMLFrameBase_GetTypeInfo,
230 HTMLFrameBase_GetIDsOfNames,
231 HTMLFrameBase_Invoke,
232 HTMLFrameBase_put_src,
233 HTMLFrameBase_get_src,
234 HTMLFrameBase_put_name,
235 HTMLFrameBase_get_name,
236 HTMLFrameBase_put_border,
237 HTMLFrameBase_get_border,
238 HTMLFrameBase_put_frameBorder,
239 HTMLFrameBase_get_frameBorder,
240 HTMLFrameBase_put_frameSpacing,
241 HTMLFrameBase_get_frameSpacing,
242 HTMLFrameBase_put_marginWidth,
243 HTMLFrameBase_get_marginWidth,
244 HTMLFrameBase_put_marginHeight,
245 HTMLFrameBase_get_marginHeight,
246 HTMLFrameBase_put_noResize,
247 HTMLFrameBase_get_noResize,
248 HTMLFrameBase_put_scrolling,
249 HTMLFrameBase_get_scrolling
252 #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLFrameBase, IHTMLFrameBase2, iface)
254 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
256 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
258 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
261 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
263 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
265 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
268 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
270 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
272 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
275 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
277 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
278 FIXME("(%p)\n", This);
282 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
283 LCID lcid, ITypeInfo **ppTInfo)
285 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
286 FIXME("(%p)\n", This);
290 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
291 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
293 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
294 FIXME("(%p)\n", This);
298 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
299 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
300 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
302 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
303 FIXME("(%p)\n", This);
307 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
309 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
311 TRACE("(%p)->(%p)\n", This, p);
313 if(This->content_window) {
314 IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window));
315 *p = HTMLWINDOW2(This->content_window);
317 WARN("NULL content window\n");
323 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
325 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
326 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
330 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
332 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
333 FIXME("(%p)->(%p)\n", This, p);
337 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
339 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
340 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
344 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
346 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
347 FIXME("(%p)->(%p)\n", This, p);
351 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
353 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
355 TRACE("(%p)->(%p)\n", This, p);
357 if(!This->content_window || !This->content_window->doc) {
358 FIXME("no document associated\n");
362 return IHTMLDocument2_get_readyState(HTMLDOC(&This->content_window->doc->basedoc), p);
365 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
367 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
368 FIXME("(%p)->(%x)\n", This, v);
372 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
374 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
375 FIXME("(%p)->(%p)\n", This, p);
379 #undef HTMLFRAMEBASE2_THIS
381 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
382 HTMLFrameBase2_QueryInterface,
383 HTMLFrameBase2_AddRef,
384 HTMLFrameBase2_Release,
385 HTMLFrameBase2_GetTypeInfoCount,
386 HTMLFrameBase2_GetTypeInfo,
387 HTMLFrameBase2_GetIDsOfNames,
388 HTMLFrameBase2_Invoke,
389 HTMLFrameBase2_get_contentWindow,
390 HTMLFrameBase2_put_onload,
391 HTMLFrameBase2_get_onload,
392 HTMLFrameBase2_put_onreadystatechange,
393 HTMLFrameBase2_get_onreadystatechange,
394 HTMLFrameBase2_get_readyState,
395 HTMLFrameBase2_put_allowTransparency,
396 HTMLFrameBase2_get_allowTransparency
399 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
401 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
402 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
403 *ppv = HTMLFRAMEBASE(This);
404 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
405 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
406 *ppv = HTMLFRAMEBASE2(This);
408 return HTMLElement_QI(&This->element.node, riid, ppv);
411 IUnknown_AddRef((IUnknown*)*ppv);
415 void HTMLFrameBase_destructor(HTMLFrameBase *This)
417 if(This->content_window) {
418 This->content_window->frame_element = NULL;
419 IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
422 HTMLElement_destructor(&This->element.node);
425 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
426 HTMLWindow *content_window, dispex_static_data_t *dispex_data)
428 This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl;
429 This->lpIHTMLFrameBase2Vtbl = &HTMLFrameBase2Vtbl;
431 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
434 IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
435 content_window->frame_element = This;
437 This->content_window = content_window;
441 HTMLFrameBase framebase;
444 #define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
446 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
448 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
450 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
453 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
455 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
457 HTMLFrameBase_destructor(&This->framebase);
460 static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
462 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
464 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
469 *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
470 IDispatch_AddRef(*p);
474 #undef HTMLFRAME_NODE_THIS
476 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
478 HTMLFrameElement_destructor,
483 HTMLFrameElement_get_document
486 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
488 nsIDOMHTMLFrameElement *nsframe;
489 HTMLFrameElement *ret;
492 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
494 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
496 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
498 ERR("Could not get nsIDOMHTMLFrameElement iface: %08x\n", nsres);
500 HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, NULL);
502 return &ret->framebase.element;