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
->basedoc
.window
, &window
);
54 mozIDOMWindowProxy_Release(mozwindow
);
58 frame
->content_window
= window
;
59 window
->frame_element
= frame
;
63 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase(IHTMLFrameBase
*iface
)
65 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase_iface
);
68 static HRESULT WINAPI
HTMLFrameBase_QueryInterface(IHTMLFrameBase
*iface
, REFIID riid
, void **ppv
)
70 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
72 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
75 static ULONG WINAPI
HTMLFrameBase_AddRef(IHTMLFrameBase
*iface
)
77 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
79 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
82 static ULONG WINAPI
HTMLFrameBase_Release(IHTMLFrameBase
*iface
)
84 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
86 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
89 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase
*iface
, UINT
*pctinfo
)
91 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
93 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
96 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfo(IHTMLFrameBase
*iface
, UINT iTInfo
,
97 LCID lcid
, ITypeInfo
**ppTInfo
)
99 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
101 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
105 static HRESULT WINAPI
HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase
*iface
, REFIID riid
,
106 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
108 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
110 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
111 cNames
, lcid
, rgDispId
);
114 static HRESULT WINAPI
HTMLFrameBase_Invoke(IHTMLFrameBase
*iface
, DISPID dispIdMember
,
115 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
116 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
118 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
120 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
121 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
124 static HRESULT WINAPI
HTMLFrameBase_put_src(IHTMLFrameBase
*iface
, BSTR v
)
126 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
128 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
130 if(!This
->content_window
|| !This
->element
.node
.doc
|| !This
->element
.node
.doc
->basedoc
.window
) {
134 nsAString_InitDepend(&nsstr
, v
);
136 nsres
= nsIDOMHTMLFrameElement_SetSrc(This
->nsframe
, &nsstr
);
138 nsres
= nsIDOMHTMLIFrameElement_SetSrc(This
->nsiframe
, &nsstr
);
139 nsAString_Finish(&nsstr
);
140 if(NS_FAILED(nsres
)) {
141 ERR("SetSrc failed: %08x\n", nsres
);
148 return navigate_url(This
->content_window
, v
, This
->element
.node
.doc
->basedoc
.window
->uri
, BINDING_NAVIGATED
);
151 static HRESULT WINAPI
HTMLFrameBase_get_src(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 frame object\n");
164 nsAString_Init(&nsstr
, NULL
);
166 nsres
= nsIDOMHTMLFrameElement_GetSrc(This
->nsframe
, &nsstr
);
168 nsres
= nsIDOMHTMLIFrameElement_GetSrc(This
->nsiframe
, &nsstr
);
169 return return_nsstr(nsres
, &nsstr
, p
);
172 static HRESULT WINAPI
HTMLFrameBase_put_name(IHTMLFrameBase
*iface
, BSTR v
)
174 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
178 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
180 if(!This
->nsframe
&& !This
->nsiframe
) {
181 ERR("No attached ns frame object\n");
185 nsAString_InitDepend(&name_str
, v
);
187 nsres
= nsIDOMHTMLFrameElement_SetName(This
->nsframe
, &name_str
);
189 nsres
= nsIDOMHTMLIFrameElement_SetName(This
->nsiframe
, &name_str
);
190 nsAString_Finish(&name_str
);
191 if(NS_FAILED(nsres
)) {
192 ERR("SetName failed: %08x\n", nsres
);
199 static HRESULT WINAPI
HTMLFrameBase_get_name(IHTMLFrameBase
*iface
, BSTR
*p
)
201 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
205 TRACE("(%p)->(%p)\n", This
, p
);
207 if(!This
->nsframe
&& !This
->nsiframe
) {
208 ERR("No attached ns frame object\n");
212 nsAString_Init(&nsstr
, NULL
);
214 nsres
= nsIDOMHTMLFrameElement_GetName(This
->nsframe
, &nsstr
);
216 nsres
= nsIDOMHTMLIFrameElement_GetName(This
->nsiframe
, &nsstr
);
217 return return_nsstr(nsres
, &nsstr
, p
);
220 static HRESULT WINAPI
HTMLFrameBase_put_border(IHTMLFrameBase
*iface
, VARIANT v
)
222 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
223 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
227 static HRESULT WINAPI
HTMLFrameBase_get_border(IHTMLFrameBase
*iface
, VARIANT
*p
)
229 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
230 FIXME("(%p)->(%p)\n", This
, p
);
234 static HRESULT WINAPI
HTMLFrameBase_put_frameBorder(IHTMLFrameBase
*iface
, BSTR v
)
236 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
240 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
242 if(!This
->nsframe
&& !This
->nsiframe
) {
243 ERR("No attached ns frame object\n");
247 nsAString_InitDepend(&nsstr
, v
);
249 nsres
= nsIDOMHTMLFrameElement_SetFrameBorder(This
->nsframe
, &nsstr
);
251 nsres
= nsIDOMHTMLIFrameElement_SetFrameBorder(This
->nsiframe
, &nsstr
);
252 nsAString_Finish(&nsstr
);
253 if(NS_FAILED(nsres
)) {
254 ERR("SetFrameBorder failed: %08x\n", nsres
);
261 static HRESULT WINAPI
HTMLFrameBase_get_frameBorder(IHTMLFrameBase
*iface
, BSTR
*p
)
263 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
267 TRACE("(%p)->(%p)\n", This
, p
);
269 if(!This
->nsframe
&& !This
->nsiframe
) {
270 ERR("No attached ns frame object\n");
274 nsAString_Init(&nsstr
, NULL
);
276 nsres
= nsIDOMHTMLFrameElement_GetFrameBorder(This
->nsframe
, &nsstr
);
278 nsres
= nsIDOMHTMLIFrameElement_GetFrameBorder(This
->nsiframe
, &nsstr
);
279 return return_nsstr(nsres
, &nsstr
, p
);
282 static HRESULT WINAPI
HTMLFrameBase_put_frameSpacing(IHTMLFrameBase
*iface
, VARIANT v
)
284 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
285 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
289 static HRESULT WINAPI
HTMLFrameBase_get_frameSpacing(IHTMLFrameBase
*iface
, VARIANT
*p
)
291 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
292 FIXME("(%p)->(%p)\n", This
, p
);
296 static HRESULT WINAPI
HTMLFrameBase_put_marginWidth(IHTMLFrameBase
*iface
, VARIANT v
)
298 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
302 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
304 if(V_VT(&v
) != VT_BSTR
) {
305 FIXME("unsupported %s\n", debugstr_variant(&v
));
309 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
311 nsres
= nsIDOMHTMLFrameElement_SetMarginWidth(This
->nsframe
, &nsstr
);
313 nsres
= nsIDOMHTMLIFrameElement_SetMarginWidth(This
->nsiframe
, &nsstr
);
314 nsAString_Finish(&nsstr
);
315 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
318 static HRESULT WINAPI
HTMLFrameBase_get_marginWidth(IHTMLFrameBase
*iface
, VARIANT
*p
)
320 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
325 TRACE("(%p)->(%p)\n", This
, p
);
327 nsAString_Init(&nsstr
, NULL
);
329 nsres
= nsIDOMHTMLFrameElement_GetMarginWidth(This
->nsframe
, &nsstr
);
331 nsres
= nsIDOMHTMLIFrameElement_GetMarginWidth(This
->nsiframe
, &nsstr
);
332 if(NS_SUCCEEDED(nsres
)) {
333 const PRUnichar
*str
, *end
;
335 nsAString_GetData(&nsstr
, &str
);
340 end
= wcsstr(str
, L
"px");
342 end
= str
+lstrlenW(str
);
343 ret
= SysAllocStringLen(str
, end
-str
);
348 hres
= E_OUTOFMEMORY
;
355 ERR("GetMarginWidth failed: %08x\n", nsres
);
359 nsAString_Finish(&nsstr
);
363 static HRESULT WINAPI
HTMLFrameBase_put_marginHeight(IHTMLFrameBase
*iface
, VARIANT v
)
365 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
369 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
371 if(V_VT(&v
) != VT_BSTR
) {
372 FIXME("unsupported %s\n", debugstr_variant(&v
));
376 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
378 nsres
= nsIDOMHTMLFrameElement_SetMarginHeight(This
->nsframe
, &nsstr
);
380 nsres
= nsIDOMHTMLIFrameElement_SetMarginHeight(This
->nsiframe
, &nsstr
);
381 nsAString_Finish(&nsstr
);
382 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
385 static HRESULT WINAPI
HTMLFrameBase_get_marginHeight(IHTMLFrameBase
*iface
, VARIANT
*p
)
387 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
392 TRACE("(%p)->(%p)\n", This
, p
);
394 nsAString_Init(&nsstr
, NULL
);
396 nsres
= nsIDOMHTMLFrameElement_GetMarginHeight(This
->nsframe
, &nsstr
);
398 nsres
= nsIDOMHTMLIFrameElement_GetMarginHeight(This
->nsiframe
, &nsstr
);
399 if(NS_SUCCEEDED(nsres
)) {
400 const PRUnichar
*str
, *end
;
402 nsAString_GetData(&nsstr
, &str
);
407 end
= wcsstr(str
, L
"px");
409 end
= str
+lstrlenW(str
);
410 ret
= SysAllocStringLen(str
, end
-str
);
415 hres
= E_OUTOFMEMORY
;
422 ERR("SetMarginHeight failed: %08x\n", nsres
);
426 nsAString_Finish(&nsstr
);
430 static HRESULT WINAPI
HTMLFrameBase_put_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL v
)
432 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
433 FIXME("(%p)->(%x)\n", This
, v
);
437 static HRESULT WINAPI
HTMLFrameBase_get_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL
*p
)
439 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
440 FIXME("(%p)->(%p)\n", This
, p
);
444 static HRESULT WINAPI
HTMLFrameBase_put_scrolling(IHTMLFrameBase
*iface
, BSTR v
)
446 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
450 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
452 if(!(!wcsicmp(v
, L
"yes") || !wcsicmp(v
, L
"no") || !wcsicmp(v
, L
"auto")))
456 nsAString_InitDepend(&nsstr
, v
);
457 nsres
= nsIDOMHTMLFrameElement_SetScrolling(This
->nsframe
, &nsstr
);
458 }else if(This
->nsiframe
) {
459 nsAString_InitDepend(&nsstr
, v
);
460 nsres
= nsIDOMHTMLIFrameElement_SetScrolling(This
->nsiframe
, &nsstr
);
462 ERR("No attached ns frame object\n");
465 nsAString_Finish(&nsstr
);
467 if(NS_FAILED(nsres
)) {
468 ERR("SetScrolling failed: 0x%08x\n", nsres
);
475 static HRESULT WINAPI
HTMLFrameBase_get_scrolling(IHTMLFrameBase
*iface
, BSTR
*p
)
477 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
479 const PRUnichar
*strdata
;
482 TRACE("(%p)->(%p)\n", This
, p
);
485 nsAString_Init(&nsstr
, NULL
);
486 nsres
= nsIDOMHTMLFrameElement_GetScrolling(This
->nsframe
, &nsstr
);
487 }else if(This
->nsiframe
) {
488 nsAString_Init(&nsstr
, NULL
);
489 nsres
= nsIDOMHTMLIFrameElement_GetScrolling(This
->nsiframe
, &nsstr
);
491 ERR("No attached ns frame object\n");
495 if(NS_FAILED(nsres
)) {
496 ERR("GetScrolling failed: 0x%08x\n", nsres
);
497 nsAString_Finish(&nsstr
);
501 nsAString_GetData(&nsstr
, &strdata
);
504 *p
= SysAllocString(strdata
);
506 *p
= SysAllocString(L
"auto");
508 nsAString_Finish(&nsstr
);
510 return *p
? S_OK
: E_OUTOFMEMORY
;
513 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl
= {
514 HTMLFrameBase_QueryInterface
,
515 HTMLFrameBase_AddRef
,
516 HTMLFrameBase_Release
,
517 HTMLFrameBase_GetTypeInfoCount
,
518 HTMLFrameBase_GetTypeInfo
,
519 HTMLFrameBase_GetIDsOfNames
,
520 HTMLFrameBase_Invoke
,
521 HTMLFrameBase_put_src
,
522 HTMLFrameBase_get_src
,
523 HTMLFrameBase_put_name
,
524 HTMLFrameBase_get_name
,
525 HTMLFrameBase_put_border
,
526 HTMLFrameBase_get_border
,
527 HTMLFrameBase_put_frameBorder
,
528 HTMLFrameBase_get_frameBorder
,
529 HTMLFrameBase_put_frameSpacing
,
530 HTMLFrameBase_get_frameSpacing
,
531 HTMLFrameBase_put_marginWidth
,
532 HTMLFrameBase_get_marginWidth
,
533 HTMLFrameBase_put_marginHeight
,
534 HTMLFrameBase_get_marginHeight
,
535 HTMLFrameBase_put_noResize
,
536 HTMLFrameBase_get_noResize
,
537 HTMLFrameBase_put_scrolling
,
538 HTMLFrameBase_get_scrolling
541 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase2(IHTMLFrameBase2
*iface
)
543 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase2_iface
);
546 static HRESULT WINAPI
HTMLFrameBase2_QueryInterface(IHTMLFrameBase2
*iface
, REFIID riid
, void **ppv
)
548 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
550 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
553 static ULONG WINAPI
HTMLFrameBase2_AddRef(IHTMLFrameBase2
*iface
)
555 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
557 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
560 static ULONG WINAPI
HTMLFrameBase2_Release(IHTMLFrameBase2
*iface
)
562 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
564 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
567 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2
*iface
, UINT
*pctinfo
)
569 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
570 FIXME("(%p)\n", This
);
574 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2
*iface
, UINT iTInfo
,
575 LCID lcid
, ITypeInfo
**ppTInfo
)
577 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
578 FIXME("(%p)\n", This
);
582 static HRESULT WINAPI
HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2
*iface
, REFIID riid
,
583 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
585 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
586 FIXME("(%p)\n", This
);
590 static HRESULT WINAPI
HTMLFrameBase2_Invoke(IHTMLFrameBase2
*iface
, DISPID dispIdMember
,
591 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
592 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
594 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
595 FIXME("(%p)\n", This
);
599 static HRESULT WINAPI
HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2
*iface
, IHTMLWindow2
**p
)
601 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
603 TRACE("(%p)->(%p)\n", This
, p
);
605 if(This
->content_window
) {
606 IHTMLWindow2_AddRef(&This
->content_window
->base
.IHTMLWindow2_iface
);
607 *p
= &This
->content_window
->base
.IHTMLWindow2_iface
;
609 WARN("NULL content window\n");
615 static HRESULT WINAPI
HTMLFrameBase2_put_onload(IHTMLFrameBase2
*iface
, VARIANT v
)
617 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
619 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
621 return set_node_event(&This
->element
.node
, EVENTID_LOAD
, &v
);
624 static HRESULT WINAPI
HTMLFrameBase2_get_onload(IHTMLFrameBase2
*iface
, VARIANT
*p
)
626 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
628 TRACE("(%p)->(%p)\n", This
, p
);
630 return get_node_event(&This
->element
.node
, EVENTID_LOAD
, p
);
633 static HRESULT WINAPI
HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT v
)
635 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
636 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
640 static HRESULT WINAPI
HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT
*p
)
642 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
643 FIXME("(%p)->(%p)\n", This
, p
);
647 static HRESULT WINAPI
HTMLFrameBase2_get_readyState(IHTMLFrameBase2
*iface
, BSTR
*p
)
649 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
651 TRACE("(%p)->(%p)\n", This
, p
);
653 if(!This
->content_window
|| !This
->content_window
->base
.inner_window
->doc
) {
654 FIXME("no document associated\n");
658 return IHTMLDocument2_get_readyState(&This
->content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
, p
);
661 static HRESULT WINAPI
HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL v
)
663 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
665 FIXME("(%p)->(%x) semi-stub\n", This
, v
);
670 static HRESULT WINAPI
HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL
*p
)
672 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
674 FIXME("(%p)->(%p) semi-stub\n", This
, p
);
680 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl
= {
681 HTMLFrameBase2_QueryInterface
,
682 HTMLFrameBase2_AddRef
,
683 HTMLFrameBase2_Release
,
684 HTMLFrameBase2_GetTypeInfoCount
,
685 HTMLFrameBase2_GetTypeInfo
,
686 HTMLFrameBase2_GetIDsOfNames
,
687 HTMLFrameBase2_Invoke
,
688 HTMLFrameBase2_get_contentWindow
,
689 HTMLFrameBase2_put_onload
,
690 HTMLFrameBase2_get_onload
,
691 HTMLFrameBase2_put_onreadystatechange
,
692 HTMLFrameBase2_get_onreadystatechange
,
693 HTMLFrameBase2_get_readyState
,
694 HTMLFrameBase2_put_allowTransparency
,
695 HTMLFrameBase2_get_allowTransparency
698 static HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*This
, REFIID riid
, void **ppv
)
700 if(IsEqualGUID(&IID_IHTMLFrameBase
, riid
)) {
701 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This
, ppv
);
702 *ppv
= &This
->IHTMLFrameBase_iface
;
703 }else if(IsEqualGUID(&IID_IHTMLFrameBase2
, riid
)) {
704 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This
, ppv
);
705 *ppv
= &This
->IHTMLFrameBase2_iface
;
707 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
710 IUnknown_AddRef((IUnknown
*)*ppv
);
714 static void HTMLFrameBase_destructor(HTMLFrameBase
*This
)
716 if(This
->content_window
)
717 This
->content_window
->frame_element
= NULL
;
719 HTMLElement_destructor(&This
->element
.node
);
722 static void HTMLFrameBase_Init(HTMLFrameBase
*This
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
,
723 dispex_static_data_t
*dispex_data
)
727 This
->IHTMLFrameBase_iface
.lpVtbl
= &HTMLFrameBaseVtbl
;
728 This
->IHTMLFrameBase2_iface
.lpVtbl
= &HTMLFrameBase2Vtbl
;
730 HTMLElement_Init(&This
->element
, doc
, nselem
, dispex_data
);
732 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFrameElement
, (void**)&This
->nsframe
);
733 if(NS_FAILED(nsres
)) {
734 This
->nsframe
= NULL
;
735 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLIFrameElement
, (void**)&This
->nsiframe
);
736 assert(nsres
== NS_OK
);
738 This
->nsiframe
= NULL
;
742 struct HTMLFrameElement
{
743 HTMLFrameBase framebase
;
744 IHTMLFrameElement3 IHTMLFrameElement3_iface
;
747 static inline HTMLFrameElement
*impl_from_IHTMLFrameElement3(IHTMLFrameElement3
*iface
)
749 return CONTAINING_RECORD(iface
, HTMLFrameElement
, IHTMLFrameElement3_iface
);
752 static HRESULT WINAPI
HTMLFrameElement3_QueryInterface(IHTMLFrameElement3
*iface
,
753 REFIID riid
, void **ppv
)
755 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
757 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
760 static ULONG WINAPI
HTMLFrameElement3_AddRef(IHTMLFrameElement3
*iface
)
762 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
764 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
767 static ULONG WINAPI
HTMLFrameElement3_Release(IHTMLFrameElement3
*iface
)
769 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
771 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
774 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3
*iface
, UINT
*pctinfo
)
776 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
777 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
781 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3
*iface
, UINT iTInfo
,
782 LCID lcid
, ITypeInfo
**ppTInfo
)
784 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
785 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
789 static HRESULT WINAPI
HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3
*iface
, REFIID riid
,
790 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
792 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
793 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
794 rgszNames
, cNames
, lcid
, rgDispId
);
797 static HRESULT WINAPI
HTMLFrameElement3_Invoke(IHTMLFrameElement3
*iface
, DISPID dispIdMember
,
798 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
799 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
801 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
802 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
803 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
806 static HRESULT WINAPI
HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3
*iface
, IDispatch
**p
)
808 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
812 TRACE("(%p)->(%p)\n", This
, p
);
814 if(!This
->framebase
.content_window
) {
815 FIXME("NULL window\n");
819 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
823 *p
= doc
? (IDispatch
*)doc
: NULL
;
827 static HRESULT WINAPI
HTMLFrameElement3_put_src(IHTMLFrameElement3
*iface
, BSTR v
)
829 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
830 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
834 static HRESULT WINAPI
HTMLFrameElement3_get_src(IHTMLFrameElement3
*iface
, BSTR
*p
)
836 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
837 FIXME("(%p)->(%p)\n", This
, p
);
841 static HRESULT WINAPI
HTMLFrameElement3_put_longDesc(IHTMLFrameElement3
*iface
, BSTR v
)
843 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
844 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
848 static HRESULT WINAPI
HTMLFrameElement3_get_longDesc(IHTMLFrameElement3
*iface
, BSTR
*p
)
850 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
851 FIXME("(%p)->(%p)\n", This
, p
);
855 static HRESULT WINAPI
HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3
*iface
, BSTR v
)
857 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
858 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
862 static HRESULT WINAPI
HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3
*iface
, BSTR
*p
)
864 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
865 FIXME("(%p)->(%p)\n", This
, p
);
869 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
= {
870 HTMLFrameElement3_QueryInterface
,
871 HTMLFrameElement3_AddRef
,
872 HTMLFrameElement3_Release
,
873 HTMLFrameElement3_GetTypeInfoCount
,
874 HTMLFrameElement3_GetTypeInfo
,
875 HTMLFrameElement3_GetIDsOfNames
,
876 HTMLFrameElement3_Invoke
,
877 HTMLFrameElement3_get_contentDocument
,
878 HTMLFrameElement3_put_src
,
879 HTMLFrameElement3_get_src
,
880 HTMLFrameElement3_put_longDesc
,
881 HTMLFrameElement3_get_longDesc
,
882 HTMLFrameElement3_put_frameBorder
,
883 HTMLFrameElement3_get_frameBorder
886 static inline HTMLFrameElement
*frame_from_HTMLDOMNode(HTMLDOMNode
*iface
)
888 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
);
891 static HRESULT
HTMLFrameElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
893 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
895 if(IsEqualGUID(&IID_IHTMLFrameElement3
, riid
)) {
896 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This
, ppv
);
897 *ppv
= &This
->IHTMLFrameElement3_iface
;
899 return HTMLFrameBase_QI(&This
->framebase
, riid
, ppv
);
902 IUnknown_AddRef((IUnknown
*)*ppv
);
906 static void HTMLFrameElement_destructor(HTMLDOMNode
*iface
)
908 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
910 HTMLFrameBase_destructor(&This
->framebase
);
913 static HRESULT
HTMLFrameElement_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
915 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
917 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
922 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
923 IDispatch_AddRef(*p
);
927 static HRESULT
HTMLFrameElement_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
929 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
931 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
934 static HRESULT
HTMLFrameElement_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
935 DWORD grfdex
, DISPID
*pid
)
937 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
939 if(!This
->framebase
.content_window
)
940 return DISP_E_UNKNOWNNAME
;
942 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, pid
);
945 static HRESULT
HTMLFrameElement_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
946 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
948 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
950 if(!This
->framebase
.content_window
) {
951 ERR("no content window to invoke on\n");
955 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
956 flags
, params
, res
, ei
, caller
);
959 static HRESULT
HTMLFrameElement_bind_to_tree(HTMLDOMNode
*iface
)
961 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
962 nsIDOMDocument
*nsdoc
;
966 nsres
= nsIDOMHTMLFrameElement_GetContentDocument(This
->framebase
.nsframe
, &nsdoc
);
967 if(NS_FAILED(nsres
) || !nsdoc
) {
968 ERR("GetContentDocument failed: %08x\n", nsres
);
972 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
973 nsIDOMDocument_Release(nsdoc
);
977 static void HTMLFrameElement_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
979 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
981 if(This
->framebase
.nsframe
)
982 note_cc_edge((nsISupports
*)This
->framebase
.nsframe
, "This->nsframe", cb
);
985 static void HTMLFrameElement_unlink(HTMLDOMNode
*iface
)
987 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
989 if(This
->framebase
.nsframe
) {
990 nsIDOMHTMLFrameElement
*nsframe
= This
->framebase
.nsframe
;
992 This
->framebase
.nsframe
= NULL
;
993 nsIDOMHTMLFrameElement_Release(nsframe
);
997 static const NodeImplVtbl HTMLFrameElementImplVtbl
= {
998 &CLSID_HTMLFrameElement
,
1000 HTMLFrameElement_destructor
,
1003 HTMLElement_handle_event
,
1004 HTMLElement_get_attr_col
,
1008 HTMLFrameElement_get_document
,
1009 HTMLFrameElement_get_readystate
,
1010 HTMLFrameElement_get_dispid
,
1011 HTMLFrameElement_invoke
,
1012 HTMLFrameElement_bind_to_tree
,
1013 HTMLFrameElement_traverse
,
1014 HTMLFrameElement_unlink
1017 static const tid_t HTMLFrameElement_iface_tids
[] = {
1020 IHTMLFrameBase2_tid
,
1021 IHTMLFrameElement3_tid
,
1025 static dispex_static_data_t HTMLFrameElement_dispex
= {
1027 DispHTMLFrameElement_tid
,
1028 HTMLFrameElement_iface_tids
,
1029 HTMLElement_init_dispex_info
1032 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1034 HTMLFrameElement
*ret
;
1036 ret
= heap_alloc_zero(sizeof(HTMLFrameElement
));
1038 return E_OUTOFMEMORY
;
1040 ret
->framebase
.element
.node
.vtbl
= &HTMLFrameElementImplVtbl
;
1041 ret
->IHTMLFrameElement3_iface
.lpVtbl
= &HTMLFrameElement3Vtbl
;
1043 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLFrameElement_dispex
);
1045 *elem
= &ret
->framebase
.element
;
1050 HTMLFrameBase framebase
;
1051 IHTMLIFrameElement IHTMLIFrameElement_iface
;
1052 IHTMLIFrameElement2 IHTMLIFrameElement2_iface
;
1053 IHTMLIFrameElement3 IHTMLIFrameElement3_iface
;
1056 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement(IHTMLIFrameElement
*iface
)
1058 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement_iface
);
1061 static HRESULT WINAPI
HTMLIFrameElement_QueryInterface(IHTMLIFrameElement
*iface
,
1062 REFIID riid
, void **ppv
)
1064 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1066 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1069 static ULONG WINAPI
HTMLIFrameElement_AddRef(IHTMLIFrameElement
*iface
)
1071 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1073 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1076 static ULONG WINAPI
HTMLIFrameElement_Release(IHTMLIFrameElement
*iface
)
1078 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1080 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1083 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfoCount(IHTMLIFrameElement
*iface
, UINT
*pctinfo
)
1085 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1086 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1090 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfo(IHTMLIFrameElement
*iface
, UINT iTInfo
,
1091 LCID lcid
, ITypeInfo
**ppTInfo
)
1093 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1094 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1098 static HRESULT WINAPI
HTMLIFrameElement_GetIDsOfNames(IHTMLIFrameElement
*iface
, REFIID riid
,
1099 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1101 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1102 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1103 rgszNames
, cNames
, lcid
, rgDispId
);
1106 static HRESULT WINAPI
HTMLIFrameElement_Invoke(IHTMLIFrameElement
*iface
, DISPID dispIdMember
,
1107 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1108 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1110 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1111 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1112 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1115 static HRESULT WINAPI
HTMLIFrameElement_put_vspace(IHTMLIFrameElement
*iface
, LONG v
)
1117 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1118 FIXME("(%p)->(%d)\n", This
, v
);
1122 static HRESULT WINAPI
HTMLIFrameElement_get_vspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1124 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1125 FIXME("(%p)->(%p)\n", This
, p
);
1129 static HRESULT WINAPI
HTMLIFrameElement_put_hspace(IHTMLIFrameElement
*iface
, LONG v
)
1131 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1132 FIXME("(%p)->(%d)\n", This
, v
);
1136 static HRESULT WINAPI
HTMLIFrameElement_get_hspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1138 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1139 FIXME("(%p)->(%p)\n", This
, p
);
1143 static HRESULT WINAPI
HTMLIFrameElement_put_align(IHTMLIFrameElement
*iface
, BSTR v
)
1145 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1146 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1150 static HRESULT WINAPI
HTMLIFrameElement_get_align(IHTMLIFrameElement
*iface
, BSTR
*p
)
1152 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1153 FIXME("(%p)->(%p)\n", This
, p
);
1157 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl
= {
1158 HTMLIFrameElement_QueryInterface
,
1159 HTMLIFrameElement_AddRef
,
1160 HTMLIFrameElement_Release
,
1161 HTMLIFrameElement_GetTypeInfoCount
,
1162 HTMLIFrameElement_GetTypeInfo
,
1163 HTMLIFrameElement_GetIDsOfNames
,
1164 HTMLIFrameElement_Invoke
,
1165 HTMLIFrameElement_put_vspace
,
1166 HTMLIFrameElement_get_vspace
,
1167 HTMLIFrameElement_put_hspace
,
1168 HTMLIFrameElement_get_hspace
,
1169 HTMLIFrameElement_put_align
,
1170 HTMLIFrameElement_get_align
1173 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement2(IHTMLIFrameElement2
*iface
)
1175 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement2_iface
);
1178 static HRESULT WINAPI
HTMLIFrameElement2_QueryInterface(IHTMLIFrameElement2
*iface
,
1179 REFIID riid
, void **ppv
)
1181 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1183 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1186 static ULONG WINAPI
HTMLIFrameElement2_AddRef(IHTMLIFrameElement2
*iface
)
1188 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1190 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1193 static ULONG WINAPI
HTMLIFrameElement2_Release(IHTMLIFrameElement2
*iface
)
1195 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1197 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1200 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfoCount(IHTMLIFrameElement2
*iface
, UINT
*pctinfo
)
1202 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1203 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1207 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfo(IHTMLIFrameElement2
*iface
, UINT iTInfo
,
1208 LCID lcid
, ITypeInfo
**ppTInfo
)
1210 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1211 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1215 static HRESULT WINAPI
HTMLIFrameElement2_GetIDsOfNames(IHTMLIFrameElement2
*iface
, REFIID riid
,
1216 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1218 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1219 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1220 rgszNames
, cNames
, lcid
, rgDispId
);
1223 static HRESULT WINAPI
HTMLIFrameElement2_Invoke(IHTMLIFrameElement2
*iface
, DISPID dispIdMember
,
1224 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1225 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1227 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1228 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1229 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1232 static HRESULT WINAPI
HTMLIFrameElement2_put_height(IHTMLIFrameElement2
*iface
, VARIANT v
)
1234 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1239 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1241 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1245 nsres
= nsIDOMHTMLIFrameElement_SetHeight(This
->framebase
.nsiframe
, &nsstr
);
1246 nsAString_Finish(&nsstr
);
1247 if(NS_FAILED(nsres
)) {
1248 ERR("SetHeight failed: %08x\n", nsres
);
1255 static HRESULT WINAPI
HTMLIFrameElement2_get_height(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1257 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1261 TRACE("(%p)->(%p)\n", This
, p
);
1263 nsAString_Init(&nsstr
, NULL
);
1264 nsres
= nsIDOMHTMLIFrameElement_GetHeight(This
->framebase
.nsiframe
, &nsstr
);
1267 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1270 static HRESULT WINAPI
HTMLIFrameElement2_put_width(IHTMLIFrameElement2
*iface
, VARIANT v
)
1272 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1277 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1279 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1283 nsres
= nsIDOMHTMLIFrameElement_SetWidth(This
->framebase
.nsiframe
, &nsstr
);
1284 nsAString_Finish(&nsstr
);
1285 if(NS_FAILED(nsres
)) {
1286 ERR("SetWidth failed: %08x\n", nsres
);
1293 static HRESULT WINAPI
HTMLIFrameElement2_get_width(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1295 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1299 TRACE("(%p)->(%p)\n", This
, p
);
1301 nsAString_Init(&nsstr
, NULL
);
1302 nsres
= nsIDOMHTMLIFrameElement_GetWidth(This
->framebase
.nsiframe
, &nsstr
);
1305 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1308 static const IHTMLIFrameElement2Vtbl HTMLIFrameElement2Vtbl
= {
1309 HTMLIFrameElement2_QueryInterface
,
1310 HTMLIFrameElement2_AddRef
,
1311 HTMLIFrameElement2_Release
,
1312 HTMLIFrameElement2_GetTypeInfoCount
,
1313 HTMLIFrameElement2_GetTypeInfo
,
1314 HTMLIFrameElement2_GetIDsOfNames
,
1315 HTMLIFrameElement2_Invoke
,
1316 HTMLIFrameElement2_put_height
,
1317 HTMLIFrameElement2_get_height
,
1318 HTMLIFrameElement2_put_width
,
1319 HTMLIFrameElement2_get_width
1322 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement3(IHTMLIFrameElement3
*iface
)
1324 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement3_iface
);
1327 static HRESULT WINAPI
HTMLIFrameElement3_QueryInterface(IHTMLIFrameElement3
*iface
,
1328 REFIID riid
, void **ppv
)
1330 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1332 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1335 static ULONG WINAPI
HTMLIFrameElement3_AddRef(IHTMLIFrameElement3
*iface
)
1337 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1339 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1342 static ULONG WINAPI
HTMLIFrameElement3_Release(IHTMLIFrameElement3
*iface
)
1344 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1346 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1349 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfoCount(IHTMLIFrameElement3
*iface
, UINT
*pctinfo
)
1351 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1352 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1356 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfo(IHTMLIFrameElement3
*iface
, UINT iTInfo
,
1357 LCID lcid
, ITypeInfo
**ppTInfo
)
1359 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1360 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1364 static HRESULT WINAPI
HTMLIFrameElement3_GetIDsOfNames(IHTMLIFrameElement3
*iface
, REFIID riid
,
1365 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1367 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1368 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1369 rgszNames
, cNames
, lcid
, rgDispId
);
1372 static HRESULT WINAPI
HTMLIFrameElement3_Invoke(IHTMLIFrameElement3
*iface
, DISPID dispIdMember
,
1373 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1374 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1376 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1377 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1378 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1381 static HRESULT WINAPI
HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3
*iface
, IDispatch
**p
)
1383 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1384 IHTMLDocument2
*doc
;
1387 TRACE("(%p)->(%p)\n", This
, p
);
1389 if(!This
->framebase
.content_window
) {
1394 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
1395 *p
= (IDispatch
*)doc
;
1399 static HRESULT WINAPI
HTMLIFrameElement3_put_src(IHTMLIFrameElement3
*iface
, BSTR v
)
1401 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1402 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1406 static HRESULT WINAPI
HTMLIFrameElement3_get_src(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1408 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1409 FIXME("(%p)->(%p)\n", This
, p
);
1413 static HRESULT WINAPI
HTMLIFrameElement3_put_longDesc(IHTMLIFrameElement3
*iface
, BSTR v
)
1415 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1416 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1420 static HRESULT WINAPI
HTMLIFrameElement3_get_longDesc(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1422 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1423 FIXME("(%p)->(%p)\n", This
, p
);
1427 static HRESULT WINAPI
HTMLIFrameElement3_put_frameBorder(IHTMLIFrameElement3
*iface
, BSTR v
)
1429 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1430 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1434 static HRESULT WINAPI
HTMLIFrameElement3_get_frameBorder(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1436 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1437 FIXME("(%p)->(%p)\n", This
, p
);
1441 static const IHTMLIFrameElement3Vtbl HTMLIFrameElement3Vtbl
= {
1442 HTMLIFrameElement3_QueryInterface
,
1443 HTMLIFrameElement3_AddRef
,
1444 HTMLIFrameElement3_Release
,
1445 HTMLIFrameElement3_GetTypeInfoCount
,
1446 HTMLIFrameElement3_GetTypeInfo
,
1447 HTMLIFrameElement3_GetIDsOfNames
,
1448 HTMLIFrameElement3_Invoke
,
1449 HTMLIFrameElement3_get_contentDocument
,
1450 HTMLIFrameElement3_put_src
,
1451 HTMLIFrameElement3_get_src
,
1452 HTMLIFrameElement3_put_longDesc
,
1453 HTMLIFrameElement3_get_longDesc
,
1454 HTMLIFrameElement3_put_frameBorder
,
1455 HTMLIFrameElement3_get_frameBorder
1458 static inline HTMLIFrame
*iframe_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1460 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
);
1463 static HRESULT
HTMLIFrame_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1465 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1467 if(IsEqualGUID(&IID_IHTMLIFrameElement
, riid
)) {
1468 TRACE("(%p)->(IID_IHTMLIFrameElement %p)\n", This
, ppv
);
1469 *ppv
= &This
->IHTMLIFrameElement_iface
;
1470 }else if(IsEqualGUID(&IID_IHTMLIFrameElement2
, riid
)) {
1471 TRACE("(%p)->(IID_IHTMLIFrameElement2 %p)\n", This
, ppv
);
1472 *ppv
= &This
->IHTMLIFrameElement2_iface
;
1473 }else if(IsEqualGUID(&IID_IHTMLIFrameElement3
, riid
)) {
1474 TRACE("(%p)->(IID_IHTMLIFrameElement3 %p)\n", This
, ppv
);
1475 *ppv
= &This
->IHTMLIFrameElement3_iface
;
1477 return HTMLFrameBase_QI(&This
->framebase
, riid
, ppv
);
1480 IUnknown_AddRef((IUnknown
*)*ppv
);
1484 static void HTMLIFrame_destructor(HTMLDOMNode
*iface
)
1486 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1488 HTMLFrameBase_destructor(&This
->framebase
);
1491 static HRESULT
HTMLIFrame_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
1493 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1495 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
1500 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1501 IDispatch_AddRef(*p
);
1505 static HRESULT
HTMLIFrame_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
1506 DWORD grfdex
, DISPID
*pid
)
1508 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1510 if(!This
->framebase
.content_window
)
1511 return DISP_E_UNKNOWNNAME
;
1513 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, pid
);
1516 static HRESULT
HTMLIFrame_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
1517 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
1519 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1521 if(!This
->framebase
.content_window
) {
1522 ERR("no content window to invoke on\n");
1526 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
1527 flags
, params
, res
, ei
, caller
);
1530 static HRESULT
HTMLIFrame_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
1532 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1534 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
1537 static HRESULT
HTMLIFrame_bind_to_tree(HTMLDOMNode
*iface
)
1539 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1540 nsIDOMDocument
*nsdoc
;
1544 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->framebase
.nsiframe
, &nsdoc
);
1545 if(NS_FAILED(nsres
) || !nsdoc
) {
1546 ERR("GetContentDocument failed: %08x\n", nsres
);
1550 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
1551 nsIDOMDocument_Release(nsdoc
);
1555 static void HTMLIFrame_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
1557 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1559 if(This
->framebase
.nsiframe
)
1560 note_cc_edge((nsISupports
*)This
->framebase
.nsiframe
, "This->nsiframe", cb
);
1563 static void HTMLIFrame_unlink(HTMLDOMNode
*iface
)
1565 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1567 if(This
->framebase
.nsiframe
) {
1568 nsIDOMHTMLIFrameElement
*nsiframe
= This
->framebase
.nsiframe
;
1570 This
->framebase
.nsiframe
= NULL
;
1571 nsIDOMHTMLIFrameElement_Release(nsiframe
);
1575 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
1578 HTMLIFrame_destructor
,
1581 HTMLElement_handle_event
,
1582 HTMLElement_get_attr_col
,
1586 HTMLIFrame_get_document
,
1587 HTMLIFrame_get_readystate
,
1588 HTMLIFrame_get_dispid
,
1590 HTMLIFrame_bind_to_tree
,
1591 HTMLIFrame_traverse
,
1595 static const tid_t HTMLIFrame_iface_tids
[] = {
1598 IHTMLFrameBase2_tid
,
1599 IHTMLIFrameElement_tid
,
1600 IHTMLIFrameElement2_tid
,
1601 IHTMLIFrameElement3_tid
,
1605 static dispex_static_data_t HTMLIFrame_dispex
= {
1608 HTMLIFrame_iface_tids
,
1609 HTMLElement_init_dispex_info
1612 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1616 ret
= heap_alloc_zero(sizeof(HTMLIFrame
));
1618 return E_OUTOFMEMORY
;
1620 ret
->IHTMLIFrameElement_iface
.lpVtbl
= &HTMLIFrameElementVtbl
;
1621 ret
->IHTMLIFrameElement2_iface
.lpVtbl
= &HTMLIFrameElement2Vtbl
;
1622 ret
->IHTMLIFrameElement3_iface
.lpVtbl
= &HTMLIFrameElement3Vtbl
;
1623 ret
->framebase
.element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
1625 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLIFrame_dispex
);
1627 *elem
= &ret
->framebase
.element
;