wined3d: Introduce WINED3DFMT_INST and use it in CheckTextureCapability().
[wine/testsucceed.git] / dlls / mshtml / htmliframe.c
blobddb32c80ab2be48a3689911dc6e9921860eff240
1 /*
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLFrameBase framebase;
36 } HTMLIFrame;
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) {
59 *p = NULL;
60 return S_OK;
63 *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
64 IDispatch_AddRef(*p);
65 return S_OK;
68 static HRESULT HTMLIFrame_get_dispid(HTMLDOMNode *iface, BSTR name,
69 DWORD grfdex, DISPID *pid)
71 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
73 if(!This->framebase.content_window)
74 return DISP_E_UNKNOWNNAME;
76 return search_window_props(This->framebase.content_window, name, grfdex, pid);
79 static HRESULT HTMLIFrame_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
80 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
82 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
84 if(!This->framebase.content_window) {
85 ERR("no content window to invoke on\n");
86 return E_FAIL;
89 return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller);
92 static HRESULT HTMLIFrame_get_readystate(HTMLDOMNode *iface, BSTR *p)
94 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
96 return IHTMLFrameBase2_get_readyState(HTMLFRAMEBASE2(&This->framebase), p);
99 static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
101 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
102 nsIDOMDocument *nsdoc;
103 nsresult nsres;
104 HRESULT hres;
106 nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->framebase.nsiframe, &nsdoc);
107 if(NS_FAILED(nsres) || !nsdoc) {
108 ERR("GetContentDocument failed: %08x\n", nsres);
109 return E_FAIL;
112 hres = set_frame_doc(&This->framebase, nsdoc);
113 nsIDOMDocument_Release(nsdoc);
114 return hres;
117 #undef HTMLIFRAME_NODE_THIS
119 static const NodeImplVtbl HTMLIFrameImplVtbl = {
120 HTMLIFrame_QI,
121 HTMLIFrame_destructor,
122 NULL,
123 NULL,
124 NULL,
125 NULL,
126 HTMLIFrame_get_document,
127 HTMLIFrame_get_readystate,
128 HTMLIFrame_get_dispid,
129 HTMLIFrame_invoke,
130 HTMLIFrame_bind_to_tree
133 static const tid_t HTMLIFrame_iface_tids[] = {
134 IHTMLDOMNode_tid,
135 IHTMLDOMNode2_tid,
136 IHTMLElement_tid,
137 IHTMLElement2_tid,
138 IHTMLElement3_tid,
139 IHTMLFrameBase_tid,
140 IHTMLFrameBase2_tid,
144 static dispex_static_data_t HTMLIFrame_dispex = {
145 NULL,
146 DispHTMLIFrame_tid,
147 NULL,
148 HTMLIFrame_iface_tids
151 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
153 HTMLIFrame *ret;
155 ret = heap_alloc_zero(sizeof(HTMLIFrame));
157 ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
159 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
161 return &ret->framebase.element;