ReactOS  0.4.13-dev-482-ge57f103
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 
21 typedef struct {
23  IHTMLFrameElement3 IHTMLFrameElement3_iface;
25 
26 static inline HTMLFrameElement *impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
27 {
28  return CONTAINING_RECORD(iface, HTMLFrameElement, IHTMLFrameElement3_iface);
29 }
30 
31 static 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 
39 static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
40 {
42 
43  return IHTMLDOMNode_AddRef(&This->framebase.element.node.IHTMLDOMNode_iface);
44 }
45 
46 static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
47 {
49 
50  return IHTMLDOMNode_Release(&This->framebase.element.node.IHTMLDOMNode_iface);
51 }
52 
53 static 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 
60 static 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 
68 static 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 
76 static 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 
85 static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
86 {
88  IHTMLDocument2 *doc;
89  HRESULT hres;
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 
106 static 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 
113 static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
114 {
116  FIXME("(%p)->(%p)\n", This, p);
117  return E_NOTIMPL;
118 }
119 
120 static 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 
127 static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
128 {
130  FIXME("(%p)->(%p)\n", This, p);
131  return E_NOTIMPL;
132 }
133 
134 static 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 
141 static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
142 {
144  FIXME("(%p)->(%p)\n", This, p);
145  return E_NOTIMPL;
146 }
147 
148 static 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 
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;
243  HRESULT hres;
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 }
static const NodeImplVtbl HTMLFrameElementImplVtbl
Definition: htmlframe.c:276
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
Definition: htmlframe.c:53
#define REFIID
Definition: guiddef.h:113
static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl
Definition: htmlframe.c:148
HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
Definition: htmlframe.c:311
HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
Definition: htmlframebase.c:26
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
REFIID riid
Definition: precomp.h:44
static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:120
tid_t
Definition: ieframe.h:311
static void HTMLFrameElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmlframe.c:256
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
static HTMLFrameElement * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmlframe.c:165
REFIID LPVOID * ppv
Definition: atlbase.h:39
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
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface, REFIID riid, void **ppv)
Definition: htmlframe.c:31
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlframe.c:60
HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
static HTMLFrameElement * impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:26
static dispex_static_data_t HTMLFrameElement_dispex
Definition: htmlframe.c:304
static void HTMLFrameElement_unlink(HTMLDOMNode *iface)
Definition: htmlframe.c:264
#define HTMLELEMENT_TIDS
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD grfdex, DISPID *pid)
Definition: htmlframe.c:213
#define debugstr_w
Definition: kernel32.h:32
static size_t elem
Definition: string.c:68
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static HRESULT HTMLFrameElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
Definition: htmlframe.c:206
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NS_FAILED(res)
static const tid_t HTMLFrameElement_iface_tids[]
Definition: htmlframe.c:296
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
Definition: htmlframe.c:192
HTMLFrameBase framebase
Definition: htmlframe.c:22
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD cb
Definition: integrity.c:41
GLbitfield flags
Definition: glext.h:7161
static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
Definition: htmlframe.c:185
int ret
static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:127
void HTMLFrameBase_destructor(HTMLFrameBase *This)
IHTMLFrameElement3 IHTMLFrameElement3_iface
Definition: htmlframe.c:23
static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:106
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
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid)
Definition: htmlwindow.c:2513
static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:39
struct stdole::EXCEPINFO EXCEPINFO
static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
Definition: htmlframe.c:85
#define S_OK
Definition: intsafe.h:59
static VARIANTARG static DISPID
Definition: ordinal.c:49
const GLdouble * v
Definition: gl.h:2040
static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:113
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
Definition: htmlframe.c:134
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
Definition: name.c:36
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
HRESULT nsresult
Definition: nsiface.idl:39
unsigned int ULONG
Definition: retypes.h:1
static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
Definition: htmlframe.c:46
static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
Definition: htmlframe.c:238
static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: htmlframe.c:224
GLfloat GLfloat p
Definition: glext.h:8902
void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
Definition: htmlframe.c:141