secur32/tests: Use importlib for functions available since Windows XP.
[wine.git] / dlls / mshtml / htmloption.c
blob21f8bf5be9627264813b125f719afbc314df4791
1 /*
2 * Copyright 2007 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>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct HTMLOptionElement {
36 HTMLElement element;
38 IHTMLOptionElement IHTMLOptionElement_iface;
40 nsIDOMHTMLOptionElement *nsoption;
43 static inline HTMLOptionElement *impl_from_IHTMLOptionElement(IHTMLOptionElement *iface)
45 return CONTAINING_RECORD(iface, HTMLOptionElement, IHTMLOptionElement_iface);
48 static HRESULT WINAPI HTMLOptionElement_QueryInterface(IHTMLOptionElement *iface,
49 REFIID riid, void **ppv)
51 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
53 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
56 static ULONG WINAPI HTMLOptionElement_AddRef(IHTMLOptionElement *iface)
58 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
60 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
63 static ULONG WINAPI HTMLOptionElement_Release(IHTMLOptionElement *iface)
65 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
67 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
70 static HRESULT WINAPI HTMLOptionElement_GetTypeInfoCount(IHTMLOptionElement *iface, UINT *pctinfo)
72 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
73 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
76 static HRESULT WINAPI HTMLOptionElement_GetTypeInfo(IHTMLOptionElement *iface, UINT iTInfo,
77 LCID lcid, ITypeInfo **ppTInfo)
79 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
80 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
81 ppTInfo);
84 static HRESULT WINAPI HTMLOptionElement_GetIDsOfNames(IHTMLOptionElement *iface, REFIID riid,
85 LPOLESTR *rgszNames, UINT cNames,
86 LCID lcid, DISPID *rgDispId)
88 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
89 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
90 cNames, lcid, rgDispId);
93 static HRESULT WINAPI HTMLOptionElement_Invoke(IHTMLOptionElement *iface, DISPID dispIdMember,
94 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
95 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
97 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
98 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
99 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102 static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface, VARIANT_BOOL v)
104 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
105 nsresult nsres;
107 TRACE("(%p)->(%x)\n", This, v);
109 nsres = nsIDOMHTMLOptionElement_SetSelected(This->nsoption, v != VARIANT_FALSE);
110 if(NS_FAILED(nsres)) {
111 ERR("SetSelected failed: %08x\n", nsres);
112 return E_FAIL;
115 return S_OK;
118 static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
120 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
121 cpp_bool selected;
122 nsresult nsres;
124 TRACE("(%p)->(%p)\n", This, p);
126 nsres = nsIDOMHTMLOptionElement_GetSelected(This->nsoption, &selected);
127 if(NS_FAILED(nsres)) {
128 ERR("GetSelected failed: %08x\n", nsres);
129 return E_FAIL;
132 *p = selected ? VARIANT_TRUE : VARIANT_FALSE;
133 return S_OK;
136 static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BSTR v)
138 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
139 nsAString value_str;
140 nsresult nsres;
142 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
144 nsAString_InitDepend(&value_str, v);
145 nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
146 nsAString_Finish(&value_str);
147 if(NS_FAILED(nsres))
148 ERR("SetValue failed: %08x\n", nsres);
150 return S_OK;
153 static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BSTR *p)
155 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
156 nsAString value_str;
157 nsresult nsres;
159 TRACE("(%p)->(%p)\n", This, p);
161 nsAString_Init(&value_str, NULL);
162 nsres = nsIDOMHTMLOptionElement_GetValue(This->nsoption, &value_str);
163 return return_nsstr(nsres, &value_str, p);
166 static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL v)
168 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
169 cpp_bool val, selected;
170 nsresult nsres;
172 TRACE("(%p)->(%x)\n", This, v);
174 val = (v == VARIANT_TRUE);
176 nsres = nsIDOMHTMLOptionElement_GetSelected(This->nsoption, &selected);
177 if(NS_FAILED(nsres)) {
178 ERR("GetSelected failed: %08x\n", nsres);
179 return E_FAIL;
182 nsres = nsIDOMHTMLOptionElement_SetDefaultSelected(This->nsoption, val);
183 if(NS_FAILED(nsres)) {
184 ERR("SetDefaultSelected failed: %08x\n", nsres);
185 return E_FAIL;
188 if(val != selected) {
189 nsres = nsIDOMHTMLOptionElement_SetSelected(This->nsoption, selected); /* WinAPI will reserve selected property */
190 if(NS_FAILED(nsres)) {
191 ERR("SetSelected failed: %08x\n", nsres);
192 return E_FAIL;
196 return S_OK;
199 static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
201 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
202 cpp_bool val;
203 nsresult nsres;
205 TRACE("(%p)->(%p)\n", This, p);
206 if(!p)
207 return E_POINTER;
208 nsres = nsIDOMHTMLOptionElement_GetDefaultSelected(This->nsoption, &val);
209 if(NS_FAILED(nsres)) {
210 ERR("GetDefaultSelected failed: %08x\n", nsres);
211 return E_FAIL;
214 *p = val ? VARIANT_TRUE : VARIANT_FALSE;
215 return S_OK;
218 static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LONG v)
220 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
221 FIXME("(%p)->(%d)\n", This, v);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LONG *p)
227 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
228 LONG val;
229 nsresult nsres;
231 TRACE("(%p)->(%p)\n", This, p);
233 if(!p)
234 return E_INVALIDARG;
236 nsres = nsIDOMHTMLOptionElement_GetIndex(This->nsoption, &val);
237 if(NS_FAILED(nsres)) {
238 ERR("GetIndex failed: %08x\n", nsres);
239 return E_FAIL;
241 *p = val;
242 return S_OK;
245 static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
247 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
248 nsIDOMText *text_node;
249 nsAString text_str;
250 nsIDOMNode *tmp;
251 nsresult nsres;
253 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
255 if(!This->element.node.doc->nsdoc) {
256 WARN("NULL nsdoc\n");
257 return E_UNEXPECTED;
260 while(1) {
261 nsIDOMNode *child;
263 nsres = nsIDOMHTMLElement_GetFirstChild(This->element.nselem, &child);
264 if(NS_FAILED(nsres) || !child)
265 break;
267 nsres = nsIDOMHTMLElement_RemoveChild(This->element.nselem, child, &tmp);
268 nsIDOMNode_Release(child);
269 if(NS_SUCCEEDED(nsres)) {
270 nsIDOMNode_Release(tmp);
271 }else {
272 ERR("RemoveChild failed: %08x\n", nsres);
273 break;
277 nsAString_InitDepend(&text_str, v);
278 nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
279 nsAString_Finish(&text_str);
280 if(NS_FAILED(nsres)) {
281 ERR("CreateTextNode failed: %08x\n", nsres);
282 return E_FAIL;
285 nsres = nsIDOMHTMLElement_AppendChild(This->element.nselem, (nsIDOMNode*)text_node, &tmp);
286 if(NS_SUCCEEDED(nsres))
287 nsIDOMNode_Release(tmp);
288 else
289 ERR("AppendChild failed: %08x\n", nsres);
291 return S_OK;
294 static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p)
296 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
297 nsAString text_str;
298 nsresult nsres;
300 TRACE("(%p)->(%p)\n", This, p);
302 nsAString_Init(&text_str, NULL);
303 nsres = nsIDOMHTMLOptionElement_GetText(This->nsoption, &text_str);
304 return return_nsstr(nsres, &text_str, p);
307 static HRESULT WINAPI HTMLOptionElement_get_form(IHTMLOptionElement *iface, IHTMLFormElement **p)
309 HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
310 nsIDOMHTMLFormElement *nsform;
311 nsIDOMNode *form_node;
312 HTMLDOMNode *node;
313 HRESULT hres;
314 nsresult nsres;
316 TRACE("(%p)->(%p)\n", This, p);
318 if(!p)
319 return E_POINTER;
321 nsres = nsIDOMHTMLOptionElement_GetForm(This->nsoption, &nsform);
322 if (NS_FAILED(nsres)) {
323 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
324 *p = NULL;
325 return E_FAIL;
327 if (nsform == NULL) {
328 TRACE("nsform not found\n");
329 *p = NULL;
330 return S_OK;
333 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
334 nsIDOMHTMLFormElement_Release(nsform);
335 assert(nsres == NS_OK);
337 hres = get_node(This->element.node.doc, form_node, TRUE, &node);
338 nsIDOMNode_Release(form_node);
339 if (FAILED(hres))
340 return hres;
342 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
344 node_release(node);
345 return hres;
348 static const IHTMLOptionElementVtbl HTMLOptionElementVtbl = {
349 HTMLOptionElement_QueryInterface,
350 HTMLOptionElement_AddRef,
351 HTMLOptionElement_Release,
352 HTMLOptionElement_GetTypeInfoCount,
353 HTMLOptionElement_GetTypeInfo,
354 HTMLOptionElement_GetIDsOfNames,
355 HTMLOptionElement_Invoke,
356 HTMLOptionElement_put_selected,
357 HTMLOptionElement_get_selected,
358 HTMLOptionElement_put_value,
359 HTMLOptionElement_get_value,
360 HTMLOptionElement_put_defaultSelected,
361 HTMLOptionElement_get_defaultSelected,
362 HTMLOptionElement_put_index,
363 HTMLOptionElement_get_index,
364 HTMLOptionElement_put_text,
365 HTMLOptionElement_get_text,
366 HTMLOptionElement_get_form
369 static inline HTMLOptionElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
371 return CONTAINING_RECORD(iface, HTMLOptionElement, element.node);
374 static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
376 HTMLOptionElement *This = impl_from_HTMLDOMNode(iface);
378 *ppv = NULL;
380 if(IsEqualGUID(&IID_IUnknown, riid)) {
381 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
382 *ppv = &This->IHTMLOptionElement_iface;
383 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
384 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
385 *ppv = &This->IHTMLOptionElement_iface;
386 }else if(IsEqualGUID(&IID_IHTMLOptionElement, riid)) {
387 TRACE("(%p)->(IID_IHTMLOptionElement %p)\n", This, ppv);
388 *ppv = &This->IHTMLOptionElement_iface;
391 if(*ppv) {
392 IUnknown_AddRef((IUnknown*)*ppv);
393 return S_OK;
396 return HTMLElement_QI(&This->element.node, riid, ppv);
399 static void HTMLOptionElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
401 HTMLOptionElement *This = impl_from_HTMLDOMNode(iface);
403 if(This->nsoption)
404 note_cc_edge((nsISupports*)This->nsoption, "This->nsoption", cb);
407 static void HTMLOptionElement_unlink(HTMLDOMNode *iface)
409 HTMLOptionElement *This = impl_from_HTMLDOMNode(iface);
411 if(This->nsoption) {
412 nsIDOMHTMLOptionElement *nsoption = This->nsoption;
414 This->nsoption = NULL;
415 nsIDOMHTMLOptionElement_Release(nsoption);
419 static const NodeImplVtbl HTMLOptionElementImplVtbl = {
420 HTMLOptionElement_QI,
421 HTMLElement_destructor,
422 HTMLElement_cpc,
423 HTMLElement_clone,
424 HTMLElement_handle_event,
425 HTMLElement_get_attr_col,
426 NULL,
427 NULL,
428 NULL,
429 NULL,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 NULL,
435 HTMLOptionElement_traverse,
436 HTMLOptionElement_unlink
439 static const tid_t HTMLOptionElement_iface_tids[] = {
440 HTMLELEMENT_TIDS,
441 IHTMLOptionElement_tid,
444 static dispex_static_data_t HTMLOptionElement_dispex = {
445 NULL,
446 DispHTMLOptionElement_tid,
447 HTMLOptionElement_iface_tids,
448 HTMLElement_init_dispex_info
451 HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
453 HTMLOptionElement *ret;
454 nsresult nsres;
456 ret = heap_alloc_zero(sizeof(HTMLOptionElement));
457 if(!ret)
458 return E_OUTOFMEMORY;
460 ret->IHTMLOptionElement_iface.lpVtbl = &HTMLOptionElementVtbl;
461 ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
463 HTMLElement_Init(&ret->element, doc, nselem, &HTMLOptionElement_dispex);
465 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
466 assert(nsres == NS_OK);
468 *elem = &ret->element;
469 return S_OK;
472 static inline HTMLOptionElementFactory *impl_from_IHTMLOptionElementFactory(IHTMLOptionElementFactory *iface)
474 return CONTAINING_RECORD(iface, HTMLOptionElementFactory, IHTMLOptionElementFactory_iface);
477 static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElementFactory *iface,
478 REFIID riid, void **ppv)
480 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
482 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
484 if(IsEqualGUID(&IID_IUnknown, riid)) {
485 *ppv = &This->IHTMLOptionElementFactory_iface;
486 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
487 *ppv = &This->IHTMLOptionElementFactory_iface;
488 }else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) {
489 *ppv = &This->IHTMLOptionElementFactory_iface;
490 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
491 return *ppv ? S_OK : E_NOINTERFACE;
492 }else {
493 *ppv = NULL;
494 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
495 return E_NOINTERFACE;
498 IUnknown_AddRef((IUnknown*)*ppv);
499 return S_OK;
502 static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface)
504 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
505 LONG ref = InterlockedIncrement(&This->ref);
507 TRACE("(%p) ref=%d\n", This, ref);
509 return ref;
512 static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface)
514 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
515 LONG ref = InterlockedDecrement(&This->ref);
517 TRACE("(%p) ref=%d\n", This, ref);
519 if(!ref) {
520 release_dispex(&This->dispex);
521 heap_free(This);
524 return ref;
527 static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo)
529 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
530 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
533 static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo,
534 LCID lcid, ITypeInfo **ppTInfo)
536 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
537 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
540 static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementFactory *iface, REFIID riid,
541 LPOLESTR *rgszNames, UINT cNames,
542 LCID lcid, DISPID *rgDispId)
544 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
545 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
548 static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory *iface, DISPID dispIdMember,
549 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
550 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
552 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
553 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams,
554 pVarResult, pExcepInfo, puArgErr);
557 static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface,
558 VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected,
559 IHTMLOptionElement **optelem)
561 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
562 nsIDOMHTMLElement *nselem;
563 HTMLDOMNode *node;
564 HRESULT hres;
566 static const PRUnichar optionW[] = {'O','P','T','I','O','N',0};
568 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
569 debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
571 if(!This->window || !This->window->doc) {
572 WARN("NULL doc\n");
573 return E_UNEXPECTED;
576 *optelem = NULL;
578 hres = create_nselem(This->window->doc, optionW, &nselem);
579 if(FAILED(hres))
580 return hres;
582 hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node);
583 nsIDOMHTMLElement_Release(nselem);
584 if(FAILED(hres))
585 return hres;
587 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface,
588 &IID_IHTMLOptionElement, (void**)optelem);
589 node_release(node);
591 if(V_VT(&text) == VT_BSTR)
592 IHTMLOptionElement_put_text(*optelem, V_BSTR(&text));
593 else if(V_VT(&text) != VT_EMPTY)
594 FIXME("Unsupported text %s\n", debugstr_variant(&text));
596 if(V_VT(&value) == VT_BSTR)
597 IHTMLOptionElement_put_value(*optelem, V_BSTR(&value));
598 else if(V_VT(&value) != VT_EMPTY)
599 FIXME("Unsupported value %s\n", debugstr_variant(&value));
601 if(V_VT(&defaultselected) != VT_EMPTY)
602 FIXME("Unsupported defaultselected %s\n", debugstr_variant(&defaultselected));
603 if(V_VT(&selected) != VT_EMPTY)
604 FIXME("Unsupported selected %s\n", debugstr_variant(&selected));
606 return S_OK;
609 static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
610 HTMLOptionElementFactory_QueryInterface,
611 HTMLOptionElementFactory_AddRef,
612 HTMLOptionElementFactory_Release,
613 HTMLOptionElementFactory_GetTypeInfoCount,
614 HTMLOptionElementFactory_GetTypeInfo,
615 HTMLOptionElementFactory_GetIDsOfNames,
616 HTMLOptionElementFactory_Invoke,
617 HTMLOptionElementFactory_create
620 static const tid_t HTMLOptionElementFactory_iface_tids[] = {
621 IHTMLOptionElementFactory_tid,
625 static dispex_static_data_t HTMLOptionElementFactory_dispex = {
626 NULL,
627 IHTMLOptionElementFactory_tid,
628 HTMLOptionElementFactory_iface_tids,
629 HTMLElement_init_dispex_info
632 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionElementFactory **ret_ptr)
634 HTMLOptionElementFactory *ret;
636 ret = heap_alloc(sizeof(*ret));
637 if(!ret)
638 return E_OUTOFMEMORY;
640 ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
641 ret->ref = 1;
642 ret->window = window;
644 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface,
645 &HTMLOptionElementFactory_dispex);
647 *ret_ptr = ret;
648 return S_OK;