mshtml: Moved cloneNode implementation to vtbl.
[wine/multimedia.git] / dlls / mshtml / htmlform.c
blobc71e2ac960333ae278440db30cc5c6d8c3586001
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>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 struct HTMLFormElement {
35 HTMLElement element;
37 const IHTMLFormElementVtbl *lpHTMLFormElementVtbl;
39 nsIDOMHTMLFormElement *nsform;
42 #define HTMLFORM(x) (&(x)->lpHTMLFormElementVtbl)
44 static HRESULT htmlform_item(HTMLFormElement *This, int i, IDispatch **ret)
46 nsIDOMHTMLCollection *elements;
47 nsIDOMNode *item;
48 HTMLDOMNode *node;
49 nsresult nsres;
51 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
52 if(NS_FAILED(nsres)) {
53 FIXME("GetElements failed: 0x%08x\n", nsres);
54 return E_FAIL;
57 nsres = nsIDOMHTMLCollection_Item(elements, i, &item);
58 nsIDOMHTMLCollection_Release(elements);
59 if(NS_FAILED(nsres)) {
60 FIXME("Item failed: 0x%08x\n", nsres);
61 return E_FAIL;
64 if(item) {
65 node = get_node(This->element.node.doc, item, TRUE);
66 if(!node)
67 return E_OUTOFMEMORY;
69 IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
70 nsIDOMNode_Release(item);
71 *ret = (IDispatch*)HTMLDOMNODE(node);
72 }else {
73 *ret = NULL;
76 return S_OK;
79 #define HTMLFORM_THIS(iface) DEFINE_THIS(HTMLFormElement, HTMLFormElement, iface)
81 static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface,
82 REFIID riid, void **ppv)
84 HTMLFormElement *This = HTMLFORM_THIS(iface);
86 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
89 static ULONG WINAPI HTMLFormElement_AddRef(IHTMLFormElement *iface)
91 HTMLFormElement *This = HTMLFORM_THIS(iface);
93 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
96 static ULONG WINAPI HTMLFormElement_Release(IHTMLFormElement *iface)
98 HTMLFormElement *This = HTMLFORM_THIS(iface);
100 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
103 static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount(IHTMLFormElement *iface, UINT *pctinfo)
105 HTMLFormElement *This = HTMLFORM_THIS(iface);
106 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
109 static HRESULT WINAPI HTMLFormElement_GetTypeInfo(IHTMLFormElement *iface, UINT iTInfo,
110 LCID lcid, ITypeInfo **ppTInfo)
112 HTMLFormElement *This = HTMLFORM_THIS(iface);
113 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
116 static HRESULT WINAPI HTMLFormElement_GetIDsOfNames(IHTMLFormElement *iface, REFIID riid,
117 LPOLESTR *rgszNames, UINT cNames,
118 LCID lcid, DISPID *rgDispId)
120 HTMLFormElement *This = HTMLFORM_THIS(iface);
121 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
124 static HRESULT WINAPI HTMLFormElement_Invoke(IHTMLFormElement *iface, DISPID dispIdMember,
125 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
126 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
128 HTMLFormElement *This = HTMLFORM_THIS(iface);
129 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
130 pVarResult, pExcepInfo, puArgErr);
133 static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v)
135 HTMLFormElement *This = HTMLFORM_THIS(iface);
136 nsAString action_str;
137 nsresult nsres;
139 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
141 nsAString_InitDepend(&action_str, v);
142 nsres = nsIDOMHTMLFormElement_SetAction(This->nsform, &action_str);
143 nsAString_Finish(&action_str);
144 if(NS_FAILED(nsres)) {
145 ERR("SetAction failed: %08x\n", nsres);
146 return E_FAIL;
149 return S_OK;
152 static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *p)
154 HTMLFormElement *This = HTMLFORM_THIS(iface);
155 nsAString action_str;
156 nsresult nsres;
157 HRESULT hres;
159 TRACE("(%p)->(%p)\n", This, p);
161 nsAString_Init(&action_str, NULL);
162 nsres = nsIDOMHTMLFormElement_GetAction(This->nsform, &action_str);
163 if(NS_SUCCEEDED(nsres)) {
164 const PRUnichar *action;
165 nsAString_GetData(&action_str, &action);
166 hres = nsuri_to_url(action, FALSE, p);
167 }else {
168 ERR("GetAction failed: %08x\n", nsres);
169 hres = E_FAIL;
172 return hres;
175 static HRESULT WINAPI HTMLFormElement_put_dir(IHTMLFormElement *iface, BSTR v)
177 HTMLFormElement *This = HTMLFORM_THIS(iface);
178 FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
179 return E_NOTIMPL;
182 static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
184 HTMLFormElement *This = HTMLFORM_THIS(iface);
185 FIXME("(%p)->(%p)\n", This, p);
186 return E_NOTIMPL;
189 static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
191 static const WCHAR urlencodedW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
192 'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
193 static const WCHAR dataW[] = {'m','u','l','t','i','p','a','r','t','/',
194 'f','o','r','m','-','d','a','t','a',0};
195 static const WCHAR plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
197 HTMLFormElement *This = HTMLFORM_THIS(iface);
198 nsAString encoding_str;
199 nsresult nsres;
201 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
203 if(lstrcmpiW(v, urlencodedW) && lstrcmpiW(v, dataW) && lstrcmpiW(v, plainW)) {
204 WARN("incorrect enctype\n");
205 return E_INVALIDARG;
208 nsAString_InitDepend(&encoding_str, v);
209 nsres = nsIDOMHTMLFormElement_SetEnctype(This->nsform, &encoding_str);
210 nsAString_Finish(&encoding_str);
211 if(NS_FAILED(nsres))
212 return E_FAIL;
214 return S_OK;
217 static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR *p)
219 HTMLFormElement *This = HTMLFORM_THIS(iface);
220 nsAString encoding_str;
221 nsresult nsres;
223 TRACE("(%p)->(%p)\n", This, p);
225 nsAString_Init(&encoding_str, NULL);
226 nsres = nsIDOMHTMLFormElement_GetEnctype(This->nsform, &encoding_str);
227 if(NS_SUCCEEDED(nsres)) {
228 const PRUnichar *encoding;
229 nsAString_GetData(&encoding_str, &encoding);
231 *p = SysAllocString(encoding);
232 if(!*p)
233 return E_OUTOFMEMORY;
234 }else
235 return E_FAIL;
237 return S_OK;
240 static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
242 static const WCHAR postW[] = {'P','O','S','T',0};
243 static const WCHAR getW[] = {'G','E','T',0};
245 HTMLFormElement *This = HTMLFORM_THIS(iface);
246 nsAString method_str;
247 nsresult nsres;
249 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
251 if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
252 WARN("unrecognized method\n");
253 return E_INVALIDARG;
256 nsAString_InitDepend(&method_str, v);
257 nsres = nsIDOMHTMLFormElement_SetMethod(This->nsform, &method_str);
258 nsAString_Finish(&method_str);
259 if(NS_FAILED(nsres))
260 return E_FAIL;
262 return S_OK;
265 static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR *p)
267 HTMLFormElement *This = HTMLFORM_THIS(iface);
268 nsAString method_str;
269 nsresult nsres;
271 TRACE("(%p)->(%p)\n", This, p);
273 nsAString_Init(&method_str, NULL);
274 nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str);
275 if(NS_SUCCEEDED(nsres)) {
276 const PRUnichar *method;
277 nsAString_GetData(&method_str, &method);
279 *p = SysAllocString(method);
280 if(!*p)
281 return E_OUTOFMEMORY;
282 }else
283 return E_FAIL;
285 return S_OK;
288 static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
290 HTMLFormElement *This = HTMLFORM_THIS(iface);
291 FIXME("(%p)->(%p)\n", This, p);
292 return E_NOTIMPL;
295 static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v)
297 HTMLFormElement *This = HTMLFORM_THIS(iface);
298 FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
299 return E_NOTIMPL;
302 static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *p)
304 HTMLFormElement *This = HTMLFORM_THIS(iface);
305 FIXME("(%p)->(%p)\n", This, p);
306 return E_NOTIMPL;
309 static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
311 HTMLFormElement *This = HTMLFORM_THIS(iface);
312 nsAString name_str;
313 nsresult nsres;
315 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
317 nsAString_InitDepend(&name_str, v);
318 nsres = nsIDOMHTMLFormElement_SetName(This->nsform, &name_str);
319 nsAString_Finish(&name_str);
320 if(NS_FAILED(nsres))
321 return E_FAIL;
323 return S_OK;
326 static HRESULT WINAPI HTMLFormElement_get_name(IHTMLFormElement *iface, BSTR *p)
328 HTMLFormElement *This = HTMLFORM_THIS(iface);
329 nsAString name_str;
330 nsresult nsres;
332 TRACE("(%p)->(%p)\n", This, p);
334 nsAString_Init(&name_str, NULL);
335 nsres = nsIDOMHTMLFormElement_GetName(This->nsform, &name_str);
336 if(NS_SUCCEEDED(nsres)) {
337 const PRUnichar *name;
338 nsAString_GetData(&name_str, &name);
340 if(*name) {
341 *p = SysAllocString(name);
342 if(!*p)
343 return E_OUTOFMEMORY;
344 }else
345 *p = NULL;
346 }else
347 return E_FAIL;
349 return S_OK;
352 static HRESULT WINAPI HTMLFormElement_put_onsubmit(IHTMLFormElement *iface, VARIANT v)
354 HTMLFormElement *This = HTMLFORM_THIS(iface);
355 FIXME("(%p)->(v)\n", This);
356 return E_NOTIMPL;
359 static HRESULT WINAPI HTMLFormElement_get_onsubmit(IHTMLFormElement *iface, VARIANT *p)
361 HTMLFormElement *This = HTMLFORM_THIS(iface);
362 FIXME("(%p)->(%p)\n", This, p);
363 return E_NOTIMPL;
366 static HRESULT WINAPI HTMLFormElement_put_onreset(IHTMLFormElement *iface, VARIANT v)
368 HTMLFormElement *This = HTMLFORM_THIS(iface);
369 FIXME("(%p)->(v)\n", This);
370 return E_NOTIMPL;
373 static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIANT *p)
375 HTMLFormElement *This = HTMLFORM_THIS(iface);
376 FIXME("(%p)->(%p)\n", This, p);
377 return E_NOTIMPL;
380 static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
382 HTMLFormElement *This = HTMLFORM_THIS(iface);
383 FIXME("(%p)->()\n", This);
384 return E_NOTIMPL;
387 static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
389 HTMLFormElement *This = HTMLFORM_THIS(iface);
390 FIXME("(%p)->()\n", This);
391 return E_NOTIMPL;
394 static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v)
396 HTMLFormElement *This = HTMLFORM_THIS(iface);
397 FIXME("(%p)->(%d)\n", This, v);
398 return E_NOTIMPL;
401 static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *p)
403 HTMLFormElement *This = HTMLFORM_THIS(iface);
404 PRInt32 length;
405 nsresult nsres;
407 TRACE("(%p)->(%p)\n", This, p);
409 nsres = nsIDOMHTMLFormElement_GetLength(This->nsform, &length);
410 if(NS_FAILED(nsres)) {
411 ERR("GetLength failed: %08x\n", nsres);
412 return E_FAIL;
415 *p = length;
416 return S_OK;
419 static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown **p)
421 HTMLFormElement *This = HTMLFORM_THIS(iface);
422 FIXME("(%p)->(%p)\n", This, p);
423 return E_NOTIMPL;
426 static HRESULT WINAPI HTMLFormElement_item(IHTMLFormElement *iface, VARIANT name,
427 VARIANT index, IDispatch **pdisp)
429 HTMLFormElement *This = HTMLFORM_THIS(iface);
431 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
433 if(!pdisp)
434 return E_INVALIDARG;
435 *pdisp = NULL;
437 if(V_VT(&name) == VT_I4) {
438 if(V_I4(&name) < 0)
439 return E_INVALIDARG;
440 return htmlform_item(This, V_I4(&name), pdisp);
443 FIXME("Unsupported args\n");
444 return E_NOTIMPL;
447 static HRESULT WINAPI HTMLFormElement_tags(IHTMLFormElement *iface, VARIANT tagName,
448 IDispatch **pdisp)
450 HTMLFormElement *This = HTMLFORM_THIS(iface);
451 FIXME("(%p)->(v %p)\n", This, pdisp);
452 return E_NOTIMPL;
455 #undef HTMLFORM_THIS
457 static const IHTMLFormElementVtbl HTMLFormElementVtbl = {
458 HTMLFormElement_QueryInterface,
459 HTMLFormElement_AddRef,
460 HTMLFormElement_Release,
461 HTMLFormElement_GetTypeInfoCount,
462 HTMLFormElement_GetTypeInfo,
463 HTMLFormElement_GetIDsOfNames,
464 HTMLFormElement_Invoke,
465 HTMLFormElement_put_action,
466 HTMLFormElement_get_action,
467 HTMLFormElement_put_dir,
468 HTMLFormElement_get_dir,
469 HTMLFormElement_put_encoding,
470 HTMLFormElement_get_encoding,
471 HTMLFormElement_put_method,
472 HTMLFormElement_get_method,
473 HTMLFormElement_get_elements,
474 HTMLFormElement_put_target,
475 HTMLFormElement_get_target,
476 HTMLFormElement_put_name,
477 HTMLFormElement_get_name,
478 HTMLFormElement_put_onsubmit,
479 HTMLFormElement_get_onsubmit,
480 HTMLFormElement_put_onreset,
481 HTMLFormElement_get_onreset,
482 HTMLFormElement_submit,
483 HTMLFormElement_reset,
484 HTMLFormElement_put_length,
485 HTMLFormElement_get_length,
486 HTMLFormElement__newEnum,
487 HTMLFormElement_item,
488 HTMLFormElement_tags
491 #define HTMLFORM_NODE_THIS(iface) DEFINE_THIS2(HTMLFormElement, element.node, iface)
493 static HRESULT HTMLFormElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
495 HTMLFormElement *This = HTMLFORM_NODE_THIS(iface);
497 *ppv = NULL;
499 if(IsEqualGUID(&IID_IUnknown, riid)) {
500 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
501 *ppv = HTMLFORM(This);
502 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
503 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
504 *ppv = HTMLFORM(This);
505 }else if(IsEqualGUID(&IID_IHTMLFormElement, riid)) {
506 TRACE("(%p)->(IID_IHTMLFormElement %p)\n", This, ppv);
507 *ppv = HTMLFORM(This);
510 if(*ppv) {
511 IUnknown_AddRef((IUnknown*)*ppv);
512 return S_OK;
515 return HTMLElement_QI(&This->element.node, riid, ppv);
518 static void HTMLFormElement_destructor(HTMLDOMNode *iface)
520 HTMLFormElement *This = HTMLFORM_NODE_THIS(iface);
522 if(This->nsform)
523 nsIDOMHTMLFormElement_Release(This->nsform);
525 HTMLElement_destructor(&This->element.node);
528 static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
529 BSTR name, DWORD grfdex, DISPID *pid)
531 HTMLFormElement *This = HTMLFORM_NODE_THIS(iface);
532 nsIDOMHTMLCollection *elements;
533 nsAString nsname, nsstr;
534 PRUint32 len, i;
535 nsresult nsres;
536 HRESULT hres = DISP_E_UNKNOWNNAME;
538 static const PRUnichar nameW[] = {'n','a','m','e',0};
540 TRACE("(%p)->(%s %x %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
542 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
543 if(NS_FAILED(nsres)) {
544 FIXME("GetElements failed: 0x%08x\n", nsres);
545 return E_FAIL;
548 nsres = nsIDOMHTMLCollection_GetLength(elements, &len);
549 if(NS_FAILED(nsres)) {
550 FIXME("GetLength failed: 0x%08x\n", nsres);
551 nsIDOMHTMLCollection_Release(elements);
552 return E_FAIL;
555 nsAString_InitDepend(&nsname, nameW);
556 nsAString_Init(&nsstr, NULL);
557 for(i = 0; i < len; ++i) {
558 nsIDOMNode *nsitem;
559 nsIDOMHTMLElement *nshtml_elem;
560 const PRUnichar *str;
562 nsres = nsIDOMHTMLCollection_Item(elements, i, &nsitem);
563 if(NS_FAILED(nsres)) {
564 FIXME("Item failed: 0x%08x\n", nsres);
565 hres = E_FAIL;
566 break;
569 nsres = nsIDOMNode_QueryInterface(nsitem, &IID_nsIDOMHTMLElement, (void**)&nshtml_elem);
570 nsIDOMNode_Release(nsitem);
571 if(NS_FAILED(nsres)) {
572 FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres);
573 hres = E_FAIL;
574 break;
577 /* compare by id attr */
578 nsres = nsIDOMHTMLElement_GetId(nshtml_elem, &nsstr);
579 if(NS_FAILED(nsres)) {
580 FIXME("GetId failed: 0x%08x\n", nsres);
581 nsIDOMHTMLElement_Release(nshtml_elem);
582 hres = E_FAIL;
583 break;
585 nsAString_GetData(&nsstr, &str);
586 if(!strcmpiW(str, name)) {
587 nsIDOMHTMLElement_Release(nshtml_elem);
588 /* FIXME: using index for dispid */
589 *pid = MSHTML_DISPID_CUSTOM_MIN + i;
590 hres = S_OK;
591 break;
594 /* compare by name attr */
595 nsres = nsIDOMHTMLElement_GetAttribute(nshtml_elem, &nsname, &nsstr);
596 nsIDOMHTMLElement_Release(nshtml_elem);
597 nsAString_GetData(&nsstr, &str);
598 if(!strcmpiW(str, name)) {
599 /* FIXME: using index for dispid */
600 *pid = MSHTML_DISPID_CUSTOM_MIN + i;
601 hres = S_OK;
602 break;
605 nsAString_Finish(&nsname);
606 nsAString_Finish(&nsstr);
608 nsIDOMHTMLCollection_Release(elements);
610 return hres;
613 static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface,
614 DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res,
615 EXCEPINFO *ei, IServiceProvider *caller)
617 HTMLFormElement *This = HTMLFORM_NODE_THIS(iface);
618 IDispatch *ret;
619 HRESULT hres;
621 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
623 hres = htmlform_item(This, id - MSHTML_DISPID_CUSTOM_MIN, &ret);
624 if(FAILED(hres))
625 return hres;
627 if(ret) {
628 V_VT(res) = VT_DISPATCH;
629 V_DISPATCH(res) = ret;
630 }else {
631 V_VT(res) = VT_NULL;
633 return S_OK;
636 #undef HTMLFORM_NODE_THIS
638 static const NodeImplVtbl HTMLFormElementImplVtbl = {
639 HTMLFormElement_QI,
640 HTMLFormElement_destructor,
641 HTMLElement_clone,
642 NULL,
643 NULL,
644 NULL,
645 NULL,
646 NULL,
647 NULL,
648 HTMLFormElement_get_dispid,
649 HTMLFormElement_invoke
652 static const tid_t HTMLFormElement_iface_tids[] = {
653 HTMLELEMENT_TIDS,
654 IHTMLFormElement_tid,
658 static dispex_static_data_t HTMLFormElement_dispex = {
659 NULL,
660 DispHTMLFormElement_tid,
661 NULL,
662 HTMLFormElement_iface_tids
665 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
667 HTMLFormElement *ret = heap_alloc_zero(sizeof(HTMLFormElement));
668 nsresult nsres;
670 ret->lpHTMLFormElementVtbl = &HTMLFormElementVtbl;
671 ret->element.node.vtbl = &HTMLFormElementImplVtbl;
673 HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex);
675 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFormElement, (void**)&ret->nsform);
676 if(NS_FAILED(nsres))
677 ERR("Could not get nsIDOMHTMLFormElement interface: %08x\n", nsres);
679 return &ret->element;