include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / dlls / mshtml / htmlhead.c
blob89c45b668a1d858d0706600533b7898237bfd27f
1 /*
2 * Copyright 2011,2012 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"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 struct HTMLTitleElement {
37 HTMLElement element;
39 IHTMLTitleElement IHTMLTitleElement_iface;
42 static inline HTMLTitleElement *impl_from_IHTMLTitleElement(IHTMLTitleElement *iface)
44 return CONTAINING_RECORD(iface, HTMLTitleElement, IHTMLTitleElement_iface);
47 DISPEX_IDISPATCH_IMPL(HTMLTitleElement, IHTMLTitleElement,
48 impl_from_IHTMLTitleElement(iface)->element.node.event_target.dispex)
50 static HRESULT WINAPI HTMLTitleElement_put_text(IHTMLTitleElement *iface, BSTR v)
52 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
53 nsAString text;
54 nsresult nsres;
56 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
58 nsAString_InitDepend(&text, v);
59 nsres = nsIDOMNode_SetTextContent(This->element.node.nsnode, &text);
60 nsAString_Finish(&text);
62 return map_nsresult(nsres);
65 static HRESULT WINAPI HTMLTitleElement_get_text(IHTMLTitleElement *iface, BSTR *p)
67 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
68 nsAString text;
69 nsresult nsres;
71 TRACE("(%p)->(%p)\n", This, p);
73 nsAString_InitDepend(&text, NULL);
74 nsres = nsIDOMNode_GetTextContent(This->element.node.nsnode, &text);
75 return return_nsstr(nsres, &text, p);
78 static const IHTMLTitleElementVtbl HTMLTitleElementVtbl = {
79 HTMLTitleElement_QueryInterface,
80 HTMLTitleElement_AddRef,
81 HTMLTitleElement_Release,
82 HTMLTitleElement_GetTypeInfoCount,
83 HTMLTitleElement_GetTypeInfo,
84 HTMLTitleElement_GetIDsOfNames,
85 HTMLTitleElement_Invoke,
86 HTMLTitleElement_put_text,
87 HTMLTitleElement_get_text
90 static inline HTMLTitleElement *HTMLTitleElement_from_DispatchEx(DispatchEx *iface)
92 return CONTAINING_RECORD(iface, HTMLTitleElement, element.node.event_target.dispex);
95 static void *HTMLTitleElement_query_interface(DispatchEx *dispex, REFIID riid)
97 HTMLTitleElement *This = HTMLTitleElement_from_DispatchEx(dispex);
99 if(IsEqualGUID(&IID_IHTMLTitleElement, riid))
100 return &This->IHTMLTitleElement_iface;
102 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
105 static const NodeImplVtbl HTMLTitleElementImplVtbl = {
106 .clsid = &CLSID_HTMLTitleElement,
107 .cpc_entries = HTMLElement_cpc,
108 .clone = HTMLElement_clone,
109 .get_attr_col = HTMLElement_get_attr_col
112 static const event_target_vtbl_t HTMLTitleElement_event_target_vtbl = {
114 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
115 .query_interface= HTMLTitleElement_query_interface,
116 .destructor = HTMLElement_destructor,
117 .traverse = HTMLElement_traverse,
118 .unlink = HTMLElement_unlink
120 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
121 .handle_event = HTMLElement_handle_event
124 static const tid_t HTMLTitleElement_iface_tids[] = {
125 HTMLELEMENT_TIDS,
126 IHTMLTitleElement_tid,
129 static dispex_static_data_t HTMLTitleElement_dispex = {
130 "HTMLTitleElement",
131 &HTMLTitleElement_event_target_vtbl.dispex_vtbl,
132 DispHTMLTitleElement_tid,
133 HTMLTitleElement_iface_tids,
134 HTMLElement_init_dispex_info
137 HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
139 HTMLTitleElement *ret;
141 ret = calloc(1, sizeof(*ret));
142 if(!ret)
143 return E_OUTOFMEMORY;
145 ret->IHTMLTitleElement_iface.lpVtbl = &HTMLTitleElementVtbl;
146 ret->element.node.vtbl = &HTMLTitleElementImplVtbl;
148 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTitleElement_dispex);
150 *elem = &ret->element;
151 return S_OK;
154 struct HTMLHtmlElement {
155 HTMLElement element;
157 IHTMLHtmlElement IHTMLHtmlElement_iface;
160 static inline HTMLHtmlElement *impl_from_IHTMLHtmlElement(IHTMLHtmlElement *iface)
162 return CONTAINING_RECORD(iface, HTMLHtmlElement, IHTMLHtmlElement_iface);
165 DISPEX_IDISPATCH_IMPL(HTMLHtmlElement, IHTMLHtmlElement,
166 impl_from_IHTMLHtmlElement(iface)->element.node.event_target.dispex)
168 static HRESULT WINAPI HTMLHtmlElement_put_version(IHTMLHtmlElement *iface, BSTR v)
170 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
171 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLHtmlElement_get_version(IHTMLHtmlElement *iface, BSTR *p)
177 HTMLHtmlElement *This = impl_from_IHTMLHtmlElement(iface);
178 FIXME("(%p)->(%p)\n", This, p);
179 return E_NOTIMPL;
182 static const IHTMLHtmlElementVtbl HTMLHtmlElementVtbl = {
183 HTMLHtmlElement_QueryInterface,
184 HTMLHtmlElement_AddRef,
185 HTMLHtmlElement_Release,
186 HTMLHtmlElement_GetTypeInfoCount,
187 HTMLHtmlElement_GetTypeInfo,
188 HTMLHtmlElement_GetIDsOfNames,
189 HTMLHtmlElement_Invoke,
190 HTMLHtmlElement_put_version,
191 HTMLHtmlElement_get_version
194 static inline HTMLHtmlElement *HTMLHtmlElement_from_DispatchEx(DispatchEx *iface)
196 return CONTAINING_RECORD(iface, HTMLHtmlElement, element.node.event_target.dispex);
199 static BOOL HTMLHtmlElement_is_settable(HTMLDOMNode *iface, DISPID dispid)
201 switch(dispid) {
202 case DISPID_IHTMLELEMENT_OUTERTEXT:
203 return FALSE;
204 default:
205 return TRUE;
209 static void *HTMLHtmlElement_query_interface(DispatchEx *dispex, REFIID riid)
211 HTMLHtmlElement *This = HTMLHtmlElement_from_DispatchEx(dispex);
213 if(IsEqualGUID(&IID_IHTMLHtmlElement, riid))
214 return &This->IHTMLHtmlElement_iface;
216 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
219 static const NodeImplVtbl HTMLHtmlElementImplVtbl = {
220 .clsid = &CLSID_HTMLHtmlElement,
221 .cpc_entries = HTMLElement_cpc,
222 .clone = HTMLElement_clone,
223 .get_attr_col = HTMLElement_get_attr_col,
224 .is_settable = HTMLHtmlElement_is_settable
227 static const event_target_vtbl_t HTMLHtmlElement_event_target_vtbl = {
229 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
230 .query_interface= HTMLHtmlElement_query_interface,
231 .destructor = HTMLElement_destructor,
232 .traverse = HTMLElement_traverse,
233 .unlink = HTMLElement_unlink
235 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
236 .handle_event = HTMLElement_handle_event
239 static const tid_t HTMLHtmlElement_iface_tids[] = {
240 HTMLELEMENT_TIDS,
241 IHTMLHtmlElement_tid,
244 static dispex_static_data_t HTMLHtmlElement_dispex = {
245 "HTMLHtmlElement",
246 &HTMLHtmlElement_event_target_vtbl.dispex_vtbl,
247 DispHTMLHtmlElement_tid,
248 HTMLHtmlElement_iface_tids,
249 HTMLElement_init_dispex_info
252 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
254 HTMLHtmlElement *ret;
256 ret = calloc(1, sizeof(*ret));
257 if(!ret)
258 return E_OUTOFMEMORY;
260 ret->IHTMLHtmlElement_iface.lpVtbl = &HTMLHtmlElementVtbl;
261 ret->element.node.vtbl = &HTMLHtmlElementImplVtbl;
263 HTMLElement_Init(&ret->element, doc, nselem, &HTMLHtmlElement_dispex);
265 *elem = &ret->element;
266 return S_OK;
269 struct HTMLMetaElement {
270 HTMLElement element;
272 IHTMLMetaElement IHTMLMetaElement_iface;
275 static inline HTMLMetaElement *impl_from_IHTMLMetaElement(IHTMLMetaElement *iface)
277 return CONTAINING_RECORD(iface, HTMLMetaElement, IHTMLMetaElement_iface);
280 DISPEX_IDISPATCH_IMPL(HTMLMetaElement, IHTMLMetaElement,
281 impl_from_IHTMLMetaElement(iface)->element.node.event_target.dispex)
283 static HRESULT WINAPI HTMLMetaElement_put_httpEquiv(IHTMLMetaElement *iface, BSTR v)
285 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
286 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
287 return E_NOTIMPL;
290 static HRESULT WINAPI HTMLMetaElement_get_httpEquiv(IHTMLMetaElement *iface, BSTR *p)
292 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
294 TRACE("(%p)->(%p)\n", This, p);
296 return elem_string_attr_getter(&This->element, L"http-equiv", TRUE, p);
299 static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR v)
301 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
302 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
303 return E_NOTIMPL;
306 static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p)
308 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
310 TRACE("(%p)->(%p)\n", This, p);
312 return elem_string_attr_getter(&This->element, L"content", TRUE, p);
315 static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
317 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
318 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
319 return E_NOTIMPL;
322 static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p)
324 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
326 TRACE("(%p)->(%p)\n", This, p);
328 return elem_string_attr_getter(&This->element, L"name", TRUE, p);
331 static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v)
333 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
334 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
335 return E_NOTIMPL;
338 static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p)
340 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
341 FIXME("(%p)->(%p)\n", This, p);
342 return E_NOTIMPL;
345 static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v)
347 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
349 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
351 return elem_string_attr_setter(&This->element, L"charset", v);
354 static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p)
356 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
358 TRACE("(%p)->(%p)\n", This, p);
360 return elem_string_attr_getter(&This->element, L"charset", TRUE, p);
363 static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = {
364 HTMLMetaElement_QueryInterface,
365 HTMLMetaElement_AddRef,
366 HTMLMetaElement_Release,
367 HTMLMetaElement_GetTypeInfoCount,
368 HTMLMetaElement_GetTypeInfo,
369 HTMLMetaElement_GetIDsOfNames,
370 HTMLMetaElement_Invoke,
371 HTMLMetaElement_put_httpEquiv,
372 HTMLMetaElement_get_httpEquiv,
373 HTMLMetaElement_put_content,
374 HTMLMetaElement_get_content,
375 HTMLMetaElement_put_name,
376 HTMLMetaElement_get_name,
377 HTMLMetaElement_put_url,
378 HTMLMetaElement_get_url,
379 HTMLMetaElement_put_charset,
380 HTMLMetaElement_get_charset
383 static inline HTMLMetaElement *HTMLMetaElement_from_DispatchEx(DispatchEx *iface)
385 return CONTAINING_RECORD(iface, HTMLMetaElement, element.node.event_target.dispex);
388 static void *HTMLMetaElement_query_interface(DispatchEx *dispex, REFIID riid)
390 HTMLMetaElement *This = HTMLMetaElement_from_DispatchEx(dispex);
392 if(IsEqualGUID(&IID_IHTMLMetaElement, riid))
393 return &This->IHTMLMetaElement_iface;
395 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
398 static const NodeImplVtbl HTMLMetaElementImplVtbl = {
399 .clsid = &CLSID_HTMLMetaElement,
400 .cpc_entries = HTMLElement_cpc,
401 .clone = HTMLElement_clone,
402 .get_attr_col = HTMLElement_get_attr_col
405 static const event_target_vtbl_t HTMLMetaElement_event_target_vtbl = {
407 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
408 .query_interface= HTMLMetaElement_query_interface,
409 .destructor = HTMLElement_destructor,
410 .traverse = HTMLElement_traverse,
411 .unlink = HTMLElement_unlink
413 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
414 .handle_event = HTMLElement_handle_event
417 static const tid_t HTMLMetaElement_iface_tids[] = {
418 HTMLELEMENT_TIDS,
419 IHTMLMetaElement_tid,
423 static dispex_static_data_t HTMLMetaElement_dispex = {
424 "HTMLMetaElement",
425 &HTMLMetaElement_event_target_vtbl.dispex_vtbl,
426 DispHTMLMetaElement_tid,
427 HTMLMetaElement_iface_tids,
428 HTMLElement_init_dispex_info
431 HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
433 HTMLMetaElement *ret;
435 ret = calloc(1, sizeof(*ret));
436 if(!ret)
437 return E_OUTOFMEMORY;
439 ret->IHTMLMetaElement_iface.lpVtbl = &HTMLMetaElementVtbl;
440 ret->element.node.vtbl = &HTMLMetaElementImplVtbl;
442 HTMLElement_Init(&ret->element, doc, nselem, &HTMLMetaElement_dispex);
444 *elem = &ret->element;
445 return S_OK;
448 struct HTMLHeadElement {
449 HTMLElement element;
451 IHTMLHeadElement IHTMLHeadElement_iface;
454 static inline HTMLHeadElement *impl_from_IHTMLHeadElement(IHTMLHeadElement *iface)
456 return CONTAINING_RECORD(iface, HTMLHeadElement, IHTMLHeadElement_iface);
459 DISPEX_IDISPATCH_IMPL(HTMLHeadElement, IHTMLHeadElement,
460 impl_from_IHTMLHeadElement(iface)->element.node.event_target.dispex)
462 static HRESULT WINAPI HTMLHeadElement_put_profile(IHTMLHeadElement *iface, BSTR v)
464 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
465 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
466 return E_NOTIMPL;
469 static HRESULT WINAPI HTMLHeadElement_get_profile(IHTMLHeadElement *iface, BSTR *p)
471 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
472 FIXME("(%p)->(%p)\n", This, p);
473 return E_NOTIMPL;
476 static const IHTMLHeadElementVtbl HTMLHeadElementVtbl = {
477 HTMLHeadElement_QueryInterface,
478 HTMLHeadElement_AddRef,
479 HTMLHeadElement_Release,
480 HTMLHeadElement_GetTypeInfoCount,
481 HTMLHeadElement_GetTypeInfo,
482 HTMLHeadElement_GetIDsOfNames,
483 HTMLHeadElement_Invoke,
484 HTMLHeadElement_put_profile,
485 HTMLHeadElement_get_profile
488 static inline HTMLHeadElement *impl_from_DispatchEx(DispatchEx *iface)
490 return CONTAINING_RECORD(iface, HTMLHeadElement, element.node.event_target.dispex);
493 static void *HTMLHeadElement_query_interface(DispatchEx *dispex, REFIID riid)
495 HTMLHeadElement *This = impl_from_DispatchEx(dispex);
497 if(IsEqualGUID(&IID_IHTMLHeadElement, riid))
498 return &This->IHTMLHeadElement_iface;
499 if(IsEqualGUID(&DIID_DispHTMLHeadElement, riid))
500 return &This->IHTMLHeadElement_iface;
502 return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid);
505 static const NodeImplVtbl HTMLHeadElementImplVtbl = {
506 .clsid = &CLSID_HTMLHeadElement,
507 .cpc_entries = HTMLElement_cpc,
508 .clone = HTMLElement_clone,
509 .get_attr_col = HTMLElement_get_attr_col
512 static const event_target_vtbl_t HTMLHeadElement_event_target_vtbl = {
514 HTMLELEMENT_DISPEX_VTBL_ENTRIES,
515 .query_interface= HTMLHeadElement_query_interface,
516 .destructor = HTMLElement_destructor,
517 .traverse = HTMLElement_traverse,
518 .unlink = HTMLElement_unlink
520 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES,
521 .handle_event = HTMLElement_handle_event
524 static const tid_t HTMLHeadElement_iface_tids[] = {
525 HTMLELEMENT_TIDS,
526 IHTMLHeadElement_tid,
529 static dispex_static_data_t HTMLHeadElement_dispex = {
530 "HTMLHeadElement",
531 &HTMLHeadElement_event_target_vtbl.dispex_vtbl,
532 DispHTMLHeadElement_tid,
533 HTMLHeadElement_iface_tids,
534 HTMLElement_init_dispex_info
537 HRESULT HTMLHeadElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
539 HTMLHeadElement *ret;
541 ret = calloc(1, sizeof(*ret));
542 if(!ret)
543 return E_OUTOFMEMORY;
545 ret->IHTMLHeadElement_iface.lpVtbl = &HTMLHeadElementVtbl;
546 ret->element.node.vtbl = &HTMLHeadElementImplVtbl;
548 HTMLElement_Init(&ret->element, doc, nselem, &HTMLHeadElement_dispex);
550 *elem = &ret->element;
551 return S_OK;