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
, *this_window
= NULL
;
366 nsIInputStream
*post_stream
;
367 nsAString action_uri_str
, target_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 this_window
= doc
->window
->base
.outer_window
;
380 TRACE("No outer window\n");
384 nsAString_Init(&target_str
, NULL
);
385 nsres
= nsIDOMHTMLFormElement_GetTarget(This
->nsform
, &target_str
);
386 if(NS_SUCCEEDED(nsres
)) {
388 window
= get_target_window(this_window
, &target_str
, &use_new_window
);
390 FIXME("submit to new window is not supported\n");
392 nsAString_Finish(&target_str
);
397 * FIXME: We currently don't use our submit implementation for sub-windows because
398 * load_nsuri can't support post data. We should fix it.
400 if(!window
->doc_obj
|| window
->doc_obj
->basedoc
.window
!= window
) {
401 nsres
= nsIDOMHTMLFormElement_Submit(This
->nsform
);
402 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
403 if(NS_FAILED(nsres
)) {
404 ERR("Submit failed: %08x\n", nsres
);
411 nsAString_Init(&action_uri_str
, NULL
);
412 nsres
= nsIDOMHTMLFormElement_GetFormData(This
->nsform
, NULL
, &action_uri_str
, &post_stream
);
413 if(NS_SUCCEEDED(nsres
)) {
414 const PRUnichar
*action_uri
;
416 nsAString_GetData(&action_uri_str
, &action_uri
);
417 hres
= create_uri(action_uri
, 0, &uri
);
419 ERR("GetFormData failed: %08x\n", nsres
);
422 nsAString_Finish(&action_uri_str
);
423 if(SUCCEEDED(hres
)) {
424 window
->readystate_locked
++;
425 hres
= submit_form(window
, uri
, post_stream
);
426 window
->readystate_locked
--;
430 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
432 nsIInputStream_Release(post_stream
);
436 static HRESULT WINAPI
HTMLFormElement_reset(IHTMLFormElement
*iface
)
438 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
439 FIXME("(%p)->()\n", This
);
443 static HRESULT WINAPI
HTMLFormElement_put_length(IHTMLFormElement
*iface
, LONG v
)
445 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
446 FIXME("(%p)->(%d)\n", This
, v
);
450 static HRESULT WINAPI
HTMLFormElement_get_length(IHTMLFormElement
*iface
, LONG
*p
)
452 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
455 TRACE("(%p)->(%p)\n", This
, p
);
457 nsres
= nsIDOMHTMLFormElement_GetLength(This
->nsform
, p
);
458 if(NS_FAILED(nsres
)) {
459 ERR("GetLength failed: %08x\n", nsres
);
466 static HRESULT WINAPI
HTMLFormElement__newEnum(IHTMLFormElement
*iface
, IUnknown
**p
)
468 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
469 FIXME("(%p)->(%p)\n", This
, p
);
473 static HRESULT WINAPI
HTMLFormElement_item(IHTMLFormElement
*iface
, VARIANT name
,
474 VARIANT index
, IDispatch
**pdisp
)
476 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
478 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(&name
), debugstr_variant(&index
), pdisp
);
484 if(V_VT(&name
) == VT_I4
) {
487 return htmlform_item(This
, V_I4(&name
), pdisp
);
490 FIXME("Unsupported args\n");
494 static HRESULT WINAPI
HTMLFormElement_tags(IHTMLFormElement
*iface
, VARIANT tagName
,
497 HTMLFormElement
*This
= impl_from_IHTMLFormElement(iface
);
498 FIXME("(%p)->(v %p)\n", This
, pdisp
);
502 static const IHTMLFormElementVtbl HTMLFormElementVtbl
= {
503 HTMLFormElement_QueryInterface
,
504 HTMLFormElement_AddRef
,
505 HTMLFormElement_Release
,
506 HTMLFormElement_GetTypeInfoCount
,
507 HTMLFormElement_GetTypeInfo
,
508 HTMLFormElement_GetIDsOfNames
,
509 HTMLFormElement_Invoke
,
510 HTMLFormElement_put_action
,
511 HTMLFormElement_get_action
,
512 HTMLFormElement_put_dir
,
513 HTMLFormElement_get_dir
,
514 HTMLFormElement_put_encoding
,
515 HTMLFormElement_get_encoding
,
516 HTMLFormElement_put_method
,
517 HTMLFormElement_get_method
,
518 HTMLFormElement_get_elements
,
519 HTMLFormElement_put_target
,
520 HTMLFormElement_get_target
,
521 HTMLFormElement_put_name
,
522 HTMLFormElement_get_name
,
523 HTMLFormElement_put_onsubmit
,
524 HTMLFormElement_get_onsubmit
,
525 HTMLFormElement_put_onreset
,
526 HTMLFormElement_get_onreset
,
527 HTMLFormElement_submit
,
528 HTMLFormElement_reset
,
529 HTMLFormElement_put_length
,
530 HTMLFormElement_get_length
,
531 HTMLFormElement__newEnum
,
532 HTMLFormElement_item
,
536 static inline HTMLFormElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
538 return CONTAINING_RECORD(iface
, HTMLFormElement
, element
.node
);
541 static HRESULT
HTMLFormElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
543 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
547 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
548 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
549 *ppv
= &This
->IHTMLFormElement_iface
;
550 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
551 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
552 *ppv
= &This
->IHTMLFormElement_iface
;
553 }else if(IsEqualGUID(&IID_IHTMLFormElement
, riid
)) {
554 TRACE("(%p)->(IID_IHTMLFormElement %p)\n", This
, ppv
);
555 *ppv
= &This
->IHTMLFormElement_iface
;
559 IUnknown_AddRef((IUnknown
*)*ppv
);
563 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
566 static HRESULT
HTMLFormElement_get_dispid(HTMLDOMNode
*iface
,
567 BSTR name
, DWORD grfdex
, DISPID
*pid
)
569 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
570 nsIDOMHTMLCollection
*elements
;
571 nsAString nsname
, nsstr
;
574 HRESULT hres
= DISP_E_UNKNOWNNAME
;
576 static const PRUnichar nameW
[] = {'n','a','m','e',0};
578 TRACE("(%p)->(%s %x %p)\n", This
, wine_dbgstr_w(name
), grfdex
, pid
);
580 nsres
= nsIDOMHTMLFormElement_GetElements(This
->nsform
, &elements
);
581 if(NS_FAILED(nsres
)) {
582 FIXME("GetElements failed: 0x%08x\n", nsres
);
586 nsres
= nsIDOMHTMLCollection_GetLength(elements
, &len
);
587 if(NS_FAILED(nsres
)) {
588 FIXME("GetLength failed: 0x%08x\n", nsres
);
589 nsIDOMHTMLCollection_Release(elements
);
593 if(len
> MSHTML_CUSTOM_DISPID_CNT
)
594 len
= MSHTML_CUSTOM_DISPID_CNT
;
596 /* FIXME: Implement in more generic way */
597 if('0' <= *name
&& *name
<= '9') {
600 i
= strtoulW(name
, &end_ptr
, 10);
601 if(!*end_ptr
&& i
< len
) {
602 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
607 nsAString_InitDepend(&nsname
, nameW
);
608 nsAString_Init(&nsstr
, NULL
);
609 for(i
= 0; i
< len
; ++i
) {
611 nsIDOMHTMLElement
*nshtml_elem
;
612 const PRUnichar
*str
;
614 nsres
= nsIDOMHTMLCollection_Item(elements
, i
, &nsitem
);
615 if(NS_FAILED(nsres
)) {
616 FIXME("Item failed: 0x%08x\n", nsres
);
621 nsres
= nsIDOMNode_QueryInterface(nsitem
, &IID_nsIDOMHTMLElement
, (void**)&nshtml_elem
);
622 nsIDOMNode_Release(nsitem
);
623 if(NS_FAILED(nsres
)) {
624 FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres
);
629 /* compare by id attr */
630 nsres
= nsIDOMHTMLElement_GetId(nshtml_elem
, &nsstr
);
631 if(NS_FAILED(nsres
)) {
632 FIXME("GetId failed: 0x%08x\n", nsres
);
633 nsIDOMHTMLElement_Release(nshtml_elem
);
637 nsAString_GetData(&nsstr
, &str
);
638 if(!strcmpiW(str
, name
)) {
639 nsIDOMHTMLElement_Release(nshtml_elem
);
640 /* FIXME: using index for dispid */
641 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
646 /* compare by name attr */
647 nsres
= nsIDOMHTMLElement_GetAttribute(nshtml_elem
, &nsname
, &nsstr
);
648 nsIDOMHTMLElement_Release(nshtml_elem
);
649 nsAString_GetData(&nsstr
, &str
);
650 if(!strcmpiW(str
, name
)) {
651 /* FIXME: using index for dispid */
652 *pid
= MSHTML_DISPID_CUSTOM_MIN
+ i
;
657 nsAString_Finish(&nsname
);
658 nsAString_Finish(&nsstr
);
660 nsIDOMHTMLCollection_Release(elements
);
665 static HRESULT
HTMLFormElement_invoke(HTMLDOMNode
*iface
,
666 DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
, VARIANT
*res
,
667 EXCEPINFO
*ei
, IServiceProvider
*caller
)
669 HTMLFormElement
*This
= impl_from_HTMLDOMNode(iface
);
673 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
675 hres
= htmlform_item(This
, id
- MSHTML_DISPID_CUSTOM_MIN
, &ret
);
680 V_VT(res
) = VT_DISPATCH
;
681 V_DISPATCH(res
) = ret
;
688 static const NodeImplVtbl HTMLFormElementImplVtbl
= {
690 HTMLElement_destructor
,
693 HTMLElement_handle_event
,
694 HTMLElement_get_attr_col
,
701 HTMLFormElement_get_dispid
,
702 HTMLFormElement_invoke
705 static const tid_t HTMLFormElement_iface_tids
[] = {
707 IHTMLFormElement_tid
,
711 static dispex_static_data_t HTMLFormElement_dispex
= {
713 DispHTMLFormElement_tid
,
715 HTMLFormElement_iface_tids
718 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
720 HTMLFormElement
*ret
;
723 ret
= heap_alloc_zero(sizeof(HTMLFormElement
));
725 return E_OUTOFMEMORY
;
727 ret
->IHTMLFormElement_iface
.lpVtbl
= &HTMLFormElementVtbl
;
728 ret
->element
.node
.vtbl
= &HTMLFormElementImplVtbl
;
730 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLFormElement_dispex
);
732 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLFormElement
, (void**)&ret
->nsform
);
734 /* Share the reference with nsnode */
735 assert(nsres
== NS_OK
&& (nsIDOMNode
*)ret
->nsform
== ret
->element
.node
.nsnode
);
736 nsIDOMNode_Release(ret
->element
.node
.nsnode
);
738 *elem
= &ret
->element
;