2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
40 nsIDOMHTMLIFrameElement
*nsiframe
;
41 HTMLDocument
*content_doc
;
44 #define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl)
46 #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
48 static HRESULT WINAPI
HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2
*iface
, REFIID riid
, void **ppv
)
50 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
52 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This
->element
.node
), riid
, ppv
);
55 static ULONG WINAPI
HTMLIFrameBase2_AddRef(IHTMLFrameBase2
*iface
)
57 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
59 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This
->element
.node
));
62 static ULONG WINAPI
HTMLIFrameBase2_Release(IHTMLFrameBase2
*iface
)
64 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
66 return IHTMLDOMNode_Release(HTMLDOMNODE(&This
->element
.node
));
69 static HRESULT WINAPI
HTMLIFrameBase2_GetTypeInfoCount(IHTMLFrameBase2
*iface
, UINT
*pctinfo
)
71 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
72 FIXME("(%p)\n", This
);
76 static HRESULT WINAPI
HTMLIFrameBase2_GetTypeInfo(IHTMLFrameBase2
*iface
, UINT iTInfo
,
77 LCID lcid
, ITypeInfo
**ppTInfo
)
79 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
80 FIXME("(%p)\n", This
);
84 static HRESULT WINAPI
HTMLIFrameBase2_GetIDsOfNames(IHTMLFrameBase2
*iface
, REFIID riid
,
85 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
87 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
88 FIXME("(%p)\n", This
);
92 static HRESULT WINAPI
HTMLIFrameBase2_Invoke(IHTMLFrameBase2
*iface
, DISPID dispIdMember
,
93 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
94 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
96 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
97 FIXME("(%p)\n", This
);
101 static HRESULT WINAPI
HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2
*iface
, IHTMLWindow2
**p
)
103 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
105 TRACE("(%p)->(%p)\n", This
, p
);
107 if(!This
->content_doc
) {
108 nsIDOMHTMLDocument
*nshtmldoc
;
109 nsIDOMDocument
*nsdoc
;
113 nsres
= nsIDOMHTMLIFrameElement_GetContentDocument(This
->nsiframe
, &nsdoc
);
114 if(NS_FAILED(nsres
)) {
115 ERR("GetContentDocument failed: %08x\n", nsres
);
120 FIXME("NULL contentDocument\n");
124 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
125 nsIDOMDocument_Release(nsdoc
);
126 if(NS_FAILED(nsres
)) {
127 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
131 hres
= create_doc_from_nsdoc(nshtmldoc
, &This
->content_doc
);
132 nsIDOMHTMLDocument_Release(nshtmldoc
);
137 return IHTMLDocument2_get_parentWindow(HTMLDOC(This
->content_doc
), p
);
140 static HRESULT WINAPI
HTMLIFrameBase2_put_onload(IHTMLFrameBase2
*iface
, VARIANT v
)
142 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
143 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
147 static HRESULT WINAPI
HTMLIFrameBase2_get_onload(IHTMLFrameBase2
*iface
, VARIANT
*p
)
149 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
150 FIXME("(%p)->(%p)\n", This
, p
);
154 static HRESULT WINAPI
HTMLIFrameBase2_put_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT v
)
156 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
157 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
161 static HRESULT WINAPI
HTMLIFrameBase2_get_onreadystatechange(IHTMLFrameBase2
*iface
, VARIANT
*p
)
163 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
164 FIXME("(%p)->(%p)\n", This
, p
);
168 static HRESULT WINAPI
HTMLIFrameBase2_get_readyState(IHTMLFrameBase2
*iface
, BSTR
*p
)
170 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
171 FIXME("(%p)->(%p)\n", This
, p
);
175 static HRESULT WINAPI
HTMLIFrameBase2_put_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL v
)
177 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
178 FIXME("(%p)->(%x)\n", This
, v
);
182 static HRESULT WINAPI
HTMLIFrameBase2_get_allowTransparency(IHTMLFrameBase2
*iface
, VARIANT_BOOL
*p
)
184 HTMLIFrame
*This
= HTMLFRAMEBASE2_THIS(iface
);
185 FIXME("(%p)->(%p)\n", This
, p
);
189 #undef HTMLFRAMEBASE2_THIS
191 static const IHTMLFrameBase2Vtbl HTMLIFrameBase2Vtbl
= {
192 HTMLIFrameBase2_QueryInterface
,
193 HTMLIFrameBase2_AddRef
,
194 HTMLIFrameBase2_Release
,
195 HTMLIFrameBase2_GetTypeInfoCount
,
196 HTMLIFrameBase2_GetTypeInfo
,
197 HTMLIFrameBase2_GetIDsOfNames
,
198 HTMLIFrameBase2_Invoke
,
199 HTMLIFrameBase2_get_contentWindow
,
200 HTMLIFrameBase2_put_onload
,
201 HTMLIFrameBase2_get_onload
,
202 HTMLIFrameBase2_put_onreadystatechange
,
203 HTMLIFrameBase2_get_onreadystatechange
,
204 HTMLIFrameBase2_get_readyState
,
205 HTMLIFrameBase2_put_allowTransparency
,
206 HTMLIFrameBase2_get_allowTransparency
209 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, element.node, iface)
211 static HRESULT
HTMLIFrame_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
213 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
217 if(IsEqualGUID(&IID_IHTMLFrameBase2
, riid
)) {
218 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This
, ppv
);
219 *ppv
= HTMLFRAMEBASE2(This
);
221 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
224 IUnknown_AddRef((IUnknown
*)*ppv
);
228 static void HTMLIFrame_destructor(HTMLDOMNode
*iface
)
230 HTMLIFrame
*This
= HTMLIFRAME_NODE_THIS(iface
);
232 if(This
->content_doc
)
233 IHTMLDocument2_Release(HTMLDOC(This
->content_doc
));
235 nsIDOMHTMLIFrameElement_Release(This
->nsiframe
);
237 HTMLElement_destructor(&This
->element
.node
);
240 #undef HTMLIFRAME_NODE_THIS
242 static const NodeImplVtbl HTMLIFrameImplVtbl
= {
244 HTMLIFrame_destructor
247 static const tid_t HTMLIFrame_iface_tids
[] = {
257 static dispex_static_data_t HTMLIFrame_dispex
= {
261 HTMLIFrame_iface_tids
264 HTMLElement
*HTMLIFrame_Create(nsIDOMHTMLElement
*nselem
)
269 ret
= heap_alloc_zero(sizeof(HTMLIFrame
));
271 ret
->lpIHTMLFrameBase2Vtbl
= &HTMLIFrameBase2Vtbl
;
272 ret
->element
.node
.vtbl
= &HTMLIFrameImplVtbl
;
274 init_dispex(&ret
->element
.node
.dispex
, (IUnknown
*)HTMLFRAMEBASE2(ret
), &HTMLIFrame_dispex
);
275 HTMLElement_Init(&ret
->element
);
277 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLIFrameElement
, (void**)&ret
->nsiframe
);
279 ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres
);
281 return &ret
->element
;