ntdll/tests: Added more registry symlink tests.
[wine.git] / dlls / mshtml / htmliframe.c
blob14f545daf8d59c7937006a075d40b2bbcf8a3595
1 /*
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLFrameBase framebase;
36 IHTMLIFrameElement IHTMLIFrameElement_iface;
37 IHTMLIFrameElement2 IHTMLIFrameElement2_iface;
38 IHTMLIFrameElement3 IHTMLIFrameElement3_iface;
39 } HTMLIFrame;
41 static inline HTMLIFrame *impl_from_IHTMLIFrameElement(IHTMLIFrameElement *iface)
43 return CONTAINING_RECORD(iface, HTMLIFrame, IHTMLIFrameElement_iface);
46 static HRESULT WINAPI HTMLIFrameElement_QueryInterface(IHTMLIFrameElement *iface,
47 REFIID riid, void **ppv)
49 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
51 return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
54 static ULONG WINAPI HTMLIFrameElement_AddRef(IHTMLIFrameElement *iface)
56 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
58 return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
61 static ULONG WINAPI HTMLIFrameElement_Release(IHTMLIFrameElement *iface)
63 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
65 return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
68 static HRESULT WINAPI HTMLIFrameElement_GetTypeInfoCount(IHTMLIFrameElement *iface, UINT *pctinfo)
70 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
71 return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface,
72 pctinfo);
75 static HRESULT WINAPI HTMLIFrameElement_GetTypeInfo(IHTMLIFrameElement *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
79 return IDispatchEx_GetTypeInfo(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, iTInfo,
80 lcid, ppTInfo);
83 static HRESULT WINAPI HTMLIFrameElement_GetIDsOfNames(IHTMLIFrameElement *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
86 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
87 return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, riid,
88 rgszNames, cNames, lcid, rgDispId);
91 static HRESULT WINAPI HTMLIFrameElement_Invoke(IHTMLIFrameElement *iface, DISPID dispIdMember,
92 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
93 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
95 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
96 return IDispatchEx_Invoke(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember,
97 riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
100 static HRESULT WINAPI HTMLIFrameElement_put_vspace(IHTMLIFrameElement *iface, LONG v)
102 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
103 FIXME("(%p)->(%d)\n", This, v);
104 return E_NOTIMPL;
107 static HRESULT WINAPI HTMLIFrameElement_get_vspace(IHTMLIFrameElement *iface, LONG *p)
109 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
110 FIXME("(%p)->(%p)\n", This, p);
111 return E_NOTIMPL;
114 static HRESULT WINAPI HTMLIFrameElement_put_hspace(IHTMLIFrameElement *iface, LONG v)
116 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
117 FIXME("(%p)->(%d)\n", This, v);
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLIFrameElement_get_hspace(IHTMLIFrameElement *iface, LONG *p)
123 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
124 FIXME("(%p)->(%p)\n", This, p);
125 return E_NOTIMPL;
128 static HRESULT WINAPI HTMLIFrameElement_put_align(IHTMLIFrameElement *iface, BSTR v)
130 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
131 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
132 return E_NOTIMPL;
135 static HRESULT WINAPI HTMLIFrameElement_get_align(IHTMLIFrameElement *iface, BSTR *p)
137 HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
138 FIXME("(%p)->(%p)\n", This, p);
139 return E_NOTIMPL;
142 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl = {
143 HTMLIFrameElement_QueryInterface,
144 HTMLIFrameElement_AddRef,
145 HTMLIFrameElement_Release,
146 HTMLIFrameElement_GetTypeInfoCount,
147 HTMLIFrameElement_GetTypeInfo,
148 HTMLIFrameElement_GetIDsOfNames,
149 HTMLIFrameElement_Invoke,
150 HTMLIFrameElement_put_vspace,
151 HTMLIFrameElement_get_vspace,
152 HTMLIFrameElement_put_hspace,
153 HTMLIFrameElement_get_hspace,
154 HTMLIFrameElement_put_align,
155 HTMLIFrameElement_get_align
158 static inline HTMLIFrame *impl_from_IHTMLIFrameElement2(IHTMLIFrameElement2 *iface)
160 return CONTAINING_RECORD(iface, HTMLIFrame, IHTMLIFrameElement2_iface);
163 static HRESULT WINAPI HTMLIFrameElement2_QueryInterface(IHTMLIFrameElement2 *iface,
164 REFIID riid, void **ppv)
166 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
168 return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
171 static ULONG WINAPI HTMLIFrameElement2_AddRef(IHTMLIFrameElement2 *iface)
173 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
175 return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
178 static ULONG WINAPI HTMLIFrameElement2_Release(IHTMLIFrameElement2 *iface)
180 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
182 return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
185 static HRESULT WINAPI HTMLIFrameElement2_GetTypeInfoCount(IHTMLIFrameElement2 *iface, UINT *pctinfo)
187 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
188 return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface,
189 pctinfo);
192 static HRESULT WINAPI HTMLIFrameElement2_GetTypeInfo(IHTMLIFrameElement2 *iface, UINT iTInfo,
193 LCID lcid, ITypeInfo **ppTInfo)
195 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
196 return IDispatchEx_GetTypeInfo(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, iTInfo,
197 lcid, ppTInfo);
200 static HRESULT WINAPI HTMLIFrameElement2_GetIDsOfNames(IHTMLIFrameElement2 *iface, REFIID riid,
201 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
203 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
204 return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, riid,
205 rgszNames, cNames, lcid, rgDispId);
208 static HRESULT WINAPI HTMLIFrameElement2_Invoke(IHTMLIFrameElement2 *iface, DISPID dispIdMember,
209 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
210 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
212 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
213 return IDispatchEx_Invoke(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember,
214 riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
217 static HRESULT WINAPI HTMLIFrameElement2_put_height(IHTMLIFrameElement2 *iface, VARIANT v)
219 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
220 nsAString nsstr;
221 nsresult nsres;
223 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
225 if(V_VT(&v) != VT_BSTR) {
226 FIXME("Unsupported %s\n", debugstr_variant(&v));
227 return E_NOTIMPL;
230 nsAString_InitDepend(&nsstr, V_BSTR(&v));
231 nsres = nsIDOMHTMLIFrameElement_SetHeight(This->framebase.nsiframe, &nsstr);
232 nsAString_Finish(&nsstr);
233 if(NS_FAILED(nsres)) {
234 ERR("SetHeight failed: %08x\n", nsres);
235 return E_FAIL;
238 return S_OK;
241 static HRESULT WINAPI HTMLIFrameElement2_get_height(IHTMLIFrameElement2 *iface, VARIANT *p)
243 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
244 nsAString nsstr;
245 nsresult nsres;
247 TRACE("(%p)->(%p)\n", This, p);
249 nsAString_Init(&nsstr, NULL);
250 nsres = nsIDOMHTMLIFrameElement_GetHeight(This->framebase.nsiframe, &nsstr);
252 V_VT(p) = VT_BSTR;
253 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
256 static HRESULT WINAPI HTMLIFrameElement2_put_width(IHTMLIFrameElement2 *iface, VARIANT v)
258 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
259 nsAString nsstr;
260 nsresult nsres;
262 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
264 if(V_VT(&v) != VT_BSTR) {
265 FIXME("Unsupported %s\n", debugstr_variant(&v));
266 return E_NOTIMPL;
269 nsAString_InitDepend(&nsstr, V_BSTR(&v));
270 nsres = nsIDOMHTMLIFrameElement_SetWidth(This->framebase.nsiframe, &nsstr);
271 nsAString_Finish(&nsstr);
272 if(NS_FAILED(nsres)) {
273 ERR("SetWidth failed: %08x\n", nsres);
274 return E_FAIL;
277 return S_OK;
280 static HRESULT WINAPI HTMLIFrameElement2_get_width(IHTMLIFrameElement2 *iface, VARIANT *p)
282 HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
283 nsAString nsstr;
284 nsresult nsres;
286 TRACE("(%p)->(%p)\n", This, p);
288 nsAString_Init(&nsstr, NULL);
289 nsres = nsIDOMHTMLIFrameElement_GetWidth(This->framebase.nsiframe, &nsstr);
291 V_VT(p) = VT_BSTR;
292 return return_nsstr(nsres, &nsstr, &V_BSTR(p));
295 static const IHTMLIFrameElement2Vtbl HTMLIFrameElement2Vtbl = {
296 HTMLIFrameElement2_QueryInterface,
297 HTMLIFrameElement2_AddRef,
298 HTMLIFrameElement2_Release,
299 HTMLIFrameElement2_GetTypeInfoCount,
300 HTMLIFrameElement2_GetTypeInfo,
301 HTMLIFrameElement2_GetIDsOfNames,
302 HTMLIFrameElement2_Invoke,
303 HTMLIFrameElement2_put_height,
304 HTMLIFrameElement2_get_height,
305 HTMLIFrameElement2_put_width,
306 HTMLIFrameElement2_get_width
309 static inline HTMLIFrame *impl_from_IHTMLIFrameElement3(IHTMLIFrameElement3 *iface)
311 return CONTAINING_RECORD(iface, HTMLIFrame, IHTMLIFrameElement3_iface);
314 static HRESULT WINAPI HTMLIFrameElement3_QueryInterface(IHTMLIFrameElement3 *iface,
315 REFIID riid, void **ppv)
317 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
319 return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
322 static ULONG WINAPI HTMLIFrameElement3_AddRef(IHTMLIFrameElement3 *iface)
324 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
326 return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
329 static ULONG WINAPI HTMLIFrameElement3_Release(IHTMLIFrameElement3 *iface)
331 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
333 return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
336 static HRESULT WINAPI HTMLIFrameElement3_GetTypeInfoCount(IHTMLIFrameElement3 *iface, UINT *pctinfo)
338 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
339 return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface,
340 pctinfo);
343 static HRESULT WINAPI HTMLIFrameElement3_GetTypeInfo(IHTMLIFrameElement3 *iface, UINT iTInfo,
344 LCID lcid, ITypeInfo **ppTInfo)
346 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
347 return IDispatchEx_GetTypeInfo(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, iTInfo,
348 lcid, ppTInfo);
351 static HRESULT WINAPI HTMLIFrameElement3_GetIDsOfNames(IHTMLIFrameElement3 *iface, REFIID riid,
352 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
354 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
355 return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, riid,
356 rgszNames, cNames, lcid, rgDispId);
359 static HRESULT WINAPI HTMLIFrameElement3_Invoke(IHTMLIFrameElement3 *iface, DISPID dispIdMember,
360 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
361 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
363 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
364 return IDispatchEx_Invoke(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember,
365 riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
368 static HRESULT WINAPI HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3 *iface, IDispatch **p)
370 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
371 IHTMLDocument2 *doc;
372 HRESULT hres;
374 TRACE("(%p)->(%p)\n", This, p);
376 if(!This->framebase.content_window) {
377 *p = NULL;
378 return S_OK;
381 hres = IHTMLWindow2_get_document(&This->framebase.content_window->base.IHTMLWindow2_iface, &doc);
382 *p = (IDispatch*)doc;
383 return hres;
386 static HRESULT WINAPI HTMLIFrameElement3_put_src(IHTMLIFrameElement3 *iface, BSTR v)
388 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
389 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
390 return E_NOTIMPL;
393 static HRESULT WINAPI HTMLIFrameElement3_get_src(IHTMLIFrameElement3 *iface, BSTR *p)
395 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
396 FIXME("(%p)->(%p)\n", This, p);
397 return E_NOTIMPL;
400 static HRESULT WINAPI HTMLIFrameElement3_put_longDesc(IHTMLIFrameElement3 *iface, BSTR v)
402 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
403 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
404 return E_NOTIMPL;
407 static HRESULT WINAPI HTMLIFrameElement3_get_longDesc(IHTMLIFrameElement3 *iface, BSTR *p)
409 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
410 FIXME("(%p)->(%p)\n", This, p);
411 return E_NOTIMPL;
414 static HRESULT WINAPI HTMLIFrameElement3_put_frameBorder(IHTMLIFrameElement3 *iface, BSTR v)
416 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
417 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
418 return E_NOTIMPL;
421 static HRESULT WINAPI HTMLIFrameElement3_get_frameBorder(IHTMLIFrameElement3 *iface, BSTR *p)
423 HTMLIFrame *This = impl_from_IHTMLIFrameElement3(iface);
424 FIXME("(%p)->(%p)\n", This, p);
425 return E_NOTIMPL;
428 static const IHTMLIFrameElement3Vtbl HTMLIFrameElement3Vtbl = {
429 HTMLIFrameElement3_QueryInterface,
430 HTMLIFrameElement3_AddRef,
431 HTMLIFrameElement3_Release,
432 HTMLIFrameElement3_GetTypeInfoCount,
433 HTMLIFrameElement3_GetTypeInfo,
434 HTMLIFrameElement3_GetIDsOfNames,
435 HTMLIFrameElement3_Invoke,
436 HTMLIFrameElement3_get_contentDocument,
437 HTMLIFrameElement3_put_src,
438 HTMLIFrameElement3_get_src,
439 HTMLIFrameElement3_put_longDesc,
440 HTMLIFrameElement3_get_longDesc,
441 HTMLIFrameElement3_put_frameBorder,
442 HTMLIFrameElement3_get_frameBorder
445 static inline HTMLIFrame *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
447 return CONTAINING_RECORD(iface, HTMLIFrame, framebase.element.node);
450 static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
452 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
454 if(IsEqualGUID(&IID_IHTMLIFrameElement, riid)) {
455 TRACE("(%p)->(IID_IHTMLIFrameElement %p)\n", This, ppv);
456 *ppv = &This->IHTMLIFrameElement_iface;
457 }else if(IsEqualGUID(&IID_IHTMLIFrameElement2, riid)) {
458 TRACE("(%p)->(IID_IHTMLIFrameElement2 %p)\n", This, ppv);
459 *ppv = &This->IHTMLIFrameElement2_iface;
460 }else if(IsEqualGUID(&IID_IHTMLIFrameElement3, riid)) {
461 TRACE("(%p)->(IID_IHTMLIFrameElement3 %p)\n", This, ppv);
462 *ppv = &This->IHTMLIFrameElement3_iface;
463 }else {
464 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
467 IUnknown_AddRef((IUnknown*)*ppv);
468 return S_OK;
471 static void HTMLIFrame_destructor(HTMLDOMNode *iface)
473 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
475 HTMLFrameBase_destructor(&This->framebase);
478 static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
480 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
482 if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
483 *p = NULL;
484 return S_OK;
487 *p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
488 IDispatch_AddRef(*p);
489 return S_OK;
492 static HRESULT HTMLIFrame_get_dispid(HTMLDOMNode *iface, BSTR name,
493 DWORD grfdex, DISPID *pid)
495 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
497 if(!This->framebase.content_window)
498 return DISP_E_UNKNOWNNAME;
500 return search_window_props(This->framebase.content_window->base.inner_window, name, grfdex, pid);
503 static HRESULT HTMLIFrame_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
504 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
506 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
508 if(!This->framebase.content_window) {
509 ERR("no content window to invoke on\n");
510 return E_FAIL;
513 return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid,
514 flags, params, res, ei, caller);
517 static HRESULT HTMLIFrame_get_readystate(HTMLDOMNode *iface, BSTR *p)
519 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
521 return IHTMLFrameBase2_get_readyState(&This->framebase.IHTMLFrameBase2_iface, p);
524 static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
526 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
527 nsIDOMDocument *nsdoc;
528 nsresult nsres;
529 HRESULT hres;
531 nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->framebase.nsiframe, &nsdoc);
532 if(NS_FAILED(nsres) || !nsdoc) {
533 ERR("GetContentDocument failed: %08x\n", nsres);
534 return E_FAIL;
537 hres = set_frame_doc(&This->framebase, nsdoc);
538 nsIDOMDocument_Release(nsdoc);
539 return hres;
542 static void HTMLIFrame_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
544 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
546 if(This->framebase.nsiframe)
547 note_cc_edge((nsISupports*)This->framebase.nsiframe, "This->nsiframe", cb);
550 static void HTMLIFrame_unlink(HTMLDOMNode *iface)
552 HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
554 if(This->framebase.nsiframe) {
555 nsIDOMHTMLIFrameElement *nsiframe = This->framebase.nsiframe;
557 This->framebase.nsiframe = NULL;
558 nsIDOMHTMLIFrameElement_Release(nsiframe);
562 static const NodeImplVtbl HTMLIFrameImplVtbl = {
563 HTMLIFrame_QI,
564 HTMLIFrame_destructor,
565 HTMLElement_cpc,
566 HTMLElement_clone,
567 HTMLElement_handle_event,
568 HTMLElement_get_attr_col,
569 NULL,
570 NULL,
571 NULL,
572 NULL,
573 HTMLIFrame_get_document,
574 HTMLIFrame_get_readystate,
575 HTMLIFrame_get_dispid,
576 HTMLIFrame_invoke,
577 HTMLIFrame_bind_to_tree,
578 HTMLIFrame_traverse,
579 HTMLIFrame_unlink
582 static const tid_t HTMLIFrame_iface_tids[] = {
583 HTMLELEMENT_TIDS,
584 IHTMLFrameBase_tid,
585 IHTMLFrameBase2_tid,
586 IHTMLIFrameElement_tid,
587 IHTMLIFrameElement2_tid,
588 IHTMLIFrameElement3_tid,
592 static dispex_static_data_t HTMLIFrame_dispex = {
593 NULL,
594 DispHTMLIFrame_tid,
595 HTMLIFrame_iface_tids,
596 HTMLElement_init_dispex_info
599 HRESULT HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
601 HTMLIFrame *ret;
603 ret = heap_alloc_zero(sizeof(HTMLIFrame));
604 if(!ret)
605 return E_OUTOFMEMORY;
607 ret->IHTMLIFrameElement_iface.lpVtbl = &HTMLIFrameElementVtbl;
608 ret->IHTMLIFrameElement2_iface.lpVtbl = &HTMLIFrameElement2Vtbl;
609 ret->IHTMLIFrameElement3_iface.lpVtbl = &HTMLIFrameElement3Vtbl;
610 ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
612 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
614 *elem = &ret->framebase.element;
615 return S_OK;