wininet: Only accept proxy and proxy bypass if type is INTERNET_OPEN_TYPE_PROXY.
[wine.git] / dlls / mshtml / htmlform.c
blobc38de5c90dfc3a735951afad2c98f96d6564ee70
1 /*
2 * Copyright 2009 Andrew Eikum 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"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 struct HTMLFormElement {
37 HTMLElement element;
39 IHTMLFormElement IHTMLFormElement_iface;
41 nsIDOMHTMLFormElement *nsform;
44 static HRESULT htmlform_item(HTMLFormElement *This, int i, IDispatch **ret)
46 nsIDOMHTMLCollection *elements;
47 nsIDOMNode *item;
48 HTMLDOMNode *node;
49 nsresult nsres;
50 HRESULT hres;
52 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
53 if(NS_FAILED(nsres)) {
54 FIXME("GetElements failed: 0x%08x\n", nsres);
55 return E_FAIL;
58 nsres = nsIDOMHTMLCollection_Item(elements, i, &item);
59 nsIDOMHTMLCollection_Release(elements);
60 if(NS_FAILED(nsres)) {
61 FIXME("Item failed: 0x%08x\n", nsres);
62 return E_FAIL;
65 if(item) {
66 hres = get_node(This->element.node.doc, item, TRUE, &node);
67 if(FAILED(hres))
68 return hres;
70 nsIDOMNode_Release(item);
71 *ret = (IDispatch*)&node->IHTMLDOMNode_iface;
72 }else {
73 *ret = NULL;
76 return S_OK;
79 static inline HTMLFormElement *impl_from_IHTMLFormElement(IHTMLFormElement *iface)
81 return CONTAINING_RECORD(iface, HTMLFormElement, IHTMLFormElement_iface);
84 static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface,
85 REFIID riid, void **ppv)
87 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
89 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
92 static ULONG WINAPI HTMLFormElement_AddRef(IHTMLFormElement *iface)
94 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
96 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
99 static ULONG WINAPI HTMLFormElement_Release(IHTMLFormElement *iface)
101 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
103 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
106 static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount(IHTMLFormElement *iface, UINT *pctinfo)
108 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
109 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
112 static HRESULT WINAPI HTMLFormElement_GetTypeInfo(IHTMLFormElement *iface, UINT iTInfo,
113 LCID lcid, ITypeInfo **ppTInfo)
115 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
116 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
117 ppTInfo);
120 static HRESULT WINAPI HTMLFormElement_GetIDsOfNames(IHTMLFormElement *iface, REFIID riid,
121 LPOLESTR *rgszNames, UINT cNames,
122 LCID lcid, DISPID *rgDispId)
124 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
125 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
126 cNames, lcid, rgDispId);
129 static HRESULT WINAPI HTMLFormElement_Invoke(IHTMLFormElement *iface, DISPID dispIdMember,
130 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
131 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
133 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
134 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
135 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
138 static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v)
140 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
141 nsAString action_str;
142 nsresult nsres;
144 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
146 nsAString_InitDepend(&action_str, v);
147 nsres = nsIDOMHTMLFormElement_SetAction(This->nsform, &action_str);
148 nsAString_Finish(&action_str);
149 if(NS_FAILED(nsres)) {
150 ERR("SetAction failed: %08x\n", nsres);
151 return E_FAIL;
154 return S_OK;
157 static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *p)
159 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
160 nsAString action_str;
161 nsresult nsres;
162 HRESULT hres;
164 TRACE("(%p)->(%p)\n", This, p);
166 nsAString_Init(&action_str, NULL);
167 nsres = nsIDOMHTMLFormElement_GetAction(This->nsform, &action_str);
168 if(NS_SUCCEEDED(nsres)) {
169 const PRUnichar *action;
170 nsAString_GetData(&action_str, &action);
171 hres = nsuri_to_url(action, FALSE, p);
172 }else {
173 ERR("GetAction failed: %08x\n", nsres);
174 hres = E_FAIL;
177 nsAString_Finish(&action_str);
178 return hres;
181 static HRESULT WINAPI HTMLFormElement_put_dir(IHTMLFormElement *iface, BSTR v)
183 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
184 FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
190 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
191 FIXME("(%p)->(%p)\n", This, p);
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
197 static const WCHAR urlencodedW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
198 'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
199 static const WCHAR dataW[] = {'m','u','l','t','i','p','a','r','t','/',
200 'f','o','r','m','-','d','a','t','a',0};
201 static const WCHAR plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
203 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
204 nsAString encoding_str;
205 nsresult nsres;
207 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
209 if(lstrcmpiW(v, urlencodedW) && lstrcmpiW(v, dataW) && lstrcmpiW(v, plainW)) {
210 WARN("incorrect enctype\n");
211 return E_INVALIDARG;
214 nsAString_InitDepend(&encoding_str, v);
215 nsres = nsIDOMHTMLFormElement_SetEnctype(This->nsform, &encoding_str);
216 nsAString_Finish(&encoding_str);
217 if(NS_FAILED(nsres))
218 return E_FAIL;
220 return S_OK;
223 static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR *p)
225 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
226 nsAString encoding_str;
227 nsresult nsres;
229 TRACE("(%p)->(%p)\n", This, p);
231 nsAString_Init(&encoding_str, NULL);
232 nsres = nsIDOMHTMLFormElement_GetEnctype(This->nsform, &encoding_str);
233 return return_nsstr(nsres, &encoding_str, p);
236 static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
238 static const WCHAR postW[] = {'P','O','S','T',0};
239 static const WCHAR getW[] = {'G','E','T',0};
241 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
242 nsAString method_str;
243 nsresult nsres;
245 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
247 if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
248 WARN("unrecognized method\n");
249 return E_INVALIDARG;
252 nsAString_InitDepend(&method_str, v);
253 nsres = nsIDOMHTMLFormElement_SetMethod(This->nsform, &method_str);
254 nsAString_Finish(&method_str);
255 if(NS_FAILED(nsres))
256 return E_FAIL;
258 return S_OK;
261 static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR *p)
263 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
264 nsAString method_str;
265 nsresult nsres;
267 TRACE("(%p)->(%p)\n", This, p);
269 nsAString_Init(&method_str, NULL);
270 nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str);
271 return return_nsstr(nsres, &method_str, p);
274 static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
276 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
278 TRACE("(%p)->(%p)\n", This, p);
280 *p = (IDispatch*)&This->IHTMLFormElement_iface;
281 IDispatch_AddRef(*p);
282 return S_OK;
285 static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v)
287 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
288 FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
289 return E_NOTIMPL;
292 static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *p)
294 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
295 FIXME("(%p)->(%p)\n", This, p);
296 return E_NOTIMPL;
299 static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
301 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
302 nsAString name_str;
303 nsresult nsres;
305 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
307 nsAString_InitDepend(&name_str, v);
308 nsres = nsIDOMHTMLFormElement_SetName(This->nsform, &name_str);
309 nsAString_Finish(&name_str);
310 if(NS_FAILED(nsres))
311 return E_FAIL;
313 return S_OK;
316 static HRESULT WINAPI HTMLFormElement_get_name(IHTMLFormElement *iface, BSTR *p)
318 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
319 nsAString name_str;
320 nsresult nsres;
322 TRACE("(%p)->(%p)\n", This, p);
324 nsAString_Init(&name_str, NULL);
325 nsres = nsIDOMHTMLFormElement_GetName(This->nsform, &name_str);
326 return return_nsstr(nsres, &name_str, p);
329 static HRESULT WINAPI HTMLFormElement_put_onsubmit(IHTMLFormElement *iface, VARIANT v)
331 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
333 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
335 return set_node_event(&This->element.node, EVENTID_SUBMIT, &v);
338 static HRESULT WINAPI HTMLFormElement_get_onsubmit(IHTMLFormElement *iface, VARIANT *p)
340 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
342 TRACE("(%p)->(%p)\n", This, p);
344 return get_node_event(&This->element.node, EVENTID_SUBMIT, p);
347 static HRESULT WINAPI HTMLFormElement_put_onreset(IHTMLFormElement *iface, VARIANT v)
349 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
350 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
351 return E_NOTIMPL;
354 static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIANT *p)
356 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
357 FIXME("(%p)->(%p)\n", This, p);
358 return E_NOTIMPL;
361 static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
363 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
364 nsresult nsres;
366 TRACE("(%p)->()\n", This);
368 nsres = nsIDOMHTMLFormElement_Submit(This->nsform);
369 if(NS_FAILED(nsres)) {
370 ERR("Submit failed: %08x\n", nsres);
371 return E_FAIL;
374 return S_OK;
377 static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
379 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
380 FIXME("(%p)->()\n", This);
381 return E_NOTIMPL;
384 static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v)
386 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
387 FIXME("(%p)->(%d)\n", This, v);
388 return E_NOTIMPL;
391 static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *p)
393 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
394 nsresult nsres;
396 TRACE("(%p)->(%p)\n", This, p);
398 nsres = nsIDOMHTMLFormElement_GetLength(This->nsform, p);
399 if(NS_FAILED(nsres)) {
400 ERR("GetLength failed: %08x\n", nsres);
401 return E_FAIL;
404 return S_OK;
407 static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown **p)
409 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
410 FIXME("(%p)->(%p)\n", This, p);
411 return E_NOTIMPL;
414 static HRESULT WINAPI HTMLFormElement_item(IHTMLFormElement *iface, VARIANT name,
415 VARIANT index, IDispatch **pdisp)
417 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
419 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
421 if(!pdisp)
422 return E_INVALIDARG;
423 *pdisp = NULL;
425 if(V_VT(&name) == VT_I4) {
426 if(V_I4(&name) < 0)
427 return E_INVALIDARG;
428 return htmlform_item(This, V_I4(&name), pdisp);
431 FIXME("Unsupported args\n");
432 return E_NOTIMPL;
435 static HRESULT WINAPI HTMLFormElement_tags(IHTMLFormElement *iface, VARIANT tagName,
436 IDispatch **pdisp)
438 HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
439 FIXME("(%p)->(v %p)\n", This, pdisp);
440 return E_NOTIMPL;
443 static const IHTMLFormElementVtbl HTMLFormElementVtbl = {
444 HTMLFormElement_QueryInterface,
445 HTMLFormElement_AddRef,
446 HTMLFormElement_Release,
447 HTMLFormElement_GetTypeInfoCount,
448 HTMLFormElement_GetTypeInfo,
449 HTMLFormElement_GetIDsOfNames,
450 HTMLFormElement_Invoke,
451 HTMLFormElement_put_action,
452 HTMLFormElement_get_action,
453 HTMLFormElement_put_dir,
454 HTMLFormElement_get_dir,
455 HTMLFormElement_put_encoding,
456 HTMLFormElement_get_encoding,
457 HTMLFormElement_put_method,
458 HTMLFormElement_get_method,
459 HTMLFormElement_get_elements,
460 HTMLFormElement_put_target,
461 HTMLFormElement_get_target,
462 HTMLFormElement_put_name,
463 HTMLFormElement_get_name,
464 HTMLFormElement_put_onsubmit,
465 HTMLFormElement_get_onsubmit,
466 HTMLFormElement_put_onreset,
467 HTMLFormElement_get_onreset,
468 HTMLFormElement_submit,
469 HTMLFormElement_reset,
470 HTMLFormElement_put_length,
471 HTMLFormElement_get_length,
472 HTMLFormElement__newEnum,
473 HTMLFormElement_item,
474 HTMLFormElement_tags
477 static inline HTMLFormElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
479 return CONTAINING_RECORD(iface, HTMLFormElement, element.node);
482 static HRESULT HTMLFormElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
484 HTMLFormElement *This = impl_from_HTMLDOMNode(iface);
486 *ppv = NULL;
488 if(IsEqualGUID(&IID_IUnknown, riid)) {
489 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
490 *ppv = &This->IHTMLFormElement_iface;
491 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
492 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
493 *ppv = &This->IHTMLFormElement_iface;
494 }else if(IsEqualGUID(&IID_IHTMLFormElement, riid)) {
495 TRACE("(%p)->(IID_IHTMLFormElement %p)\n", This, ppv);
496 *ppv = &This->IHTMLFormElement_iface;
499 if(*ppv) {
500 IUnknown_AddRef((IUnknown*)*ppv);
501 return S_OK;
504 return HTMLElement_QI(&This->element.node, riid, ppv);
507 static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
508 BSTR name, DWORD grfdex, DISPID *pid)
510 HTMLFormElement *This = impl_from_HTMLDOMNode(iface);
511 nsIDOMHTMLCollection *elements;
512 nsAString nsname, nsstr;
513 UINT32 len, i;
514 nsresult nsres;
515 HRESULT hres = DISP_E_UNKNOWNNAME;
517 static const PRUnichar nameW[] = {'n','a','m','e',0};
519 TRACE("(%p)->(%s %x %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
521 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
522 if(NS_FAILED(nsres)) {
523 FIXME("GetElements failed: 0x%08x\n", nsres);
524 return E_FAIL;
527 nsres = nsIDOMHTMLCollection_GetLength(elements, &len);
528 if(NS_FAILED(nsres)) {
529 FIXME("GetLength failed: 0x%08x\n", nsres);
530 nsIDOMHTMLCollection_Release(elements);
531 return E_FAIL;
534 if(len > MSHTML_CUSTOM_DISPID_CNT)
535 len = MSHTML_CUSTOM_DISPID_CNT;
537 /* FIXME: Implement in more generic way */
538 if('0' <= *name && *name <= '9') {
539 WCHAR *end_ptr;
541 i = strtoulW(name, &end_ptr, 10);
542 if(!*end_ptr && i < len) {
543 *pid = MSHTML_DISPID_CUSTOM_MIN + i;
544 return S_OK;
548 nsAString_InitDepend(&nsname, nameW);
549 nsAString_Init(&nsstr, NULL);
550 for(i = 0; i < len; ++i) {
551 nsIDOMNode *nsitem;
552 nsIDOMHTMLElement *nshtml_elem;
553 const PRUnichar *str;
555 nsres = nsIDOMHTMLCollection_Item(elements, i, &nsitem);
556 if(NS_FAILED(nsres)) {
557 FIXME("Item failed: 0x%08x\n", nsres);
558 hres = E_FAIL;
559 break;
562 nsres = nsIDOMNode_QueryInterface(nsitem, &IID_nsIDOMHTMLElement, (void**)&nshtml_elem);
563 nsIDOMNode_Release(nsitem);
564 if(NS_FAILED(nsres)) {
565 FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres);
566 hres = E_FAIL;
567 break;
570 /* compare by id attr */
571 nsres = nsIDOMHTMLElement_GetId(nshtml_elem, &nsstr);
572 if(NS_FAILED(nsres)) {
573 FIXME("GetId failed: 0x%08x\n", nsres);
574 nsIDOMHTMLElement_Release(nshtml_elem);
575 hres = E_FAIL;
576 break;
578 nsAString_GetData(&nsstr, &str);
579 if(!strcmpiW(str, name)) {
580 nsIDOMHTMLElement_Release(nshtml_elem);
581 /* FIXME: using index for dispid */
582 *pid = MSHTML_DISPID_CUSTOM_MIN + i;
583 hres = S_OK;
584 break;
587 /* compare by name attr */
588 nsres = nsIDOMHTMLElement_GetAttribute(nshtml_elem, &nsname, &nsstr);
589 nsIDOMHTMLElement_Release(nshtml_elem);
590 nsAString_GetData(&nsstr, &str);
591 if(!strcmpiW(str, name)) {
592 /* FIXME: using index for dispid */
593 *pid = MSHTML_DISPID_CUSTOM_MIN + i;
594 hres = S_OK;
595 break;
598 nsAString_Finish(&nsname);
599 nsAString_Finish(&nsstr);
601 nsIDOMHTMLCollection_Release(elements);
603 return hres;
606 static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface,
607 DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res,
608 EXCEPINFO *ei, IServiceProvider *caller)
610 HTMLFormElement *This = impl_from_HTMLDOMNode(iface);
611 IDispatch *ret;
612 HRESULT hres;
614 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
616 hres = htmlform_item(This, id - MSHTML_DISPID_CUSTOM_MIN, &ret);
617 if(FAILED(hres))
618 return hres;
620 if(ret) {
621 V_VT(res) = VT_DISPATCH;
622 V_DISPATCH(res) = ret;
623 }else {
624 V_VT(res) = VT_NULL;
626 return S_OK;
629 static const NodeImplVtbl HTMLFormElementImplVtbl = {
630 HTMLFormElement_QI,
631 HTMLElement_destructor,
632 HTMLElement_cpc,
633 HTMLElement_clone,
634 HTMLElement_handle_event,
635 HTMLElement_get_attr_col,
636 NULL,
637 NULL,
638 NULL,
639 NULL,
640 NULL,
641 NULL,
642 HTMLFormElement_get_dispid,
643 HTMLFormElement_invoke
646 static const tid_t HTMLFormElement_iface_tids[] = {
647 HTMLELEMENT_TIDS,
648 IHTMLFormElement_tid,
652 static dispex_static_data_t HTMLFormElement_dispex = {
653 NULL,
654 DispHTMLFormElement_tid,
655 NULL,
656 HTMLFormElement_iface_tids
659 HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
661 HTMLFormElement *ret;
662 nsresult nsres;
664 ret = heap_alloc_zero(sizeof(HTMLFormElement));
665 if(!ret)
666 return E_OUTOFMEMORY;
668 ret->IHTMLFormElement_iface.lpVtbl = &HTMLFormElementVtbl;
669 ret->element.node.vtbl = &HTMLFormElementImplVtbl;
671 HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex);
673 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFormElement, (void**)&ret->nsform);
675 /* Share the reference with nsnode */
676 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsform == ret->element.node.nsnode);
677 nsIDOMNode_Release(ret->element.node.nsnode);
679 *elem = &ret->element;
680 return S_OK;