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);
94 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
98 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
100 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, p);
105 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
107 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
108 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
112 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
114 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
115 FIXME("(%p)->(%p)\n", This, p);
119 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
121 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
122 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
126 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
128 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
129 FIXME("(%p)->(%p)\n", This, p);
133 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
135 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
136 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
140 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
142 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, p);
147 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
149 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
150 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
154 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
156 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
157 FIXME("(%p)->(%p)\n", This, p);
161 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
163 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
164 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
168 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
170 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
171 FIXME("(%p)->(%p)\n", This, p);
175 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
177 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
178 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
182 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
184 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
185 FIXME("(%p)->(%p)\n", This, p);
189 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
191 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
192 FIXME("(%p)->(%x)\n", This, v);
196 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
198 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
199 FIXME("(%p)->(%p)\n", This, p);
203 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
205 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
206 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
210 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
212 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
213 FIXME("(%p)->(%p)\n", This, p);
217 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
218 HTMLFrameBase_QueryInterface,
219 HTMLFrameBase_AddRef,
220 HTMLFrameBase_Release,
221 HTMLFrameBase_GetTypeInfoCount,
222 HTMLFrameBase_GetTypeInfo,
223 HTMLFrameBase_GetIDsOfNames,
224 HTMLFrameBase_Invoke,
225 HTMLFrameBase_put_src,
226 HTMLFrameBase_get_src,
227 HTMLFrameBase_put_name,
228 HTMLFrameBase_get_name,
229 HTMLFrameBase_put_border,
230 HTMLFrameBase_get_border,
231 HTMLFrameBase_put_frameBorder,
232 HTMLFrameBase_get_frameBorder,
233 HTMLFrameBase_put_frameSpacing,
234 HTMLFrameBase_get_frameSpacing,
235 HTMLFrameBase_put_marginWidth,
236 HTMLFrameBase_get_marginWidth,
237 HTMLFrameBase_put_marginHeight,
238 HTMLFrameBase_get_marginHeight,
239 HTMLFrameBase_put_noResize,
240 HTMLFrameBase_get_noResize,
241 HTMLFrameBase_put_scrolling,
242 HTMLFrameBase_get_scrolling
245 #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLFrameBase, IHTMLFrameBase2, iface)
247 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
249 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
251 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
254 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
256 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
258 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
261 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
263 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
265 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
268 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
270 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
271 FIXME("(%p)\n", This);
275 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
276 LCID lcid, ITypeInfo **ppTInfo)
278 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
279 FIXME("(%p)\n", This);
283 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
284 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
286 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
287 FIXME("(%p)\n", This);
291 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
292 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
293 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
295 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
296 FIXME("(%p)\n", This);
300 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
302 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
304 TRACE("(%p)->(%p)\n", This, p);
306 if(This->content_window) {
307 IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window));
308 *p = HTMLWINDOW2(This->content_window);
310 WARN("NULL content window\n");
316 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
318 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
319 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
323 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
325 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
326 FIXME("(%p)->(%p)\n", This, p);
330 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
332 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
333 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
337 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
339 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
340 FIXME("(%p)->(%p)\n", This, p);
344 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
346 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
347 FIXME("(%p)->(%p)\n", This, p);
351 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
353 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
354 FIXME("(%p)->(%x)\n", This, v);
358 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
360 HTMLFrameBase *This = HTMLFRAMEBASE2_THIS(iface);
361 FIXME("(%p)->(%p)\n", This, p);
365 #undef HTMLFRAMEBASE2_THIS
367 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
368 HTMLFrameBase2_QueryInterface,
369 HTMLFrameBase2_AddRef,
370 HTMLFrameBase2_Release,
371 HTMLFrameBase2_GetTypeInfoCount,
372 HTMLFrameBase2_GetTypeInfo,
373 HTMLFrameBase2_GetIDsOfNames,
374 HTMLFrameBase2_Invoke,
375 HTMLFrameBase2_get_contentWindow,
376 HTMLFrameBase2_put_onload,
377 HTMLFrameBase2_get_onload,
378 HTMLFrameBase2_put_onreadystatechange,
379 HTMLFrameBase2_get_onreadystatechange,
380 HTMLFrameBase2_get_readyState,
381 HTMLFrameBase2_put_allowTransparency,
382 HTMLFrameBase2_get_allowTransparency
385 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
387 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
388 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
389 *ppv = HTMLFRAMEBASE(This);
390 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
391 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
392 *ppv = HTMLFRAMEBASE2(This);
394 return HTMLElement_QI(&This->element.node, riid, ppv);
397 IUnknown_AddRef((IUnknown*)*ppv);
401 void HTMLFrameBase_destructor(HTMLFrameBase *This)
403 if(This->content_window) {
404 This->content_window->frame_element = NULL;
405 IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
408 HTMLElement_destructor(&This->element.node);
411 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
412 HTMLWindow *content_window, dispex_static_data_t *dispex_data)
414 This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl;
415 This->lpIHTMLFrameBase2Vtbl = &HTMLFrameBase2Vtbl;
417 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
420 IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
421 content_window->frame_element = This;
423 This->content_window = content_window;
427 HTMLFrameBase framebase;
430 #define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
432 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
434 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
436 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
439 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
441 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
443 HTMLFrameBase_destructor(&This->framebase);
446 static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
448 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
450 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
455 *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
456 IDispatch_AddRef(*p);
460 #undef HTMLFRAME_NODE_THIS
462 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
464 HTMLFrameElement_destructor,
469 HTMLFrameElement_get_document
472 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
474 nsIDOMHTMLFrameElement *nsframe;
475 HTMLFrameElement *ret;
478 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
480 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
482 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
484 ERR("Could not get nsIDOMHTMLFrameElement iface: %08x\n", nsres);
486 HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, NULL);
488 return &ret->framebase.element;