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 HTMLWindow *content_window;
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_window) {
108 nsIDOMHTMLDocument *nshtmldoc;
109 HTMLDocumentNode *content_doc;
110 nsIDOMDocument *nsdoc;
115 nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->nsiframe, &nsdoc);
116 if(NS_FAILED(nsres)) {
117 ERR("GetContentDocument failed: %08x\n", nsres);
122 FIXME("NULL contentDocument\n");
126 nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
127 nsIDOMDocument_Release(nsdoc);
128 if(NS_FAILED(nsres)) {
129 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres);
133 hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, NULL, &window);
135 nsIDOMDocument_Release(nsdoc);
139 hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->basedoc.doc_obj, window, &content_doc);
140 nsIDOMHTMLDocument_Release(nshtmldoc);
142 window_set_docnode(window, content_doc);
144 IHTMLWindow2_Release(HTMLWINDOW2(window));
145 htmldoc_release(&content_doc->basedoc);
149 This->content_window = window;
152 IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window));
153 *p = HTMLWINDOW2(This->content_window);
157 static HRESULT WINAPI HTMLIFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
159 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
160 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
164 static HRESULT WINAPI HTMLIFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
166 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
167 FIXME("(%p)->(%p)\n", This, p);
171 static HRESULT WINAPI HTMLIFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
173 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
174 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
178 static HRESULT WINAPI HTMLIFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
180 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
181 FIXME("(%p)->(%p)\n", This, p);
185 static HRESULT WINAPI HTMLIFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
187 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
188 FIXME("(%p)->(%p)\n", This, p);
192 static HRESULT WINAPI HTMLIFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
194 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
195 FIXME("(%p)->(%x)\n", This, v);
199 static HRESULT WINAPI HTMLIFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
201 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
202 FIXME("(%p)->(%p)\n", This, p);
206 #undef HTMLFRAMEBASE2_THIS
208 static const IHTMLFrameBase2Vtbl HTMLIFrameBase2Vtbl = {
209 HTMLIFrameBase2_QueryInterface,
210 HTMLIFrameBase2_AddRef,
211 HTMLIFrameBase2_Release,
212 HTMLIFrameBase2_GetTypeInfoCount,
213 HTMLIFrameBase2_GetTypeInfo,
214 HTMLIFrameBase2_GetIDsOfNames,
215 HTMLIFrameBase2_Invoke,
216 HTMLIFrameBase2_get_contentWindow,
217 HTMLIFrameBase2_put_onload,
218 HTMLIFrameBase2_get_onload,
219 HTMLIFrameBase2_put_onreadystatechange,
220 HTMLIFrameBase2_get_onreadystatechange,
221 HTMLIFrameBase2_get_readyState,
222 HTMLIFrameBase2_put_allowTransparency,
223 HTMLIFrameBase2_get_allowTransparency
226 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, element.node, iface)
228 static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
230 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
234 if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
235 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
236 *ppv = HTMLFRAMEBASE2(This);
238 return HTMLElement_QI(&This->element.node, riid, ppv);
241 IUnknown_AddRef((IUnknown*)*ppv);
245 static void HTMLIFrame_destructor(HTMLDOMNode *iface)
247 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
249 if(This->content_window)
250 IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
252 nsIDOMHTMLIFrameElement_Release(This->nsiframe);
254 HTMLElement_destructor(&This->element.node);
257 #undef HTMLIFRAME_NODE_THIS
259 static const NodeImplVtbl HTMLIFrameImplVtbl = {
261 HTMLIFrame_destructor
264 static const tid_t HTMLIFrame_iface_tids[] = {
274 static dispex_static_data_t HTMLIFrame_dispex = {
278 HTMLIFrame_iface_tids
281 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement *nselem)
286 ret = heap_alloc_zero(sizeof(HTMLIFrame));
288 ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
289 ret->element.node.vtbl = &HTMLIFrameImplVtbl;
291 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLFRAMEBASE2(ret), &HTMLIFrame_dispex);
292 HTMLElement_Init(&ret->element);
294 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
296 ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
298 return &ret->element;