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);
35 HTMLFrameBase framebase;
38 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, framebase.element.node, iface)
40 static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
42 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
44 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
47 static void HTMLIFrame_destructor(HTMLDOMNode *iface)
49 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
51 HTMLFrameBase_destructor(&This->framebase);
54 static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
56 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
58 if(!This->framebase.content_window || !This->framebase.content_window->doc) {
63 *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
68 static HRESULT HTMLIFrame_get_readystate(HTMLDOMNode *iface, BSTR *p)
70 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
72 return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This->framebase), p);
75 static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
77 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
78 nsIDOMDocument *nsdoc;
82 nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->framebase.nsiframe, &nsdoc);
83 if(NS_FAILED(nsres) || !nsdoc) {
84 ERR("GetContentDocument failed: %08x\n", nsres);
88 hres = set_frame_doc(&This->framebase, nsdoc);
89 nsIDOMDocument_Release(nsdoc);
93 #undef HTMLIFRAME_NODE_THIS
95 static const NodeImplVtbl HTMLIFrameImplVtbl = {
97 HTMLIFrame_destructor,
102 HTMLIFrame_get_document,
103 HTMLIFrame_get_readystate,
106 HTMLIFrame_bind_to_tree
109 static const tid_t HTMLIFrame_iface_tids[] = {
120 static dispex_static_data_t HTMLIFrame_dispex = {
124 HTMLIFrame_iface_tids
127 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
131 ret = heap_alloc_zero(sizeof(HTMLIFrame));
133 ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
135 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
137 return &ret->framebase.element;