ReactOS 0.4.16-dev-122-g325d74c
htmlform.c File Reference
#include "mshtml_private.h"
Include dependency graph for htmlform.c:

Go to the source code of this file.

Classes

struct  HTMLFormElement
 

Functions

static HRESULT htmlform_item (HTMLFormElement *This, int i, IDispatch **ret)
 
static HTMLFormElementimpl_from_IHTMLFormElement (IHTMLFormElement *iface)
 
static HRESULT WINAPI HTMLFormElement_QueryInterface (IHTMLFormElement *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HTMLFormElement_AddRef (IHTMLFormElement *iface)
 
static ULONG WINAPI HTMLFormElement_Release (IHTMLFormElement *iface)
 
static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount (IHTMLFormElement *iface, UINT *pctinfo)
 
static HRESULT WINAPI HTMLFormElement_GetTypeInfo (IHTMLFormElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI HTMLFormElement_GetIDsOfNames (IHTMLFormElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI HTMLFormElement_Invoke (IHTMLFormElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI HTMLFormElement_put_action (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_action (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_put_dir (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_dir (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_put_encoding (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_encoding (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_put_method (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_method (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_get_elements (IHTMLFormElement *iface, IDispatch **p)
 
static HRESULT WINAPI HTMLFormElement_put_target (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_target (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_put_name (IHTMLFormElement *iface, BSTR v)
 
static HRESULT WINAPI HTMLFormElement_get_name (IHTMLFormElement *iface, BSTR *p)
 
static HRESULT WINAPI HTMLFormElement_put_onsubmit (IHTMLFormElement *iface, VARIANT v)
 
static HRESULT WINAPI HTMLFormElement_get_onsubmit (IHTMLFormElement *iface, VARIANT *p)
 
static HRESULT WINAPI HTMLFormElement_put_onreset (IHTMLFormElement *iface, VARIANT v)
 
static HRESULT WINAPI HTMLFormElement_get_onreset (IHTMLFormElement *iface, VARIANT *p)
 
static HRESULT WINAPI HTMLFormElement_submit (IHTMLFormElement *iface)
 
static HRESULT WINAPI HTMLFormElement_reset (IHTMLFormElement *iface)
 
static HRESULT WINAPI HTMLFormElement_put_length (IHTMLFormElement *iface, LONG v)
 
static HRESULT WINAPI HTMLFormElement_get_length (IHTMLFormElement *iface, LONG *p)
 
static HRESULT WINAPI HTMLFormElement__newEnum (IHTMLFormElement *iface, IUnknown **p)
 
static HRESULT WINAPI HTMLFormElement_item (IHTMLFormElement *iface, VARIANT name, VARIANT index, IDispatch **pdisp)
 
static HRESULT WINAPI HTMLFormElement_tags (IHTMLFormElement *iface, VARIANT tagName, IDispatch **pdisp)
 
static HTMLFormElementimpl_from_HTMLDOMNode (HTMLDOMNode *iface)
 
static HRESULT HTMLFormElement_QI (HTMLDOMNode *iface, REFIID riid, void **ppv)
 
static HRESULT HTMLFormElement_get_dispid (HTMLDOMNode *iface, BSTR name, DWORD grfdex, DISPID *pid)
 
static HRESULT HTMLFormElement_invoke (HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
static HRESULT HTMLFormElement_handle_event (HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
 
static void HTMLFormElement_traverse (HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
 
static void HTMLFormElement_unlink (HTMLDOMNode *iface)
 
HRESULT HTMLFormElement_Create (HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
 

Variables

static const IHTMLFormElementVtbl HTMLFormElementVtbl
 
static const NodeImplVtbl HTMLFormElementImplVtbl
 
static const tid_t HTMLFormElement_iface_tids []
 
static dispex_static_data_t HTMLFormElement_dispex
 

Function Documentation

◆ htmlform_item()

static HRESULT htmlform_item ( HTMLFormElement This,
int  i,
IDispatch **  ret 
)
static

Definition at line 29 of file htmlform.c.

30{
31 nsIDOMHTMLCollection *elements;
34 nsresult nsres;
36
37 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
38 if(NS_FAILED(nsres)) {
39 FIXME("GetElements failed: 0x%08x\n", nsres);
40 return E_FAIL;
41 }
42
43 nsres = nsIDOMHTMLCollection_Item(elements, i, &item);
44 nsIDOMHTMLCollection_Release(elements);
45 if(NS_FAILED(nsres)) {
46 FIXME("Item failed: 0x%08x\n", nsres);
47 return E_FAIL;
48 }
49
50 if(item) {
51 hres = get_node(This->element.node.doc, item, TRUE, &node);
52 if(FAILED(hres))
53 return hres;
54
55 nsIDOMNode_Release(item);
56 *ret = (IDispatch*)&node->IHTMLDOMNode_iface;
57 }else {
58 *ret = NULL;
59 }
60
61 return S_OK;
62}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret)
Definition: htmlnode.c:1339
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465
static ATOM item
Definition: dde.c:856
#define NS_FAILED(res)
Definition: dlist.c:348
int ret

Referenced by HTMLFormElement_invoke(), and HTMLFormElement_item().

◆ HTMLFormElement__newEnum()

static HRESULT WINAPI HTMLFormElement__newEnum ( IHTMLFormElement *  iface,
IUnknown **  p 
)
static

Definition at line 495 of file htmlform.c.

496{
498 FIXME("(%p)->(%p)\n", This, p);
499 return E_NOTIMPL;
500}
#define E_NOTIMPL
Definition: ddrawi.h:99
GLfloat GLfloat p
Definition: glext.h:8902
static HTMLFormElement * impl_from_IHTMLFormElement(IHTMLFormElement *iface)
Definition: htmlform.c:64

◆ HTMLFormElement_AddRef()

static ULONG WINAPI HTMLFormElement_AddRef ( IHTMLFormElement *  iface)
static

Definition at line 77 of file htmlform.c.

78{
80
81 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
82}

◆ HTMLFormElement_Create()

HRESULT HTMLFormElement_Create ( HTMLDocumentNode doc,
nsIDOMHTMLElement nselem,
HTMLElement **  elem 
)

Definition at line 785 of file htmlform.c.

786{
788 nsresult nsres;
789
790 ret = heap_alloc_zero(sizeof(HTMLFormElement));
791 if(!ret)
792 return E_OUTOFMEMORY;
793
794 ret->IHTMLFormElement_iface.lpVtbl = &HTMLFormElementVtbl;
795 ret->element.node.vtbl = &HTMLFormElementImplVtbl;
796
797 HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex);
798
799 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFormElement, (void**)&ret->nsform);
800 assert(nsres == NS_OK);
801
802 *elem = &ret->element;
803 return S_OK;
804}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define assert(x)
Definition: debug.h:53
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
Definition: htmlelem.c:4008
static const NodeImplVtbl HTMLFormElementImplVtbl
Definition: htmlform.c:752
static const IHTMLFormElementVtbl HTMLFormElementVtbl
Definition: htmlform.c:531
static dispex_static_data_t HTMLFormElement_dispex
Definition: htmlform.c:778
static size_t elem
Definition: string.c:68
#define NS_OK

◆ HTMLFormElement_get_action()

static HRESULT WINAPI HTMLFormElement_get_action ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 142 of file htmlform.c.

143{
145 nsAString action_str;
146 nsresult nsres;
148
149 TRACE("(%p)->(%p)\n", This, p);
150
151 nsAString_Init(&action_str, NULL);
152 nsres = nsIDOMHTMLFormElement_GetAction(This->nsform, &action_str);
153 if(NS_SUCCEEDED(nsres)) {
154 const PRUnichar *action;
155 nsAString_GetData(&action_str, &action);
157 }else {
158 ERR("GetAction failed: %08x\n", nsres);
159 hres = E_FAIL;
160 }
161
162 nsAString_Finish(&action_str);
163 return hres;
164}
#define ERR(fmt,...)
Definition: precomp.h:57
#define FALSE
Definition: types.h:117
const WCHAR * action
Definition: action.c:7509
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
HRESULT nsuri_to_url(LPCWSTR, BOOL, BSTR *) DECLSPEC_HIDDEN
Definition: nsio.c:175
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
#define NS_SUCCEEDED(res)
WCHAR PRUnichar
Definition: nsiface.idl:48
#define TRACE(s)
Definition: solgame.cpp:4

◆ HTMLFormElement_get_dir()

static HRESULT WINAPI HTMLFormElement_get_dir ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 173 of file htmlform.c.

174{
176 FIXME("(%p)->(%p)\n", This, p);
177 return E_NOTIMPL;
178}

◆ HTMLFormElement_get_dispid()

static HRESULT HTMLFormElement_get_dispid ( HTMLDOMNode iface,
BSTR  name,
DWORD  grfdex,
DISPID pid 
)
static

Definition at line 598 of file htmlform.c.

600{
602 nsIDOMHTMLCollection *elements;
603 nsAString nsstr, name_str;
604 UINT32 len, i;
605 nsresult nsres;
607
608 static const PRUnichar nameW[] = {'n','a','m','e',0};
609
610 TRACE("(%p)->(%s %x %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
611
612 nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
613 if(NS_FAILED(nsres)) {
614 FIXME("GetElements failed: 0x%08x\n", nsres);
615 return E_FAIL;
616 }
617
618 nsres = nsIDOMHTMLCollection_GetLength(elements, &len);
619 if(NS_FAILED(nsres)) {
620 FIXME("GetLength failed: 0x%08x\n", nsres);
621 nsIDOMHTMLCollection_Release(elements);
622 return E_FAIL;
623 }
624
627
628 /* FIXME: Implement in more generic way */
629 if('0' <= *name && *name <= '9') {
630 WCHAR *end_ptr;
631
632 i = strtoulW(name, &end_ptr, 10);
633 if(!*end_ptr && i < len) {
635 return S_OK;
636 }
637 }
638
639 nsAString_Init(&nsstr, NULL);
640 for(i = 0; i < len; ++i) {
641 nsIDOMNode *nsitem;
642 nsIDOMHTMLElement *nshtml_elem;
643 const PRUnichar *str;
644
645 nsres = nsIDOMHTMLCollection_Item(elements, i, &nsitem);
646 if(NS_FAILED(nsres)) {
647 FIXME("Item failed: 0x%08x\n", nsres);
648 hres = E_FAIL;
649 break;
650 }
651
652 nsres = nsIDOMNode_QueryInterface(nsitem, &IID_nsIDOMHTMLElement, (void**)&nshtml_elem);
653 nsIDOMNode_Release(nsitem);
654 if(NS_FAILED(nsres)) {
655 FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres);
656 hres = E_FAIL;
657 break;
658 }
659
660 /* compare by id attr */
661 nsres = nsIDOMHTMLElement_GetId(nshtml_elem, &nsstr);
662 if(NS_FAILED(nsres)) {
663 FIXME("GetId failed: 0x%08x\n", nsres);
664 nsIDOMHTMLElement_Release(nshtml_elem);
665 hres = E_FAIL;
666 break;
667 }
668 nsAString_GetData(&nsstr, &str);
669 if(!strcmpiW(str, name)) {
670 nsIDOMHTMLElement_Release(nshtml_elem);
671 /* FIXME: using index for dispid */
673 hres = S_OK;
674 break;
675 }
676
677 /* compare by name attr */
678 nsres = get_elem_attr_value(nshtml_elem, nameW, &name_str, &str);
679 nsIDOMHTMLElement_Release(nshtml_elem);
680 if(NS_SUCCEEDED(nsres)) {
681 if(!strcmpiW(str, name)) {
682 nsAString_Finish(&name_str);
683 /* FIXME: using index for dispid */
685 hres = S_OK;
686 break;
687 }
688 nsAString_Finish(&name_str);
689 }
690 }
691
692 nsAString_Finish(&nsstr);
693 nsIDOMHTMLCollection_Release(elements);
694 return hres;
695}
unsigned int UINT32
static const WCHAR nameW[]
Definition: main.c:49
GLenum GLsizei len
Definition: glext.h:6722
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
static HTMLFormElement * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmlform.c:565
#define wine_dbgstr_w
Definition: kernel32.h:34
#define MSHTML_CUSTOM_DISPID_CNT
#define MSHTML_DISPID_CUSTOM_MIN
#define strcmpiW(s1, s2)
Definition: unicode.h:45
#define strtoulW(s1, s2, b)
Definition: unicode.h:47
const WCHAR * str
Definition: name.c:39
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ HTMLFormElement_get_elements()

static HRESULT WINAPI HTMLFormElement_get_elements ( IHTMLFormElement *  iface,
IDispatch **  p 
)
static

Definition at line 259 of file htmlform.c.

260{
262
263 TRACE("(%p)->(%p)\n", This, p);
264
265 *p = (IDispatch*)&This->IHTMLFormElement_iface;
266 IDispatch_AddRef(*p);
267 return S_OK;
268}

◆ HTMLFormElement_get_encoding()

static HRESULT WINAPI HTMLFormElement_get_encoding ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 208 of file htmlform.c.

209{
211 nsAString encoding_str;
212 nsresult nsres;
213
214 TRACE("(%p)->(%p)\n", This, p);
215
216 nsAString_Init(&encoding_str, NULL);
217 nsres = nsIDOMHTMLFormElement_GetEnctype(This->nsform, &encoding_str);
218 return return_nsstr(nsres, &encoding_str, p);
219}
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841

◆ HTMLFormElement_get_length()

static HRESULT WINAPI HTMLFormElement_get_length ( IHTMLFormElement *  iface,
LONG p 
)
static

Definition at line 479 of file htmlform.c.

480{
482 nsresult nsres;
483
484 TRACE("(%p)->(%p)\n", This, p);
485
486 nsres = nsIDOMHTMLFormElement_GetLength(This->nsform, p);
487 if(NS_FAILED(nsres)) {
488 ERR("GetLength failed: %08x\n", nsres);
489 return E_FAIL;
490 }
491
492 return S_OK;
493}

◆ HTMLFormElement_get_method()

static HRESULT WINAPI HTMLFormElement_get_method ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 246 of file htmlform.c.

247{
249 nsAString method_str;
250 nsresult nsres;
251
252 TRACE("(%p)->(%p)\n", This, p);
253
254 nsAString_Init(&method_str, NULL);
255 nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str);
256 return return_nsstr(nsres, &method_str, p);
257}

◆ HTMLFormElement_get_name()

static HRESULT WINAPI HTMLFormElement_get_name ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 322 of file htmlform.c.

323{
325 nsAString name_str;
326 nsresult nsres;
327
328 TRACE("(%p)->(%p)\n", This, p);
329
330 nsAString_Init(&name_str, NULL);
331 nsres = nsIDOMHTMLFormElement_GetName(This->nsform, &name_str);
332 return return_nsstr(nsres, &name_str, p);
333}

◆ HTMLFormElement_get_onreset()

static HRESULT WINAPI HTMLFormElement_get_onreset ( IHTMLFormElement *  iface,
VARIANT p 
)
static

Definition at line 360 of file htmlform.c.

361{
363 FIXME("(%p)->(%p)\n", This, p);
364 return E_NOTIMPL;
365}

◆ HTMLFormElement_get_onsubmit()

static HRESULT WINAPI HTMLFormElement_get_onsubmit ( IHTMLFormElement *  iface,
VARIANT p 
)
static

Definition at line 344 of file htmlform.c.

345{
347
348 TRACE("(%p)->(%p)\n", This, p);
349
350 return get_node_event(&This->element.node, EVENTID_SUBMIT, p);
351}
@ EVENTID_SUBMIT
Definition: htmlevent.h:51
static HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
Definition: htmlevent.h:85

◆ HTMLFormElement_get_target()

static HRESULT WINAPI HTMLFormElement_get_target ( IHTMLFormElement *  iface,
BSTR p 
)
static

Definition at line 291 of file htmlform.c.

292{
295 nsresult nsres;
296
297 TRACE("(%p)->(%p)\n", This, p);
298
300 nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &str);
301
302 return return_nsstr(nsres, &str, p);
303}

◆ HTMLFormElement_GetIDsOfNames()

static HRESULT WINAPI HTMLFormElement_GetIDsOfNames ( IHTMLFormElement *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 105 of file htmlform.c.

108{
110 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
111 cNames, lcid, rgDispId);
112}
REFIID riid
Definition: atlbase.h:39

◆ HTMLFormElement_GetTypeInfo()

static HRESULT WINAPI HTMLFormElement_GetTypeInfo ( IHTMLFormElement *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 97 of file htmlform.c.

99{
101 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
102 ppTInfo);
103}

◆ HTMLFormElement_GetTypeInfoCount()

static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount ( IHTMLFormElement *  iface,
UINT pctinfo 
)
static

Definition at line 91 of file htmlform.c.

92{
94 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
95}

◆ HTMLFormElement_handle_event()

static HRESULT HTMLFormElement_handle_event ( HTMLDOMNode iface,
DWORD  eid,
nsIDOMEvent event,
BOOL prevent_default 
)
static

Definition at line 720 of file htmlform.c.

721{
723
724 if(eid == EVENTID_SUBMIT) {
725 *prevent_default = TRUE;
726 return IHTMLFormElement_submit(&This->IHTMLFormElement_iface);
727 }
728
729 return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default);
730}
struct _cl_event * event
Definition: glext.h:7739
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815

◆ HTMLFormElement_invoke()

static HRESULT HTMLFormElement_invoke ( HTMLDOMNode iface,
DISPID  id,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei,
IServiceProvider caller 
)
static

Definition at line 697 of file htmlform.c.

700{
702 IDispatch *ret;
704
705 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
706
708 if(FAILED(hres))
709 return hres;
710
711 if(ret) {
713 V_DISPATCH(res) = ret;
714 }else {
715 V_VT(res) = VT_NULL;
716 }
717 return S_OK;
718}
@ VT_NULL
Definition: compat.h:2296
@ VT_DISPATCH
Definition: compat.h:2304
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
static HRESULT htmlform_item(HTMLFormElement *This, int i, IDispatch **ret)
Definition: htmlform.c:29
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCH(A)
Definition: oleauto.h:239

◆ HTMLFormElement_Invoke()

static HRESULT WINAPI HTMLFormElement_Invoke ( IHTMLFormElement *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 114 of file htmlform.c.

117{
119 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
120 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
121}
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ HTMLFormElement_item()

static HRESULT WINAPI HTMLFormElement_item ( IHTMLFormElement *  iface,
VARIANT  name,
VARIANT  index,
IDispatch **  pdisp 
)
static

Definition at line 502 of file htmlform.c.

504{
506
507 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
508
509 if(!pdisp)
510 return E_INVALIDARG;
511 *pdisp = NULL;
512
513 if(V_VT(&name) == VT_I4) {
514 if(V_I4(&name) < 0)
515 return E_INVALIDARG;
516 return htmlform_item(This, V_I4(&name), pdisp);
517 }
518
519 FIXME("Unsupported args\n");
520 return E_NOTIMPL;
521}
#define E_INVALIDARG
Definition: ddrawi.h:101
@ VT_I4
Definition: compat.h:2298
GLuint index
Definition: glext.h:6031
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define V_I4(A)
Definition: oleauto.h:247

◆ HTMLFormElement_put_action()

static HRESULT WINAPI HTMLFormElement_put_action ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 123 of file htmlform.c.

124{
126 nsAString action_str;
127 nsresult nsres;
128
129 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
130
131 nsAString_InitDepend(&action_str, v);
132 nsres = nsIDOMHTMLFormElement_SetAction(This->nsform, &action_str);
133 nsAString_Finish(&action_str);
134 if(NS_FAILED(nsres)) {
135 ERR("SetAction failed: %08x\n", nsres);
136 return E_FAIL;
137 }
138
139 return S_OK;
140}
const GLdouble * v
Definition: gl.h:2040
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826

◆ HTMLFormElement_put_dir()

static HRESULT WINAPI HTMLFormElement_put_dir ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 166 of file htmlform.c.

167{
169 FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
170 return E_NOTIMPL;
171}

◆ HTMLFormElement_put_encoding()

static HRESULT WINAPI HTMLFormElement_put_encoding ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 180 of file htmlform.c.

181{
182 static const WCHAR urlencodedW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
183 'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
184 static const WCHAR dataW[] = {'m','u','l','t','i','p','a','r','t','/',
185 'f','o','r','m','-','d','a','t','a',0};
186 static const WCHAR plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
187
189 nsAString encoding_str;
190 nsresult nsres;
191
192 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
193
194 if(lstrcmpiW(v, urlencodedW) && lstrcmpiW(v, dataW) && lstrcmpiW(v, plainW)) {
195 WARN("incorrect enctype\n");
196 return E_INVALIDARG;
197 }
198
199 nsAString_InitDepend(&encoding_str, v);
200 nsres = nsIDOMHTMLFormElement_SetEnctype(This->nsform, &encoding_str);
201 nsAString_Finish(&encoding_str);
202 if(NS_FAILED(nsres))
203 return E_FAIL;
204
205 return S_OK;
206}
#define WARN(fmt,...)
Definition: precomp.h:61
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261

◆ HTMLFormElement_put_length()

static HRESULT WINAPI HTMLFormElement_put_length ( IHTMLFormElement *  iface,
LONG  v 
)
static

Definition at line 472 of file htmlform.c.

473{
475 FIXME("(%p)->(%d)\n", This, v);
476 return E_NOTIMPL;
477}

◆ HTMLFormElement_put_method()

static HRESULT WINAPI HTMLFormElement_put_method ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 221 of file htmlform.c.

222{
223 static const WCHAR postW[] = {'P','O','S','T',0};
224 static const WCHAR getW[] = {'G','E','T',0};
225
227 nsAString method_str;
228 nsresult nsres;
229
230 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
231
232 if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
233 WARN("unrecognized method\n");
234 return E_INVALIDARG;
235 }
236
237 nsAString_InitDepend(&method_str, v);
238 nsres = nsIDOMHTMLFormElement_SetMethod(This->nsform, &method_str);
239 nsAString_Finish(&method_str);
240 if(NS_FAILED(nsres))
241 return E_FAIL;
242
243 return S_OK;
244}
static const WCHAR getW[]
Definition: object.c:50
static const WCHAR postW[]

◆ HTMLFormElement_put_name()

static HRESULT WINAPI HTMLFormElement_put_name ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 305 of file htmlform.c.

306{
308 nsAString name_str;
309 nsresult nsres;
310
311 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
312
313 nsAString_InitDepend(&name_str, v);
314 nsres = nsIDOMHTMLFormElement_SetName(This->nsform, &name_str);
315 nsAString_Finish(&name_str);
316 if(NS_FAILED(nsres))
317 return E_FAIL;
318
319 return S_OK;
320}

◆ HTMLFormElement_put_onreset()

static HRESULT WINAPI HTMLFormElement_put_onreset ( IHTMLFormElement *  iface,
VARIANT  v 
)
static

Definition at line 353 of file htmlform.c.

354{
356 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
357 return E_NOTIMPL;
358}

◆ HTMLFormElement_put_onsubmit()

static HRESULT WINAPI HTMLFormElement_put_onsubmit ( IHTMLFormElement *  iface,
VARIANT  v 
)
static

Definition at line 335 of file htmlform.c.

336{
338
339 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
340
341 return set_node_event(&This->element.node, EVENTID_SUBMIT, &v);
342}
static HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
Definition: htmlevent.h:80

◆ HTMLFormElement_put_target()

static HRESULT WINAPI HTMLFormElement_put_target ( IHTMLFormElement *  iface,
BSTR  v 
)
static

Definition at line 270 of file htmlform.c.

271{
274 nsresult nsres;
275
276 TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
277
279
280 nsres = nsIDOMHTMLFormElement_SetTarget(This->nsform, &str);
281
283 if (NS_FAILED(nsres)) {
284 ERR("Set Target(%s) failed: %08x\n", wine_dbgstr_w(v), nsres);
285 return E_FAIL;
286 }
287
288 return S_OK;
289}

◆ HTMLFormElement_QI()

static HRESULT HTMLFormElement_QI ( HTMLDOMNode iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 570 of file htmlform.c.

571{
573
574 *ppv = NULL;
575
577 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
578 *ppv = &This->IHTMLFormElement_iface;
579 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
580 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
581 *ppv = &This->IHTMLFormElement_iface;
582 }else if(IsEqualGUID(&IID_IHTMLFormElement, riid)) {
583 TRACE("(%p)->(IID_IHTMLFormElement %p)\n", This, ppv);
584 *ppv = &This->IHTMLFormElement_iface;
585 }else if(IsEqualGUID(&DIID_DispHTMLFormElement, riid)) {
586 TRACE("(%p)->(DIID_DispHTMLFormElement %p)\n", This, ppv);
587 *ppv = &This->IHTMLFormElement_iface;
588 }
589
590 if(*ppv) {
591 IUnknown_AddRef((IUnknown*)*ppv);
592 return S_OK;
593 }
594
595 return HTMLElement_QI(&This->element.node, riid, ppv);
596}
const GUID IID_IUnknown
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlelem.c:3738
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IDispatch
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ HTMLFormElement_QueryInterface()

static HRESULT WINAPI HTMLFormElement_QueryInterface ( IHTMLFormElement *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 69 of file htmlform.c.

71{
73
74 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
75}

◆ HTMLFormElement_Release()

static ULONG WINAPI HTMLFormElement_Release ( IHTMLFormElement *  iface)
static

Definition at line 84 of file htmlform.c.

85{
87
88 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
89}

◆ HTMLFormElement_reset()

static HRESULT WINAPI HTMLFormElement_reset ( IHTMLFormElement *  iface)
static

Definition at line 457 of file htmlform.c.

458{
460 nsresult nsres;
461
462 TRACE("(%p)->()\n", This);
463 nsres = nsIDOMHTMLFormElement_Reset(This->nsform);
464 if (NS_FAILED(nsres)) {
465 ERR("Reset failed: %08x\n", nsres);
466 return E_FAIL;
467 }
468
469 return S_OK;
470}

◆ HTMLFormElement_submit()

static HRESULT WINAPI HTMLFormElement_submit ( IHTMLFormElement *  iface)
static

Definition at line 367 of file htmlform.c.

368{
370 HTMLOuterWindow *window = NULL, *this_window = NULL;
371 nsAString action_uri_str, target_str, method_str;
372 nsIInputStream *post_stream;
373 BOOL is_post_submit = FALSE;
374 IUri *uri;
375 nsresult nsres;
377 BOOL use_new_window = FALSE;
378
379 TRACE("(%p)\n", This);
380
381 if(This->element.node.doc) {
382 HTMLDocumentNode *doc = This->element.node.doc;
383 if(doc->window && doc->window->base.outer_window)
384 this_window = doc->window->base.outer_window;
385 }
386 if(!this_window) {
387 TRACE("No outer window\n");
388 return S_OK;
389 }
390
391 nsAString_Init(&target_str, NULL);
392 nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str);
393 if(NS_SUCCEEDED(nsres))
394 window = get_target_window(this_window, &target_str, &use_new_window);
395
396 if(!window && !use_new_window) {
397 nsAString_Finish(&target_str);
398 return S_OK;
399 }
400
401 nsAString_Init(&method_str, NULL);
402 nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str);
403 if(NS_SUCCEEDED(nsres)) {
404 const PRUnichar *method;
405
406 static const PRUnichar postW[] = {'p','o','s','t',0};
407
408 nsAString_GetData(&method_str, &method);
409 TRACE("method is %s\n", debugstr_w(method));
410 is_post_submit = !strcmpiW(method, postW);
411 }
412 nsAString_Finish(&method_str);
413
414 /*
415 * FIXME: We currently use our submit implementation for POST submit. We should always use it.
416 */
417 if(window && !is_post_submit) {
418 nsres = nsIDOMHTMLFormElement_Submit(This->nsform);
419 nsAString_Finish(&target_str);
420 IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
421 if(NS_FAILED(nsres)) {
422 ERR("Submit failed: %08x\n", nsres);
423 return E_FAIL;
424 }
425
426 return S_OK;
427 }
428
429 nsAString_Init(&action_uri_str, NULL);
430 nsres = nsIDOMHTMLFormElement_GetFormData(This->nsform, NULL, &action_uri_str, &post_stream);
431 if(NS_SUCCEEDED(nsres)) {
432 const PRUnichar *action_uri;
433
434 nsAString_GetData(&action_uri_str, &action_uri);
435 hres = create_uri(action_uri, 0, &uri);
436 }else {
437 ERR("GetFormData failed: %08x\n", nsres);
438 hres = E_FAIL;
439 }
440 nsAString_Finish(&action_uri_str);
441 if(SUCCEEDED(hres)) {
442 const PRUnichar *target;
443
444 nsAString_GetData(&target_str, &target);
445 hres = submit_form(window, target, uri, post_stream);
446 IUri_Release(uri);
447 }
448
449 nsAString_Finish(&target_str);
450 if(window)
451 IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
452 if(post_stream)
453 nsIInputStream_Release(post_stream);
454 return hres;
455}
HRESULT submit_form(HTMLOuterWindow *, const WCHAR *, IUri *, nsIInputStream *) DECLSPEC_HIDDEN
Definition: navigate.c:2361
HRESULT create_uri(const WCHAR *, DWORD, IUri **) DECLSPEC_HIDDEN
Definition: persist.c:158
method
Definition: dragdrop.c:54
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum target
Definition: glext.h:7315
HTMLOuterWindow * get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window)
Definition: htmlanchor.c:45
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_w
Definition: kernel32.h:32
static IHTMLWindow2 * window
Definition: events.c:77
const char * uri
Definition: sec_mgr.c:1588
HTMLInnerWindow * window
HTMLOuterWindow * outer_window

◆ HTMLFormElement_tags()

static HRESULT WINAPI HTMLFormElement_tags ( IHTMLFormElement *  iface,
VARIANT  tagName,
IDispatch **  pdisp 
)
static

Definition at line 523 of file htmlform.c.

525{
527 FIXME("(%p)->(v %p)\n", This, pdisp);
528 return E_NOTIMPL;
529}

◆ HTMLFormElement_traverse()

static void HTMLFormElement_traverse ( HTMLDOMNode iface,
nsCycleCollectionTraversalCallback cb 
)
static

Definition at line 732 of file htmlform.c.

733{
735
736 if(This->nsform)
737 note_cc_edge((nsISupports*)This->nsform, "This->nsform", cb);
738}
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

◆ HTMLFormElement_unlink()

static void HTMLFormElement_unlink ( HTMLDOMNode iface)
static

Definition at line 740 of file htmlform.c.

741{
743
744 if(This->nsform) {
745 nsIDOMHTMLFormElement *nsform = This->nsform;
746
747 This->nsform = NULL;
748 nsIDOMHTMLFormElement_Release(nsform);
749 }
750}

◆ impl_from_HTMLDOMNode()

static HTMLFormElement * impl_from_HTMLDOMNode ( HTMLDOMNode iface)
inlinestatic

Definition at line 565 of file htmlform.c.

566{
567 return CONTAINING_RECORD(iface, HTMLFormElement, element.node);
568}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by HTMLFormElement_get_dispid(), HTMLFormElement_handle_event(), HTMLFormElement_invoke(), HTMLFormElement_QI(), HTMLFormElement_traverse(), and HTMLFormElement_unlink().

◆ impl_from_IHTMLFormElement()

Variable Documentation

◆ HTMLFormElement_dispex

dispex_static_data_t HTMLFormElement_dispex
static
Initial value:
= {
DispHTMLFormElement_tid,
}
static const tid_t HTMLFormElement_iface_tids[]
Definition: htmlform.c:772

Definition at line 778 of file htmlform.c.

Referenced by HTMLFormElement_Create().

◆ HTMLFormElement_iface_tids

const tid_t HTMLFormElement_iface_tids[]
static
Initial value:
= {
IHTMLFormElement_tid,
0
}
#define HTMLELEMENT_TIDS

Definition at line 772 of file htmlform.c.

◆ HTMLFormElementImplVtbl

const NodeImplVtbl HTMLFormElementImplVtbl
static
Initial value:
= {
}
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
void HTMLElement_destructor(HTMLDOMNode *iface)
Definition: htmlelem.c:3764
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD grfdex, DISPID *pid)
Definition: htmlform.c:598
static void HTMLFormElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmlform.c:732
static HRESULT HTMLFormElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlform.c:570
static void HTMLFormElement_unlink(HTMLDOMNode *iface)
Definition: htmlform.c:740
static HRESULT HTMLFormElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlform.c:720
static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: htmlform.c:697

Definition at line 752 of file htmlform.c.

Referenced by HTMLFormElement_Create().

◆ HTMLFormElementVtbl

const IHTMLFormElementVtbl HTMLFormElementVtbl
static

Definition at line 531 of file htmlform.c.

Referenced by HTMLFormElement_Create().