server: Use common get_fd_type implementation for both pipe end implementations.
[wine.git] / dlls / mshtml / htmloption.c
blob16de9d376994c7c8ffe7dca9fc4dd79df01aa1e1
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 &CLSID_HTMLOptionElement,
421 HTMLOptionElement_QI,
422 HTMLElement_destructor,
423 HTMLElement_cpc,
424 HTMLElement_clone,
425 HTMLElement_handle_event,
426 HTMLElement_get_attr_col,
427 NULL,
428 NULL,
429 NULL,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 NULL,
435 NULL,
436 HTMLOptionElement_traverse,
437 HTMLOptionElement_unlink
440 static const tid_t HTMLOptionElement_iface_tids[] = {
441 HTMLELEMENT_TIDS,
442 IHTMLOptionElement_tid,
445 static dispex_static_data_t HTMLOptionElement_dispex = {
446 NULL,
447 DispHTMLOptionElement_tid,
448 HTMLOptionElement_iface_tids,
449 HTMLElement_init_dispex_info
452 HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
454 HTMLOptionElement *ret;
455 nsresult nsres;
457 ret = heap_alloc_zero(sizeof(HTMLOptionElement));
458 if(!ret)
459 return E_OUTOFMEMORY;
461 ret->IHTMLOptionElement_iface.lpVtbl = &HTMLOptionElementVtbl;
462 ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
464 HTMLElement_Init(&ret->element, doc, nselem, &HTMLOptionElement_dispex);
466 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
467 assert(nsres == NS_OK);
469 *elem = &ret->element;
470 return S_OK;
473 static inline HTMLOptionElementFactory *impl_from_IHTMLOptionElementFactory(IHTMLOptionElementFactory *iface)
475 return CONTAINING_RECORD(iface, HTMLOptionElementFactory, IHTMLOptionElementFactory_iface);
478 static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElementFactory *iface,
479 REFIID riid, void **ppv)
481 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
483 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
485 if(IsEqualGUID(&IID_IUnknown, riid)) {
486 *ppv = &This->IHTMLOptionElementFactory_iface;
487 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
488 *ppv = &This->IHTMLOptionElementFactory_iface;
489 }else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) {
490 *ppv = &This->IHTMLOptionElementFactory_iface;
491 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
492 return *ppv ? S_OK : E_NOINTERFACE;
493 }else {
494 *ppv = NULL;
495 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
496 return E_NOINTERFACE;
499 IUnknown_AddRef((IUnknown*)*ppv);
500 return S_OK;
503 static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface)
505 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
506 LONG ref = InterlockedIncrement(&This->ref);
508 TRACE("(%p) ref=%d\n", This, ref);
510 return ref;
513 static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface)
515 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
516 LONG ref = InterlockedDecrement(&This->ref);
518 TRACE("(%p) ref=%d\n", This, ref);
520 if(!ref) {
521 release_dispex(&This->dispex);
522 heap_free(This);
525 return ref;
528 static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo)
530 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
531 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
534 static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo,
535 LCID lcid, ITypeInfo **ppTInfo)
537 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
538 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
541 static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementFactory *iface, REFIID riid,
542 LPOLESTR *rgszNames, UINT cNames,
543 LCID lcid, DISPID *rgDispId)
545 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
546 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
549 static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory *iface, DISPID dispIdMember,
550 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
551 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
553 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
554 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams,
555 pVarResult, pExcepInfo, puArgErr);
558 static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface,
559 VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected,
560 IHTMLOptionElement **optelem)
562 HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
563 nsIDOMHTMLElement *nselem;
564 HTMLDOMNode *node;
565 HRESULT hres;
567 static const PRUnichar optionW[] = {'O','P','T','I','O','N',0};
569 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
570 debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
572 if(!This->window || !This->window->doc) {
573 WARN("NULL doc\n");
574 return E_UNEXPECTED;
577 *optelem = NULL;
579 hres = create_nselem(This->window->doc, optionW, &nselem);
580 if(FAILED(hres))
581 return hres;
583 hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node);
584 nsIDOMHTMLElement_Release(nselem);
585 if(FAILED(hres))
586 return hres;
588 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface,
589 &IID_IHTMLOptionElement, (void**)optelem);
590 node_release(node);
592 if(V_VT(&text) == VT_BSTR)
593 IHTMLOptionElement_put_text(*optelem, V_BSTR(&text));
594 else if(V_VT(&text) != VT_EMPTY)
595 FIXME("Unsupported text %s\n", debugstr_variant(&text));
597 if(V_VT(&value) == VT_BSTR)
598 IHTMLOptionElement_put_value(*optelem, V_BSTR(&value));
599 else if(V_VT(&value) != VT_EMPTY)
600 FIXME("Unsupported value %s\n", debugstr_variant(&value));
602 if(V_VT(&defaultselected) != VT_EMPTY)
603 FIXME("Unsupported defaultselected %s\n", debugstr_variant(&defaultselected));
604 if(V_VT(&selected) != VT_EMPTY)
605 FIXME("Unsupported selected %s\n", debugstr_variant(&selected));
607 return S_OK;
610 static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
611 HTMLOptionElementFactory_QueryInterface,
612 HTMLOptionElementFactory_AddRef,
613 HTMLOptionElementFactory_Release,
614 HTMLOptionElementFactory_GetTypeInfoCount,
615 HTMLOptionElementFactory_GetTypeInfo,
616 HTMLOptionElementFactory_GetIDsOfNames,
617 HTMLOptionElementFactory_Invoke,
618 HTMLOptionElementFactory_create
621 static const tid_t HTMLOptionElementFactory_iface_tids[] = {
622 IHTMLOptionElementFactory_tid,
626 static dispex_static_data_t HTMLOptionElementFactory_dispex = {
627 NULL,
628 IHTMLOptionElementFactory_tid,
629 HTMLOptionElementFactory_iface_tids,
630 HTMLElement_init_dispex_info
633 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionElementFactory **ret_ptr)
635 HTMLOptionElementFactory *ret;
637 ret = heap_alloc(sizeof(*ret));
638 if(!ret)
639 return E_OUTOFMEMORY;
641 ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
642 ret->ref = 1;
643 ret->window = window;
645 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface,
646 &HTMLOptionElementFactory_dispex);
648 *ret_ptr = ret;
649 return S_OK;