user32: Handle VK_RETURN WM_KEYDOWN events better in edit controls.
[wine] / dlls / mshtml / htmlinput.c
1 /*
2  * Copyright 2006 Jacek Caban 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 <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29
30 #include "mshtml_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
33
34 typedef struct {
35     HTMLElement element;
36
37     const IHTMLInputElementVtbl *lpHTMLInputElementVtbl;
38     const IHTMLInputTextElementVtbl *lpHTMLInputTextElementVtbl;
39
40     nsIDOMHTMLInputElement *nsinput;
41 } HTMLInputElement;
42
43 #define HTMLINPUT(x)      ((IHTMLInputElement*)      &(x)->lpHTMLInputElementVtbl)
44 #define HTMLINPUTTEXT(x)  ((IHTMLInputTextElement*)  &(x)->lpHTMLInputTextElementVtbl)
45
46 #define HTMLINPUT_THIS(iface) DEFINE_THIS(HTMLInputElement, HTMLInputElement, iface)
47
48 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
49                                                          REFIID riid, void **ppv)
50 {
51     HTMLInputElement *This = HTMLINPUT_THIS(iface);
52
53     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 }
55
56 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
57 {
58     HTMLInputElement *This = HTMLINPUT_THIS(iface);
59
60     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 }
62
63 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
64 {
65     HTMLInputElement *This = HTMLINPUT_THIS(iface);
66
67     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 }
69
70 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
71 {
72     HTMLInputElement *This = HTMLINPUT_THIS(iface);
73     FIXME("(%p)->(%p)\n", This, pctinfo);
74     return E_NOTIMPL;
75 }
76
77 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
78                                               LCID lcid, ITypeInfo **ppTInfo)
79 {
80     HTMLInputElement *This = HTMLINPUT_THIS(iface);
81     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
82     return E_NOTIMPL;
83 }
84
85 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
86                                                 LPOLESTR *rgszNames, UINT cNames,
87                                                 LCID lcid, DISPID *rgDispId)
88 {
89     HTMLInputElement *This = HTMLINPUT_THIS(iface);
90     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
91                                         lcid, rgDispId);
92     return E_NOTIMPL;
93 }
94
95 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
96                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
97                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
98 {
99     HTMLInputElement *This = HTMLINPUT_THIS(iface);
100     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
101             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
106 {
107     HTMLInputElement *This = HTMLINPUT_THIS(iface);
108     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
113 {
114     HTMLInputElement *This = HTMLINPUT_THIS(iface);
115     nsAString type_str;
116     const PRUnichar *type;
117     nsresult nsres;
118
119     TRACE("(%p)->(%p)\n", This, p);
120
121     nsAString_Init(&type_str, NULL);
122     nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
123
124     if(NS_SUCCEEDED(nsres)) {
125         nsAString_GetData(&type_str, &type);
126         *p = SysAllocString(type);
127     }else {
128         ERR("GetType failed: %08x\n", nsres);
129     }
130
131     nsAString_Finish(&type_str);
132
133     TRACE("type=%s\n", debugstr_w(*p));
134     return S_OK;
135 }
136
137 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
138 {
139     HTMLInputElement *This = HTMLINPUT_THIS(iface);
140     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
141     return E_NOTIMPL;
142 }
143
144 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
145 {
146     HTMLInputElement *This = HTMLINPUT_THIS(iface);
147     nsAString value_str;
148     const PRUnichar *value = NULL;
149     nsresult nsres;
150
151     TRACE("(%p)->(%p)\n", This, p);
152
153     nsAString_Init(&value_str, NULL);
154
155     nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
156     if(NS_SUCCEEDED(nsres)) {
157         nsAString_GetData(&value_str, &value);
158         *p = SysAllocString(value);
159     }else {
160         ERR("GetValue failed: %08x\n", nsres);
161     }
162
163     nsAString_Finish(&value_str);
164
165     TRACE("value=%s\n", debugstr_w(*p));
166     return S_OK;
167 }
168
169 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
170 {
171     HTMLInputElement *This = HTMLINPUT_THIS(iface);
172     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
173     return E_NOTIMPL;
174 }
175
176 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
177 {
178     HTMLInputElement *This = HTMLINPUT_THIS(iface);
179     nsAString name_str;
180     const PRUnichar *name;
181     nsresult nsres;
182
183     TRACE("(%p)->(%p)\n", This, p);
184
185     nsAString_Init(&name_str, NULL);
186
187     nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
188     if(NS_SUCCEEDED(nsres)) {
189         nsAString_GetData(&name_str, &name);
190         *p = SysAllocString(name);
191     }else {
192         ERR("GetName failed: %08x\n", nsres);
193         return E_FAIL;
194     }
195
196     nsAString_Finish(&name_str);
197
198     TRACE("name=%s\n", debugstr_w(*p));
199     return S_OK;
200 }
201
202 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
203 {
204     HTMLInputElement *This = HTMLINPUT_THIS(iface);
205     FIXME("(%p)->(%x)\n", This, v);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
210 {
211     HTMLInputElement *This = HTMLINPUT_THIS(iface);
212     FIXME("(%p)->(%p)\n", This, p);
213     return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
217 {
218     HTMLInputElement *This = HTMLINPUT_THIS(iface);
219     FIXME("(%p)->(%x)\n", This, v);
220     return E_NOTIMPL;
221 }
222
223 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
224 {
225     HTMLInputElement *This = HTMLINPUT_THIS(iface);
226     FIXME("(%p)->(%p)\n", This, p);
227     return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
231 {
232     HTMLInputElement *This = HTMLINPUT_THIS(iface);
233     FIXME("(%p)->(%p)\n", This, p);
234     return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, long v)
238 {
239     HTMLInputElement *This = HTMLINPUT_THIS(iface);
240     FIXME("(%p)->(%ld)\n", This, v);
241     return E_NOTIMPL;
242 }
243
244 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, long *p)
245 {
246     HTMLInputElement *This = HTMLINPUT_THIS(iface);
247     FIXME("(%p)->(%p)\n", This, p);
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, long v)
252 {
253     HTMLInputElement *This = HTMLINPUT_THIS(iface);
254     FIXME("(%p)->(%ld)\n", This, v);
255     return E_NOTIMPL;
256 }
257
258 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, long *p)
259 {
260     HTMLInputElement *This = HTMLINPUT_THIS(iface);
261     FIXME("(%p)->(%p)\n", This, p);
262     return E_NOTIMPL;
263 }
264
265 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
266 {
267     HTMLInputElement *This = HTMLINPUT_THIS(iface);
268     FIXME("(%p)\n", This);
269     return E_NOTIMPL;
270 }
271
272 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
273 {
274     HTMLInputElement *This = HTMLINPUT_THIS(iface);
275     FIXME("(%p)->()\n", This);
276     return E_NOTIMPL;
277 }
278
279 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
280 {
281     HTMLInputElement *This = HTMLINPUT_THIS(iface);
282     FIXME("(%p)->(%p)\n", This, p);
283     return E_NOTIMPL;
284 }
285
286 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
287 {
288     HTMLInputElement *This = HTMLINPUT_THIS(iface);
289     FIXME("(%p)->()\n", This);
290     return E_NOTIMPL;
291 }
292
293 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
294 {
295     HTMLInputElement *This = HTMLINPUT_THIS(iface);
296     FIXME("(%p)->(%p)\n", This, p);
297     return E_NOTIMPL;
298 }
299
300 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
301 {
302     HTMLInputElement *This = HTMLINPUT_THIS(iface);
303     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
304     return E_NOTIMPL;
305 }
306
307 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
308 {
309     HTMLInputElement *This = HTMLINPUT_THIS(iface);
310     FIXME("(%p)->(%p)\n", This, p);
311     return E_NOTIMPL;
312 }
313
314 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
315 {
316     HTMLInputElement *This = HTMLINPUT_THIS(iface);
317     FIXME("(%p)->(%x)\n", This, v);
318     return E_NOTIMPL;
319 }
320
321 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
322 {
323     HTMLInputElement *This = HTMLINPUT_THIS(iface);
324     FIXME("(%p)->(%p)\n", This, p);
325     return E_NOTIMPL;
326 }
327
328 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
329 {
330     HTMLInputElement *This = HTMLINPUT_THIS(iface);
331     FIXME("(%p)->(%p)\n", This, range);
332     return E_NOTIMPL;
333 }
334
335 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
336 {
337     HTMLInputElement *This = HTMLINPUT_THIS(iface);
338     FIXME("(%p)->(%x)\n", This, v);
339     return E_NOTIMPL;
340 }
341
342 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
343 {
344     HTMLInputElement *This = HTMLINPUT_THIS(iface);
345     FIXME("(%p)->(%p)\n", This, p);
346     return E_NOTIMPL;
347 }
348
349 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
350 {
351     HTMLInputElement *This = HTMLINPUT_THIS(iface);
352     FIXME("(%p)->(%x)\n", This, v);
353     return E_NOTIMPL;
354 }
355
356 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
357 {
358     HTMLInputElement *This = HTMLINPUT_THIS(iface);
359     FIXME("(%p)->(%p)\n", This, p);
360     return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
364 {
365     HTMLInputElement *This = HTMLINPUT_THIS(iface);
366     FIXME("(%p)->(%x)\n", This, v);
367     return E_NOTIMPL;
368 }
369
370 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
371 {
372     HTMLInputElement *This = HTMLINPUT_THIS(iface);
373     PRBool checked;
374     nsresult nsres;
375
376     TRACE("(%p)->(%p)\n", This, p);
377
378     nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
379     if(NS_FAILED(nsres)) {
380         ERR("GetChecked failed: %08x\n", nsres);
381         return E_FAIL;
382     }
383
384     *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
385     TRACE("checked=%x\n", *p);
386     return S_OK;
387 }
388
389 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
390 {
391     HTMLInputElement *This = HTMLINPUT_THIS(iface);
392     FIXME("(%p)->()\n", This);
393     return E_NOTIMPL;
394 }
395
396 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
397 {
398     HTMLInputElement *This = HTMLINPUT_THIS(iface);
399     FIXME("(%p)->(%p)\n", This, p);
400     return E_NOTIMPL;
401 }
402
403 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, long v)
404 {
405     HTMLInputElement *This = HTMLINPUT_THIS(iface);
406     FIXME("(%p)->(%ld)\n", This, v);
407     return E_NOTIMPL;
408 }
409
410 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, long *p)
411 {
412     HTMLInputElement *This = HTMLINPUT_THIS(iface);
413     FIXME("(%p)->(%p)\n", This, p);
414     return E_NOTIMPL;
415 }
416
417 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, long v)
418 {
419     HTMLInputElement *This = HTMLINPUT_THIS(iface);
420     FIXME("(%p)->(%ld)\n", This, v);
421     return E_NOTIMPL;
422 }
423
424 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, long *p)
425 {
426     HTMLInputElement *This = HTMLINPUT_THIS(iface);
427     FIXME("(%p)->(%p)\n", This, p);
428     return E_NOTIMPL;
429 }
430
431 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
432 {
433     HTMLInputElement *This = HTMLINPUT_THIS(iface);
434     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
435     return E_NOTIMPL;
436 }
437
438 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
439 {
440     HTMLInputElement *This = HTMLINPUT_THIS(iface);
441     FIXME("(%p)->(%p)\n", This, p);
442     return E_NOTIMPL;
443 }
444
445 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
446 {
447     HTMLInputElement *This = HTMLINPUT_THIS(iface);
448     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
449     return E_NOTIMPL;
450 }
451
452 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
453 {
454     HTMLInputElement *This = HTMLINPUT_THIS(iface);
455     FIXME("(%p)->(%p)\n", This, p);
456     return E_NOTIMPL;
457 }
458
459 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
460 {
461     HTMLInputElement *This = HTMLINPUT_THIS(iface);
462     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
463     return E_NOTIMPL;
464 }
465
466 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
467 {
468     HTMLInputElement *This = HTMLINPUT_THIS(iface);
469     FIXME("(%p)->(%p)\n", This, p);
470     return E_NOTIMPL;
471 }
472
473 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
474 {
475     HTMLInputElement *This = HTMLINPUT_THIS(iface);
476     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
477     return E_NOTIMPL;
478 }
479
480 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
481 {
482     HTMLInputElement *This = HTMLINPUT_THIS(iface);
483     FIXME("(%p)->(%p)\n", This, p);
484     return E_NOTIMPL;
485 }
486
487 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
488 {
489     HTMLInputElement *This = HTMLINPUT_THIS(iface);
490     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
491     return E_NOTIMPL;
492 }
493
494 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
495 {
496     HTMLInputElement *This = HTMLINPUT_THIS(iface);
497     FIXME("(%p)->(%p)\n", This, p);
498     return E_NOTIMPL;
499 }
500
501 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
502 {
503     HTMLInputElement *This = HTMLINPUT_THIS(iface);
504     FIXME("(%p)->(%p)\n", This, p);
505     return E_NOTIMPL;
506 }
507
508 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
509 {
510     HTMLInputElement *This = HTMLINPUT_THIS(iface);
511     FIXME("(%p)->(%p)\n", This, p);
512     return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
516 {
517     HTMLInputElement *This = HTMLINPUT_THIS(iface);
518     FIXME("(%p)->()\n", This);
519     return E_NOTIMPL;
520 }
521
522 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
523 {
524     HTMLInputElement *This = HTMLINPUT_THIS(iface);
525     FIXME("(%p)->(%p)\n", This, p);
526     return E_NOTIMPL;
527 }
528
529 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
530 {
531     HTMLInputElement *This = HTMLINPUT_THIS(iface);
532     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
533     return E_NOTIMPL;
534 }
535
536 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
537 {
538     HTMLInputElement *This = HTMLINPUT_THIS(iface);
539     FIXME("(%p)->(%p)\n", This, p);
540     return E_NOTIMPL;
541 }
542
543 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
544 {
545     HTMLInputElement *This = HTMLINPUT_THIS(iface);
546     FIXME("(%p)->()\n", This);
547     return E_NOTIMPL;
548 }
549
550 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
551 {
552     HTMLInputElement *This = HTMLINPUT_THIS(iface);
553     FIXME("(%p)->(%p)\n", This, p);
554     return E_NOTIMPL;
555 }
556
557 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
558 {
559     HTMLInputElement *This = HTMLINPUT_THIS(iface);
560     FIXME("(%p)->()\n", This);
561     return E_NOTIMPL;
562 }
563
564 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
565 {
566     HTMLInputElement *This = HTMLINPUT_THIS(iface);
567     FIXME("(%p)->(%p)\n", This, p);
568     return E_NOTIMPL;
569 }
570
571 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
572 {
573     HTMLInputElement *This = HTMLINPUT_THIS(iface);
574     FIXME("(%p)->()\n", This);
575     return E_NOTIMPL;
576 }
577
578 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
579 {
580     HTMLInputElement *This = HTMLINPUT_THIS(iface);
581     FIXME("(%p)->(%p)\n", This, p);
582     return E_NOTIMPL;
583 }
584
585 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, long v)
586 {
587     HTMLInputElement *This = HTMLINPUT_THIS(iface);
588     FIXME("(%p)->(%ld)\n", This, v);
589     return E_NOTIMPL;
590 }
591
592 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, long *p)
593 {
594     HTMLInputElement *This = HTMLINPUT_THIS(iface);
595     FIXME("(%p)->(%p)\n", This, p);
596     return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, long v)
600 {
601     HTMLInputElement *This = HTMLINPUT_THIS(iface);
602     FIXME("(%p)->(%ld)\n", This, v);
603     return E_NOTIMPL;
604 }
605
606 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, long *p)
607 {
608     HTMLInputElement *This = HTMLINPUT_THIS(iface);
609     FIXME("(%p)->(%p)\n", This, p);
610     return E_NOTIMPL;
611 }
612
613 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
614 {
615     HTMLInputElement *This = HTMLINPUT_THIS(iface);
616     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
617     return E_NOTIMPL;
618 }
619
620 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
621 {
622     HTMLInputElement *This = HTMLINPUT_THIS(iface);
623     FIXME("(%p)->(%p)\n", This, p);
624     return E_NOTIMPL;
625 }
626
627 #undef HTMLINPUT_THIS
628
629 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
630     HTMLInputElement_QueryInterface,
631     HTMLInputElement_AddRef,
632     HTMLInputElement_Release,
633     HTMLInputElement_GetTypeInfoCount,
634     HTMLInputElement_GetTypeInfo,
635     HTMLInputElement_GetIDsOfNames,
636     HTMLInputElement_Invoke,
637     HTMLInputElement_put_type,
638     HTMLInputElement_get_type,
639     HTMLInputElement_put_value,
640     HTMLInputElement_get_value,
641     HTMLInputElement_put_name,
642     HTMLInputElement_get_name,
643     HTMLInputElement_put_status,
644     HTMLInputElement_get_status,
645     HTMLInputElement_put_disabled,
646     HTMLInputElement_get_disabled,
647     HTMLInputElement_get_form,
648     HTMLInputElement_put_size,
649     HTMLInputElement_get_size,
650     HTMLInputElement_put_maxLength,
651     HTMLInputElement_get_maxLength,
652     HTMLInputElement_select,
653     HTMLInputElement_put_onchange,
654     HTMLInputElement_get_onchange,
655     HTMLInputElement_put_onselect,
656     HTMLInputElement_get_onselect,
657     HTMLInputElement_put_defaultValue,
658     HTMLInputElement_get_defaultValue,
659     HTMLInputElement_put_readOnly,
660     HTMLInputElement_get_readOnly,
661     HTMLInputElement_createTextRange,
662     HTMLInputElement_put_indeterminate,
663     HTMLInputElement_get_indeterminate,
664     HTMLInputElement_put_defaultChecked,
665     HTMLInputElement_get_defaultChecked,
666     HTMLInputElement_put_checked,
667     HTMLInputElement_get_checked,
668     HTMLInputElement_put_border,
669     HTMLInputElement_get_border,
670     HTMLInputElement_put_vspace,
671     HTMLInputElement_get_vspace,
672     HTMLInputElement_put_hspace,
673     HTMLInputElement_get_hspace,
674     HTMLInputElement_put_alt,
675     HTMLInputElement_get_alt,
676     HTMLInputElement_put_src,
677     HTMLInputElement_get_src,
678     HTMLInputElement_put_lowsrc,
679     HTMLInputElement_get_lowsrc,
680     HTMLInputElement_put_vrml,
681     HTMLInputElement_get_vrml,
682     HTMLInputElement_put_dynsrc,
683     HTMLInputElement_get_dynsrc,
684     HTMLInputElement_get_readyState,
685     HTMLInputElement_get_complete,
686     HTMLInputElement_put_loop,
687     HTMLInputElement_get_loop,
688     HTMLInputElement_put_align,
689     HTMLInputElement_get_align,
690     HTMLInputElement_put_onload,
691     HTMLInputElement_get_onload,
692     HTMLInputElement_put_onerror,
693     HTMLInputElement_get_onerror,
694     HTMLInputElement_put_onabort,
695     HTMLInputElement_get_onabort,
696     HTMLInputElement_put_width,
697     HTMLInputElement_get_width,
698     HTMLInputElement_put_height,
699     HTMLInputElement_get_height,
700     HTMLInputElement_put_start,
701     HTMLInputElement_get_start
702 };
703
704 #define HTMLINPUTTEXT_THIS(iface) DEFINE_THIS(HTMLInputElement, HTMLInputTextElement, iface)
705
706 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
707         REFIID riid, void **ppv)
708 {
709     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
710
711     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
712 }
713
714 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
715 {
716     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
717
718     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
719 }
720
721 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
722 {
723     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
724
725     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
726 }
727
728 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
729 {
730     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
731     FIXME("(%p)->(%p)\n", This, pctinfo);
732     return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
736         LCID lcid, ITypeInfo **ppTInfo)
737 {
738     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
739     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
740     return E_NOTIMPL;
741 }
742
743 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
744         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
745 {
746     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
747     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
748                                         lcid, rgDispId);
749     return E_NOTIMPL;
750 }
751
752 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
753                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
754                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
755 {
756     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
757     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
758             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
759     return E_NOTIMPL;
760 }
761
762 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
763 {
764     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
765
766     TRACE("(%p)->(%p)\n", This, p);
767
768     return IHTMLInputElement_get_type(HTMLINPUT(This), p);
769 }
770
771 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
772 {
773     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
774
775     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
776
777     return IHTMLInputElement_put_value(HTMLINPUT(This), v);
778 }
779
780 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
781 {
782     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
783
784     TRACE("(%p)->(%p)\n", This, p);
785
786     return IHTMLInputTextElement_get_value(HTMLINPUT(This), p);
787 }
788
789 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
790 {
791     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
792
793     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
794
795     return IHTMLInputElement_put_name(HTMLINPUT(This), v);
796 }
797
798 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
799 {
800     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
801
802     TRACE("(%p)->(%p)\n", This, p);
803
804     return IHTMLInputElement_get_name(HTMLINPUT(This), p);
805 }
806
807 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
808 {
809     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
810     FIXME("(%p)->(v)\n", This);
811     return E_NOTIMPL;
812 }
813
814 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
815 {
816     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
817     TRACE("(%p)->(v)\n", This);
818     return E_NOTIMPL;
819 }
820
821 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
822 {
823     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
824
825     TRACE("(%p)->(%x)\n", This, v);
826
827     return IHTMLInputElement_put_disabled(HTMLINPUT(This), v);
828 }
829
830 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
831 {
832     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
833
834     TRACE("(%p)->(%p)\n", This, p);
835
836     return IHTMLInputElement_get_disabled(HTMLINPUT(This), p);
837 }
838
839 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
840 {
841     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
842
843     TRACE("(%p)->(%p)\n", This, p);
844
845     return IHTMLInputElement_get_form(HTMLINPUT(This), p);
846 }
847
848 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
849 {
850     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
851
852     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
853
854     return IHTMLInputElement_put_defaultValue(HTMLINPUT(This), v);
855 }
856
857 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
858 {
859     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
860
861     TRACE("(%p)->(%p)\n", This, p);
862
863     return IHTMLInputElement_get_defaultValue(HTMLINPUT(This), p);
864 }
865
866 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, long v)
867 {
868     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
869
870     TRACE("(%p)->(%ld)\n", This, v);
871
872     return IHTMLInputElement_put_size(HTMLINPUT(This), v);
873 }
874
875 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, long *p)
876 {
877     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
878
879     TRACE("(%p)->(%p)\n", This, p);
880
881     return IHTMLInputElement_get_size(HTMLINPUT(This), p);
882 }
883
884 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, long v)
885 {
886     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
887
888     TRACE("(%p)->(%ld)\n", This, v);
889
890     return IHTMLInputElement_put_maxLength(HTMLINPUT(This), v);
891 }
892
893 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, long *p)
894 {
895     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
896
897     TRACE("(%p)->(%p)\n", This, p);
898
899     return IHTMLInputElement_get_maxLength(HTMLINPUT(This), p);
900 }
901
902 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
903 {
904     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
905
906     TRACE("(%p)\n", This);
907
908     return IHTMLInputElement_select(HTMLINPUT(This));
909 }
910
911 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
912 {
913     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
914
915     TRACE("(%p)->()\n", This);
916
917     return IHTMLInputElement_put_onchange(HTMLINPUT(This), v);
918 }
919
920 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
921 {
922     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
923
924     TRACE("(%p)->(%p)\n", This, p);
925
926     return IHTMLInputElement_get_onchange(HTMLINPUT(This), p);
927 }
928
929 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
930 {
931     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
932
933     TRACE("(%p)->()\n", This);
934
935     return IHTMLInputElement_put_onselect(HTMLINPUT(This), v);
936 }
937
938 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
939 {
940     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
941
942     TRACE("(%p)->(%p)\n", This, p);
943
944     return IHTMLInputElement_get_onselect(HTMLINPUT(This), p);
945 }
946
947 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
948 {
949     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
950
951     TRACE("(%p)->(%x)\n", This, v);
952
953     return IHTMLInputElement_put_readOnly(HTMLINPUT(This), v);
954 }
955
956 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
957 {
958     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
959
960     TRACE("(%p)->(%p)\n", This, p);
961
962     return IHTMLInputElement_get_readOnly(HTMLINPUT(This), p);
963 }
964
965 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
966 {
967     HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface);
968
969     TRACE("(%p)->(%p)\n", This, range);
970
971     return IHTMLInputElement_createTextRange(HTMLINPUT(This), range);
972 }
973
974 #undef HTMLINPUT_THIS
975
976 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
977     HTMLInputTextElement_QueryInterface,
978     HTMLInputTextElement_AddRef,
979     HTMLInputTextElement_Release,
980     HTMLInputTextElement_GetTypeInfoCount,
981     HTMLInputTextElement_GetTypeInfo,
982     HTMLInputTextElement_GetIDsOfNames,
983     HTMLInputTextElement_Invoke,
984     HTMLInputTextElement_get_type,
985     HTMLInputTextElement_put_value,
986     HTMLInputTextElement_get_value,
987     HTMLInputTextElement_put_name,
988     HTMLInputTextElement_get_name,
989     HTMLInputTextElement_put_status,
990     HTMLInputTextElement_get_status,
991     HTMLInputTextElement_put_disabled,
992     HTMLInputTextElement_get_disabled,
993     HTMLInputTextElement_get_form,
994     HTMLInputTextElement_put_defaultValue,
995     HTMLInputTextElement_get_defaultValue,
996     HTMLInputTextElement_put_size,
997     HTMLInputTextElement_get_size,
998     HTMLInputTextElement_put_maxLength,
999     HTMLInputTextElement_get_maxLength,
1000     HTMLInputTextElement_select,
1001     HTMLInputTextElement_put_onchange,
1002     HTMLInputTextElement_get_onchange,
1003     HTMLInputTextElement_put_onselect,
1004     HTMLInputTextElement_get_onselect,
1005     HTMLInputTextElement_put_readOnly,
1006     HTMLInputTextElement_get_readOnly,
1007     HTMLInputTextElement_createTextRange
1008 };
1009
1010 #define HTMLINPUT_NODE_THIS(iface) DEFINE_THIS2(HTMLInputElement, element.node, iface)
1011
1012 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1013 {
1014     HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
1015
1016     *ppv = NULL;
1017
1018     if(IsEqualGUID(&IID_IUnknown, riid)) {
1019         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1020         *ppv = HTMLINPUT(This);
1021     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1022         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1023         *ppv = HTMLINPUT(This);
1024     }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1025         TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1026         *ppv = HTMLINPUT(This);
1027     }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1028         TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1029         *ppv = HTMLINPUT(This);
1030     }
1031
1032     if(*ppv) {
1033         IUnknown_AddRef((IUnknown*)*ppv);
1034         return S_OK;
1035     }
1036
1037     return HTMLElement_QI(&This->element.node, riid, ppv);
1038 }
1039
1040 static void HTMLInputElement_destructor(HTMLDOMNode *iface)
1041 {
1042     HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
1043
1044     nsIDOMHTMLInputElement_Release(This->nsinput);
1045
1046     HTMLElement_destructor(&This->element.node);
1047 }
1048
1049 #undef HTMLINPUT_NODE_THIS
1050
1051 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1052     HTMLInputElement_QI,
1053     HTMLInputElement_destructor
1054 };
1055
1056 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem)
1057 {
1058     HTMLInputElement *ret = heap_alloc_zero(sizeof(HTMLInputElement));
1059     nsresult nsres;
1060
1061     HTMLElement_Init(&ret->element);
1062
1063     ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl;
1064     ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1065
1066     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement,
1067                                              (void**)&ret->nsinput);
1068     if(NS_FAILED(nsres))
1069         ERR("Could not get nsIDOMHTMLInputElement interface: %08x\n", nsres);
1070
1071     return &ret->element;
1072 }