d3d9/tests: Add test for regression in IDirect3DDevice9_Reset().
[wine.git] / dlls / mshtml / htmlhead.c
blob9f735ebbb9006c538446a6c30d21bcdb6df1cc4f
1 /*
2 * Copyright 2011 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"
27 #include "mshtmdid.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLElement element;
38 IHTMLTitleElement IHTMLTitleElement_iface;
39 } HTMLTitleElement;
41 static inline HTMLTitleElement *impl_from_IHTMLTitleElement(IHTMLTitleElement *iface)
43 return CONTAINING_RECORD(iface, HTMLTitleElement, IHTMLTitleElement_iface);
46 static HRESULT WINAPI HTMLTitleElement_QueryInterface(IHTMLTitleElement *iface,
47 REFIID riid, void **ppv)
49 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
51 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
54 static ULONG WINAPI HTMLTitleElement_AddRef(IHTMLTitleElement *iface)
56 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
58 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
61 static ULONG WINAPI HTMLTitleElement_Release(IHTMLTitleElement *iface)
63 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
65 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
68 static HRESULT WINAPI HTMLTitleElement_GetTypeInfoCount(IHTMLTitleElement *iface, UINT *pctinfo)
70 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
72 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
75 static HRESULT WINAPI HTMLTitleElement_GetTypeInfo(IHTMLTitleElement *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
80 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
81 ppTInfo);
84 static HRESULT WINAPI HTMLTitleElement_GetIDsOfNames(IHTMLTitleElement *iface, REFIID riid,
85 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
87 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
89 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
90 cNames, lcid, rgDispId);
93 static HRESULT WINAPI HTMLTitleElement_Invoke(IHTMLTitleElement *iface, DISPID dispIdMember,
94 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
95 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
97 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
99 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
100 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
103 static HRESULT WINAPI HTMLTitleElement_put_text(IHTMLTitleElement *iface, BSTR v)
105 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
106 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
107 return E_NOTIMPL;
110 static HRESULT WINAPI HTMLTitleElement_get_text(IHTMLTitleElement *iface, BSTR *p)
112 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
113 FIXME("(%p)->(%p)\n", This, p);
114 return E_NOTIMPL;
117 static const IHTMLTitleElementVtbl HTMLTitleElementVtbl = {
118 HTMLTitleElement_QueryInterface,
119 HTMLTitleElement_AddRef,
120 HTMLTitleElement_Release,
121 HTMLTitleElement_GetTypeInfoCount,
122 HTMLTitleElement_GetTypeInfo,
123 HTMLTitleElement_GetIDsOfNames,
124 HTMLTitleElement_Invoke,
125 HTMLTitleElement_put_text,
126 HTMLTitleElement_get_text
129 static inline HTMLTitleElement *HTMLTitleElement_from_HTMLDOMNode(HTMLDOMNode *iface)
131 return CONTAINING_RECORD(iface, HTMLTitleElement, element.node);
134 static HRESULT HTMLTitleElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
136 HTMLTitleElement *This = HTMLTitleElement_from_HTMLDOMNode(iface);
138 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
140 if(IsEqualGUID(&IID_IHTMLTitleElement, riid))
141 *ppv = &This->IHTMLTitleElement_iface;
142 else
143 return HTMLElement_QI(&This->element.node, riid, ppv);
145 IUnknown_AddRef((IUnknown*)*ppv);
146 return S_OK;
149 static void HTMLTitleElement_destructor(HTMLDOMNode *iface)
151 HTMLTitleElement *This = HTMLTitleElement_from_HTMLDOMNode(iface);
153 HTMLElement_destructor(&This->element.node);
156 static const NodeImplVtbl HTMLTitleElementImplVtbl = {
157 HTMLTitleElement_QI,
158 HTMLTitleElement_destructor,
159 HTMLElement_cpc,
160 HTMLElement_clone,
161 HTMLElement_handle_event,
162 HTMLElement_get_attr_col
165 static const tid_t HTMLTitleElement_iface_tids[] = {
166 HTMLELEMENT_TIDS,
167 IHTMLTitleElement_tid,
170 static dispex_static_data_t HTMLTitleElement_dispex = {
171 NULL,
172 DispHTMLTitleElement_tid,
173 HTMLTitleElement_iface_tids,
174 HTMLElement_init_dispex_info
177 HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
179 HTMLTitleElement *ret;
181 ret = heap_alloc_zero(sizeof(*ret));
182 if(!ret)
183 return E_OUTOFMEMORY;
185 ret->IHTMLTitleElement_iface.lpVtbl = &HTMLTitleElementVtbl;
186 ret->element.node.vtbl = &HTMLTitleElementImplVtbl;
188 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTitleElement_dispex);
190 *elem = &ret->element;
191 return S_OK;
194 typedef struct {
195 HTMLElement element;
197 IHTMLHtmlElement IHTMLHtmlElement_iface;
198 } HTMLHtmlElement;
200 static inline HTMLHtmlElement *impl_from_IHTMLHtmlElement(IHTMLHtmlElement *iface)
202 return CONTAINING_RECORD(iface, HTMLHtmlElement, IHTMLHtmlElement_iface);
205 static HRESULT WINAPI HTMLHtmlElement_QueryInterface(IHTMLHtmlElement *iface,
206 REFIID riid, void **ppv)
208 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
210 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
213 static ULONG WINAPI HTMLHtmlElement_AddRef(IHTMLHtmlElement *iface)
215 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
217 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
220 static ULONG WINAPI HTMLHtmlElement_Release(IHTMLHtmlElement *iface)
222 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
224 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
227 static HRESULT WINAPI HTMLHtmlElement_GetTypeInfoCount(IHTMLHtmlElement *iface, UINT *pctinfo)
229 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
231 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
234 static HRESULT WINAPI HTMLHtmlElement_GetTypeInfo(IHTMLHtmlElement *iface, UINT iTInfo,
235 LCID lcid, ITypeInfo **ppTInfo)
237 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
239 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
240 ppTInfo);
243 static HRESULT WINAPI HTMLHtmlElement_GetIDsOfNames(IHTMLHtmlElement *iface, REFIID riid,
244 LPOLESTR *rgszNames, UINT cNames,
245 LCID lcid, DISPID *rgDispId)
247 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
249 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
250 cNames, lcid, rgDispId);
253 static HRESULT WINAPI HTMLHtmlElement_Invoke(IHTMLHtmlElement *iface, DISPID dispIdMember,
254 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
255 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
257 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
259 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
260 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
263 static HRESULT WINAPI HTMLHtmlElement_put_version(IHTMLHtmlElement *iface, BSTR v)
265 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
266 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
267 return E_NOTIMPL;
270 static HRESULT WINAPI HTMLHtmlElement_get_version(IHTMLHtmlElement *iface, BSTR *p)
272 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
273 FIXME("(%p)->(%p)\n", This, p);
274 return E_NOTIMPL;
277 static const IHTMLHtmlElementVtbl HTMLHtmlElementVtbl = {
278 HTMLHtmlElement_QueryInterface,
279 HTMLHtmlElement_AddRef,
280 HTMLHtmlElement_Release,
281 HTMLHtmlElement_GetTypeInfoCount,
282 HTMLHtmlElement_GetTypeInfo,
283 HTMLHtmlElement_GetIDsOfNames,
284 HTMLHtmlElement_Invoke,
285 HTMLHtmlElement_put_version,
286 HTMLHtmlElement_get_version
289 static inline HTMLHtmlElement *HTMLHtmlElement_from_HTMLDOMNode(HTMLDOMNode *iface)
291 return CONTAINING_RECORD(iface, HTMLHtmlElement, element.node);
294 static HRESULT HTMLHtmlElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
296 HTMLHtmlElement *This = HTMLHtmlElement_from_HTMLDOMNode(iface);
298 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
300 if(IsEqualGUID(&IID_IHTMLHtmlElement, riid))
301 *ppv = &This->IHTMLHtmlElement_iface;
302 else
303 return HTMLElement_QI(&This->element.node, riid, ppv);
305 IUnknown_AddRef((IUnknown*)*ppv);
306 return S_OK;
309 static void HTMLHtmlElement_destructor(HTMLDOMNode *iface)
311 HTMLHtmlElement *This = HTMLHtmlElement_from_HTMLDOMNode(iface);
313 HTMLElement_destructor(&This->element.node);
316 static BOOL HTMLHtmlElement_is_settable(HTMLDOMNode *iface, DISPID dispid)
318 switch(dispid) {
319 case DISPID_IHTMLELEMENT_OUTERTEXT:
320 return FALSE;
321 default:
322 return TRUE;
326 static const NodeImplVtbl HTMLHtmlElementImplVtbl = {
327 HTMLHtmlElement_QI,
328 HTMLHtmlElement_destructor,
329 HTMLElement_cpc,
330 HTMLElement_clone,
331 HTMLElement_handle_event,
332 HTMLElement_get_attr_col,
333 NULL,
334 NULL,
335 NULL,
336 NULL,
337 NULL,
338 NULL,
339 NULL,
340 NULL,
341 NULL,
342 NULL,
343 NULL,
344 NULL,
345 HTMLHtmlElement_is_settable
348 static const tid_t HTMLHtmlElement_iface_tids[] = {
349 HTMLELEMENT_TIDS,
350 IHTMLHtmlElement_tid,
353 static dispex_static_data_t HTMLHtmlElement_dispex = {
354 NULL,
355 DispHTMLHtmlElement_tid,
356 HTMLHtmlElement_iface_tids,
357 HTMLElement_init_dispex_info
360 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
362 HTMLHtmlElement *ret;
364 ret = heap_alloc_zero(sizeof(*ret));
365 if(!ret)
366 return E_OUTOFMEMORY;
368 ret->IHTMLHtmlElement_iface.lpVtbl = &HTMLHtmlElementVtbl;
369 ret->element.node.vtbl = &HTMLHtmlElementImplVtbl;
371 HTMLElement_Init(&ret->element, doc, nselem, &HTMLHtmlElement_dispex);
373 *elem = &ret->element;
374 return S_OK;
377 typedef struct {
378 HTMLElement element;
380 IHTMLHeadElement IHTMLHeadElement_iface;
381 } HTMLHeadElement;
383 static inline HTMLHeadElement *impl_from_IHTMLHeadElement(IHTMLHeadElement *iface)
385 return CONTAINING_RECORD(iface, HTMLHeadElement, IHTMLHeadElement_iface);
388 static HRESULT WINAPI HTMLHeadElement_QueryInterface(IHTMLHeadElement *iface,
389 REFIID riid, void **ppv)
391 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
393 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
396 static ULONG WINAPI HTMLHeadElement_AddRef(IHTMLHeadElement *iface)
398 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
400 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
403 static ULONG WINAPI HTMLHeadElement_Release(IHTMLHeadElement *iface)
405 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
407 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
410 static HRESULT WINAPI HTMLHeadElement_GetTypeInfoCount(IHTMLHeadElement *iface, UINT *pctinfo)
412 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
414 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
417 static HRESULT WINAPI HTMLHeadElement_GetTypeInfo(IHTMLHeadElement *iface, UINT iTInfo,
418 LCID lcid, ITypeInfo **ppTInfo)
420 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
422 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
423 ppTInfo);
426 static HRESULT WINAPI HTMLHeadElement_GetIDsOfNames(IHTMLHeadElement *iface, REFIID riid,
427 LPOLESTR *rgszNames, UINT cNames,
428 LCID lcid, DISPID *rgDispId)
430 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
432 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
433 cNames, lcid, rgDispId);
436 static HRESULT WINAPI HTMLHeadElement_Invoke(IHTMLHeadElement *iface, DISPID dispIdMember,
437 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
438 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
440 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
442 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
443 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
446 static HRESULT WINAPI HTMLHeadElement_put_profile(IHTMLHeadElement *iface, BSTR v)
448 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
449 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
450 return E_NOTIMPL;
453 static HRESULT WINAPI HTMLHeadElement_get_profile(IHTMLHeadElement *iface, BSTR *p)
455 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
456 FIXME("(%p)->(%p)\n", This, p);
457 return E_NOTIMPL;
460 static const IHTMLHeadElementVtbl HTMLHeadElementVtbl = {
461 HTMLHeadElement_QueryInterface,
462 HTMLHeadElement_AddRef,
463 HTMLHeadElement_Release,
464 HTMLHeadElement_GetTypeInfoCount,
465 HTMLHeadElement_GetTypeInfo,
466 HTMLHeadElement_GetIDsOfNames,
467 HTMLHeadElement_Invoke,
468 HTMLHeadElement_put_profile,
469 HTMLHeadElement_get_profile
472 static inline HTMLHeadElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
474 return CONTAINING_RECORD(iface, HTMLHeadElement, element.node);
477 static HRESULT HTMLHeadElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
479 HTMLHeadElement *This = impl_from_HTMLDOMNode(iface);
481 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
483 if(IsEqualGUID(&IID_IHTMLHeadElement, riid))
484 *ppv = &This->IHTMLHeadElement_iface;
485 else
486 return HTMLElement_QI(&This->element.node, riid, ppv);
488 IUnknown_AddRef((IUnknown*)*ppv);
489 return S_OK;
492 static void HTMLHeadElement_destructor(HTMLDOMNode *iface)
494 HTMLHeadElement *This = impl_from_HTMLDOMNode(iface);
496 HTMLElement_destructor(&This->element.node);
499 static const NodeImplVtbl HTMLHeadElementImplVtbl = {
500 HTMLHeadElement_QI,
501 HTMLHeadElement_destructor,
502 HTMLElement_cpc,
503 HTMLElement_clone,
504 HTMLElement_handle_event,
505 HTMLElement_get_attr_col
508 static const tid_t HTMLHeadElement_iface_tids[] = {
509 HTMLELEMENT_TIDS,
510 IHTMLHeadElement_tid,
513 static dispex_static_data_t HTMLHeadElement_dispex = {
514 NULL,
515 DispHTMLHeadElement_tid,
516 HTMLHeadElement_iface_tids,
517 HTMLElement_init_dispex_info
520 HRESULT HTMLHeadElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
522 HTMLHeadElement *ret;
524 ret = heap_alloc_zero(sizeof(*ret));
525 if(!ret)
526 return E_OUTOFMEMORY;
528 ret->IHTMLHeadElement_iface.lpVtbl = &HTMLHeadElementVtbl;
529 ret->element.node.vtbl = &HTMLHeadElementImplVtbl;
531 HTMLElement_Init(&ret->element, doc, nselem, &HTMLHeadElement_dispex);
533 *elem = &ret->element;
534 return S_OK;