2 * Copyright 2008,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 "htmlevent.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 static HRESULT
set_frame_doc(HTMLFrameBase
*frame
, nsIDOMDocument
*nsdoc
)
38 mozIDOMWindowProxy
*mozwindow
;
39 HTMLOuterWindow
*window
;
43 if(frame
->content_window
)
46 nsres
= nsIDOMDocument_GetDefaultView(nsdoc
, &mozwindow
);
47 if(NS_FAILED(nsres
) || !mozwindow
)
50 window
= mozwindow_to_window(mozwindow
);
51 if(!window
&& frame
->element
.node
.doc
->browser
) {
52 hres
= create_outer_window(frame
->element
.node
.doc
->browser
, mozwindow
,
53 frame
->element
.node
.doc
->window
->base
.outer_window
, &window
);
55 /* Don't hold ref to the created window; the parent keeps ref to it */
57 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
59 mozIDOMWindowProxy_Release(mozwindow
);
63 frame
->content_window
= window
;
64 window
->frame_element
= frame
;
68 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase(IHTMLFrameBase
*iface
)
70 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase_iface
);
73 DISPEX_IDISPATCH_IMPL(HTMLFrameBase
, IHTMLFrameBase
,
74 impl_from_IHTMLFrameBase(iface
)->element
.node
.event_target
.dispex
)
76 static HRESULT WINAPI
HTMLFrameBase_put_src(IHTMLFrameBase
*iface
, BSTR v
)
78 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
80 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
82 if(!This
->content_window
|| !This
->element
.node
.doc
|| !This
->element
.node
.doc
->window
|| !This
->element
.node
.doc
->window
->base
.outer_window
) {
86 nsAString_InitDepend(&nsstr
, v
);
88 nsres
= nsIDOMHTMLFrameElement_SetSrc(This
->nsframe
, &nsstr
);
90 nsres
= nsIDOMHTMLIFrameElement_SetSrc(This
->nsiframe
, &nsstr
);
91 nsAString_Finish(&nsstr
);
92 if(NS_FAILED(nsres
)) {
93 ERR("SetSrc failed: %08lx\n", nsres
);
100 return navigate_url(This
->content_window
, v
, This
->element
.node
.doc
->window
->base
.outer_window
->uri
, BINDING_NAVIGATED
);
103 static HRESULT WINAPI
HTMLFrameBase_get_src(IHTMLFrameBase
*iface
, BSTR
*p
)
105 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
109 TRACE("(%p)->(%p)\n", This
, p
);
111 if(!This
->nsframe
&& !This
->nsiframe
) {
112 ERR("No attached frame object\n");
116 nsAString_Init(&nsstr
, NULL
);
118 nsres
= nsIDOMHTMLFrameElement_GetSrc(This
->nsframe
, &nsstr
);
120 nsres
= nsIDOMHTMLIFrameElement_GetSrc(This
->nsiframe
, &nsstr
);
121 return return_nsstr(nsres
, &nsstr
, p
);
124 static HRESULT WINAPI
HTMLFrameBase_put_name(IHTMLFrameBase
*iface
, BSTR v
)
126 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
130 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
132 if(!This
->nsframe
&& !This
->nsiframe
) {
133 ERR("No attached ns frame object\n");
137 nsAString_InitDepend(&name_str
, v
);
139 nsres
= nsIDOMHTMLFrameElement_SetName(This
->nsframe
, &name_str
);
141 nsres
= nsIDOMHTMLIFrameElement_SetName(This
->nsiframe
, &name_str
);
142 nsAString_Finish(&name_str
);
143 if(NS_FAILED(nsres
)) {
144 ERR("SetName failed: %08lx\n", nsres
);
151 static HRESULT WINAPI
HTMLFrameBase_get_name(IHTMLFrameBase
*iface
, BSTR
*p
)
153 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
157 TRACE("(%p)->(%p)\n", This
, p
);
159 if(!This
->nsframe
&& !This
->nsiframe
) {
160 ERR("No attached ns frame object\n");
164 nsAString_Init(&nsstr
, NULL
);
166 nsres
= nsIDOMHTMLFrameElement_GetName(This
->nsframe
, &nsstr
);
168 nsres
= nsIDOMHTMLIFrameElement_GetName(This
->nsiframe
, &nsstr
);
169 return return_nsstr(nsres
, &nsstr
, p
);
172 static HRESULT WINAPI
HTMLFrameBase_put_border(IHTMLFrameBase
*iface
, VARIANT v
)
174 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
175 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
179 static HRESULT WINAPI
HTMLFrameBase_get_border(IHTMLFrameBase
*iface
, VARIANT
*p
)
181 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
182 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
HTMLFrameBase_put_frameBorder(IHTMLFrameBase
*iface
, BSTR v
)
188 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
192 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
194 if(!This
->nsframe
&& !This
->nsiframe
) {
195 ERR("No attached ns frame object\n");
199 nsAString_InitDepend(&nsstr
, v
);
201 nsres
= nsIDOMHTMLFrameElement_SetFrameBorder(This
->nsframe
, &nsstr
);
203 nsres
= nsIDOMHTMLIFrameElement_SetFrameBorder(This
->nsiframe
, &nsstr
);
204 nsAString_Finish(&nsstr
);
205 if(NS_FAILED(nsres
)) {
206 ERR("SetFrameBorder failed: %08lx\n", nsres
);
213 static HRESULT WINAPI
HTMLFrameBase_get_frameBorder(IHTMLFrameBase
*iface
, BSTR
*p
)
215 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
219 TRACE("(%p)->(%p)\n", This
, p
);
221 if(!This
->nsframe
&& !This
->nsiframe
) {
222 ERR("No attached ns frame object\n");
226 nsAString_Init(&nsstr
, NULL
);
228 nsres
= nsIDOMHTMLFrameElement_GetFrameBorder(This
->nsframe
, &nsstr
);
230 nsres
= nsIDOMHTMLIFrameElement_GetFrameBorder(This
->nsiframe
, &nsstr
);
231 return return_nsstr(nsres
, &nsstr
, p
);
234 static HRESULT WINAPI
HTMLFrameBase_put_frameSpacing(IHTMLFrameBase
*iface
, VARIANT v
)
236 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
237 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
241 static HRESULT WINAPI
HTMLFrameBase_get_frameSpacing(IHTMLFrameBase
*iface
, VARIANT
*p
)
243 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
244 FIXME("(%p)->(%p)\n", This
, p
);
248 static HRESULT WINAPI
HTMLFrameBase_put_marginWidth(IHTMLFrameBase
*iface
, VARIANT v
)
250 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
254 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
256 if(V_VT(&v
) != VT_BSTR
) {
257 FIXME("unsupported %s\n", debugstr_variant(&v
));
261 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
263 nsres
= nsIDOMHTMLFrameElement_SetMarginWidth(This
->nsframe
, &nsstr
);
265 nsres
= nsIDOMHTMLIFrameElement_SetMarginWidth(This
->nsiframe
, &nsstr
);
266 nsAString_Finish(&nsstr
);
267 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
270 static HRESULT WINAPI
HTMLFrameBase_get_marginWidth(IHTMLFrameBase
*iface
, VARIANT
*p
)
272 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
277 TRACE("(%p)->(%p)\n", This
, p
);
279 nsAString_Init(&nsstr
, NULL
);
281 nsres
= nsIDOMHTMLFrameElement_GetMarginWidth(This
->nsframe
, &nsstr
);
283 nsres
= nsIDOMHTMLIFrameElement_GetMarginWidth(This
->nsiframe
, &nsstr
);
284 if(NS_SUCCEEDED(nsres
)) {
285 const PRUnichar
*str
, *end
;
287 nsAString_GetData(&nsstr
, &str
);
292 end
= wcsstr(str
, L
"px");
294 end
= str
+lstrlenW(str
);
295 ret
= SysAllocStringLen(str
, end
-str
);
300 hres
= E_OUTOFMEMORY
;
307 ERR("GetMarginWidth failed: %08lx\n", nsres
);
311 nsAString_Finish(&nsstr
);
315 static HRESULT WINAPI
HTMLFrameBase_put_marginHeight(IHTMLFrameBase
*iface
, VARIANT v
)
317 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
321 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
323 if(V_VT(&v
) != VT_BSTR
) {
324 FIXME("unsupported %s\n", debugstr_variant(&v
));
328 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
330 nsres
= nsIDOMHTMLFrameElement_SetMarginHeight(This
->nsframe
, &nsstr
);
332 nsres
= nsIDOMHTMLIFrameElement_SetMarginHeight(This
->nsiframe
, &nsstr
);
333 nsAString_Finish(&nsstr
);
334 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
337 static HRESULT WINAPI
HTMLFrameBase_get_marginHeight(IHTMLFrameBase
*iface
, VARIANT
*p
)
339 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
344 TRACE("(%p)->(%p)\n", This
, p
);
346 nsAString_Init(&nsstr
, NULL
);
348 nsres
= nsIDOMHTMLFrameElement_GetMarginHeight(This
->nsframe
, &nsstr
);
350 nsres
= nsIDOMHTMLIFrameElement_GetMarginHeight(This
->nsiframe
, &nsstr
);
351 if(NS_SUCCEEDED(nsres
)) {
352 const PRUnichar
*str
, *end
;
354 nsAString_GetData(&nsstr
, &str
);
359 end
= wcsstr(str
, L
"px");
361 end
= str
+lstrlenW(str
);
362 ret
= SysAllocStringLen(str
, end
-str
);
367 hres
= E_OUTOFMEMORY
;
374 ERR("SetMarginHeight failed: %08lx\n", nsres
);
378 nsAString_Finish(&nsstr
);
382 static HRESULT WINAPI
HTMLFrameBase_put_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL v
)
384 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
385 FIXME("(%p)->(%x)\n", This
, v
);
389 static HRESULT WINAPI
HTMLFrameBase_get_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL
*p
)
391 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
392 FIXME("(%p)->(%p)\n", This
, p
);
396 static HRESULT WINAPI
HTMLFrameBase_put_scrolling(IHTMLFrameBase
*iface
, BSTR v
)
398 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
402 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
404 if(!(!wcsicmp(v
, L
"yes") || !wcsicmp(v
, L
"no") || !wcsicmp(v
, L
"auto")))
408 nsAString_InitDepend(&nsstr
, v
);
409 nsres
= nsIDOMHTMLFrameElement_SetScrolling(This
->nsframe
, &nsstr
);
410 }else if(This
->nsiframe
) {
411 nsAString_InitDepend(&nsstr
, v
);
412 nsres
= nsIDOMHTMLIFrameElement_SetScrolling(This
->nsiframe
, &nsstr
);
414 ERR("No attached ns frame object\n");
417 nsAString_Finish(&nsstr
);
419 if(NS_FAILED(nsres
)) {
420 ERR("SetScrolling failed: 0x%08lx\n", nsres
);
427 static HRESULT WINAPI
HTMLFrameBase_get_scrolling(IHTMLFrameBase
*iface
, BSTR
*p
)
429 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
431 const PRUnichar
*strdata
;
434 TRACE("(%p)->(%p)\n", This
, p
);
437 nsAString_Init(&nsstr
, NULL
);
438 nsres
= nsIDOMHTMLFrameElement_GetScrolling(This
->nsframe
, &nsstr
);
439 }else if(This
->nsiframe
) {
440 nsAString_Init(&nsstr
, NULL
);
441 nsres
= nsIDOMHTMLIFrameElement_GetScrolling(This
->nsiframe
, &nsstr
);
443 ERR("No attached ns frame object\n");
447 if(NS_FAILED(nsres
)) {
448 ERR("GetScrolling failed: 0x%08lx\n", nsres
);
449 nsAString_Finish(&nsstr
);
453 nsAString_GetData(&nsstr
, &strdata
);
456 *p
= SysAllocString(strdata
);
458 *p
= SysAllocString(L
"auto");
460 nsAString_Finish(&nsstr
);
462 return *p
? S_OK
: E_OUTOFMEMORY
;
465 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl
= {
466 HTMLFrameBase_QueryInterface
,
467 HTMLFrameBase_AddRef
,
468 HTMLFrameBase_Release
,
469 HTMLFrameBase_GetTypeInfoCount
,
470 HTMLFrameBase_GetTypeInfo
,
471 HTMLFrameBase_GetIDsOfNames
,
472 HTMLFrameBase_Invoke
,
473 HTMLFrameBase_put_src
,
474 HTMLFrameBase_get_src
,
475 HTMLFrameBase_put_name
,
476 HTMLFrameBase_get_name
,
477 HTMLFrameBase_put_border
,
478 HTMLFrameBase_get_border
,
479 HTMLFrameBase_put_frameBorder
,
480 HTMLFrameBase_get_frameBorder
,
481 HTMLFrameBase_put_frameSpacing
,
482 HTMLFrameBase_get_frameSpacing
,
483 HTMLFrameBase_put_marginWidth
,
484 HTMLFrameBase_get_marginWidth
,
485 HTMLFrameBase_put_marginHeight
,
486 HTMLFrameBase_get_marginHeight
,
487 HTMLFrameBase_put_noResize
,
488 HTMLFrameBase_get_noResize
,
489 HTMLFrameBase_put_scrolling
,
490 HTMLFrameBase_get_scrolling
493 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase2(IHTMLFrameBase2
*iface
)
495 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase2_iface
);
498 static HRESULT WINAPI
HTMLFrameBase2_QueryInterface(IHTMLFrameBase2
*iface
, REFIID riid
, void **ppv
)
500 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
502 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
505 static ULONG WINAPI
HTMLFrameBase2_AddRef(IHTMLFrameBase2
*iface
)
507 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
509 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
512 static ULONG WINAPI
HTMLFrameBase2_Release(IHTMLFrameBase2
*iface
)
514 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
516 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
519 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2
*iface
, UINT
*pctinfo
)
521 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
522 FIXME("(%p)\n", This
);
526 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2
*iface
, UINT iTInfo
,
527 LCID lcid
, ITypeInfo
**ppTInfo
)
529 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
530 FIXME("(%p)\n", This
);
534 static HRESULT WINAPI
HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2
*iface
, REFIID riid
,
535 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
537 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
538 FIXME("(%p)\n", This
);
542 static HRESULT WINAPI
HTMLFrameBase2_Invoke(IHTMLFrameBase2
*iface
, DISPID dispIdMember
,
543 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
544 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
546 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
547 FIXME("(%p)\n", This
);
551 static HRESULT WINAPI
HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2
*iface
, IHTMLWindow2
**p
)
553 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
555 TRACE("(%p)->(%p)\n", This
, p
);
557 if(This
->content_window
) {
558 IHTMLWindow2_AddRef(&This
->content_window
->base
.IHTMLWindow2_iface
);
559 *p
= &This
->content_window
->base
.IHTMLWindow2_iface
;
561 WARN("NULL content window\n");
567 static HRESULT WINAPI
HTMLFrameBase2_put_onload(IHTMLFrameBase2
*iface
, VARIANT v
)
569 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
571 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
573 return set_node_event(&This
->element
.node
, EVENTID_LOAD
, &v
);
576 static HRESULT WINAPI
HTMLFrameBase2_get_onload(IHTMLFrameBase2
*iface
, VARIANT
*p
)
578 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
580 TRACE("(%p)->(%p)\n", This
, p
);
582 return get_node_event(&This
->element
.node
, EVENTID_LOAD
, p
);
585 static HRESULT WINAPI
HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT v
)
587 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
588 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
592 static HRESULT WINAPI
HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT
*p
)
594 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
595 FIXME("(%p)->(%p)\n", This
, p
);
599 static HRESULT WINAPI
HTMLFrameBase2_get_readyState(IHTMLFrameBase2
*iface
, BSTR
*p
)
601 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
603 TRACE("(%p)->(%p)\n", This
, p
);
605 if(!This
->content_window
|| !This
->content_window
->base
.inner_window
->doc
) {
606 FIXME("no document associated\n");
610 return IHTMLDocument2_get_readyState(&This
->content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
, p
);
613 static HRESULT WINAPI
HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL v
)
615 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
617 FIXME("(%p)->(%x) semi-stub\n", This
, v
);
622 static HRESULT WINAPI
HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL
*p
)
624 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
626 FIXME("(%p)->(%p) semi-stub\n", This
, p
);
632 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl
= {
633 HTMLFrameBase2_QueryInterface
,
634 HTMLFrameBase2_AddRef
,
635 HTMLFrameBase2_Release
,
636 HTMLFrameBase2_GetTypeInfoCount
,
637 HTMLFrameBase2_GetTypeInfo
,
638 HTMLFrameBase2_GetIDsOfNames
,
639 HTMLFrameBase2_Invoke
,
640 HTMLFrameBase2_get_contentWindow
,
641 HTMLFrameBase2_put_onload
,
642 HTMLFrameBase2_get_onload
,
643 HTMLFrameBase2_put_onreadystatechange
,
644 HTMLFrameBase2_get_onreadystatechange
,
645 HTMLFrameBase2_get_readyState
,
646 HTMLFrameBase2_put_allowTransparency
,
647 HTMLFrameBase2_get_allowTransparency
650 static void *HTMLFrameBase_QI(HTMLFrameBase
*This
, REFIID riid
)
652 if(IsEqualGUID(&IID_IHTMLFrameBase
, riid
))
653 return &This
->IHTMLFrameBase_iface
;
654 if(IsEqualGUID(&IID_IHTMLFrameBase2
, riid
))
655 return &This
->IHTMLFrameBase2_iface
;
657 return HTMLElement_query_interface(&This
->element
.node
.event_target
.dispex
, riid
);
660 static void HTMLFrameBase_destructor(HTMLFrameBase
*This
)
662 if(This
->content_window
)
663 This
->content_window
->frame_element
= NULL
;
665 HTMLElement_destructor(&This
->element
.node
.event_target
.dispex
);
668 static void HTMLFrameBase_Init(HTMLFrameBase
*This
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
,
669 dispex_static_data_t
*dispex_data
)
673 This
->IHTMLFrameBase_iface
.lpVtbl
= &HTMLFrameBaseVtbl
;
674 This
->IHTMLFrameBase2_iface
.lpVtbl
= &HTMLFrameBase2Vtbl
;
676 HTMLElement_Init(&This
->element
, doc
, nselem
, dispex_data
);
678 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFrameElement
, (void**)&This
->nsframe
);
679 if(NS_FAILED(nsres
)) {
680 This
->nsframe
= NULL
;
681 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLIFrameElement
, (void**)&This
->nsiframe
);
682 assert(nsres
== NS_OK
);
684 This
->nsiframe
= NULL
;
688 struct HTMLFrameElement
{
689 HTMLFrameBase framebase
;
690 IHTMLFrameElement3 IHTMLFrameElement3_iface
;
693 static inline HTMLFrameElement
*impl_from_IHTMLFrameElement3(IHTMLFrameElement3
*iface
)
695 return CONTAINING_RECORD(iface
, HTMLFrameElement
, IHTMLFrameElement3_iface
);
698 DISPEX_IDISPATCH_IMPL(HTMLFrameElement3
, IHTMLFrameElement3
,
699 impl_from_IHTMLFrameElement3(iface
)->framebase
.element
.node
.event_target
.dispex
)
701 static HRESULT WINAPI
HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3
*iface
, IDispatch
**p
)
703 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
707 TRACE("(%p)->(%p)\n", This
, p
);
709 if(!This
->framebase
.content_window
) {
710 FIXME("NULL window\n");
714 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
718 *p
= doc
? (IDispatch
*)doc
: NULL
;
722 static HRESULT WINAPI
HTMLFrameElement3_put_src(IHTMLFrameElement3
*iface
, BSTR v
)
724 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
725 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
729 static HRESULT WINAPI
HTMLFrameElement3_get_src(IHTMLFrameElement3
*iface
, BSTR
*p
)
731 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
732 FIXME("(%p)->(%p)\n", This
, p
);
736 static HRESULT WINAPI
HTMLFrameElement3_put_longDesc(IHTMLFrameElement3
*iface
, BSTR v
)
738 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
739 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
743 static HRESULT WINAPI
HTMLFrameElement3_get_longDesc(IHTMLFrameElement3
*iface
, BSTR
*p
)
745 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
746 FIXME("(%p)->(%p)\n", This
, p
);
750 static HRESULT WINAPI
HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3
*iface
, BSTR v
)
752 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
753 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
757 static HRESULT WINAPI
HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3
*iface
, BSTR
*p
)
759 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
760 FIXME("(%p)->(%p)\n", This
, p
);
764 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
= {
765 HTMLFrameElement3_QueryInterface
,
766 HTMLFrameElement3_AddRef
,
767 HTMLFrameElement3_Release
,
768 HTMLFrameElement3_GetTypeInfoCount
,
769 HTMLFrameElement3_GetTypeInfo
,
770 HTMLFrameElement3_GetIDsOfNames
,
771 HTMLFrameElement3_Invoke
,
772 HTMLFrameElement3_get_contentDocument
,
773 HTMLFrameElement3_put_src
,
774 HTMLFrameElement3_get_src
,
775 HTMLFrameElement3_put_longDesc
,
776 HTMLFrameElement3_get_longDesc
,
777 HTMLFrameElement3_put_frameBorder
,
778 HTMLFrameElement3_get_frameBorder
781 static inline HTMLFrameElement
*frame_from_HTMLDOMNode(HTMLDOMNode
*iface
)
783 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
);
786 static HRESULT
HTMLFrameElement_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
788 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
790 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
795 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
;
796 IDispatch_AddRef(*p
);
800 static HRESULT
HTMLFrameElement_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
802 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
804 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
807 static HRESULT
HTMLFrameElement_bind_to_tree(HTMLDOMNode
*iface
)
809 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
810 nsIDOMDocument
*nsdoc
;
814 nsres
= nsIDOMHTMLFrameElement_GetContentDocument(This
->framebase
.nsframe
, &nsdoc
);
815 if(NS_FAILED(nsres
) || !nsdoc
) {
816 ERR("GetContentDocument failed: %08lx\n", nsres
);
820 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
821 nsIDOMDocument_Release(nsdoc
);
825 static inline HTMLFrameElement
*frame_from_DispatchEx(DispatchEx
*iface
)
827 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
.event_target
.dispex
);
830 static void *HTMLFrameElement_query_interface(DispatchEx
*dispex
, REFIID riid
)
832 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
834 if(IsEqualGUID(&IID_IHTMLFrameElement3
, riid
))
835 return &This
->IHTMLFrameElement3_iface
;
837 return HTMLFrameBase_QI(&This
->framebase
, riid
);
840 static void HTMLFrameElement_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
842 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
843 HTMLElement_traverse(dispex
, cb
);
845 if(This
->framebase
.nsframe
)
846 note_cc_edge((nsISupports
*)This
->framebase
.nsframe
, "nsframe", cb
);
849 static void HTMLFrameElement_unlink(DispatchEx
*dispex
)
851 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
852 HTMLDOMNode_unlink(dispex
);
853 unlink_ref(&This
->framebase
.nsframe
);
856 static void HTMLFrameElement_destructor(DispatchEx
*dispex
)
858 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
860 HTMLFrameBase_destructor(&This
->framebase
);
863 static HRESULT
HTMLFrameElement_get_dispid(DispatchEx
*dispex
, const WCHAR
*name
, DWORD grfdex
, DISPID
*dispid
)
865 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
867 if(!This
->framebase
.content_window
)
868 return DISP_E_UNKNOWNNAME
;
870 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, dispid
);
873 static HRESULT
HTMLFrameElement_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
875 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
876 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
878 if(!This
->framebase
.content_window
||
879 idx
>= This
->framebase
.content_window
->base
.inner_window
->global_prop_cnt
)
880 return DISP_E_MEMBERNOTFOUND
;
882 *name
= SysAllocString(This
->framebase
.content_window
->base
.inner_window
->global_props
[idx
].name
);
883 return *name
? S_OK
: E_OUTOFMEMORY
;
886 static HRESULT
HTMLFrameElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
887 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
889 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
891 if(!This
->framebase
.content_window
) {
892 ERR("no content window to invoke on\n");
896 return IWineJSDispatchHost_InvokeEx(&This
->framebase
.content_window
->IWineJSDispatchHost_iface
, id
, lcid
,
897 flags
, params
, res
, ei
, caller
);
900 static const NodeImplVtbl HTMLFrameElementImplVtbl
= {
901 .clsid
= &CLSID_HTMLFrameElement
,
902 .cpc_entries
= HTMLElement_cpc
,
903 .clone
= HTMLElement_clone
,
904 .get_attr_col
= HTMLElement_get_attr_col
,
905 .get_document
= HTMLFrameElement_get_document
,
906 .get_readystate
= HTMLFrameElement_get_readystate
,
907 .bind_to_tree
= HTMLFrameElement_bind_to_tree
,
910 static const event_target_vtbl_t HTMLFrameElement_event_target_vtbl
= {
912 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
913 .query_interface
= HTMLFrameElement_query_interface
,
914 .destructor
= HTMLFrameElement_destructor
,
915 .traverse
= HTMLFrameElement_traverse
,
916 .unlink
= HTMLFrameElement_unlink
,
917 .get_dispid
= HTMLFrameElement_get_dispid
,
918 .get_name
= HTMLFrameElement_get_name
,
919 .invoke
= HTMLFrameElement_invoke
921 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
922 .handle_event
= HTMLElement_handle_event
925 static const tid_t HTMLFrameElement_iface_tids
[] = {
929 IHTMLFrameElement3_tid
,
933 static dispex_static_data_t HTMLFrameElement_dispex
= {
935 &HTMLFrameElement_event_target_vtbl
.dispex_vtbl
,
936 DispHTMLFrameElement_tid
,
937 HTMLFrameElement_iface_tids
,
938 HTMLElement_init_dispex_info
941 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
943 HTMLFrameElement
*ret
;
945 ret
= calloc(1, sizeof(HTMLFrameElement
));
947 return E_OUTOFMEMORY
;
949 ret
->framebase
.element
.node
.vtbl
= &HTMLFrameElementImplVtbl
;
950 ret
->IHTMLFrameElement3_iface
.lpVtbl
= &HTMLFrameElement3Vtbl
;
952 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLFrameElement_dispex
);
954 *elem
= &ret
->framebase
.element
;
959 HTMLFrameBase framebase
;
960 IHTMLIFrameElement IHTMLIFrameElement_iface
;
961 IHTMLIFrameElement2 IHTMLIFrameElement2_iface
;
962 IHTMLIFrameElement3 IHTMLIFrameElement3_iface
;
965 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement(IHTMLIFrameElement
*iface
)
967 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement_iface
);
970 DISPEX_IDISPATCH_IMPL(HTMLIFrameElement
, IHTMLIFrameElement
,
971 impl_from_IHTMLIFrameElement(iface
)->framebase
.element
.node
.event_target
.dispex
)
973 static HRESULT WINAPI
HTMLIFrameElement_put_vspace(IHTMLIFrameElement
*iface
, LONG v
)
975 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
976 FIXME("(%p)->(%ld)\n", This
, v
);
980 static HRESULT WINAPI
HTMLIFrameElement_get_vspace(IHTMLIFrameElement
*iface
, LONG
*p
)
982 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
983 FIXME("(%p)->(%p)\n", This
, p
);
987 static HRESULT WINAPI
HTMLIFrameElement_put_hspace(IHTMLIFrameElement
*iface
, LONG v
)
989 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
990 FIXME("(%p)->(%ld)\n", This
, v
);
994 static HRESULT WINAPI
HTMLIFrameElement_get_hspace(IHTMLIFrameElement
*iface
, LONG
*p
)
996 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
997 FIXME("(%p)->(%p)\n", This
, p
);
1001 static HRESULT WINAPI
HTMLIFrameElement_put_align(IHTMLIFrameElement
*iface
, BSTR v
)
1003 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1004 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1008 static HRESULT WINAPI
HTMLIFrameElement_get_align(IHTMLIFrameElement
*iface
, BSTR
*p
)
1010 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1011 FIXME("(%p)->(%p)\n", This
, p
);
1015 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl
= {
1016 HTMLIFrameElement_QueryInterface
,
1017 HTMLIFrameElement_AddRef
,
1018 HTMLIFrameElement_Release
,
1019 HTMLIFrameElement_GetTypeInfoCount
,
1020 HTMLIFrameElement_GetTypeInfo
,
1021 HTMLIFrameElement_GetIDsOfNames
,
1022 HTMLIFrameElement_Invoke
,
1023 HTMLIFrameElement_put_vspace
,
1024 HTMLIFrameElement_get_vspace
,
1025 HTMLIFrameElement_put_hspace
,
1026 HTMLIFrameElement_get_hspace
,
1027 HTMLIFrameElement_put_align
,
1028 HTMLIFrameElement_get_align
1031 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement2(IHTMLIFrameElement2
*iface
)
1033 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement2_iface
);
1036 DISPEX_IDISPATCH_IMPL(HTMLIFrameElement2
, IHTMLIFrameElement2
,
1037 impl_from_IHTMLIFrameElement2(iface
)->framebase
.element
.node
.event_target
.dispex
)
1039 static HRESULT WINAPI
HTMLIFrameElement2_put_height(IHTMLIFrameElement2
*iface
, VARIANT v
)
1041 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1046 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1048 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1052 nsres
= nsIDOMHTMLIFrameElement_SetHeight(This
->framebase
.nsiframe
, &nsstr
);
1053 nsAString_Finish(&nsstr
);
1054 if(NS_FAILED(nsres
)) {
1055 ERR("SetHeight failed: %08lx\n", nsres
);
1062 static HRESULT WINAPI
HTMLIFrameElement2_get_height(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1064 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1068 TRACE("(%p)->(%p)\n", This
, p
);
1070 nsAString_Init(&nsstr
, NULL
);
1071 nsres
= nsIDOMHTMLIFrameElement_GetHeight(This
->framebase
.nsiframe
, &nsstr
);
1074 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1077 static HRESULT WINAPI
HTMLIFrameElement2_put_width(IHTMLIFrameElement2
*iface
, VARIANT v
)
1079 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1084 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1086 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1090 nsres
= nsIDOMHTMLIFrameElement_SetWidth(This
->framebase
.nsiframe
, &nsstr
);
1091 nsAString_Finish(&nsstr
);
1092 if(NS_FAILED(nsres
)) {
1093 ERR("SetWidth failed: %08lx\n", nsres
);
1100 static HRESULT WINAPI
HTMLIFrameElement2_get_width(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1102 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1106 TRACE("(%p)->(%p)\n", This
, p
);
1108 nsAString_Init(&nsstr
, NULL
);
1109 nsres
= nsIDOMHTMLIFrameElement_GetWidth(This
->framebase
.nsiframe
, &nsstr
);
1112 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1115 static const IHTMLIFrameElement2Vtbl HTMLIFrameElement2Vtbl
= {
1116 HTMLIFrameElement2_QueryInterface
,
1117 HTMLIFrameElement2_AddRef
,
1118 HTMLIFrameElement2_Release
,
1119 HTMLIFrameElement2_GetTypeInfoCount
,
1120 HTMLIFrameElement2_GetTypeInfo
,
1121 HTMLIFrameElement2_GetIDsOfNames
,
1122 HTMLIFrameElement2_Invoke
,
1123 HTMLIFrameElement2_put_height
,
1124 HTMLIFrameElement2_get_height
,
1125 HTMLIFrameElement2_put_width
,
1126 HTMLIFrameElement2_get_width
1129 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement3(IHTMLIFrameElement3
*iface
)
1131 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement3_iface
);
1134 DISPEX_IDISPATCH_IMPL(HTMLIFrameElement3
, IHTMLIFrameElement3
,
1135 impl_from_IHTMLIFrameElement3(iface
)->framebase
.element
.node
.event_target
.dispex
)
1137 static HRESULT WINAPI
HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3
*iface
, IDispatch
**p
)
1139 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1140 IHTMLDocument2
*doc
;
1143 TRACE("(%p)->(%p)\n", This
, p
);
1145 if(!This
->framebase
.content_window
) {
1150 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
1151 *p
= (IDispatch
*)doc
;
1155 static HRESULT WINAPI
HTMLIFrameElement3_put_src(IHTMLIFrameElement3
*iface
, BSTR v
)
1157 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1158 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1162 static HRESULT WINAPI
HTMLIFrameElement3_get_src(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1164 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1165 FIXME("(%p)->(%p)\n", This
, p
);
1169 static HRESULT WINAPI
HTMLIFrameElement3_put_longDesc(IHTMLIFrameElement3
*iface
, BSTR v
)
1171 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1172 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1176 static HRESULT WINAPI
HTMLIFrameElement3_get_longDesc(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1178 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1179 FIXME("(%p)->(%p)\n", This
, p
);
1183 static HRESULT WINAPI
HTMLIFrameElement3_put_frameBorder(IHTMLIFrameElement3
*iface
, BSTR v
)
1185 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1186 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1190 static HRESULT WINAPI
HTMLIFrameElement3_get_frameBorder(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1192 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1193 FIXME("(%p)->(%p)\n", This
, p
);
1197 static const IHTMLIFrameElement3Vtbl HTMLIFrameElement3Vtbl
= {
1198 HTMLIFrameElement3_QueryInterface
,
1199 HTMLIFrameElement3_AddRef
,
1200 HTMLIFrameElement3_Release
,
1201 HTMLIFrameElement3_GetTypeInfoCount
,
1202 HTMLIFrameElement3_GetTypeInfo
,
1203 HTMLIFrameElement3_GetIDsOfNames
,
1204 HTMLIFrameElement3_Invoke
,
1205 HTMLIFrameElement3_get_contentDocument
,
1206 HTMLIFrameElement3_put_src
,
1207 HTMLIFrameElement3_get_src
,
1208 HTMLIFrameElement3_put_longDesc
,
1209 HTMLIFrameElement3_get_longDesc
,
1210 HTMLIFrameElement3_put_frameBorder
,
1211 HTMLIFrameElement3_get_frameBorder
1214 static inline HTMLIFrame
*iframe_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1216 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
);
1219 static HRESULT
HTMLIFrame_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
1221 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1223 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
1228 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
;
1229 IDispatch_AddRef(*p
);
1233 static HRESULT
HTMLIFrame_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
1235 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1237 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
1240 static HRESULT
HTMLIFrame_bind_to_tree(HTMLDOMNode
*iface
)
1242 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1243 nsIDOMDocument
*nsdoc
;
1247 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->framebase
.nsiframe
, &nsdoc
);
1248 if(NS_FAILED(nsres
) || !nsdoc
) {
1249 ERR("GetContentDocument failed: %08lx\n", nsres
);
1253 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
1254 nsIDOMDocument_Release(nsdoc
);
1258 static inline HTMLIFrame
*iframe_from_DispatchEx(DispatchEx
*iface
)
1260 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
.event_target
.dispex
);
1263 static void *HTMLIFrame_query_interface(DispatchEx
*dispex
, REFIID riid
)
1265 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1267 if(IsEqualGUID(&IID_IHTMLIFrameElement
, riid
))
1268 return &This
->IHTMLIFrameElement_iface
;
1269 if(IsEqualGUID(&IID_IHTMLIFrameElement2
, riid
))
1270 return &This
->IHTMLIFrameElement2_iface
;
1271 if(IsEqualGUID(&IID_IHTMLIFrameElement3
, riid
))
1272 return &This
->IHTMLIFrameElement3_iface
;
1274 return HTMLFrameBase_QI(&This
->framebase
, riid
);
1277 static void HTMLIFrame_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
1279 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1280 HTMLElement_traverse(dispex
, cb
);
1282 if(This
->framebase
.nsiframe
)
1283 note_cc_edge((nsISupports
*)This
->framebase
.nsiframe
, "nsiframe", cb
);
1286 static void HTMLIFrame_unlink(DispatchEx
*dispex
)
1288 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1289 HTMLDOMNode_unlink(dispex
);
1290 unlink_ref(&This
->framebase
.nsiframe
);
1293 static void HTMLIFrame_destructor(DispatchEx
*dispex
)
1295 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1297 HTMLFrameBase_destructor(&This
->framebase
);
1300 static HRESULT
HTMLIFrame_get_dispid(DispatchEx
*dispex
, const WCHAR
*name
, DWORD grfdex
, DISPID
*dispid
)
1302 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1304 if(!This
->framebase
.content_window
)
1305 return DISP_E_UNKNOWNNAME
;
1307 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, dispid
);
1310 static HRESULT
HTMLIFrame_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
1312 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1313 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
1315 if(!This
->framebase
.content_window
||
1316 idx
>= This
->framebase
.content_window
->base
.inner_window
->global_prop_cnt
)
1317 return DISP_E_MEMBERNOTFOUND
;
1319 *name
= SysAllocString(This
->framebase
.content_window
->base
.inner_window
->global_props
[idx
].name
);
1320 return *name
? S_OK
: E_OUTOFMEMORY
;
1323 static HRESULT
HTMLIFrame_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
1324 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
1326 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1328 if(!This
->framebase
.content_window
) {
1329 ERR("no content window to invoke on\n");
1333 return IWineJSDispatchHost_InvokeEx(&This
->framebase
.content_window
->IWineJSDispatchHost_iface
, id
, lcid
,
1334 flags
, params
, res
, ei
, caller
);
1337 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
1338 .clsid
= &CLSID_HTMLIFrame
,
1339 .cpc_entries
= HTMLElement_cpc
,
1340 .clone
= HTMLElement_clone
,
1341 .get_attr_col
= HTMLElement_get_attr_col
,
1342 .get_document
= HTMLIFrame_get_document
,
1343 .get_readystate
= HTMLIFrame_get_readystate
,
1344 .bind_to_tree
= HTMLIFrame_bind_to_tree
,
1347 static const event_target_vtbl_t HTMLIFrame_event_target_vtbl
= {
1349 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
1350 .query_interface
= HTMLIFrame_query_interface
,
1351 .destructor
= HTMLIFrame_destructor
,
1352 .traverse
= HTMLIFrame_traverse
,
1353 .unlink
= HTMLIFrame_unlink
,
1354 .get_dispid
= HTMLIFrame_get_dispid
,
1355 .get_name
= HTMLIFrame_get_name
,
1356 .invoke
= HTMLIFrame_invoke
1358 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
1359 .handle_event
= HTMLElement_handle_event
1362 static const tid_t HTMLIFrame_iface_tids
[] = {
1365 IHTMLFrameBase2_tid
,
1366 IHTMLIFrameElement_tid
,
1367 IHTMLIFrameElement2_tid
,
1368 IHTMLIFrameElement3_tid
,
1372 static dispex_static_data_t HTMLIFrame_dispex
= {
1373 "HTMLIFrameElement",
1374 &HTMLIFrame_event_target_vtbl
.dispex_vtbl
,
1376 HTMLIFrame_iface_tids
,
1377 HTMLElement_init_dispex_info
1380 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1384 ret
= calloc(1, sizeof(HTMLIFrame
));
1386 return E_OUTOFMEMORY
;
1388 ret
->IHTMLIFrameElement_iface
.lpVtbl
= &HTMLIFrameElementVtbl
;
1389 ret
->IHTMLIFrameElement2_iface
.lpVtbl
= &HTMLIFrameElement2Vtbl
;
1390 ret
->IHTMLIFrameElement3_iface
.lpVtbl
= &HTMLIFrameElement3Vtbl
;
1391 ret
->framebase
.element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
1393 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLIFrame_dispex
);
1395 *elem
= &ret
->framebase
.element
;