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
29 #include "mshtml_private.h"
31 #include "htmlevent.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
37 static HRESULT
set_frame_doc(HTMLFrameBase
*frame
, nsIDOMDocument
*nsdoc
)
39 mozIDOMWindowProxy
*mozwindow
;
40 HTMLOuterWindow
*window
;
44 if(frame
->content_window
)
47 nsres
= nsIDOMDocument_GetDefaultView(nsdoc
, &mozwindow
);
48 if(NS_FAILED(nsres
) || !mozwindow
)
51 window
= mozwindow_to_window(mozwindow
);
52 if(!window
&& frame
->element
.node
.doc
->browser
)
53 hres
= create_outer_window(frame
->element
.node
.doc
->browser
, mozwindow
,
54 frame
->element
.node
.doc
->basedoc
.window
, &window
);
55 mozIDOMWindowProxy_Release(mozwindow
);
59 frame
->content_window
= window
;
60 window
->frame_element
= frame
;
64 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase(IHTMLFrameBase
*iface
)
66 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase_iface
);
69 static HRESULT WINAPI
HTMLFrameBase_QueryInterface(IHTMLFrameBase
*iface
, REFIID riid
, void **ppv
)
71 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
73 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
76 static ULONG WINAPI
HTMLFrameBase_AddRef(IHTMLFrameBase
*iface
)
78 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
80 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
83 static ULONG WINAPI
HTMLFrameBase_Release(IHTMLFrameBase
*iface
)
85 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
87 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
90 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase
*iface
, UINT
*pctinfo
)
92 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
94 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
97 static HRESULT WINAPI
HTMLFrameBase_GetTypeInfo(IHTMLFrameBase
*iface
, UINT iTInfo
,
98 LCID lcid
, ITypeInfo
**ppTInfo
)
100 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
102 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
106 static HRESULT WINAPI
HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase
*iface
, REFIID riid
,
107 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
109 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
111 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
112 cNames
, lcid
, rgDispId
);
115 static HRESULT WINAPI
HTMLFrameBase_Invoke(IHTMLFrameBase
*iface
, DISPID dispIdMember
,
116 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
117 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
119 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
121 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
122 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
125 static HRESULT WINAPI
HTMLFrameBase_put_src(IHTMLFrameBase
*iface
, BSTR v
)
127 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
129 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
131 if(!This
->content_window
|| !This
->element
.node
.doc
|| !This
->element
.node
.doc
->basedoc
.window
) {
135 nsAString_InitDepend(&nsstr
, v
);
137 nsres
= nsIDOMHTMLFrameElement_SetSrc(This
->nsframe
, &nsstr
);
139 nsres
= nsIDOMHTMLIFrameElement_SetSrc(This
->nsiframe
, &nsstr
);
140 nsAString_Finish(&nsstr
);
141 if(NS_FAILED(nsres
)) {
142 ERR("SetSrc failed: %08x\n", nsres
);
149 return navigate_url(This
->content_window
, v
, This
->element
.node
.doc
->basedoc
.window
->uri
, BINDING_NAVIGATED
);
152 static HRESULT WINAPI
HTMLFrameBase_get_src(IHTMLFrameBase
*iface
, BSTR
*p
)
154 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
158 TRACE("(%p)->(%p)\n", This
, p
);
160 if(!This
->nsframe
&& !This
->nsiframe
) {
161 ERR("No attached frame object\n");
165 nsAString_Init(&nsstr
, NULL
);
167 nsres
= nsIDOMHTMLFrameElement_GetSrc(This
->nsframe
, &nsstr
);
169 nsres
= nsIDOMHTMLIFrameElement_GetSrc(This
->nsiframe
, &nsstr
);
170 return return_nsstr(nsres
, &nsstr
, p
);
173 static HRESULT WINAPI
HTMLFrameBase_put_name(IHTMLFrameBase
*iface
, BSTR v
)
175 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
179 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
181 if(!This
->nsframe
&& !This
->nsiframe
) {
182 ERR("No attached ns frame object\n");
186 nsAString_InitDepend(&name_str
, v
);
188 nsres
= nsIDOMHTMLFrameElement_SetName(This
->nsframe
, &name_str
);
190 nsres
= nsIDOMHTMLIFrameElement_SetName(This
->nsiframe
, &name_str
);
191 nsAString_Finish(&name_str
);
192 if(NS_FAILED(nsres
)) {
193 ERR("SetName failed: %08x\n", nsres
);
200 static HRESULT WINAPI
HTMLFrameBase_get_name(IHTMLFrameBase
*iface
, BSTR
*p
)
202 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
206 TRACE("(%p)->(%p)\n", This
, p
);
208 if(!This
->nsframe
&& !This
->nsiframe
) {
209 ERR("No attached ns frame object\n");
213 nsAString_Init(&nsstr
, NULL
);
215 nsres
= nsIDOMHTMLFrameElement_GetName(This
->nsframe
, &nsstr
);
217 nsres
= nsIDOMHTMLIFrameElement_GetName(This
->nsiframe
, &nsstr
);
218 return return_nsstr(nsres
, &nsstr
, p
);
221 static HRESULT WINAPI
HTMLFrameBase_put_border(IHTMLFrameBase
*iface
, VARIANT v
)
223 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
224 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
228 static HRESULT WINAPI
HTMLFrameBase_get_border(IHTMLFrameBase
*iface
, VARIANT
*p
)
230 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
231 FIXME("(%p)->(%p)\n", This
, p
);
235 static HRESULT WINAPI
HTMLFrameBase_put_frameBorder(IHTMLFrameBase
*iface
, BSTR v
)
237 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
241 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
243 if(!This
->nsframe
&& !This
->nsiframe
) {
244 ERR("No attached ns frame object\n");
248 nsAString_InitDepend(&nsstr
, v
);
250 nsres
= nsIDOMHTMLFrameElement_SetFrameBorder(This
->nsframe
, &nsstr
);
252 nsres
= nsIDOMHTMLIFrameElement_SetFrameBorder(This
->nsiframe
, &nsstr
);
253 nsAString_Finish(&nsstr
);
254 if(NS_FAILED(nsres
)) {
255 ERR("SetFrameBorder failed: %08x\n", nsres
);
262 static HRESULT WINAPI
HTMLFrameBase_get_frameBorder(IHTMLFrameBase
*iface
, BSTR
*p
)
264 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
268 TRACE("(%p)->(%p)\n", This
, p
);
270 if(!This
->nsframe
&& !This
->nsiframe
) {
271 ERR("No attached ns frame object\n");
275 nsAString_Init(&nsstr
, NULL
);
277 nsres
= nsIDOMHTMLFrameElement_GetFrameBorder(This
->nsframe
, &nsstr
);
279 nsres
= nsIDOMHTMLIFrameElement_GetFrameBorder(This
->nsiframe
, &nsstr
);
280 return return_nsstr(nsres
, &nsstr
, p
);
283 static HRESULT WINAPI
HTMLFrameBase_put_frameSpacing(IHTMLFrameBase
*iface
, VARIANT v
)
285 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
286 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
290 static HRESULT WINAPI
HTMLFrameBase_get_frameSpacing(IHTMLFrameBase
*iface
, VARIANT
*p
)
292 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
293 FIXME("(%p)->(%p)\n", This
, p
);
297 static HRESULT WINAPI
HTMLFrameBase_put_marginWidth(IHTMLFrameBase
*iface
, VARIANT v
)
299 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
303 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
305 if(V_VT(&v
) != VT_BSTR
) {
306 FIXME("unsupported %s\n", debugstr_variant(&v
));
310 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
312 nsres
= nsIDOMHTMLFrameElement_SetMarginWidth(This
->nsframe
, &nsstr
);
314 nsres
= nsIDOMHTMLIFrameElement_SetMarginWidth(This
->nsiframe
, &nsstr
);
315 nsAString_Finish(&nsstr
);
316 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
319 static HRESULT WINAPI
HTMLFrameBase_get_marginWidth(IHTMLFrameBase
*iface
, VARIANT
*p
)
321 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
326 TRACE("(%p)->(%p)\n", This
, p
);
328 nsAString_Init(&nsstr
, NULL
);
330 nsres
= nsIDOMHTMLFrameElement_GetMarginWidth(This
->nsframe
, &nsstr
);
332 nsres
= nsIDOMHTMLIFrameElement_GetMarginWidth(This
->nsiframe
, &nsstr
);
333 if(NS_SUCCEEDED(nsres
)) {
334 const PRUnichar
*str
, *end
;
336 nsAString_GetData(&nsstr
, &str
);
341 end
= wcsstr(str
, L
"px");
343 end
= str
+lstrlenW(str
);
344 ret
= SysAllocStringLen(str
, end
-str
);
349 hres
= E_OUTOFMEMORY
;
356 ERR("GetMarginWidth failed: %08x\n", nsres
);
360 nsAString_Finish(&nsstr
);
364 static HRESULT WINAPI
HTMLFrameBase_put_marginHeight(IHTMLFrameBase
*iface
, VARIANT v
)
366 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
370 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
372 if(V_VT(&v
) != VT_BSTR
) {
373 FIXME("unsupported %s\n", debugstr_variant(&v
));
377 nsAString_InitDepend(&nsstr
, V_BSTR(&v
));
379 nsres
= nsIDOMHTMLFrameElement_SetMarginHeight(This
->nsframe
, &nsstr
);
381 nsres
= nsIDOMHTMLIFrameElement_SetMarginHeight(This
->nsiframe
, &nsstr
);
382 nsAString_Finish(&nsstr
);
383 return NS_SUCCEEDED(nsres
) ? S_OK
: E_FAIL
;
386 static HRESULT WINAPI
HTMLFrameBase_get_marginHeight(IHTMLFrameBase
*iface
, VARIANT
*p
)
388 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
393 TRACE("(%p)->(%p)\n", This
, p
);
395 nsAString_Init(&nsstr
, NULL
);
397 nsres
= nsIDOMHTMLFrameElement_GetMarginHeight(This
->nsframe
, &nsstr
);
399 nsres
= nsIDOMHTMLIFrameElement_GetMarginHeight(This
->nsiframe
, &nsstr
);
400 if(NS_SUCCEEDED(nsres
)) {
401 const PRUnichar
*str
, *end
;
403 nsAString_GetData(&nsstr
, &str
);
408 end
= wcsstr(str
, L
"px");
410 end
= str
+lstrlenW(str
);
411 ret
= SysAllocStringLen(str
, end
-str
);
416 hres
= E_OUTOFMEMORY
;
423 ERR("SetMarginHeight failed: %08x\n", nsres
);
427 nsAString_Finish(&nsstr
);
431 static HRESULT WINAPI
HTMLFrameBase_put_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL v
)
433 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
434 FIXME("(%p)->(%x)\n", This
, v
);
438 static HRESULT WINAPI
HTMLFrameBase_get_noResize(IHTMLFrameBase
*iface
, VARIANT_BOOL
*p
)
440 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
441 FIXME("(%p)->(%p)\n", This
, p
);
445 static HRESULT WINAPI
HTMLFrameBase_put_scrolling(IHTMLFrameBase
*iface
, BSTR v
)
447 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
451 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
453 if(!(!wcsicmp(v
, L
"yes") || !wcsicmp(v
, L
"no") || !wcsicmp(v
, L
"auto")))
457 nsAString_InitDepend(&nsstr
, v
);
458 nsres
= nsIDOMHTMLFrameElement_SetScrolling(This
->nsframe
, &nsstr
);
459 }else if(This
->nsiframe
) {
460 nsAString_InitDepend(&nsstr
, v
);
461 nsres
= nsIDOMHTMLIFrameElement_SetScrolling(This
->nsiframe
, &nsstr
);
463 ERR("No attached ns frame object\n");
466 nsAString_Finish(&nsstr
);
468 if(NS_FAILED(nsres
)) {
469 ERR("SetScrolling failed: 0x%08x\n", nsres
);
476 static HRESULT WINAPI
HTMLFrameBase_get_scrolling(IHTMLFrameBase
*iface
, BSTR
*p
)
478 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase(iface
);
480 const PRUnichar
*strdata
;
483 TRACE("(%p)->(%p)\n", This
, p
);
486 nsAString_Init(&nsstr
, NULL
);
487 nsres
= nsIDOMHTMLFrameElement_GetScrolling(This
->nsframe
, &nsstr
);
488 }else if(This
->nsiframe
) {
489 nsAString_Init(&nsstr
, NULL
);
490 nsres
= nsIDOMHTMLIFrameElement_GetScrolling(This
->nsiframe
, &nsstr
);
492 ERR("No attached ns frame object\n");
496 if(NS_FAILED(nsres
)) {
497 ERR("GetScrolling failed: 0x%08x\n", nsres
);
498 nsAString_Finish(&nsstr
);
502 nsAString_GetData(&nsstr
, &strdata
);
505 *p
= SysAllocString(strdata
);
507 *p
= SysAllocString(L
"auto");
509 nsAString_Finish(&nsstr
);
511 return *p
? S_OK
: E_OUTOFMEMORY
;
514 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl
= {
515 HTMLFrameBase_QueryInterface
,
516 HTMLFrameBase_AddRef
,
517 HTMLFrameBase_Release
,
518 HTMLFrameBase_GetTypeInfoCount
,
519 HTMLFrameBase_GetTypeInfo
,
520 HTMLFrameBase_GetIDsOfNames
,
521 HTMLFrameBase_Invoke
,
522 HTMLFrameBase_put_src
,
523 HTMLFrameBase_get_src
,
524 HTMLFrameBase_put_name
,
525 HTMLFrameBase_get_name
,
526 HTMLFrameBase_put_border
,
527 HTMLFrameBase_get_border
,
528 HTMLFrameBase_put_frameBorder
,
529 HTMLFrameBase_get_frameBorder
,
530 HTMLFrameBase_put_frameSpacing
,
531 HTMLFrameBase_get_frameSpacing
,
532 HTMLFrameBase_put_marginWidth
,
533 HTMLFrameBase_get_marginWidth
,
534 HTMLFrameBase_put_marginHeight
,
535 HTMLFrameBase_get_marginHeight
,
536 HTMLFrameBase_put_noResize
,
537 HTMLFrameBase_get_noResize
,
538 HTMLFrameBase_put_scrolling
,
539 HTMLFrameBase_get_scrolling
542 static inline HTMLFrameBase
*impl_from_IHTMLFrameBase2(IHTMLFrameBase2
*iface
)
544 return CONTAINING_RECORD(iface
, HTMLFrameBase
, IHTMLFrameBase2_iface
);
547 static HRESULT WINAPI
HTMLFrameBase2_QueryInterface(IHTMLFrameBase2
*iface
, REFIID riid
, void **ppv
)
549 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
551 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
554 static ULONG WINAPI
HTMLFrameBase2_AddRef(IHTMLFrameBase2
*iface
)
556 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
558 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
561 static ULONG WINAPI
HTMLFrameBase2_Release(IHTMLFrameBase2
*iface
)
563 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
565 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
568 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2
*iface
, UINT
*pctinfo
)
570 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
571 FIXME("(%p)\n", This
);
575 static HRESULT WINAPI
HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2
*iface
, UINT iTInfo
,
576 LCID lcid
, ITypeInfo
**ppTInfo
)
578 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
579 FIXME("(%p)\n", This
);
583 static HRESULT WINAPI
HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2
*iface
, REFIID riid
,
584 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
586 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
587 FIXME("(%p)\n", This
);
591 static HRESULT WINAPI
HTMLFrameBase2_Invoke(IHTMLFrameBase2
*iface
, DISPID dispIdMember
,
592 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
593 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
595 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
596 FIXME("(%p)\n", This
);
600 static HRESULT WINAPI
HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2
*iface
, IHTMLWindow2
**p
)
602 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
604 TRACE("(%p)->(%p)\n", This
, p
);
606 if(This
->content_window
) {
607 IHTMLWindow2_AddRef(&This
->content_window
->base
.IHTMLWindow2_iface
);
608 *p
= &This
->content_window
->base
.IHTMLWindow2_iface
;
610 WARN("NULL content window\n");
616 static HRESULT WINAPI
HTMLFrameBase2_put_onload(IHTMLFrameBase2
*iface
, VARIANT v
)
618 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
620 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
622 return set_node_event(&This
->element
.node
, EVENTID_LOAD
, &v
);
625 static HRESULT WINAPI
HTMLFrameBase2_get_onload(IHTMLFrameBase2
*iface
, VARIANT
*p
)
627 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
629 TRACE("(%p)->(%p)\n", This
, p
);
631 return get_node_event(&This
->element
.node
, EVENTID_LOAD
, p
);
634 static HRESULT WINAPI
HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT v
)
636 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
637 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
641 static HRESULT WINAPI
HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT
*p
)
643 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
644 FIXME("(%p)->(%p)\n", This
, p
);
648 static HRESULT WINAPI
HTMLFrameBase2_get_readyState(IHTMLFrameBase2
*iface
, BSTR
*p
)
650 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
652 TRACE("(%p)->(%p)\n", This
, p
);
654 if(!This
->content_window
|| !This
->content_window
->base
.inner_window
->doc
) {
655 FIXME("no document associated\n");
659 return IHTMLDocument2_get_readyState(&This
->content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
, p
);
662 static HRESULT WINAPI
HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL v
)
664 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
666 FIXME("(%p)->(%x) semi-stub\n", This
, v
);
671 static HRESULT WINAPI
HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL
*p
)
673 HTMLFrameBase
*This
= impl_from_IHTMLFrameBase2(iface
);
675 FIXME("(%p)->(%p) semi-stub\n", This
, p
);
681 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl
= {
682 HTMLFrameBase2_QueryInterface
,
683 HTMLFrameBase2_AddRef
,
684 HTMLFrameBase2_Release
,
685 HTMLFrameBase2_GetTypeInfoCount
,
686 HTMLFrameBase2_GetTypeInfo
,
687 HTMLFrameBase2_GetIDsOfNames
,
688 HTMLFrameBase2_Invoke
,
689 HTMLFrameBase2_get_contentWindow
,
690 HTMLFrameBase2_put_onload
,
691 HTMLFrameBase2_get_onload
,
692 HTMLFrameBase2_put_onreadystatechange
,
693 HTMLFrameBase2_get_onreadystatechange
,
694 HTMLFrameBase2_get_readyState
,
695 HTMLFrameBase2_put_allowTransparency
,
696 HTMLFrameBase2_get_allowTransparency
699 static HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*This
, REFIID riid
, void **ppv
)
701 if(IsEqualGUID(&IID_IHTMLFrameBase
, riid
)) {
702 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This
, ppv
);
703 *ppv
= &This
->IHTMLFrameBase_iface
;
704 }else if(IsEqualGUID(&IID_IHTMLFrameBase2
, riid
)) {
705 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This
, ppv
);
706 *ppv
= &This
->IHTMLFrameBase2_iface
;
708 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
711 IUnknown_AddRef((IUnknown
*)*ppv
);
715 static void HTMLFrameBase_destructor(HTMLFrameBase
*This
)
717 if(This
->content_window
)
718 This
->content_window
->frame_element
= NULL
;
720 HTMLElement_destructor(&This
->element
.node
);
723 static void HTMLFrameBase_Init(HTMLFrameBase
*This
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
,
724 dispex_static_data_t
*dispex_data
)
728 This
->IHTMLFrameBase_iface
.lpVtbl
= &HTMLFrameBaseVtbl
;
729 This
->IHTMLFrameBase2_iface
.lpVtbl
= &HTMLFrameBase2Vtbl
;
731 HTMLElement_Init(&This
->element
, doc
, nselem
, dispex_data
);
733 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFrameElement
, (void**)&This
->nsframe
);
734 if(NS_FAILED(nsres
)) {
735 This
->nsframe
= NULL
;
736 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLIFrameElement
, (void**)&This
->nsiframe
);
737 assert(nsres
== NS_OK
);
739 This
->nsiframe
= NULL
;
743 struct HTMLFrameElement
{
744 HTMLFrameBase framebase
;
745 IHTMLFrameElement3 IHTMLFrameElement3_iface
;
748 static inline HTMLFrameElement
*impl_from_IHTMLFrameElement3(IHTMLFrameElement3
*iface
)
750 return CONTAINING_RECORD(iface
, HTMLFrameElement
, IHTMLFrameElement3_iface
);
753 static HRESULT WINAPI
HTMLFrameElement3_QueryInterface(IHTMLFrameElement3
*iface
,
754 REFIID riid
, void **ppv
)
756 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
758 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
761 static ULONG WINAPI
HTMLFrameElement3_AddRef(IHTMLFrameElement3
*iface
)
763 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
765 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
768 static ULONG WINAPI
HTMLFrameElement3_Release(IHTMLFrameElement3
*iface
)
770 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
772 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
775 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3
*iface
, UINT
*pctinfo
)
777 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
778 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
782 static HRESULT WINAPI
HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3
*iface
, UINT iTInfo
,
783 LCID lcid
, ITypeInfo
**ppTInfo
)
785 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
786 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
790 static HRESULT WINAPI
HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3
*iface
, REFIID riid
,
791 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
793 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
794 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
795 rgszNames
, cNames
, lcid
, rgDispId
);
798 static HRESULT WINAPI
HTMLFrameElement3_Invoke(IHTMLFrameElement3
*iface
, DISPID dispIdMember
,
799 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
800 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
802 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
803 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
804 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
807 static HRESULT WINAPI
HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3
*iface
, IDispatch
**p
)
809 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
813 TRACE("(%p)->(%p)\n", This
, p
);
815 if(!This
->framebase
.content_window
) {
816 FIXME("NULL window\n");
820 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
824 *p
= doc
? (IDispatch
*)doc
: NULL
;
828 static HRESULT WINAPI
HTMLFrameElement3_put_src(IHTMLFrameElement3
*iface
, BSTR v
)
830 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
831 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
835 static HRESULT WINAPI
HTMLFrameElement3_get_src(IHTMLFrameElement3
*iface
, BSTR
*p
)
837 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
838 FIXME("(%p)->(%p)\n", This
, p
);
842 static HRESULT WINAPI
HTMLFrameElement3_put_longDesc(IHTMLFrameElement3
*iface
, BSTR v
)
844 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
845 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
849 static HRESULT WINAPI
HTMLFrameElement3_get_longDesc(IHTMLFrameElement3
*iface
, BSTR
*p
)
851 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
852 FIXME("(%p)->(%p)\n", This
, p
);
856 static HRESULT WINAPI
HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3
*iface
, BSTR v
)
858 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
859 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
863 static HRESULT WINAPI
HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3
*iface
, BSTR
*p
)
865 HTMLFrameElement
*This
= impl_from_IHTMLFrameElement3(iface
);
866 FIXME("(%p)->(%p)\n", This
, p
);
870 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
= {
871 HTMLFrameElement3_QueryInterface
,
872 HTMLFrameElement3_AddRef
,
873 HTMLFrameElement3_Release
,
874 HTMLFrameElement3_GetTypeInfoCount
,
875 HTMLFrameElement3_GetTypeInfo
,
876 HTMLFrameElement3_GetIDsOfNames
,
877 HTMLFrameElement3_Invoke
,
878 HTMLFrameElement3_get_contentDocument
,
879 HTMLFrameElement3_put_src
,
880 HTMLFrameElement3_get_src
,
881 HTMLFrameElement3_put_longDesc
,
882 HTMLFrameElement3_get_longDesc
,
883 HTMLFrameElement3_put_frameBorder
,
884 HTMLFrameElement3_get_frameBorder
887 static inline HTMLFrameElement
*frame_from_HTMLDOMNode(HTMLDOMNode
*iface
)
889 return CONTAINING_RECORD(iface
, HTMLFrameElement
, framebase
.element
.node
);
892 static HRESULT
HTMLFrameElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
894 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
896 if(IsEqualGUID(&IID_IHTMLFrameElement3
, riid
)) {
897 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This
, ppv
);
898 *ppv
= &This
->IHTMLFrameElement3_iface
;
900 return HTMLFrameBase_QI(&This
->framebase
, riid
, ppv
);
903 IUnknown_AddRef((IUnknown
*)*ppv
);
907 static void HTMLFrameElement_destructor(HTMLDOMNode
*iface
)
909 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
911 HTMLFrameBase_destructor(&This
->framebase
);
914 static HRESULT
HTMLFrameElement_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
916 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
918 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
923 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
924 IDispatch_AddRef(*p
);
928 static HRESULT
HTMLFrameElement_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
930 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
932 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
935 static HRESULT
HTMLFrameElement_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
936 DWORD grfdex
, DISPID
*pid
)
938 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
940 if(!This
->framebase
.content_window
)
941 return DISP_E_UNKNOWNNAME
;
943 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, pid
);
946 static HRESULT
HTMLFrameElement_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
947 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
949 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
951 if(!This
->framebase
.content_window
) {
952 ERR("no content window to invoke on\n");
956 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
957 flags
, params
, res
, ei
, caller
);
960 static HRESULT
HTMLFrameElement_bind_to_tree(HTMLDOMNode
*iface
)
962 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
963 nsIDOMDocument
*nsdoc
;
967 nsres
= nsIDOMHTMLFrameElement_GetContentDocument(This
->framebase
.nsframe
, &nsdoc
);
968 if(NS_FAILED(nsres
) || !nsdoc
) {
969 ERR("GetContentDocument failed: %08x\n", nsres
);
973 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
974 nsIDOMDocument_Release(nsdoc
);
978 static void HTMLFrameElement_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
980 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
982 if(This
->framebase
.nsframe
)
983 note_cc_edge((nsISupports
*)This
->framebase
.nsframe
, "This->nsframe", cb
);
986 static void HTMLFrameElement_unlink(HTMLDOMNode
*iface
)
988 HTMLFrameElement
*This
= frame_from_HTMLDOMNode(iface
);
990 if(This
->framebase
.nsframe
) {
991 nsIDOMHTMLFrameElement
*nsframe
= This
->framebase
.nsframe
;
993 This
->framebase
.nsframe
= NULL
;
994 nsIDOMHTMLFrameElement_Release(nsframe
);
998 static const NodeImplVtbl HTMLFrameElementImplVtbl
= {
999 &CLSID_HTMLFrameElement
,
1000 HTMLFrameElement_QI
,
1001 HTMLFrameElement_destructor
,
1004 HTMLElement_handle_event
,
1005 HTMLElement_get_attr_col
,
1009 HTMLFrameElement_get_document
,
1010 HTMLFrameElement_get_readystate
,
1011 HTMLFrameElement_get_dispid
,
1012 HTMLFrameElement_invoke
,
1013 HTMLFrameElement_bind_to_tree
,
1014 HTMLFrameElement_traverse
,
1015 HTMLFrameElement_unlink
1018 static const tid_t HTMLFrameElement_iface_tids
[] = {
1021 IHTMLFrameBase2_tid
,
1022 IHTMLFrameElement3_tid
,
1026 static dispex_static_data_t HTMLFrameElement_dispex
= {
1028 DispHTMLFrameElement_tid
,
1029 HTMLFrameElement_iface_tids
,
1030 HTMLElement_init_dispex_info
1033 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1035 HTMLFrameElement
*ret
;
1037 ret
= heap_alloc_zero(sizeof(HTMLFrameElement
));
1039 return E_OUTOFMEMORY
;
1041 ret
->framebase
.element
.node
.vtbl
= &HTMLFrameElementImplVtbl
;
1042 ret
->IHTMLFrameElement3_iface
.lpVtbl
= &HTMLFrameElement3Vtbl
;
1044 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLFrameElement_dispex
);
1046 *elem
= &ret
->framebase
.element
;
1051 HTMLFrameBase framebase
;
1052 IHTMLIFrameElement IHTMLIFrameElement_iface
;
1053 IHTMLIFrameElement2 IHTMLIFrameElement2_iface
;
1054 IHTMLIFrameElement3 IHTMLIFrameElement3_iface
;
1057 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement(IHTMLIFrameElement
*iface
)
1059 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement_iface
);
1062 static HRESULT WINAPI
HTMLIFrameElement_QueryInterface(IHTMLIFrameElement
*iface
,
1063 REFIID riid
, void **ppv
)
1065 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1067 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1070 static ULONG WINAPI
HTMLIFrameElement_AddRef(IHTMLIFrameElement
*iface
)
1072 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1074 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1077 static ULONG WINAPI
HTMLIFrameElement_Release(IHTMLIFrameElement
*iface
)
1079 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1081 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1084 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfoCount(IHTMLIFrameElement
*iface
, UINT
*pctinfo
)
1086 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1087 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1091 static HRESULT WINAPI
HTMLIFrameElement_GetTypeInfo(IHTMLIFrameElement
*iface
, UINT iTInfo
,
1092 LCID lcid
, ITypeInfo
**ppTInfo
)
1094 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1095 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1099 static HRESULT WINAPI
HTMLIFrameElement_GetIDsOfNames(IHTMLIFrameElement
*iface
, REFIID riid
,
1100 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1102 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1103 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1104 rgszNames
, cNames
, lcid
, rgDispId
);
1107 static HRESULT WINAPI
HTMLIFrameElement_Invoke(IHTMLIFrameElement
*iface
, DISPID dispIdMember
,
1108 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1109 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1111 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1112 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1113 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1116 static HRESULT WINAPI
HTMLIFrameElement_put_vspace(IHTMLIFrameElement
*iface
, LONG v
)
1118 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1119 FIXME("(%p)->(%d)\n", This
, v
);
1123 static HRESULT WINAPI
HTMLIFrameElement_get_vspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1125 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1126 FIXME("(%p)->(%p)\n", This
, p
);
1130 static HRESULT WINAPI
HTMLIFrameElement_put_hspace(IHTMLIFrameElement
*iface
, LONG v
)
1132 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1133 FIXME("(%p)->(%d)\n", This
, v
);
1137 static HRESULT WINAPI
HTMLIFrameElement_get_hspace(IHTMLIFrameElement
*iface
, LONG
*p
)
1139 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1140 FIXME("(%p)->(%p)\n", This
, p
);
1144 static HRESULT WINAPI
HTMLIFrameElement_put_align(IHTMLIFrameElement
*iface
, BSTR v
)
1146 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1147 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1151 static HRESULT WINAPI
HTMLIFrameElement_get_align(IHTMLIFrameElement
*iface
, BSTR
*p
)
1153 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement(iface
);
1154 FIXME("(%p)->(%p)\n", This
, p
);
1158 static const IHTMLIFrameElementVtbl HTMLIFrameElementVtbl
= {
1159 HTMLIFrameElement_QueryInterface
,
1160 HTMLIFrameElement_AddRef
,
1161 HTMLIFrameElement_Release
,
1162 HTMLIFrameElement_GetTypeInfoCount
,
1163 HTMLIFrameElement_GetTypeInfo
,
1164 HTMLIFrameElement_GetIDsOfNames
,
1165 HTMLIFrameElement_Invoke
,
1166 HTMLIFrameElement_put_vspace
,
1167 HTMLIFrameElement_get_vspace
,
1168 HTMLIFrameElement_put_hspace
,
1169 HTMLIFrameElement_get_hspace
,
1170 HTMLIFrameElement_put_align
,
1171 HTMLIFrameElement_get_align
1174 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement2(IHTMLIFrameElement2
*iface
)
1176 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement2_iface
);
1179 static HRESULT WINAPI
HTMLIFrameElement2_QueryInterface(IHTMLIFrameElement2
*iface
,
1180 REFIID riid
, void **ppv
)
1182 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1184 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1187 static ULONG WINAPI
HTMLIFrameElement2_AddRef(IHTMLIFrameElement2
*iface
)
1189 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1191 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1194 static ULONG WINAPI
HTMLIFrameElement2_Release(IHTMLIFrameElement2
*iface
)
1196 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1198 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1201 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfoCount(IHTMLIFrameElement2
*iface
, UINT
*pctinfo
)
1203 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1204 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1208 static HRESULT WINAPI
HTMLIFrameElement2_GetTypeInfo(IHTMLIFrameElement2
*iface
, UINT iTInfo
,
1209 LCID lcid
, ITypeInfo
**ppTInfo
)
1211 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1212 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1216 static HRESULT WINAPI
HTMLIFrameElement2_GetIDsOfNames(IHTMLIFrameElement2
*iface
, REFIID riid
,
1217 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1219 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1220 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1221 rgszNames
, cNames
, lcid
, rgDispId
);
1224 static HRESULT WINAPI
HTMLIFrameElement2_Invoke(IHTMLIFrameElement2
*iface
, DISPID dispIdMember
,
1225 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1226 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1228 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1229 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1230 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1233 static HRESULT WINAPI
HTMLIFrameElement2_put_height(IHTMLIFrameElement2
*iface
, VARIANT v
)
1235 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1240 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1242 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1246 nsres
= nsIDOMHTMLIFrameElement_SetHeight(This
->framebase
.nsiframe
, &nsstr
);
1247 nsAString_Finish(&nsstr
);
1248 if(NS_FAILED(nsres
)) {
1249 ERR("SetHeight failed: %08x\n", nsres
);
1256 static HRESULT WINAPI
HTMLIFrameElement2_get_height(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1258 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1262 TRACE("(%p)->(%p)\n", This
, p
);
1264 nsAString_Init(&nsstr
, NULL
);
1265 nsres
= nsIDOMHTMLIFrameElement_GetHeight(This
->framebase
.nsiframe
, &nsstr
);
1268 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1271 static HRESULT WINAPI
HTMLIFrameElement2_put_width(IHTMLIFrameElement2
*iface
, VARIANT v
)
1273 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1278 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1280 hres
= variant_to_nsstr(&v
, FALSE
, &nsstr
);
1284 nsres
= nsIDOMHTMLIFrameElement_SetWidth(This
->framebase
.nsiframe
, &nsstr
);
1285 nsAString_Finish(&nsstr
);
1286 if(NS_FAILED(nsres
)) {
1287 ERR("SetWidth failed: %08x\n", nsres
);
1294 static HRESULT WINAPI
HTMLIFrameElement2_get_width(IHTMLIFrameElement2
*iface
, VARIANT
*p
)
1296 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement2(iface
);
1300 TRACE("(%p)->(%p)\n", This
, p
);
1302 nsAString_Init(&nsstr
, NULL
);
1303 nsres
= nsIDOMHTMLIFrameElement_GetWidth(This
->framebase
.nsiframe
, &nsstr
);
1306 return return_nsstr(nsres
, &nsstr
, &V_BSTR(p
));
1309 static const IHTMLIFrameElement2Vtbl HTMLIFrameElement2Vtbl
= {
1310 HTMLIFrameElement2_QueryInterface
,
1311 HTMLIFrameElement2_AddRef
,
1312 HTMLIFrameElement2_Release
,
1313 HTMLIFrameElement2_GetTypeInfoCount
,
1314 HTMLIFrameElement2_GetTypeInfo
,
1315 HTMLIFrameElement2_GetIDsOfNames
,
1316 HTMLIFrameElement2_Invoke
,
1317 HTMLIFrameElement2_put_height
,
1318 HTMLIFrameElement2_get_height
,
1319 HTMLIFrameElement2_put_width
,
1320 HTMLIFrameElement2_get_width
1323 static inline HTMLIFrame
*impl_from_IHTMLIFrameElement3(IHTMLIFrameElement3
*iface
)
1325 return CONTAINING_RECORD(iface
, HTMLIFrame
, IHTMLIFrameElement3_iface
);
1328 static HRESULT WINAPI
HTMLIFrameElement3_QueryInterface(IHTMLIFrameElement3
*iface
,
1329 REFIID riid
, void **ppv
)
1331 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1333 return IHTMLDOMNode_QueryInterface(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
1336 static ULONG WINAPI
HTMLIFrameElement3_AddRef(IHTMLIFrameElement3
*iface
)
1338 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1340 return IHTMLDOMNode_AddRef(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1343 static ULONG WINAPI
HTMLIFrameElement3_Release(IHTMLIFrameElement3
*iface
)
1345 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1347 return IHTMLDOMNode_Release(&This
->framebase
.element
.node
.IHTMLDOMNode_iface
);
1350 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfoCount(IHTMLIFrameElement3
*iface
, UINT
*pctinfo
)
1352 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1353 return IDispatchEx_GetTypeInfoCount(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
,
1357 static HRESULT WINAPI
HTMLIFrameElement3_GetTypeInfo(IHTMLIFrameElement3
*iface
, UINT iTInfo
,
1358 LCID lcid
, ITypeInfo
**ppTInfo
)
1360 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1361 return IDispatchEx_GetTypeInfo(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
,
1365 static HRESULT WINAPI
HTMLIFrameElement3_GetIDsOfNames(IHTMLIFrameElement3
*iface
, REFIID riid
,
1366 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1368 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1369 return IDispatchEx_GetIDsOfNames(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
,
1370 rgszNames
, cNames
, lcid
, rgDispId
);
1373 static HRESULT WINAPI
HTMLIFrameElement3_Invoke(IHTMLIFrameElement3
*iface
, DISPID dispIdMember
,
1374 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1375 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1377 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1378 return IDispatchEx_Invoke(&This
->framebase
.element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
,
1379 riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1382 static HRESULT WINAPI
HTMLIFrameElement3_get_contentDocument(IHTMLIFrameElement3
*iface
, IDispatch
**p
)
1384 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1385 IHTMLDocument2
*doc
;
1388 TRACE("(%p)->(%p)\n", This
, p
);
1390 if(!This
->framebase
.content_window
) {
1395 hres
= IHTMLWindow2_get_document(&This
->framebase
.content_window
->base
.IHTMLWindow2_iface
, &doc
);
1396 *p
= (IDispatch
*)doc
;
1400 static HRESULT WINAPI
HTMLIFrameElement3_put_src(IHTMLIFrameElement3
*iface
, BSTR v
)
1402 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1403 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1407 static HRESULT WINAPI
HTMLIFrameElement3_get_src(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1409 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1410 FIXME("(%p)->(%p)\n", This
, p
);
1414 static HRESULT WINAPI
HTMLIFrameElement3_put_longDesc(IHTMLIFrameElement3
*iface
, BSTR v
)
1416 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1417 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1421 static HRESULT WINAPI
HTMLIFrameElement3_get_longDesc(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1423 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1424 FIXME("(%p)->(%p)\n", This
, p
);
1428 static HRESULT WINAPI
HTMLIFrameElement3_put_frameBorder(IHTMLIFrameElement3
*iface
, BSTR v
)
1430 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1431 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1435 static HRESULT WINAPI
HTMLIFrameElement3_get_frameBorder(IHTMLIFrameElement3
*iface
, BSTR
*p
)
1437 HTMLIFrame
*This
= impl_from_IHTMLIFrameElement3(iface
);
1438 FIXME("(%p)->(%p)\n", This
, p
);
1442 static const IHTMLIFrameElement3Vtbl HTMLIFrameElement3Vtbl
= {
1443 HTMLIFrameElement3_QueryInterface
,
1444 HTMLIFrameElement3_AddRef
,
1445 HTMLIFrameElement3_Release
,
1446 HTMLIFrameElement3_GetTypeInfoCount
,
1447 HTMLIFrameElement3_GetTypeInfo
,
1448 HTMLIFrameElement3_GetIDsOfNames
,
1449 HTMLIFrameElement3_Invoke
,
1450 HTMLIFrameElement3_get_contentDocument
,
1451 HTMLIFrameElement3_put_src
,
1452 HTMLIFrameElement3_get_src
,
1453 HTMLIFrameElement3_put_longDesc
,
1454 HTMLIFrameElement3_get_longDesc
,
1455 HTMLIFrameElement3_put_frameBorder
,
1456 HTMLIFrameElement3_get_frameBorder
1459 static inline HTMLIFrame
*iframe_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1461 return CONTAINING_RECORD(iface
, HTMLIFrame
, framebase
.element
.node
);
1464 static HRESULT
HTMLIFrame_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1466 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1468 if(IsEqualGUID(&IID_IHTMLIFrameElement
, riid
)) {
1469 TRACE("(%p)->(IID_IHTMLIFrameElement %p)\n", This
, ppv
);
1470 *ppv
= &This
->IHTMLIFrameElement_iface
;
1471 }else if(IsEqualGUID(&IID_IHTMLIFrameElement2
, riid
)) {
1472 TRACE("(%p)->(IID_IHTMLIFrameElement2 %p)\n", This
, ppv
);
1473 *ppv
= &This
->IHTMLIFrameElement2_iface
;
1474 }else if(IsEqualGUID(&IID_IHTMLIFrameElement3
, riid
)) {
1475 TRACE("(%p)->(IID_IHTMLIFrameElement3 %p)\n", This
, ppv
);
1476 *ppv
= &This
->IHTMLIFrameElement3_iface
;
1478 return HTMLFrameBase_QI(&This
->framebase
, riid
, ppv
);
1481 IUnknown_AddRef((IUnknown
*)*ppv
);
1485 static void HTMLIFrame_destructor(HTMLDOMNode
*iface
)
1487 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1489 HTMLFrameBase_destructor(&This
->framebase
);
1492 static HRESULT
HTMLIFrame_get_document(HTMLDOMNode
*iface
, IDispatch
**p
)
1494 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1496 if(!This
->framebase
.content_window
|| !This
->framebase
.content_window
->base
.inner_window
->doc
) {
1501 *p
= (IDispatch
*)&This
->framebase
.content_window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1502 IDispatch_AddRef(*p
);
1506 static HRESULT
HTMLIFrame_get_dispid(HTMLDOMNode
*iface
, BSTR name
,
1507 DWORD grfdex
, DISPID
*pid
)
1509 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1511 if(!This
->framebase
.content_window
)
1512 return DISP_E_UNKNOWNNAME
;
1514 return search_window_props(This
->framebase
.content_window
->base
.inner_window
, name
, grfdex
, pid
);
1517 static HRESULT
HTMLIFrame_invoke(HTMLDOMNode
*iface
, DISPID id
, LCID lcid
,
1518 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
1520 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1522 if(!This
->framebase
.content_window
) {
1523 ERR("no content window to invoke on\n");
1527 return IDispatchEx_InvokeEx(&This
->framebase
.content_window
->base
.IDispatchEx_iface
, id
, lcid
,
1528 flags
, params
, res
, ei
, caller
);
1531 static HRESULT
HTMLIFrame_get_readystate(HTMLDOMNode
*iface
, BSTR
*p
)
1533 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1535 return IHTMLFrameBase2_get_readyState(&This
->framebase
.IHTMLFrameBase2_iface
, p
);
1538 static HRESULT
HTMLIFrame_bind_to_tree(HTMLDOMNode
*iface
)
1540 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1541 nsIDOMDocument
*nsdoc
;
1545 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->framebase
.nsiframe
, &nsdoc
);
1546 if(NS_FAILED(nsres
) || !nsdoc
) {
1547 ERR("GetContentDocument failed: %08x\n", nsres
);
1551 hres
= set_frame_doc(&This
->framebase
, nsdoc
);
1552 nsIDOMDocument_Release(nsdoc
);
1556 static void HTMLIFrame_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
1558 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1560 if(This
->framebase
.nsiframe
)
1561 note_cc_edge((nsISupports
*)This
->framebase
.nsiframe
, "This->nsiframe", cb
);
1564 static void HTMLIFrame_unlink(HTMLDOMNode
*iface
)
1566 HTMLIFrame
*This
= iframe_from_HTMLDOMNode(iface
);
1568 if(This
->framebase
.nsiframe
) {
1569 nsIDOMHTMLIFrameElement
*nsiframe
= This
->framebase
.nsiframe
;
1571 This
->framebase
.nsiframe
= NULL
;
1572 nsIDOMHTMLIFrameElement_Release(nsiframe
);
1576 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
1579 HTMLIFrame_destructor
,
1582 HTMLElement_handle_event
,
1583 HTMLElement_get_attr_col
,
1587 HTMLIFrame_get_document
,
1588 HTMLIFrame_get_readystate
,
1589 HTMLIFrame_get_dispid
,
1591 HTMLIFrame_bind_to_tree
,
1592 HTMLIFrame_traverse
,
1596 static const tid_t HTMLIFrame_iface_tids
[] = {
1599 IHTMLFrameBase2_tid
,
1600 IHTMLIFrameElement_tid
,
1601 IHTMLIFrameElement2_tid
,
1602 IHTMLIFrameElement3_tid
,
1606 static dispex_static_data_t HTMLIFrame_dispex
= {
1609 HTMLIFrame_iface_tids
,
1610 HTMLElement_init_dispex_info
1613 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
1617 ret
= heap_alloc_zero(sizeof(HTMLIFrame
));
1619 return E_OUTOFMEMORY
;
1621 ret
->IHTMLIFrameElement_iface
.lpVtbl
= &HTMLIFrameElementVtbl
;
1622 ret
->IHTMLIFrameElement2_iface
.lpVtbl
= &HTMLIFrameElement2Vtbl
;
1623 ret
->IHTMLIFrameElement3_iface
.lpVtbl
= &HTMLIFrameElement3Vtbl
;
1624 ret
->framebase
.element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
1626 HTMLFrameBase_Init(&ret
->framebase
, doc
, nselem
, &HTMLIFrame_dispex
);
1628 *elem
= &ret
->framebase
.element
;