ReactOS  0.4.14-dev-593-g1793dcc
htmlform.c
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Andrew Eikum for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include "mshtml_private.h"
20 
23 
24  IHTMLFormElement IHTMLFormElement_iface;
25 
27 };
28 
30 {
31  nsIDOMHTMLCollection *elements;
34  nsresult nsres;
35  HRESULT hres;
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 }
63 
64 static inline HTMLFormElement *impl_from_IHTMLFormElement(IHTMLFormElement *iface)
65 {
66  return CONTAINING_RECORD(iface, HTMLFormElement, IHTMLFormElement_iface);
67 }
68 
69 static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface,
70  REFIID riid, void **ppv)
71 {
73 
74  return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
75 }
76 
77 static ULONG WINAPI HTMLFormElement_AddRef(IHTMLFormElement *iface)
78 {
80 
81  return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
82 }
83 
84 static ULONG WINAPI HTMLFormElement_Release(IHTMLFormElement *iface)
85 {
87 
88  return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
89 }
90 
91 static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount(IHTMLFormElement *iface, UINT *pctinfo)
92 {
94  return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
95 }
96 
97 static HRESULT WINAPI HTMLFormElement_GetTypeInfo(IHTMLFormElement *iface, UINT iTInfo,
98  LCID lcid, ITypeInfo **ppTInfo)
99 {
101  return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
102  ppTInfo);
103 }
104 
105 static HRESULT WINAPI HTMLFormElement_GetIDsOfNames(IHTMLFormElement *iface, REFIID riid,
106  LPOLESTR *rgszNames, UINT cNames,
107  LCID lcid, DISPID *rgDispId)
108 {
110  return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
111  cNames, lcid, rgDispId);
112 }
113 
114 static HRESULT WINAPI HTMLFormElement_Invoke(IHTMLFormElement *iface, DISPID dispIdMember,
115  REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
116  VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
117 {
119  return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
120  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
121 }
122 
123 static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v)
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 }
141 
142 static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *p)
143 {
145  nsAString action_str;
146  nsresult nsres;
147  HRESULT hres;
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 }
165 
166 static HRESULT WINAPI HTMLFormElement_put_dir(IHTMLFormElement *iface, BSTR v)
167 {
169  FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
170  return E_NOTIMPL;
171 }
172 
173 static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
174 {
176  FIXME("(%p)->(%p)\n", This, p);
177  return E_NOTIMPL;
178 }
179 
180 static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
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 }
207 
208 static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR *p)
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 }
220 
221 static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
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 }
245 
246 static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR *p)
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 }
258 
259 static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
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 }
269 
270 static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v)
271 {
273  nsAString str;
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 }
290 
291 static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *p)
292 {
294  nsAString str;
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 }
304 
305 static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
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 }
321 
322 static HRESULT WINAPI HTMLFormElement_get_name(IHTMLFormElement *iface, BSTR *p)
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 }
334 
335 static HRESULT WINAPI HTMLFormElement_put_onsubmit(IHTMLFormElement *iface, VARIANT v)
336 {
338 
339  TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
340 
341  return set_node_event(&This->element.node, EVENTID_SUBMIT, &v);
342 }
343 
344 static HRESULT WINAPI HTMLFormElement_get_onsubmit(IHTMLFormElement *iface, VARIANT *p)
345 {
347 
348  TRACE("(%p)->(%p)\n", This, p);
349 
350  return get_node_event(&This->element.node, EVENTID_SUBMIT, p);
351 }
352 
353 static HRESULT WINAPI HTMLFormElement_put_onreset(IHTMLFormElement *iface, VARIANT v)
354 {
356  FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
357  return E_NOTIMPL;
358 }
359 
360 static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIANT *p)
361 {
363  FIXME("(%p)->(%p)\n", This, p);
364  return E_NOTIMPL;
365 }
366 
367 static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
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;
376  HRESULT hres;
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 }
456 
457 static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
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 }
471 
472 static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v)
473 {
475  FIXME("(%p)->(%d)\n", This, v);
476  return E_NOTIMPL;
477 }
478 
479 static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *p)
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 }
494 
495 static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown **p)
496 {
498  FIXME("(%p)->(%p)\n", This, p);
499  return E_NOTIMPL;
500 }
501 
502 static HRESULT WINAPI HTMLFormElement_item(IHTMLFormElement *iface, VARIANT name,
503  VARIANT index, IDispatch **pdisp)
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 }
522 
523 static HRESULT WINAPI HTMLFormElement_tags(IHTMLFormElement *iface, VARIANT tagName,
524  IDispatch **pdisp)
525 {
527  FIXME("(%p)->(v %p)\n", This, pdisp);
528  return E_NOTIMPL;
529 }
530 
531 static const IHTMLFormElementVtbl HTMLFormElementVtbl = {
563 };
564 
566 {
567  return CONTAINING_RECORD(iface, HTMLFormElement, element.node);
568 }
569 
571 {
573 
574  *ppv = NULL;
575 
576  if(IsEqualGUID(&IID_IUnknown, riid)) {
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 }
597 
599  BSTR name, DWORD grfdex, DISPID *pid)
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 }
696 
699  EXCEPINFO *ei, IServiceProvider *caller)
700 {
702  IDispatch *ret;
703  HRESULT hres;
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) {
712  V_VT(res) = VT_DISPATCH;
713  V_DISPATCH(res) = ret;
714  }else {
715  V_VT(res) = VT_NULL;
716  }
717  return S_OK;
718 }
719 
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 }
731 
733 {
735 
736  if(This->nsform)
737  note_cc_edge((nsISupports*)This->nsform, "This->nsform", cb);
738 }
739 
741 {
743 
744  if(This->nsform) {
745  nsIDOMHTMLFormElement *nsform = This->nsform;
746 
747  This->nsform = NULL;
748  nsIDOMHTMLFormElement_Release(nsform);
749  }
750 }
751 
759  NULL,
760  NULL,
761  NULL,
762  NULL,
763  NULL,
764  NULL,
767  NULL,
770 };
771 
774  IHTMLFormElement_tid,
775  0
776 };
777 
779  NULL,
780  DispHTMLFormElement_tid,
781  NULL,
783 };
784 
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 }
static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD grfdex, DISPID *pid)
Definition: htmlform.c:598
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
static HTMLFormElement * impl_from_IHTMLFormElement(IHTMLFormElement *iface)
Definition: htmlform.c:64
Definition: compat.h:1947
static HRESULT WINAPI HTMLFormElement_tags(IHTMLFormElement *iface, VARIANT tagName, IDispatch **pdisp)
Definition: htmlform.c:523
static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown **p)
Definition: htmlform.c:495
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlelem.c:3815
const cpc_entry_t HTMLElement_cpc[]
Definition: htmlelem.c:3847
static const tid_t HTMLFormElement_iface_tids[]
Definition: htmlform.c:772
static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface, REFIID riid, void **ppv)
Definition: htmlform.c:69
static void HTMLFormElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
Definition: htmlform.c:732
const char * uri
Definition: sec_mgr.c:1594
REFIID riid
Definition: precomp.h:44
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define MSHTML_DISPID_CUSTOM_MIN
HTMLInnerWindow * window
tid_t
Definition: ieframe.h:311
static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:173
#define MSHTML_CUSTOM_DISPID_CNT
static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:246
#define WARN(fmt,...)
Definition: debug.h:111
HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
Definition: htmlelem.c:4827
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlelem.c:3738
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
#define assert(x)
Definition: debug.h:53
static HRESULT WINAPI HTMLFormElement_put_onreset(IHTMLFormElement *iface, VARIANT v)
Definition: htmlform.c:353
DWORD LCID
Definition: nls.h:13
static HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
Definition: htmlevent.h:80
OLECHAR * BSTR
Definition: compat.h:1942
static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:291
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT WINAPI HTMLFormElement_get_onsubmit(IHTMLFormElement *iface, VARIANT *p)
Definition: htmlform.c:344
static HTMLFormElement * impl_from_HTMLDOMNode(HTMLDOMNode *iface)
Definition: htmlform.c:565
HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
Definition: htmlform.c:785
#define V_I4(A)
Definition: oleauto.h:247
HTMLOuterWindow * get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window)
Definition: htmlanchor.c:45
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *p)
Definition: htmlform.c:479
static const WCHAR postW[]
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define NS_OK
struct node node
static const WCHAR getW[]
Definition: object.c:50
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
#define HTMLELEMENT_TIDS
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:208
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned int UINT32
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static const IHTMLFormElementVtbl HTMLFormElementVtbl
Definition: htmlform.c:531
#define debugstr_w
Definition: kernel32.h:32
static HRESULT WINAPI HTMLFormElement_get_name(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:322
static HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
Definition: htmlevent.h:85
static size_t elem
Definition: string.c:68
HRESULT nsuri_to_url(LPCWSTR, BOOL, BSTR *) DECLSPEC_HIDDEN
Definition: nsio.c:175
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
Definition: htmlform.c:367
static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
Definition: htmlform.c:457
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:221
static HRESULT WINAPI HTMLFormElement_Invoke(IHTMLFormElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlform.c:114
IHTMLFormElement IHTMLFormElement_iface
Definition: htmlform.c:24
static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:180
GLuint index
Definition: glext.h:6031
static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
Definition: htmlform.c:697
static const NodeImplVtbl HTMLFormElementImplVtbl
Definition: htmlform.c:752
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NS_FAILED(res)
static const WCHAR nameW[]
Definition: main.c:46
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
nsIDOMHTMLFormElement * nsform
Definition: htmlform.c:26
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
HRESULT submit_form(HTMLOuterWindow *, const WCHAR *, IUri *, nsIInputStream *) DECLSPEC_HIDDEN
Definition: navigate.c:2361
static HRESULT WINAPI HTMLFormElement_put_onsubmit(IHTMLFormElement *iface, VARIANT v)
Definition: htmlform.c:335
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:270
const GUID IID_IUnknown
static ULONG WINAPI HTMLFormElement_AddRef(IHTMLFormElement *iface)
Definition: htmlform.c:77
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI HTMLFormElement_put_dir(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:166
unsigned short WORD
Definition: ntddk_ex.h:93
void HTMLElement_destructor(HTMLDOMNode *iface)
Definition: htmlelem.c:3764
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NS_SUCCEEDED(res)
static void HTMLFormElement_unlink(HTMLDOMNode *iface)
Definition: htmlform.c:740
static HRESULT WINAPI HTMLFormElement_item(IHTMLFormElement *iface, VARIANT name, VARIANT index, IDispatch **pdisp)
Definition: htmlform.c:502
GLbitfield flags
Definition: glext.h:7161
method
Definition: dragdrop.c:53
static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIANT *p)
Definition: htmlform.c:360
const GUID IID_IDispatch
static HRESULT WINAPI HTMLFormElement_GetIDsOfNames(IHTMLFormElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlform.c:105
static dispex_static_data_t HTMLFormElement_dispex
Definition: htmlform.c:778
int ret
#define V_VT(A)
Definition: oleauto.h:211
GLenum GLsizei len
Definition: glext.h:6722
void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
Definition: htmlelem.c:4008
static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
Definition: htmlform.c:259
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
static IHTMLWindow2 * window
Definition: events.c:77
struct _cl_event * event
Definition: glext.h:7739
#define strcmpiW(s1, s2)
Definition: unicode.h:39
static HRESULT HTMLFormElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
Definition: htmlform.c:720
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:305
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
Definition: htmlelem.c:3793
struct stdole::EXCEPINFO EXCEPINFO
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
const WCHAR * action
Definition: action.c:7783
static ATOM item
Definition: dde.c:856
const GLdouble * v
Definition: gl.h:2040
HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret)
Definition: htmlnode.c:1339
struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
#define E_NOTIMPL
Definition: ddrawi.h:99
HTMLOuterWindow * outer_window
static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *p)
Definition: htmlform.c:142
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
Definition: name.c:38
GLuint res
Definition: glext.h:9613
struct stdole::DISPPARAMS DISPPARAMS
static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v)
Definition: htmlform.c:123
static HRESULT htmlform_item(HTMLFormElement *This, int i, IDispatch **ret)
Definition: htmlform.c:29
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
unsigned int ULONG
Definition: retypes.h:1
GLenum target
Definition: glext.h:7315
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v)
Definition: htmlform.c:472
GLfloat GLfloat p
Definition: glext.h:8902
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HTMLElement element
Definition: htmlform.c:22
static ULONG WINAPI HTMLFormElement_Release(IHTMLFormElement *iface)
Definition: htmlform.c:84
Definition: dlist.c:348
HRESULT create_uri(const WCHAR *, DWORD, IUri **) DECLSPEC_HIDDEN
Definition: persist.c:158
static HRESULT WINAPI HTMLFormElement_GetTypeInfoCount(IHTMLFormElement *iface, UINT *pctinfo)
Definition: htmlform.c:91
static HRESULT WINAPI HTMLFormElement_GetTypeInfo(IHTMLFormElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlform.c:97
static HRESULT HTMLFormElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
Definition: htmlform.c:570