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
->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 static HRESULT WINAPI
HTMLFrameBase_QueryInterface(IHTMLFrameBase
*iface
, REFIID riid
, void **ppv
)
75 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
77 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
80 static ULONG WINAPI
HTMLFrameBase_AddRef(IHTMLFrameBase
*iface
)
82 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
84 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
87 static ULONG WINAPI
HTMLFrameBase_Release(IHTMLFrameBase
*iface
)
89 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
91 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
94 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase
*iface
, UINT
*pctinfo
)
96 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
98 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
101 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfo(IHTMLFrameBase
*iface
, UINT iTInfo
,
102 LCID lcid
, ITypeInfo
**ppTInfo
)
104 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
106 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
110 static HRESULT WINAPI
HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase
*iface
, REFIID riid
,
111 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
113 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
115 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
116 cNames
, lcid
, rgDispId
);
119 static HRESULT WINAPI
HTMLFrameBase_Invoke(IHTMLFrameBase
*iface
, DISPID dispIdMember
,
120 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
121 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
123 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
125 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
126 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
129 static HRESULT WINAPI
HTMLFrameBase_put_src(IHTMLFrameBase
*iface
, BSTR v
)
131 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
133 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
135 if(!This
->content_window
|| !This
->element
.node
.doc
|| !This
->element
.node
.doc
->outer_window
) {
139 nsAString_InitDepend(&nsstr
, v
);
141 nsres
= nsIDOMHTMLFrameElement_SetSrc(This
->nsframe
, &nsstr
);
143 nsres
= nsIDOMHTMLIFrameElement_SetSrc(This
->nsiframe
, &nsstr
);
144 nsAString_Finish(&nsstr
);
145 if(NS_FAILED(nsres
)) {
146 ERR("SetSrc failed: %08lx\n", nsres
);
153 return navigate_url(This
->content_window
, v
, This
->element
.node
.doc
->outer_window
->uri
, BINDING_NAVIGATED
);
156 static HRESULT WINAPI
HTMLFrameBase_get_src(IHTMLFrameBase
*iface
, BSTR
*p
)
158 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
162 TRACE("(%p)->(%p)\n", This
, p
);
164 if(!This
->nsframe
&& !This
->nsiframe
) {
165 ERR("No attached frame object\n");
169 nsAString_Init(&nsstr
, NULL
);
171 nsres
= nsIDOMHTMLFrameElement_GetSrc(This
->nsframe
, &nsstr
);
173 nsres
= nsIDOMHTMLIFrameElement_GetSrc(This
->nsiframe
, &nsstr
);
174 return return_nsstr(nsres
, &nsstr
, p
);
177 static HRESULT WINAPI
HTMLFrameBase_put_name(IHTMLFrameBase
*iface
, BSTR v
)
179 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
183 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
185 if(!This
->nsframe
&& !This
->nsiframe
) {
186 ERR("No attached ns frame object\n");
190 nsAString_InitDepend(&name_str
, v
);
192 nsres
= nsIDOMHTMLFrameElement_SetName(This
->nsframe
, &name_str
);
194 nsres
= nsIDOMHTMLIFrameElement_SetName(This
->nsiframe
, &name_str
);
195 nsAString_Finish(&name_str
);
196 if(NS_FAILED(nsres
)) {
197 ERR("SetName failed: %08lx\n", nsres
);
204 static HRESULT WINAPI
HTMLFrameBase_get_name(IHTMLFrameBase
*iface
, BSTR
*p
)
206 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
210 TRACE("(%p)->(%p)\n", This
, p
);
212 if(!This
->nsframe
&& !This
->nsiframe
) {
213 ERR("No attached ns frame object\n");
217 nsAString_Init(&nsstr
, NULL
);
219 nsres
= nsIDOMHTMLFrameElement_GetName(This
->nsframe
, &nsstr
);
221 nsres
= nsIDOMHTMLIFrameElement_GetName(This
->nsiframe
, &nsstr
);
222 return return_nsstr(nsres
, &nsstr
, p
);
225 static HRESULT WINAPI
HTMLFrameBase_put_border(IHTMLFrameBase
*iface
, VARIANT v
)
227 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
228 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
232 static HRESULT WINAPI
HTMLFrameBase_get_border(IHTMLFrameBase
*iface
, VARIANT
*p
)
234 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
235 FIXME("(%p)->(%p)\n", This
, p
);
239 static HRESULT WINAPI
HTMLFrameBase_put_frameBorder(IHTMLFrameBase
*iface
, BSTR v
)
241 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
245 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
247 if(!This
->nsframe
&& !This
->nsiframe
) {
248 ERR("No attached ns frame object\n");
252 nsAString_InitDepend(&nsstr
, v
);
254 nsres
= nsIDOMHTMLFrameElement_SetFrameBorder(This
->nsframe
, &nsstr
);
256 nsres
= nsIDOMHTMLIFrameElement_SetFrameBorder(This
->nsiframe
, &nsstr
);
257 nsAString_Finish(&nsstr
);
258 if(NS_FAILED(nsres
)) {
259 ERR("SetFrameBorder failed: %08lx\n", nsres
);
266 static HRESULT WINAPI
HTMLFrameBase_get_frameBorder(IHTMLFrameBase
*iface
, BSTR
*p
)
268 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
272 TRACE("(%p)->(%p)\n", This
, p
);
274 if(!This
->nsframe
&& !This
->nsiframe
) {
275 ERR("No attached ns frame object\n");
279 nsAString_Init(&nsstr
, NULL
);
281 nsres
= nsIDOMHTMLFrameElement_GetFrameBorder(This
->nsframe
, &nsstr
);
283 nsres
= nsIDOMHTMLIFrameElement_GetFrameBorder(This
->nsiframe
, &nsstr
);
284 return return_nsstr(nsres
, &nsstr
, p
);
287 static HRESULT WINAPI
HTMLFrameBase_put_frameSpacing(IHTMLFrameBase
*iface
, VARIANT v
)
289 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
290 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
294 static HRESULT WINAPI
HTMLFrameBase_get_frameSpacing(IHTMLFrameBase
*iface
, VARIANT
*p
)
296 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
297 FIXME("(%p)->(%p)\n", This
, p
);
301 static HRESULT WINAPI
HTMLFrameBase_put_marginWidth(IHTMLFrameBase
*iface
, VARIANT v
)
303 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
307 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
309 if(V_VT(&v
) != VT_BSTR
) {
310 FIXME("unsupported %s\n", debugstr_variant(&v
));
314 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
316 nsres
= nsIDOMHTMLFrameElement_SetMarginWidth(This
->nsframe
, &nsstr
);
318 nsres
= nsIDOMHTMLIFrameElement_SetMarginWidth(This
->nsiframe
, &nsstr
);
319 nsAString_Finish(&nsstr
);
320 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
323 static HRESULT WINAPI
HTMLFrameBase_get_marginWidth(IHTMLFrameBase
*iface
, VARIANT
*p
)
325 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
330 TRACE("(%p)->(%p)\n", This
, p
);
332 nsAString_Init(&nsstr
, NULL
);
334 nsres
= nsIDOMHTMLFrameElement_GetMarginWidth(This
->nsframe
, &nsstr
);
336 nsres
= nsIDOMHTMLIFrameElement_GetMarginWidth(This
->nsiframe
, &nsstr
);
337 if(NS_SUCCEEDED(nsres
)) {
338 const PRUnichar
*str
, *end
;
340 nsAString_GetData(&nsstr
, &str
);
345 end
= wcsstr(str
, L
"px");
347 end
= str
+lstrlenW(str
);
348 ret
= SysAllocStringLen(str
, end
-str
);
353 hres
= E_OUTOFMEMORY
;
360 ERR("GetMarginWidth failed: %08lx\n", nsres
);
364 nsAString_Finish(&nsstr
);
368 static HRESULT WINAPI
HTMLFrameBase_put_marginHeight(IHTMLFrameBase
*iface
, VARIANT v
)
370 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
374 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
376 if(V_VT(&v
) != VT_BSTR
) {
377 FIXME("unsupported %s\n", debugstr_variant(&v
));
381 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
383 nsres
= nsIDOMHTMLFrameElement_SetMarginHeight(This
->nsframe
, &nsstr
);
385 nsres
= nsIDOMHTMLIFrameElement_SetMarginHeight(This
->nsiframe
, &nsstr
);
386 nsAString_Finish(&nsstr
);
387 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
390 static HRESULT WINAPI
HTMLFrameBase_get_marginHeight(IHTMLFrameBase
*iface
, VARIANT
*p
)
392 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
397 TRACE("(%p)->(%p)\n", This
, p
);
399 nsAString_Init(&nsstr
, NULL
);
401 nsres
= nsIDOMHTMLFrameElement_GetMarginHeight(This
->nsframe
, &nsstr
);
403 nsres
= nsIDOMHTMLIFrameElement_GetMarginHeight(This
->nsiframe
, &nsstr
);
404 if(NS_SUCCEEDED(nsres
)) {
405 const PRUnichar
*str
, *end
;
407 nsAString_GetData(&nsstr
, &str
);
412 end
= wcsstr(str
, L
"px");
414 end
= str
+lstrlenW(str
);
415 ret
= SysAllocStringLen(str
, end
-str
);
420 hres
= E_OUTOFMEMORY
;
427 ERR("SetMarginHeight failed: %08lx\n", nsres
);
431 nsAString_Finish(&nsstr
);
435 static HRESULT WINAPI
HTMLFrameBase_put_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL v
)
437 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
438 FIXME("(%p)->(%x)\n", This
, v
);
442 static HRESULT WINAPI
HTMLFrameBase_get_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL
*p
)
444 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
445 FIXME("(%p)->(%p)\n", This
, p
);
449 static HRESULT WINAPI
HTMLFrameBase_put_scrolling(IHTMLFrameBase
*iface
, BSTR v
)
451 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
455 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
457 if(!(!wcsicmp(v
, L
"yes") || !wcsicmp(v
, L
"no") || !wcsicmp(v
, L
"auto")))
461 nsAString_InitDepend(&nsstr
, v
);
462 nsres
= nsIDOMHTMLFrameElement_SetScrolling(This
->nsframe
, &nsstr
);
463 }else if(This
->nsiframe
) {
464 nsAString_InitDepend(&nsstr
, v
);
465 nsres
= nsIDOMHTMLIFrameElement_SetScrolling(This
->nsiframe
, &nsstr
);
467 ERR("No attached ns frame object\n");
470 nsAString_Finish(&nsstr
);
472 if(NS_FAILED(nsres
)) {
473 ERR("SetScrolling failed: 0x%08lx\n", nsres
);
480 static HRESULT WINAPI
HTMLFrameBase_get_scrolling(IHTMLFrameBase
*iface
, BSTR
*p
)
482 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
484 const PRUnichar
*strdata
;
487 TRACE("(%p)->(%p)\n", This
, p
);
490 nsAString_Init(&nsstr
, NULL
);
491 nsres
= nsIDOMHTMLFrameElement_GetScrolling(This
->nsframe
, &nsstr
);
492 }else if(This
->nsiframe
) {
493 nsAString_Init(&nsstr
, NULL
);
494 nsres
= nsIDOMHTMLIFrameElement_GetScrolling(This
->nsiframe
, &nsstr
);
496 ERR("No attached ns frame object\n");
500 if(NS_FAILED(nsres
)) {
501 ERR("GetScrolling failed: 0x%08lx\n", nsres
);
502 nsAString_Finish(&nsstr
);
506 nsAString_GetData(&nsstr
, &strdata
);
509 *p
= SysAllocString(strdata
);
511 *p
= SysAllocString(L
"auto");
513 nsAString_Finish(&nsstr
);
515 return *p
? S_OK
: E_OUTOFMEMORY
;
518 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl
= {
519 HTMLFrameBase_QueryInterface
,
520 HTMLFrameBase_AddRef
,
521 HTMLFrameBase_Release
,
522 HTMLFrameBase_GetTypeInfoCount
,
523 HTMLFrameBase_GetTypeInfo
,
524 HTMLFrameBase_GetIDsOfNames
,
525 HTMLFrameBase_Invoke
,
526 HTMLFrameBase_put_src
,
527 HTMLFrameBase_get_src
,
528 HTMLFrameBase_put_name
,
529 HTMLFrameBase_get_name
,
530 HTMLFrameBase_put_border
,
531 HTMLFrameBase_get_border
,
532 HTMLFrameBase_put_frameBorder
,
533 HTMLFrameBase_get_frameBorder
,
534 HTMLFrameBase_put_frameSpacing
,
535 HTMLFrameBase_get_frameSpacing
,
536 HTMLFrameBase_put_marginWidth
,
537 HTMLFrameBase_get_marginWidth
,
538 HTMLFrameBase_put_marginHeight
,
539 HTMLFrameBase_get_marginHeight
,
540 HTMLFrameBase_put_noResize
,
541 HTMLFrameBase_get_noResize
,
542 HTMLFrameBase_put_scrolling
,
543 HTMLFrameBase_get_scrolling
546 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase2(IHTMLFrameBase2
*iface
)
548 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase2_iface
);
551 static HRESULT WINAPI
HTMLFrameBase2_QueryInterface(IHTMLFrameBase2
*iface
, REFIID riid
, void **ppv
)
553 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
555 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
558 static ULONG WINAPI
HTMLFrameBase2_AddRef(IHTMLFrameBase2
*iface
)
560 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
562 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
565 static ULONG WINAPI
HTMLFrameBase2_Release(IHTMLFrameBase2
*iface
)
567 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
569 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
572 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2
*iface
, UINT
*pctinfo
)
574 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
575 FIXME("(%p)\n", This
);
579 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2
*iface
, UINT iTInfo
,
580 LCID lcid
, ITypeInfo
**ppTInfo
)
582 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
583 FIXME("(%p)\n", This
);
587 static HRESULT WINAPI
HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2
*iface
, REFIID riid
,
588 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
590 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
591 FIXME("(%p)\n", This
);
595 static HRESULT WINAPI
HTMLFrameBase2_Invoke(IHTMLFrameBase2
*iface
, DISPID dispIdMember
,
596 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
597 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
599 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
600 FIXME("(%p)\n", This
);
604 static HRESULT WINAPI
HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2
*iface
, IHTMLWindow2
**p
)
606 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
608 TRACE("(%p)->(%p)\n", This
, p
);
610 if(This
->content_window
) {
611 IHTMLWindow2_AddRef(&This
->content_window
->base
.IHTMLWindow2_iface
);
612 *p
= &This
->content_window
->base
.IHTMLWindow2_iface
;
614 WARN("NULL content window\n");
620 static HRESULT WINAPI
HTMLFrameBase2_put_onload(IHTMLFrameBase2
*iface
, VARIANT v
)
622 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
624 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
626 return set_node_event(&This
->element
.node
, EVENTID_LOAD
, &v
);
629 static HRESULT WINAPI
HTMLFrameBase2_get_onload(IHTMLFrameBase2
*iface
, VARIANT
*p
)
631 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
633 TRACE("(%p)->(%p)\n", This
, p
);
635 return get_node_event(&This
->element
.node
, EVENTID_LOAD
, p
);
638 static HRESULT WINAPI
HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT v
)
640 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
641 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
645 static HRESULT WINAPI
HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT
*p
)
647 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
648 FIXME("(%p)->(%p)\n", This
, p
);
652 static HRESULT WINAPI
HTMLFrameBase2_get_readyState(IHTMLFrameBase2
*iface
, BSTR
*p
)
654 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
656 TRACE("(%p)->(%p)\n", This
, p
);
658 if(!This
->content_window
|| !This
->content_window
->base
.inner_window
->doc
) {
659 FIXME("no document associated\n");
663 return IHTMLDocument2_get_readyState(&This
->content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
, p
);
666 static HRESULT WINAPI
HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL v
)
668 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
670 FIXME("(%p)->(%x) semi-stub\n", This
, v
);
675 static HRESULT WINAPI
HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL
*p
)
677 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
679 FIXME("(%p)->(%p) semi-stub\n", This
, p
);
685 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl
= {
686 HTMLFrameBase2_QueryInterface
,
687 HTMLFrameBase2_AddRef
,
688 HTMLFrameBase2_Release
,
689 HTMLFrameBase2_GetTypeInfoCount
,
690 HTMLFrameBase2_GetTypeInfo
,
691 HTMLFrameBase2_GetIDsOfNames
,
692 HTMLFrameBase2_Invoke
,
693 HTMLFrameBase2_get_contentWindow
,
694 HTMLFrameBase2_put_onload
,
695 HTMLFrameBase2_get_onload
,
696 HTMLFrameBase2_put_onreadystatechange
,
697 HTMLFrameBase2_get_onreadystatechange
,
698 HTMLFrameBase2_get_readyState
,
699 HTMLFrameBase2_put_allowTransparency
,
700 HTMLFrameBase2_get_allowTransparency
703 static void *HTMLFrameBase_QI(HTMLFrameBase
*This
, REFIID riid
)
705 if(IsEqualGUID(&IID_IHTMLFrameBase
, riid
))
706 return &This
->IHTMLFrameBase_iface
;
707 if(IsEqualGUID(&IID_IHTMLFrameBase2
, riid
))
708 return &This
->IHTMLFrameBase2_iface
;
710 return HTMLElement_query_interface(&This
->element
.node
.event_target
.dispex
, riid
);
713 static void HTMLFrameBase_destructor(HTMLFrameBase
*This
)
715 if(This
->content_window
)
716 This
->content_window
->frame_element
= NULL
;
718 HTMLElement_destructor(&This
->element
.node
.event_target
.dispex
);
721 static void HTMLFrameBase_Init(HTMLFrameBase
*This
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
,
722 dispex_static_data_t
*dispex_data
)
726 This
->IHTMLFrameBase_iface
.lpVtbl
= &HTMLFrameBaseVtbl
;
727 This
->IHTMLFrameBase2_iface
.lpVtbl
= &HTMLFrameBase2Vtbl
;
729 HTMLElement_Init(&This
->element
, doc
, nselem
, dispex_data
);
731 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFrameElement
, (void**)&This
->nsframe
);
732 if(NS_FAILED(nsres
)) {
733 This
->nsframe
= NULL
;
734 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLIFrameElement
, (void**)&This
->nsiframe
);
735 assert(nsres
== NS_OK
);
737 This
->nsiframe
= NULL
;
741 struct HTMLFrameElement
{
742 HTMLFrameBase framebase
;
743 IHTMLFrameElement3 IHTMLFrameElement3_iface
;
746 static inline HTMLFrameElement
*impl_from_IHTMLFrameElement3(IHTMLFrameElement3
*iface
)
748 return CONTAINING_RECORD(iface
, HTMLFrameElement
, IHTMLFrameElement3_iface
);
751 static HRESULT WINAPI
HTMLFrameElement3_QueryInterface(IHTMLFrameElement3
*iface
,
752 REFIID riid
, void **ppv
)
754 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
756 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
759 static ULONG WINAPI
HTMLFrameElement3_AddRef(IHTMLFrameElement3
*iface
)
761 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
763 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
766 static ULONG WINAPI
HTMLFrameElement3_Release(IHTMLFrameElement3
*iface
)
768 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
770 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
773 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3
*iface
, UINT
*pctinfo
)
775 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
776 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
780 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3
*iface
, UINT iTInfo
,
781 LCID lcid
, ITypeInfo
**ppTInfo
)
783 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
784 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
788 static HRESULT WINAPI
HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3
*iface
, REFIID riid
,
789 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
791 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
792 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
793 rgszNames
, cNames
, lcid
, rgDispId
);
796 static HRESULT WINAPI
HTMLFrameElement3_Invoke(IHTMLFrameElement3
*iface
, DISPID dispIdMember
,
797 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
798 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
800 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
801 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
802 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
805 static HRESULT WINAPI
HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3
*iface
, IDispatch
**p
)
807 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
811 TRACE("(%p)->(%p)\n", This
, p
);
813 if(!This
->framebase
.content_window
) {
814 FIXME("NULL window\n");
818 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
822 *p
= doc
? (IDispatch
*)doc
: NULL
;
826 static HRESULT WINAPI
HTMLFrameElement3_put_src(IHTMLFrameElement3
*iface
, BSTR v
)
828 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
829 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
833 static HRESULT WINAPI
HTMLFrameElement3_get_src(IHTMLFrameElement3
*iface
, BSTR
*p
)
835 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
836 FIXME("(%p)->(%p)\n", This
, p
);
840 static HRESULT WINAPI
HTMLFrameElement3_put_longDesc(IHTMLFrameElement3
*iface
, BSTR v
)
842 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
843 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
847 static HRESULT WINAPI
HTMLFrameElement3_get_longDesc(IHTMLFrameElement3
*iface
, BSTR
*p
)
849 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
850 FIXME("(%p)->(%p)\n", This
, p
);
854 static HRESULT WINAPI
HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3
*iface
, BSTR v
)
856 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
857 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
861 static HRESULT WINAPI
HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3
*iface
, BSTR
*p
)
863 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
864 FIXME("(%p)->(%p)\n", This
, p
);
868 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
= {
869 HTMLFrameElement3_QueryInterface
,
870 HTMLFrameElement3_AddRef
,
871 HTMLFrameElement3_Release
,
872 HTMLFrameElement3_GetTypeInfoCount
,
873 HTMLFrameElement3_GetTypeInfo
,
874 HTMLFrameElement3_GetIDsOfNames
,
875 HTMLFrameElement3_Invoke
,
876 HTMLFrameElement3_get_contentDocument
,
877 HTMLFrameElement3_put_src
,
878 HTMLFrameElement3_get_src
,
879 HTMLFrameElement3_put_longDesc
,
880 HTMLFrameElement3_get_longDesc
,
881 HTMLFrameElement3_put_frameBorder
,
882 HTMLFrameElement3_get_frameBorder
885 static inline HTMLFrameElement
*frame_from_HTMLDOMNode(HTMLDOMNode
*iface
)
887 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
);
890 static HRESULT
HTMLFrameElement_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
892 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
894 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
899 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
;
900 IDispatch_AddRef(*p
);
904 static HRESULT
HTMLFrameElement_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
906 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
908 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
911 static HRESULT
HTMLFrameElement_bind_to_tree(HTMLDOMNode
*iface
)
913 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
914 nsIDOMDocument
*nsdoc
;
918 nsres
= nsIDOMHTMLFrameElement_GetContentDocument(This
->framebase
.nsframe
, &nsdoc
);
919 if(NS_FAILED(nsres
) || !nsdoc
) {
920 ERR("GetContentDocument failed: %08lx\n", nsres
);
924 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
925 nsIDOMDocument_Release(nsdoc
);
929 static inline HTMLFrameElement
*frame_from_DispatchEx(DispatchEx
*iface
)
931 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
.event_target
.dispex
);
934 static void *HTMLFrameElement_query_interface(DispatchEx
*dispex
, REFIID riid
)
936 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
938 if(IsEqualGUID(&IID_IHTMLFrameElement3
, riid
))
939 return &This
->IHTMLFrameElement3_iface
;
941 return HTMLFrameBase_QI(&This
->framebase
, riid
);
944 static void HTMLFrameElement_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
946 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
947 HTMLDOMNode_traverse(dispex
, cb
);
949 if(This
->framebase
.nsframe
)
950 note_cc_edge((nsISupports
*)This
->framebase
.nsframe
, "nsframe", cb
);
953 static void HTMLFrameElement_unlink(DispatchEx
*dispex
)
955 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
956 HTMLDOMNode_unlink(dispex
);
957 unlink_ref(&This
->framebase
.nsframe
);
960 static void HTMLFrameElement_destructor(DispatchEx
*dispex
)
962 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
964 HTMLFrameBase_destructor(&This
->framebase
);
967 static HRESULT
HTMLFrameElement_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD grfdex
, DISPID
*dispid
)
969 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
971 if(!This
->framebase
.content_window
)
972 return DISP_E_UNKNOWNNAME
;
974 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, dispid
);
977 static HRESULT
HTMLFrameElement_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
979 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
980 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
982 if(!This
->framebase
.content_window
||
983 idx
>= This
->framebase
.content_window
->base
.inner_window
->global_prop_cnt
)
984 return DISP_E_MEMBERNOTFOUND
;
986 *name
= SysAllocString(This
->framebase
.content_window
->base
.inner_window
->global_props
[idx
].name
);
987 return *name
? S_OK
: E_OUTOFMEMORY
;
990 static HRESULT
HTMLFrameElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
991 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
993 HTMLFrameElement
*This
= frame_from_DispatchEx(dispex
);
995 if(!This
->framebase
.content_window
) {
996 ERR("no content window to invoke on\n");
1000 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
1001 flags
, params
, res
, ei
, caller
);
1004 static const NodeImplVtbl HTMLFrameElementImplVtbl
= {
1005 .clsid
= &CLSID_HTMLFrameElement
,
1006 .cpc_entries
= HTMLElement_cpc
,
1007 .clone
= HTMLElement_clone
,
1008 .get_attr_col
= HTMLElement_get_attr_col
,
1009 .get_document
= HTMLFrameElement_get_document
,
1010 .get_readystate
= HTMLFrameElement_get_readystate
,
1011 .bind_to_tree
= HTMLFrameElement_bind_to_tree
,
1014 static const event_target_vtbl_t HTMLFrameElement_event_target_vtbl
= {
1016 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
1017 .query_interface
= HTMLFrameElement_query_interface
,
1018 .destructor
= HTMLFrameElement_destructor
,
1019 .traverse
= HTMLFrameElement_traverse
,
1020 .unlink
= HTMLFrameElement_unlink
,
1021 .get_dispid
= HTMLFrameElement_get_dispid
,
1022 .get_name
= HTMLFrameElement_get_name
,
1023 .invoke
= HTMLFrameElement_invoke
1025 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
1026 .handle_event
= HTMLElement_handle_event
1029 static const tid_t HTMLFrameElement_iface_tids
[] = {
1032 IHTMLFrameBase2_tid
,
1033 IHTMLFrameElement3_tid
,
1037 static dispex_static_data_t HTMLFrameElement_dispex
= {
1039 &HTMLFrameElement_event_target_vtbl
.dispex_vtbl
,
1040 DispHTMLFrameElement_tid
,
1041 HTMLFrameElement_iface_tids
,
1042 HTMLElement_init_dispex_info
1045 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1047 HTMLFrameElement
*ret
;
1049 ret
= calloc(1, sizeof(HTMLFrameElement
));
1051 return E_OUTOFMEMORY
;
1053 ret
->framebase
.element
.node
.vtbl
= &HTMLFrameElementImplVtbl
;
1054 ret
->IHTMLFrameElement3_iface
.lpVtbl
= &HTMLFrameElement3Vtbl
;
1056 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLFrameElement_dispex
);
1058 *elem
= &ret
->framebase
.element
;
1063 HTMLFrameBase framebase
;
1064 IHTMLIFrameElement IHTMLIFrameElement_iface
;
1065 IHTMLIFrameElement2 IHTMLIFrameElement2_iface
;
1066 IHTMLIFrameElement3 IHTMLIFrameElement3_iface
;
1069 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement(IHTMLIFrameElement
*iface
)
1071 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement_iface
);
1074 static HRESULT WINAPI
HTMLIFrameElement_QueryInterface(IHTMLIFrameElement
*iface
,
1075 REFIID riid
, void **ppv
)
1077 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1079 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1082 static ULONG WINAPI
HTMLIFrameElement_AddRef(IHTMLIFrameElement
*iface
)
1084 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1086 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1089 static ULONG WINAPI
HTMLIFrameElement_Release(IHTMLIFrameElement
*iface
)
1091 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1093 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1096 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfoCount(IHTMLIFrameElement
*iface
, UINT
*pctinfo
)
1098 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1099 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1103 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfo(IHTMLIFrameElement
*iface
, UINT iTInfo
,
1104 LCID lcid
, ITypeInfo
**ppTInfo
)
1106 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1107 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1111 static HRESULT WINAPI
HTMLIFrameElement_GetIDsOfNames(IHTMLIFrameElement
*iface
, REFIID riid
,
1112 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1114 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1115 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1116 rgszNames
, cNames
, lcid
, rgDispId
);
1119 static HRESULT WINAPI
HTMLIFrameElement_Invoke(IHTMLIFrameElement
*iface
, DISPID dispIdMember
,
1120 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1121 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1123 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1124 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1125 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1128 static HRESULT WINAPI
HTMLIFrameElement_put_vspace(IHTMLIFrameElement
*iface
, LONG v
)
1130 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1131 FIXME("(%p)->(%ld)\n", This
, v
);
1135 static HRESULT WINAPI
HTMLIFrameElement_get_vspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1137 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1138 FIXME("(%p)->(%p)\n", This
, p
);
1142 static HRESULT WINAPI
HTMLIFrameElement_put_hspace(IHTMLIFrameElement
*iface
, LONG v
)
1144 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1145 FIXME("(%p)->(%ld)\n", This
, v
);
1149 static HRESULT WINAPI
HTMLIFrameElement_get_hspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1151 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1152 FIXME("(%p)->(%p)\n", This
, p
);
1156 static HRESULT WINAPI
HTMLIFrameElement_put_align(IHTMLIFrameElement
*iface
, BSTR v
)
1158 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1159 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1163 static HRESULT WINAPI
HTMLIFrameElement_get_align(IHTMLIFrameElement
*iface
, BSTR
*p
)
1165 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1166 FIXME("(%p)->(%p)\n", This
, p
);
1170 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl
= {
1171 HTMLIFrameElement_QueryInterface
,
1172 HTMLIFrameElement_AddRef
,
1173 HTMLIFrameElement_Release
,
1174 HTMLIFrameElement_GetTypeInfoCount
,
1175 HTMLIFrameElement_GetTypeInfo
,
1176 HTMLIFrameElement_GetIDsOfNames
,
1177 HTMLIFrameElement_Invoke
,
1178 HTMLIFrameElement_put_vspace
,
1179 HTMLIFrameElement_get_vspace
,
1180 HTMLIFrameElement_put_hspace
,
1181 HTMLIFrameElement_get_hspace
,
1182 HTMLIFrameElement_put_align
,
1183 HTMLIFrameElement_get_align
1186 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement2(IHTMLIFrameElement2
*iface
)
1188 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement2_iface
);
1191 static HRESULT WINAPI
HTMLIFrameElement2_QueryInterface(IHTMLIFrameElement2
*iface
,
1192 REFIID riid
, void **ppv
)
1194 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1196 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1199 static ULONG WINAPI
HTMLIFrameElement2_AddRef(IHTMLIFrameElement2
*iface
)
1201 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1203 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1206 static ULONG WINAPI
HTMLIFrameElement2_Release(IHTMLIFrameElement2
*iface
)
1208 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1210 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1213 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfoCount(IHTMLIFrameElement2
*iface
, UINT
*pctinfo
)
1215 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1216 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1220 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfo(IHTMLIFrameElement2
*iface
, UINT iTInfo
,
1221 LCID lcid
, ITypeInfo
**ppTInfo
)
1223 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1224 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1228 static HRESULT WINAPI
HTMLIFrameElement2_GetIDsOfNames(IHTMLIFrameElement2
*iface
, REFIID riid
,
1229 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1231 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1232 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1233 rgszNames
, cNames
, lcid
, rgDispId
);
1236 static HRESULT WINAPI
HTMLIFrameElement2_Invoke(IHTMLIFrameElement2
*iface
, DISPID dispIdMember
,
1237 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1238 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1240 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1241 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1242 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1245 static HRESULT WINAPI
HTMLIFrameElement2_put_height(IHTMLIFrameElement2
*iface
, VARIANT v
)
1247 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1252 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1254 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1258 nsres
= nsIDOMHTMLIFrameElement_SetHeight(This
->framebase
.nsiframe
, &nsstr
);
1259 nsAString_Finish(&nsstr
);
1260 if(NS_FAILED(nsres
)) {
1261 ERR("SetHeight failed: %08lx\n", nsres
);
1268 static HRESULT WINAPI
HTMLIFrameElement2_get_height(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1270 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1274 TRACE("(%p)->(%p)\n", This
, p
);
1276 nsAString_Init(&nsstr
, NULL
);
1277 nsres
= nsIDOMHTMLIFrameElement_GetHeight(This
->framebase
.nsiframe
, &nsstr
);
1280 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1283 static HRESULT WINAPI
HTMLIFrameElement2_put_width(IHTMLIFrameElement2
*iface
, VARIANT v
)
1285 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1290 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1292 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1296 nsres
= nsIDOMHTMLIFrameElement_SetWidth(This
->framebase
.nsiframe
, &nsstr
);
1297 nsAString_Finish(&nsstr
);
1298 if(NS_FAILED(nsres
)) {
1299 ERR("SetWidth failed: %08lx\n", nsres
);
1306 static HRESULT WINAPI
HTMLIFrameElement2_get_width(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1308 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1312 TRACE("(%p)->(%p)\n", This
, p
);
1314 nsAString_Init(&nsstr
, NULL
);
1315 nsres
= nsIDOMHTMLIFrameElement_GetWidth(This
->framebase
.nsiframe
, &nsstr
);
1318 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1321 static const IHTMLIFrameElement2Vtbl HTMLIFrameElement2Vtbl
= {
1322 HTMLIFrameElement2_QueryInterface
,
1323 HTMLIFrameElement2_AddRef
,
1324 HTMLIFrameElement2_Release
,
1325 HTMLIFrameElement2_GetTypeInfoCount
,
1326 HTMLIFrameElement2_GetTypeInfo
,
1327 HTMLIFrameElement2_GetIDsOfNames
,
1328 HTMLIFrameElement2_Invoke
,
1329 HTMLIFrameElement2_put_height
,
1330 HTMLIFrameElement2_get_height
,
1331 HTMLIFrameElement2_put_width
,
1332 HTMLIFrameElement2_get_width
1335 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement3(IHTMLIFrameElement3
*iface
)
1337 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement3_iface
);
1340 static HRESULT WINAPI
HTMLIFrameElement3_QueryInterface(IHTMLIFrameElement3
*iface
,
1341 REFIID riid
, void **ppv
)
1343 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1345 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1348 static ULONG WINAPI
HTMLIFrameElement3_AddRef(IHTMLIFrameElement3
*iface
)
1350 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1352 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1355 static ULONG WINAPI
HTMLIFrameElement3_Release(IHTMLIFrameElement3
*iface
)
1357 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1359 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1362 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfoCount(IHTMLIFrameElement3
*iface
, UINT
*pctinfo
)
1364 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1365 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1369 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfo(IHTMLIFrameElement3
*iface
, UINT iTInfo
,
1370 LCID lcid
, ITypeInfo
**ppTInfo
)
1372 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1373 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1377 static HRESULT WINAPI
HTMLIFrameElement3_GetIDsOfNames(IHTMLIFrameElement3
*iface
, REFIID riid
,
1378 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1380 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1381 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1382 rgszNames
, cNames
, lcid
, rgDispId
);
1385 static HRESULT WINAPI
HTMLIFrameElement3_Invoke(IHTMLIFrameElement3
*iface
, DISPID dispIdMember
,
1386 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1387 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1389 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1390 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1391 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1394 static HRESULT WINAPI
HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3
*iface
, IDispatch
**p
)
1396 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1397 IHTMLDocument2
*doc
;
1400 TRACE("(%p)->(%p)\n", This
, p
);
1402 if(!This
->framebase
.content_window
) {
1407 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
1408 *p
= (IDispatch
*)doc
;
1412 static HRESULT WINAPI
HTMLIFrameElement3_put_src(IHTMLIFrameElement3
*iface
, BSTR v
)
1414 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1415 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1419 static HRESULT WINAPI
HTMLIFrameElement3_get_src(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1421 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1422 FIXME("(%p)->(%p)\n", This
, p
);
1426 static HRESULT WINAPI
HTMLIFrameElement3_put_longDesc(IHTMLIFrameElement3
*iface
, BSTR v
)
1428 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1429 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1433 static HRESULT WINAPI
HTMLIFrameElement3_get_longDesc(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1435 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1436 FIXME("(%p)->(%p)\n", This
, p
);
1440 static HRESULT WINAPI
HTMLIFrameElement3_put_frameBorder(IHTMLIFrameElement3
*iface
, BSTR v
)
1442 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1443 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1447 static HRESULT WINAPI
HTMLIFrameElement3_get_frameBorder(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1449 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1450 FIXME("(%p)->(%p)\n", This
, p
);
1454 static const IHTMLIFrameElement3Vtbl HTMLIFrameElement3Vtbl
= {
1455 HTMLIFrameElement3_QueryInterface
,
1456 HTMLIFrameElement3_AddRef
,
1457 HTMLIFrameElement3_Release
,
1458 HTMLIFrameElement3_GetTypeInfoCount
,
1459 HTMLIFrameElement3_GetTypeInfo
,
1460 HTMLIFrameElement3_GetIDsOfNames
,
1461 HTMLIFrameElement3_Invoke
,
1462 HTMLIFrameElement3_get_contentDocument
,
1463 HTMLIFrameElement3_put_src
,
1464 HTMLIFrameElement3_get_src
,
1465 HTMLIFrameElement3_put_longDesc
,
1466 HTMLIFrameElement3_get_longDesc
,
1467 HTMLIFrameElement3_put_frameBorder
,
1468 HTMLIFrameElement3_get_frameBorder
1471 static inline HTMLIFrame
*iframe_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1473 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
);
1476 static HRESULT
HTMLIFrame_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
1478 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1480 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
1485 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->IHTMLDocument2_iface
;
1486 IDispatch_AddRef(*p
);
1490 static HRESULT
HTMLIFrame_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
1492 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1494 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
1497 static HRESULT
HTMLIFrame_bind_to_tree(HTMLDOMNode
*iface
)
1499 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1500 nsIDOMDocument
*nsdoc
;
1504 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->framebase
.nsiframe
, &nsdoc
);
1505 if(NS_FAILED(nsres
) || !nsdoc
) {
1506 ERR("GetContentDocument failed: %08lx\n", nsres
);
1510 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
1511 nsIDOMDocument_Release(nsdoc
);
1515 static inline HTMLIFrame
*iframe_from_DispatchEx(DispatchEx
*iface
)
1517 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
.event_target
.dispex
);
1520 static void *HTMLIFrame_query_interface(DispatchEx
*dispex
, REFIID riid
)
1522 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1524 if(IsEqualGUID(&IID_IHTMLIFrameElement
, riid
))
1525 return &This
->IHTMLIFrameElement_iface
;
1526 if(IsEqualGUID(&IID_IHTMLIFrameElement2
, riid
))
1527 return &This
->IHTMLIFrameElement2_iface
;
1528 if(IsEqualGUID(&IID_IHTMLIFrameElement3
, riid
))
1529 return &This
->IHTMLIFrameElement3_iface
;
1531 return HTMLFrameBase_QI(&This
->framebase
, riid
);
1534 static void HTMLIFrame_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
1536 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1537 HTMLDOMNode_traverse(dispex
, cb
);
1539 if(This
->framebase
.nsiframe
)
1540 note_cc_edge((nsISupports
*)This
->framebase
.nsiframe
, "nsiframe", cb
);
1543 static void HTMLIFrame_unlink(DispatchEx
*dispex
)
1545 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1546 HTMLDOMNode_unlink(dispex
);
1547 unlink_ref(&This
->framebase
.nsiframe
);
1550 static void HTMLIFrame_destructor(DispatchEx
*dispex
)
1552 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1554 HTMLFrameBase_destructor(&This
->framebase
);
1557 static HRESULT
HTMLIFrame_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD grfdex
, DISPID
*dispid
)
1559 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1561 if(!This
->framebase
.content_window
)
1562 return DISP_E_UNKNOWNNAME
;
1564 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, dispid
);
1567 static HRESULT
HTMLIFrame_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
1569 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1570 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
1572 if(!This
->framebase
.content_window
||
1573 idx
>= This
->framebase
.content_window
->base
.inner_window
->global_prop_cnt
)
1574 return DISP_E_MEMBERNOTFOUND
;
1576 *name
= SysAllocString(This
->framebase
.content_window
->base
.inner_window
->global_props
[idx
].name
);
1577 return *name
? S_OK
: E_OUTOFMEMORY
;
1580 static HRESULT
HTMLIFrame_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
1581 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
1583 HTMLIFrame
*This
= iframe_from_DispatchEx(dispex
);
1585 if(!This
->framebase
.content_window
) {
1586 ERR("no content window to invoke on\n");
1590 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
1591 flags
, params
, res
, ei
, caller
);
1594 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
1595 .clsid
= &CLSID_HTMLIFrame
,
1596 .cpc_entries
= HTMLElement_cpc
,
1597 .clone
= HTMLElement_clone
,
1598 .get_attr_col
= HTMLElement_get_attr_col
,
1599 .get_document
= HTMLIFrame_get_document
,
1600 .get_readystate
= HTMLIFrame_get_readystate
,
1601 .bind_to_tree
= HTMLIFrame_bind_to_tree
,
1604 static const event_target_vtbl_t HTMLIFrame_event_target_vtbl
= {
1606 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
1607 .query_interface
= HTMLIFrame_query_interface
,
1608 .destructor
= HTMLIFrame_destructor
,
1609 .traverse
= HTMLIFrame_traverse
,
1610 .unlink
= HTMLIFrame_unlink
,
1611 .get_dispid
= HTMLIFrame_get_dispid
,
1612 .get_name
= HTMLIFrame_get_name
,
1613 .invoke
= HTMLIFrame_invoke
1615 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
1616 .handle_event
= HTMLElement_handle_event
1619 static const tid_t HTMLIFrame_iface_tids
[] = {
1622 IHTMLFrameBase2_tid
,
1623 IHTMLIFrameElement_tid
,
1624 IHTMLIFrameElement2_tid
,
1625 IHTMLIFrameElement3_tid
,
1629 static dispex_static_data_t HTMLIFrame_dispex
= {
1630 "HTMLIFrameElement",
1631 &HTMLIFrame_event_target_vtbl
.dispex_vtbl
,
1633 HTMLIFrame_iface_tids
,
1634 HTMLElement_init_dispex_info
1637 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1641 ret
= calloc(1, sizeof(HTMLIFrame
));
1643 return E_OUTOFMEMORY
;
1645 ret
->IHTMLIFrameElement_iface
.lpVtbl
= &HTMLIFrameElementVtbl
;
1646 ret
->IHTMLIFrameElement2_iface
.lpVtbl
= &HTMLIFrameElement2Vtbl
;
1647 ret
->IHTMLIFrameElement3_iface
.lpVtbl
= &HTMLIFrameElement3Vtbl
;
1648 ret
->framebase
.element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
1650 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLIFrame_dispex
);
1652 *elem
= &ret
->framebase
.element
;