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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
37 struct HTMLFormElement
{
40 IHTMLFormElement IHTMLFormElement_iface
;
42 nsIDOMHTMLFormElement
*nsform
;
45 static HRESULT
htmlform_item(HTMLFormElement
*This
, int i
, IDispatch
**ret
)
47 nsIDOMHTMLCollection
*elements
;
53 nsres
= nsIDOMHTMLFormElement_GetElements(This
->nsform
, &elements
);
54 if(NS_FAILED(nsres
)) {
55 FIXME("GetElements failed: 0x%08x\n", nsres
);
59 nsres
= nsIDOMHTMLCollection_Item(elements
, i
, &item
);
60 nsIDOMHTMLCollection_Release(elements
);
61 if(NS_FAILED(nsres
)) {
62 FIXME("Item failed: 0x%08x\n", nsres
);
67 hres
= get_node(This
->element
.node
.doc
, item
, TRUE
, &node
);
71 nsIDOMNode_Release(item
);
72 *ret
= (IDispatch
*)&node
->IHTMLDOMNode_iface
;
80 static inline HTMLFormElement
*impl_from_IHTMLFormElement(IHTMLFormElement
*iface
)
82 return CONTAINING_RECORD(iface
, HTMLFormElement
, IHTMLFormElement_iface
);
85 static HRESULT WINAPI
HTMLFormElement_QueryInterface(IHTMLFormElement
*iface
,
86 REFIID riid
, void **ppv
)
88 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
90 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
93 static ULONG WINAPI
HTMLFormElement_AddRef(IHTMLFormElement
*iface
)
95 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
97 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
100 static ULONG WINAPI
HTMLFormElement_Release(IHTMLFormElement
*iface
)
102 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
104 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
107 static HRESULT WINAPI
HTMLFormElement_GetTypeInfoCount(IHTMLFormElement
*iface
, UINT
*pctinfo
)
109 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
110 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.dispex
.IDispatchEx_iface
, pctinfo
);
113 static HRESULT WINAPI
HTMLFormElement_GetTypeInfo(IHTMLFormElement
*iface
, UINT iTInfo
,
114 LCID lcid
, ITypeInfo
**ppTInfo
)
116 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
117 return IDispatchEx_GetTypeInfo(&This
->element
.node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
121 static HRESULT WINAPI
HTMLFormElement_GetIDsOfNames(IHTMLFormElement
*iface
, REFIID riid
,
122 LPOLESTR
*rgszNames
, UINT cNames
,
123 LCID lcid
, DISPID
*rgDispId
)
125 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
126 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
127 cNames
, lcid
, rgDispId
);
130 static HRESULT WINAPI
HTMLFormElement_Invoke(IHTMLFormElement
*iface
, DISPID dispIdMember
,
131 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
132 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
134 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
135 return IDispatchEx_Invoke(&This
->element
.node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
136 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
139 static HRESULT WINAPI
HTMLFormElement_put_action(IHTMLFormElement
*iface
, BSTR v
)
141 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
142 nsAString action_str
;
145 TRACE("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
147 nsAString_InitDepend(&action_str
, v
);
148 nsres
= nsIDOMHTMLFormElement_SetAction(This
->nsform
, &action_str
);
149 nsAString_Finish(&action_str
);
150 if(NS_FAILED(nsres
)) {
151 ERR("SetAction failed: %08x\n", nsres
);
158 static HRESULT WINAPI
HTMLFormElement_get_action(IHTMLFormElement
*iface
, BSTR
*p
)
160 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
161 nsAString action_str
;
165 TRACE("(%p)->(%p)\n", This
, p
);
167 nsAString_Init(&action_str
, NULL
);
168 nsres
= nsIDOMHTMLFormElement_GetAction(This
->nsform
, &action_str
);
169 if(NS_SUCCEEDED(nsres
)) {
170 const PRUnichar
*action
;
171 nsAString_GetData(&action_str
, &action
);
172 hres
= nsuri_to_url(action
, FALSE
, p
);
174 ERR("GetAction failed: %08x\n", nsres
);
178 nsAString_Finish(&action_str
);
182 static HRESULT WINAPI
HTMLFormElement_put_dir(IHTMLFormElement
*iface
, BSTR v
)
184 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
185 FIXME("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
189 static HRESULT WINAPI
HTMLFormElement_get_dir(IHTMLFormElement
*iface
, BSTR
*p
)
191 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
192 FIXME("(%p)->(%p)\n", This
, p
);
196 static HRESULT WINAPI
HTMLFormElement_put_encoding(IHTMLFormElement
*iface
, BSTR v
)
198 static const WCHAR urlencodedW
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
199 'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
200 static const WCHAR dataW
[] = {'m','u','l','t','i','p','a','r','t','/',
201 'f','o','r','m','-','d','a','t','a',0};
202 static const WCHAR plainW
[] = {'t','e','x','t','/','p','l','a','i','n',0};
204 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
205 nsAString encoding_str
;
208 TRACE("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
210 if(lstrcmpiW(v
, urlencodedW
) && lstrcmpiW(v
, dataW
) && lstrcmpiW(v
, plainW
)) {
211 WARN("incorrect enctype\n");
215 nsAString_InitDepend(&encoding_str
, v
);
216 nsres
= nsIDOMHTMLFormElement_SetEnctype(This
->nsform
, &encoding_str
);
217 nsAString_Finish(&encoding_str
);
224 static HRESULT WINAPI
HTMLFormElement_get_encoding(IHTMLFormElement
*iface
, BSTR
*p
)
226 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
227 nsAString encoding_str
;
230 TRACE("(%p)->(%p)\n", This
, p
);
232 nsAString_Init(&encoding_str
, NULL
);
233 nsres
= nsIDOMHTMLFormElement_GetEnctype(This
->nsform
, &encoding_str
);
234 return return_nsstr(nsres
, &encoding_str
, p
);
237 static HRESULT WINAPI
HTMLFormElement_put_method(IHTMLFormElement
*iface
, BSTR v
)
239 static const WCHAR postW
[] = {'P','O','S','T',0};
240 static const WCHAR getW
[] = {'G','E','T',0};
242 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
243 nsAString method_str
;
246 TRACE("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
248 if(lstrcmpiW(v
, postW
) && lstrcmpiW(v
, getW
)) {
249 WARN("unrecognized method\n");
253 nsAString_InitDepend(&method_str
, v
);
254 nsres
= nsIDOMHTMLFormElement_SetMethod(This
->nsform
, &method_str
);
255 nsAString_Finish(&method_str
);
262 static HRESULT WINAPI
HTMLFormElement_get_method(IHTMLFormElement
*iface
, BSTR
*p
)
264 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
265 nsAString method_str
;
268 TRACE("(%p)->(%p)\n", This
, p
);
270 nsAString_Init(&method_str
, NULL
);
271 nsres
= nsIDOMHTMLFormElement_GetMethod(This
->nsform
, &method_str
);
272 return return_nsstr(nsres
, &method_str
, p
);
275 static HRESULT WINAPI
HTMLFormElement_get_elements(IHTMLFormElement
*iface
, IDispatch
**p
)
277 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
279 TRACE("(%p)->(%p)\n", This
, p
);
281 *p
= (IDispatch
*)&This
->IHTMLFormElement_iface
;
282 IDispatch_AddRef(*p
);
286 static HRESULT WINAPI
HTMLFormElement_put_target(IHTMLFormElement
*iface
, BSTR v
)
288 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
289 FIXME("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
293 static HRESULT WINAPI
HTMLFormElement_get_target(IHTMLFormElement
*iface
, BSTR
*p
)
295 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
296 FIXME("(%p)->(%p)\n", This
, p
);
300 static HRESULT WINAPI
HTMLFormElement_put_name(IHTMLFormElement
*iface
, BSTR v
)
302 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
306 TRACE("(%p)->(%s)\n", This
, wine_dbgstr_w(v
));
308 nsAString_InitDepend(&name_str
, v
);
309 nsres
= nsIDOMHTMLFormElement_SetName(This
->nsform
, &name_str
);
310 nsAString_Finish(&name_str
);
317 static HRESULT WINAPI
HTMLFormElement_get_name(IHTMLFormElement
*iface
, BSTR
*p
)
319 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
323 TRACE("(%p)->(%p)\n", This
, p
);
325 nsAString_Init(&name_str
, NULL
);
326 nsres
= nsIDOMHTMLFormElement_GetName(This
->nsform
, &name_str
);
327 return return_nsstr(nsres
, &name_str
, p
);
330 static HRESULT WINAPI
HTMLFormElement_put_onsubmit(IHTMLFormElement
*iface
, VARIANT v
)
332 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
334 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
336 return set_node_event(&This
->element
.node
, EVENTID_SUBMIT
, &v
);
339 static HRESULT WINAPI
HTMLFormElement_get_onsubmit(IHTMLFormElement
*iface
, VARIANT
*p
)
341 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
343 TRACE("(%p)->(%p)\n", This
, p
);
345 return get_node_event(&This
->element
.node
, EVENTID_SUBMIT
, p
);
348 static HRESULT WINAPI
HTMLFormElement_put_onreset(IHTMLFormElement
*iface
, VARIANT v
)
350 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
351 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
355 static HRESULT WINAPI
HTMLFormElement_get_onreset(IHTMLFormElement
*iface
, VARIANT
*p
)
357 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
358 FIXME("(%p)->(%p)\n", This
, p
);
362 static HRESULT WINAPI
HTMLFormElement_submit(IHTMLFormElement
*iface
)
364 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
365 HTMLOuterWindow
*window
= NULL
;
366 nsIInputStream
*post_stream
;
367 nsAString action_uri_str
;
372 TRACE("(%p)->()\n", This
);
374 if(This
->element
.node
.doc
) {
375 HTMLDocumentNode
*doc
= This
->element
.node
.doc
;
376 if(doc
->window
&& doc
->window
->base
.outer_window
)
377 window
= doc
->window
->base
.outer_window
;
380 TRACE("No outer window\n");
385 * FIXME: We currently don't use our submit implementation for sub-windows because
386 * load_nsuri can't support post data. We should fix it.
388 if(!window
->doc_obj
|| window
->doc_obj
->basedoc
.window
!= window
) {
389 nsres
= nsIDOMHTMLFormElement_Submit(This
->nsform
);
390 if(NS_FAILED(nsres
)) {
391 ERR("Submit failed: %08x\n", nsres
);
398 nsAString_Init(&action_uri_str
, NULL
);
399 nsres
= nsIDOMHTMLFormElement_GetFormData(This
->nsform
, NULL
, &action_uri_str
, &post_stream
);
400 if(NS_SUCCEEDED(nsres
)) {
401 const PRUnichar
*action_uri
;
403 nsAString_GetData(&action_uri_str
, &action_uri
);
404 hres
= create_uri(action_uri
, 0, &uri
);
406 ERR("GetFormData failed: %08x\n", nsres
);
409 nsAString_Finish(&action_uri_str
);
410 if(SUCCEEDED(hres
)) {
411 window
->readystate_locked
++;
412 hres
= submit_form(window
, uri
, post_stream
);
413 window
->readystate_locked
--;
418 nsIInputStream_Release(post_stream
);
422 static HRESULT WINAPI
HTMLFormElement_reset(IHTMLFormElement
*iface
)
424 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
425 FIXME("(%p)->()\n", This
);
429 static HRESULT WINAPI
HTMLFormElement_put_length(IHTMLFormElement
*iface
, LONG v
)
431 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
432 FIXME("(%p)->(%d)\n", This
, v
);
436 static HRESULT WINAPI
HTMLFormElement_get_length(IHTMLFormElement
*iface
, LONG
*p
)
438 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
441 TRACE("(%p)->(%p)\n", This
, p
);
443 nsres
= nsIDOMHTMLFormElement_GetLength(This
->nsform
, p
);
444 if(NS_FAILED(nsres
)) {
445 ERR("GetLength failed: %08x\n", nsres
);
452 static HRESULT WINAPI
HTMLFormElement__newEnum(IHTMLFormElement
*iface
, IUnknown
**p
)
454 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
455 FIXME("(%p)->(%p)\n", This
, p
);
459 static HRESULT WINAPI
HTMLFormElement_item(IHTMLFormElement
*iface
, VARIANT name
,
460 VARIANT index
, IDispatch
**pdisp
)
462 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
464 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(&name
), debugstr_variant(&index
), pdisp
);
470 if(V_VT(&name
) == VT_I4
) {
473 return htmlform_item(This
, V_I4(&name
), pdisp
);
476 FIXME("Unsupported args\n");
480 static HRESULT WINAPI
HTMLFormElement_tags(IHTMLFormElement
*iface
, VARIANT tagName
,
483 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
484 FIXME("(%p)->(v %p)\n", This
, pdisp
);
488 static const IHTMLFormElementVtbl HTMLFormElementVtbl
= {
489 HTMLFormElement_QueryInterface
,
490 HTMLFormElement_AddRef
,
491 HTMLFormElement_Release
,
492 HTMLFormElement_GetTypeInfoCount
,
493 HTMLFormElement_GetTypeInfo
,
494 HTMLFormElement_GetIDsOfNames
,
495 HTMLFormElement_Invoke
,
496 HTMLFormElement_put_action
,
497 HTMLFormElement_get_action
,
498 HTMLFormElement_put_dir
,
499 HTMLFormElement_get_dir
,
500 HTMLFormElement_put_encoding
,
501 HTMLFormElement_get_encoding
,
502 HTMLFormElement_put_method
,
503 HTMLFormElement_get_method
,
504 HTMLFormElement_get_elements
,
505 HTMLFormElement_put_target
,
506 HTMLFormElement_get_target
,
507 HTMLFormElement_put_name
,
508 HTMLFormElement_get_name
,
509 HTMLFormElement_put_onsubmit
,
510 HTMLFormElement_get_onsubmit
,
511 HTMLFormElement_put_onreset
,
512 HTMLFormElement_get_onreset
,
513 HTMLFormElement_submit
,
514 HTMLFormElement_reset
,
515 HTMLFormElement_put_length
,
516 HTMLFormElement_get_length
,
517 HTMLFormElement__newEnum
,
518 HTMLFormElement_item
,
522 static inline HTMLFormElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
524 return CONTAINING_RECORD(iface
, HTMLFormElement
, element
.node
);
527 static HRESULT
HTMLFormElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
529 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
533 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
534 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
535 *ppv
= &This
->IHTMLFormElement_iface
;
536 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
537 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
538 *ppv
= &This
->IHTMLFormElement_iface
;
539 }else if(IsEqualGUID(&IID_IHTMLFormElement
, riid
)) {
540 TRACE("(%p)->(IID_IHTMLFormElement %p)\n", This
, ppv
);
541 *ppv
= &This
->IHTMLFormElement_iface
;
545 IUnknown_AddRef((IUnknown
*)*ppv
);
549 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
552 static HRESULT
HTMLFormElement_get_dispid(HTMLDOMNode
*iface
,
553 BSTR name
, DWORD grfdex
, DISPID
*pid
)
555 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
556 nsIDOMHTMLCollection
*elements
;
557 nsAString nsname
, nsstr
;
560 HRESULT hres
= DISP_E_UNKNOWNNAME
;
562 static const PRUnichar nameW
[] = {'n','a','m','e',0};
564 TRACE("(%p)->(%s %x %p)\n", This
, wine_dbgstr_w(name
), grfdex
, pid
);
566 nsres
= nsIDOMHTMLFormElement_GetElements(This
->nsform
, &elements
);
567 if(NS_FAILED(nsres
)) {
568 FIXME("GetElements failed: 0x%08x\n", nsres
);
572 nsres
= nsIDOMHTMLCollection_GetLength(elements
, &len
);
573 if(NS_FAILED(nsres
)) {
574 FIXME("GetLength failed: 0x%08x\n", nsres
);
575 nsIDOMHTMLCollection_Release(elements
);
579 if(len
> MSHTML_CUSTOM_DISPID_CNT
)
580 len
= MSHTML_CUSTOM_DISPID_CNT
;
582 /* FIXME: Implement in more generic way */
583 if('0' <= *name
&& *name
<= '9') {
586 i
= strtoulW(name
, &end_ptr
, 10);
587 if(!*end_ptr
&& i
< len
) {
588 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
593 nsAString_InitDepend(&nsname
, nameW
);
594 nsAString_Init(&nsstr
, NULL
);
595 for(i
= 0; i
< len
; ++i
) {
597 nsIDOMHTMLElement
*nshtml_elem
;
598 const PRUnichar
*str
;
600 nsres
= nsIDOMHTMLCollection_Item(elements
, i
, &nsitem
);
601 if(NS_FAILED(nsres
)) {
602 FIXME("Item failed: 0x%08x\n", nsres
);
607 nsres
= nsIDOMNode_QueryInterface(nsitem
, &IID_nsIDOMHTMLElement
, (void**)&nshtml_elem
);
608 nsIDOMNode_Release(nsitem
);
609 if(NS_FAILED(nsres
)) {
610 FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres
);
615 /* compare by id attr */
616 nsres
= nsIDOMHTMLElement_GetId(nshtml_elem
, &nsstr
);
617 if(NS_FAILED(nsres
)) {
618 FIXME("GetId failed: 0x%08x\n", nsres
);
619 nsIDOMHTMLElement_Release(nshtml_elem
);
623 nsAString_GetData(&nsstr
, &str
);
624 if(!strcmpiW(str
, name
)) {
625 nsIDOMHTMLElement_Release(nshtml_elem
);
626 /* FIXME: using index for dispid */
627 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
632 /* compare by name attr */
633 nsres
= nsIDOMHTMLElement_GetAttribute(nshtml_elem
, &nsname
, &nsstr
);
634 nsIDOMHTMLElement_Release(nshtml_elem
);
635 nsAString_GetData(&nsstr
, &str
);
636 if(!strcmpiW(str
, name
)) {
637 /* FIXME: using index for dispid */
638 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
643 nsAString_Finish(&nsname
);
644 nsAString_Finish(&nsstr
);
646 nsIDOMHTMLCollection_Release(elements
);
651 static HRESULT
HTMLFormElement_invoke(HTMLDOMNode
*iface
,
652 DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
, VARIANT
*res
,
653 EXCEPINFO
*ei
, IServiceProvider
*caller
)
655 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
659 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
661 hres
= htmlform_item(This
, id
- MSHTML_DISPID_CUSTOM_MIN
, &ret
);
666 V_VT(res
) = VT_DISPATCH
;
667 V_DISPATCH(res
) = ret
;
674 static const NodeImplVtbl HTMLFormElementImplVtbl
= {
676 HTMLElement_destructor
,
679 HTMLElement_handle_event
,
680 HTMLElement_get_attr_col
,
687 HTMLFormElement_get_dispid
,
688 HTMLFormElement_invoke
691 static const tid_t HTMLFormElement_iface_tids
[] = {
693 IHTMLFormElement_tid
,
697 static dispex_static_data_t HTMLFormElement_dispex
= {
699 DispHTMLFormElement_tid
,
701 HTMLFormElement_iface_tids
704 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
706 HTMLFormElement
*ret
;
709 ret
= heap_alloc_zero(sizeof(HTMLFormElement
));
711 return E_OUTOFMEMORY
;
713 ret
->IHTMLFormElement_iface
.lpVtbl
= &HTMLFormElementVtbl
;
714 ret
->element
.node
.vtbl
= &HTMLFormElementImplVtbl
;
716 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLFormElement_dispex
);
718 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFormElement
, (void**)&ret
->nsform
);
720 /* Share the reference with nsnode */
721 assert(nsres
== NS_OK
&& (nsIDOMNode
*)ret
->nsform
== ret
->element
.node
.nsnode
);
722 nsIDOMNode_Release(ret
->element
.node
.nsnode
);
724 *elem
= &ret
->element
;