ReactOS 0.4.15-dev-7712-gbbbcd8e
htmlframe.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "mshtml_private.h"
20
21typedef struct {
23 IHTMLFrameElement3 IHTMLFrameElement3_iface;
25
26static inline HTMLFrameElement *impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
27{
28 return CONTAINING_RECORD(iface, HTMLFrameElement, IHTMLFrameElement3_iface);
29}
30
31static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
32 REFIID riid, void **ppv)
33{
35
36 return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv);
37}
38
39static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
40{
42
43 return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
44}
45
46static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
47{
49
50 return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
51}
52
53static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
54{
56 return IDispatchEx_GetTypeInfoCount(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface,
57 pctinfo);
58}
59
60static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
61 LCID lcid, ITypeInfo **ppTInfo)
62{
64 return IDispatchEx_GetTypeInfo(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, iTInfo,
65 lcid, ppTInfo);
66}
67
68static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
69 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
70{
72 return IDispatchEx_GetIDsOfNames(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, riid,
73 rgszNames, cNames, lcid, rgDispId);
74}
75
76static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
77 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
78 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
79{
81 return IDispatchEx_Invoke(&This->framebase.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember,
82 riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
83}
84
86{
88 IHTMLDocument2 *doc;
90
91 TRACE("(%p)->(%p)\n", This, p);
92
93 if(!This->framebase.content_window) {
94 FIXME("NULL window\n");
95 return E_FAIL;
96 }
97
98 hres = IHTMLWindow2_get_document(&This->framebase.content_window->base.IHTMLWindow2_iface, &doc);
99 if(FAILED(hres))
100 return hres;
101
102 *p = doc ? (IDispatch*)doc : NULL;
103 return S_OK;
104}
105
106static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
107{
109 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
110 return E_NOTIMPL;
111}
112
113static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
114{
116 FIXME("(%p)->(%p)\n", This, p);
117 return E_NOTIMPL;
118}
119
120static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
121{
123 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
124 return E_NOTIMPL;
125}
126
127static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
128{
130 FIXME("(%p)->(%p)\n", This, p);
131 return E_NOTIMPL;
132}
133
134static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
135{
137 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
138 return E_NOTIMPL;
139}
140
141static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
142{
144 FIXME("(%p)->(%p)\n", This, p);
145 return E_NOTIMPL;
146}
147
148static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
163};
164
166{
167 return CONTAINING_RECORD(iface, HTMLFrameElement, framebase.element.node);
168}
169
171{
173
174 if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
175 TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
176 *ppv = &This->IHTMLFrameElement3_iface;
177 }else {
178 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
179 }
180
181 IUnknown_AddRef((IUnknown*)*ppv);
182 return S_OK;
183}
184
186{
188
189 HTMLFrameBase_destructor(&This->framebase);
190}
191
193{
195
196 if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
197 *p = NULL;
198 return S_OK;
199 }
200
201 *p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
202 IDispatch_AddRef(*p);
203 return S_OK;
204}
205
207{
209
210 return IHTMLFrameBase2_get_readyState(&This->framebase.IHTMLFrameBase2_iface, p);
211}
212
214 DWORD grfdex, DISPID *pid)
215{
217
218 if(!This->framebase.content_window)
219 return DISP_E_UNKNOWNNAME;
220
221 return search_window_props(This->framebase.content_window->base.inner_window, name, grfdex, pid);
222}
223
225 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
226{
228
229 if(!This->framebase.content_window) {
230 ERR("no content window to invoke on\n");
231 return E_FAIL;
232 }
233
234 return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid,
235 flags, params, res, ei, caller);
236}
237
239{
241 nsIDOMDocument *nsdoc;
242 nsresult nsres;
244
245 nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
246 if(NS_FAILED(nsres) || !nsdoc) {
247 ERR("GetContentDocument failed: %08x\n", nsres);
248 return E_FAIL;
249 }
250
251 hres = set_frame_doc(&This->framebase, nsdoc);
252 nsIDOMDocument_Release(nsdoc);
253 return hres;
254}
255
257{
259
260 if(This->framebase.nsframe)
261 note_cc_edge((nsISupports*)This->framebase.nsframe, "This->nsframe", cb);
262}
263
265{
267
268 if(This->framebase.nsframe) {
269 nsIDOMHTMLFrameElement *nsframe = This->framebase.nsframe;
270
271 This->framebase.nsframe = NULL;
272 nsIDOMHTMLFrameElement_Release(nsframe);
273 }
274}
275
283 NULL,
284 NULL,
285 NULL,
286 NULL,
294};
295
298 IHTMLFrameBase_tid,
299 IHTMLFrameBase2_tid,
300 IHTMLFrameElement3_tid,
301 0
302};
303
305 NULL,
306 DispHTMLFrameElement_tid,
307 NULL,
309};
310
312{
314
315 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
316 if(!ret)
317 return E_OUTOFMEMORY;
318
319 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
320 ret->IHTMLFrameElement3_iface.lpVtbl = &HTMLFrameElement3Vtbl;
321
322 HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
323
324 *elem = &ret->framebase.element;
325 return S_OK;
326}
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
const GLdouble * v
Definition: gl.h:2040
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
static const NodeImplVtbl HTMLFrameElementImplVtbl
Definition: htmlframe.c:276
static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
Definition: htmlframe.c:148
static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
Definition: htmlframe.c:192
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlframe.c:60
static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:127
static HTMLFrameElement * impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:26
static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:120
static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD grfdex, DISPID *pid)
Definition: htmlframe.c:213
static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
Definition: htmlframe.c:185
static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlframe.c:76
static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:46
static HTMLFrameElement * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmlframe.c:165
static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlframe.c:68
static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlframe.c:170
static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:134
static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: htmlframe.c:224
static void HTMLFrameElement_unlink(HTMLDOMNode *iface)
Definition: htmlframe.c:264
static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:141
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
Definition: htmlframe.c:53
HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
Definition: htmlframe.c:311
static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:113
static HRESULT HTMLFrameElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
Definition: htmlframe.c:206
static void HTMLFrameElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmlframe.c:256
static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
Definition: htmlframe.c:85
static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface, REFIID riid, void **ppv)
Definition: htmlframe.c:31
static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:106
static const tid_t HTMLFrameElement_iface_tids[]
Definition: htmlframe.c:296
static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
Definition: htmlframe.c:238
static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:39
static dispex_static_data_t HTMLFrameElement_dispex
Definition: htmlframe.c:304
void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
Definition: htmlframebase.c:26
void HTMLFrameBase_destructor(HTMLFrameBase *This)
HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: htmlwindow.c:2513
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static size_t elem
Definition: string.c:68
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
#define HTMLELEMENT_TIDS
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
#define NS_FAILED(res)
unsigned int UINT
Definition: ndis.h:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
HTMLFrameBase framebase
Definition: htmlframe.c:22
IHTMLFrameElement3 IHTMLFrameElement3_iface
Definition: htmlframe.c:23
Definition: name.c:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define WINAPI
Definition: msvc.h:6
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515