49083ccca32621cd2c1486fa91871f6f3be57b0d
[reactos.git] / dll / win32 / 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 "mshtml_private.h"
20
21 #include <limits.h>
22
23 typedef struct {
24 HTMLElement element;
25
26 IHTMLInputElement IHTMLInputElement_iface;
27 IHTMLInputTextElement IHTMLInputTextElement_iface;
28
29 nsIDOMHTMLInputElement *nsinput;
30 } HTMLInputElement;
31
32 static const WCHAR forW[] = {'f','o','r',0};
33
34 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
35 {
36 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
37 }
38
39 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
40 {
41 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
42 }
43
44 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
45 REFIID riid, void **ppv)
46 {
47 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
48
49 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
50 }
51
52 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
53 {
54 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
55
56 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
57 }
58
59 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
60 {
61 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
62
63 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
64 }
65
66 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
67 {
68 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
69
70 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
71 }
72
73 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
74 LCID lcid, ITypeInfo **ppTInfo)
75 {
76 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
77
78 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
79 ppTInfo);
80 }
81
82 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
83 LPOLESTR *rgszNames, UINT cNames,
84 LCID lcid, DISPID *rgDispId)
85 {
86 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
87
88 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
89 cNames, lcid, rgDispId);
90 }
91
92 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
95 {
96 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
97
98 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
99 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
100 }
101
102 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
103 {
104 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
105 nsAString type_str;
106 nsresult nsres;
107
108 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
109
110 /*
111 * FIXME:
112 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
113 */
114 nsAString_InitDepend(&type_str, v);
115 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
116 nsAString_Finish(&type_str);
117 if(NS_FAILED(nsres)) {
118 ERR("SetType failed: %08x\n", nsres);
119 return E_FAIL;
120 }
121
122 return S_OK;
123 }
124
125 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
126 {
127 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
128 nsAString type_str;
129 nsresult nsres;
130
131 TRACE("(%p)->(%p)\n", This, p);
132
133 nsAString_Init(&type_str, NULL);
134 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
135 return return_nsstr(nsres, &type_str, p);
136 }
137
138 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
139 {
140 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
141 nsAString val_str;
142 nsresult nsres;
143
144 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
145
146 nsAString_InitDepend(&val_str, v);
147 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
148 nsAString_Finish(&val_str);
149 if(NS_FAILED(nsres))
150 ERR("SetValue failed: %08x\n", nsres);
151
152 return S_OK;
153 }
154
155 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
156 {
157 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
158 nsAString value_str;
159 nsresult nsres;
160
161 TRACE("(%p)->(%p)\n", This, p);
162
163 nsAString_Init(&value_str, NULL);
164 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
165 return return_nsstr(nsres, &value_str, p);
166 }
167
168 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
169 {
170 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
171 nsAString name_str;
172 nsresult nsres;
173
174 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
175
176 nsAString_InitDepend(&name_str, v);
177 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
178 nsAString_Finish(&name_str);
179 if(NS_FAILED(nsres)) {
180 ERR("SetName failed: %08x\n", nsres);
181 return E_FAIL;
182 }
183
184 return S_OK;
185 }
186
187 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
188 {
189 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
190 nsAString name_str;
191 nsresult nsres;
192
193 TRACE("(%p)->(%p)\n", This, p);
194
195 nsAString_Init(&name_str, NULL);
196 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
197 return return_nsstr(nsres, &name_str, p);
198 }
199
200 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
201 {
202 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
203 FIXME("(%p)->(%x)\n", This, v);
204 return E_NOTIMPL;
205 }
206
207 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
208 {
209 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
210 FIXME("(%p)->(%p)\n", This, p);
211 return E_NOTIMPL;
212 }
213
214 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
215 {
216 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
217 nsresult nsres;
218
219 TRACE("(%p)->(%x)\n", This, v);
220
221 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
222 if(NS_FAILED(nsres))
223 ERR("SetDisabled failed: %08x\n", nsres);
224
225 return S_OK;
226 }
227
228 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
229 {
230 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
231 cpp_bool disabled = FALSE;
232
233 TRACE("(%p)->(%p)\n", This, p);
234
235 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
236
237 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
238 return S_OK;
239 }
240
241 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
242 {
243 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
244 nsIDOMHTMLFormElement *nsform;
245 nsIDOMNode *form_node;
246 HTMLDOMNode *node;
247 HRESULT hres;
248 nsresult nsres;
249
250 TRACE("(%p)->(%p)\n", This, p);
251
252 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
253 if (NS_FAILED(nsres) || nsform == NULL) {
254 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
255 *p = NULL;
256 return E_FAIL;
257 }
258
259 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
260 nsIDOMHTMLFormElement_Release(nsform);
261 assert(nsres == NS_OK);
262
263 hres = get_node(This->element.node.doc, form_node, TRUE, &node);
264 nsIDOMNode_Release(form_node);
265 if (FAILED(hres))
266 return hres;
267
268 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
269
270 node_release(node);
271 return hres;
272 }
273
274 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
275 {
276 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
277 UINT32 val = v;
278 nsresult nsres;
279
280 TRACE("(%p)->(%d)\n", This, v);
281 if (v <= 0)
282 return CTL_E_INVALIDPROPERTYVALUE;
283
284 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
285 if (NS_FAILED(nsres)) {
286 ERR("Set Size(%u) failed: %08x\n", val, nsres);
287 return E_FAIL;
288 }
289 return S_OK;
290 }
291
292 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
293 {
294 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
295 UINT32 val;
296 nsresult nsres;
297
298 TRACE("(%p)->(%p)\n", This, p);
299 if (p == NULL)
300 return E_INVALIDARG;
301
302 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
303 if (NS_FAILED(nsres)) {
304 ERR("Get Size failed: %08x\n", nsres);
305 return E_FAIL;
306 }
307 *p = val;
308 return S_OK;
309 }
310
311 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
312 {
313 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
314 nsresult nsres;
315
316 TRACE("(%p)->(%d)\n", This, v);
317
318 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
319 if(NS_FAILED(nsres)) {
320 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
321 FIXME("SetMaxLength failed\n");
322 return E_FAIL;
323 }
324
325 return S_OK;
326 }
327
328 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
329 {
330 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
331 LONG max_length;
332 nsresult nsres;
333
334 TRACE("(%p)->(%p)\n", This, p);
335
336 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
337 assert(nsres == NS_OK);
338
339 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
340 *p = max_length == -1 ? INT_MAX : max_length;
341 return S_OK;
342 }
343
344 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
345 {
346 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
347 nsresult nsres;
348
349 TRACE("(%p)\n", This);
350
351 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
352 if(NS_FAILED(nsres)) {
353 ERR("Select failed: %08x\n", nsres);
354 return E_FAIL;
355 }
356
357 return S_OK;
358 }
359
360 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
361 {
362 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
363
364 TRACE("(%p)->()\n", This);
365
366 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
367 }
368
369 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
370 {
371 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
372
373 TRACE("(%p)->(%p)\n", This, p);
374
375 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
376 }
377
378 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
379 {
380 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
381 FIXME("(%p)->()\n", This);
382 return E_NOTIMPL;
383 }
384
385 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
386 {
387 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
388 FIXME("(%p)->(%p)\n", This, p);
389 return E_NOTIMPL;
390 }
391
392 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
393 {
394 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
395 nsAString nsstr;
396 nsresult nsres;
397
398 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
399
400 nsAString_InitDepend(&nsstr, v);
401 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
402 nsAString_Finish(&nsstr);
403 if(NS_FAILED(nsres)) {
404 ERR("SetValue failed: %08x\n", nsres);
405 return E_FAIL;
406 }
407
408 return S_OK;
409 }
410
411 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
412 {
413 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
414 nsAString nsstr;
415 nsresult nsres;
416
417 TRACE("(%p)->(%p)\n", This, p);
418
419 nsAString_Init(&nsstr, NULL);
420 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
421 return return_nsstr(nsres, &nsstr, p);
422 }
423
424 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
425 {
426 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
427 nsresult nsres;
428
429 TRACE("(%p)->(%x)\n", This, v);
430
431 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
432 if (NS_FAILED(nsres)) {
433 ERR("Set ReadOnly Failed: %08x\n", nsres);
434 return E_FAIL;
435 }
436 return S_OK;
437 }
438
439 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
440 {
441 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
442 nsresult nsres;
443 cpp_bool b;
444
445 TRACE("(%p)->(%p)\n", This, p);
446
447 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
448 if (NS_FAILED(nsres)) {
449 ERR("Get ReadOnly Failed: %08x\n", nsres);
450 return E_FAIL;
451 }
452 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
453 return S_OK;
454 }
455
456 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
457 {
458 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
459 FIXME("(%p)->(%p)\n", This, range);
460 return E_NOTIMPL;
461 }
462
463 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
464 {
465 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
466 FIXME("(%p)->(%x)\n", This, v);
467 return E_NOTIMPL;
468 }
469
470 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
471 {
472 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
473 FIXME("(%p)->(%p)\n", This, p);
474 return E_NOTIMPL;
475 }
476
477 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
478 {
479 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
480 nsresult nsres;
481
482 TRACE("(%p)->(%x)\n", This, v);
483
484 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
485 if(NS_FAILED(nsres)) {
486 ERR("SetDefaultChecked failed: %08x\n", nsres);
487 return E_FAIL;
488 }
489
490 return S_OK;
491 }
492
493 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
494 {
495 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
496 cpp_bool default_checked = FALSE;
497 nsresult nsres;
498
499 TRACE("(%p)->(%p)\n", This, p);
500
501 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
502 if(NS_FAILED(nsres)) {
503 ERR("GetDefaultChecked failed: %08x\n", nsres);
504 return E_FAIL;
505 }
506
507 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
508 return S_OK;
509 }
510
511 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
512 {
513 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
514 nsresult nsres;
515
516 TRACE("(%p)->(%x)\n", This, v);
517
518 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
519 if(NS_FAILED(nsres)) {
520 ERR("SetChecked failed: %08x\n", nsres);
521 return E_FAIL;
522 }
523
524 return S_OK;
525 }
526
527 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
528 {
529 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
530 cpp_bool checked;
531 nsresult nsres;
532
533 TRACE("(%p)->(%p)\n", This, p);
534
535 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
536 if(NS_FAILED(nsres)) {
537 ERR("GetChecked failed: %08x\n", nsres);
538 return E_FAIL;
539 }
540
541 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
542 TRACE("checked=%x\n", *p);
543 return S_OK;
544 }
545
546 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
547 {
548 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
549 FIXME("(%p)->()\n", This);
550 return E_NOTIMPL;
551 }
552
553 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
554 {
555 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
556 FIXME("(%p)->(%p)\n", This, p);
557 return E_NOTIMPL;
558 }
559
560 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
561 {
562 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
563 FIXME("(%p)->(%d)\n", This, v);
564 return E_NOTIMPL;
565 }
566
567 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
568 {
569 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
570 FIXME("(%p)->(%p)\n", This, p);
571 return E_NOTIMPL;
572 }
573
574 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
575 {
576 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
577 FIXME("(%p)->(%d)\n", This, v);
578 return E_NOTIMPL;
579 }
580
581 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
582 {
583 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
584 FIXME("(%p)->(%p)\n", This, p);
585 return E_NOTIMPL;
586 }
587
588 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
589 {
590 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
591 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
592 return E_NOTIMPL;
593 }
594
595 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
596 {
597 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
598 FIXME("(%p)->(%p)\n", This, p);
599 return E_NOTIMPL;
600 }
601
602 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
603 {
604 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
605 nsAString nsstr;
606 nsresult nsres;
607
608 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
609
610 nsAString_InitDepend(&nsstr, v);
611 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
612 nsAString_Finish(&nsstr);
613 if(NS_FAILED(nsres))
614 ERR("SetSrc failed: %08x\n", nsres);
615
616 return S_OK;
617 }
618
619 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
620 {
621 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
622 const PRUnichar *src;
623 nsAString src_str;
624 nsresult nsres;
625 HRESULT hres;
626
627 TRACE("(%p)->(%p)\n", This, p);
628
629 nsAString_Init(&src_str, NULL);
630 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
631 if(NS_FAILED(nsres)) {
632 ERR("GetSrc failed: %08x\n", nsres);
633 return E_FAIL;
634 }
635
636 nsAString_GetData(&src_str, &src);
637 hres = nsuri_to_url(src, FALSE, p);
638 nsAString_Finish(&src_str);
639
640 return hres;
641 }
642
643 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
644 {
645 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
646 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
647 return E_NOTIMPL;
648 }
649
650 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
651 {
652 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
653 FIXME("(%p)->(%p)\n", This, p);
654 return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
658 {
659 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
660 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
661 return E_NOTIMPL;
662 }
663
664 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
665 {
666 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
667 FIXME("(%p)->(%p)\n", This, p);
668 return E_NOTIMPL;
669 }
670
671 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
672 {
673 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
674 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
675 return E_NOTIMPL;
676 }
677
678 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
679 {
680 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
681 FIXME("(%p)->(%p)\n", This, p);
682 return E_NOTIMPL;
683 }
684
685 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
686 {
687 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
688 FIXME("(%p)->(%p)\n", This, p);
689 return E_NOTIMPL;
690 }
691
692 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
693 {
694 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
695 FIXME("(%p)->(%p)\n", This, p);
696 return E_NOTIMPL;
697 }
698
699 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
700 {
701 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
702 FIXME("(%p)->()\n", This);
703 return E_NOTIMPL;
704 }
705
706 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
707 {
708 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
709 FIXME("(%p)->(%p)\n", This, p);
710 return E_NOTIMPL;
711 }
712
713 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
714 {
715 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
716 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
717 return E_NOTIMPL;
718 }
719
720 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
721 {
722 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
723 FIXME("(%p)->(%p)\n", This, p);
724 return E_NOTIMPL;
725 }
726
727 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
728 {
729 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
730 FIXME("(%p)->()\n", This);
731 return E_NOTIMPL;
732 }
733
734 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
735 {
736 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
737 FIXME("(%p)->(%p)\n", This, p);
738 return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
742 {
743 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
744 FIXME("(%p)->()\n", This);
745 return E_NOTIMPL;
746 }
747
748 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
749 {
750 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
751 FIXME("(%p)->(%p)\n", This, p);
752 return E_NOTIMPL;
753 }
754
755 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
756 {
757 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
758 FIXME("(%p)->()\n", This);
759 return E_NOTIMPL;
760 }
761
762 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
763 {
764 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
765 FIXME("(%p)->(%p)\n", This, p);
766 return E_NOTIMPL;
767 }
768
769 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
770 {
771 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
772 FIXME("(%p)->(%d)\n", This, v);
773 return E_NOTIMPL;
774 }
775
776 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
777 {
778 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
779 FIXME("(%p)->(%p)\n", This, p);
780 return E_NOTIMPL;
781 }
782
783 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
784 {
785 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
786 FIXME("(%p)->(%d)\n", This, v);
787 return E_NOTIMPL;
788 }
789
790 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
791 {
792 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
793 FIXME("(%p)->(%p)\n", This, p);
794 return E_NOTIMPL;
795 }
796
797 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
798 {
799 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
800 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
801 return E_NOTIMPL;
802 }
803
804 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
805 {
806 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
807 FIXME("(%p)->(%p)\n", This, p);
808 return E_NOTIMPL;
809 }
810
811 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
812 HTMLInputElement_QueryInterface,
813 HTMLInputElement_AddRef,
814 HTMLInputElement_Release,
815 HTMLInputElement_GetTypeInfoCount,
816 HTMLInputElement_GetTypeInfo,
817 HTMLInputElement_GetIDsOfNames,
818 HTMLInputElement_Invoke,
819 HTMLInputElement_put_type,
820 HTMLInputElement_get_type,
821 HTMLInputElement_put_value,
822 HTMLInputElement_get_value,
823 HTMLInputElement_put_name,
824 HTMLInputElement_get_name,
825 HTMLInputElement_put_status,
826 HTMLInputElement_get_status,
827 HTMLInputElement_put_disabled,
828 HTMLInputElement_get_disabled,
829 HTMLInputElement_get_form,
830 HTMLInputElement_put_size,
831 HTMLInputElement_get_size,
832 HTMLInputElement_put_maxLength,
833 HTMLInputElement_get_maxLength,
834 HTMLInputElement_select,
835 HTMLInputElement_put_onchange,
836 HTMLInputElement_get_onchange,
837 HTMLInputElement_put_onselect,
838 HTMLInputElement_get_onselect,
839 HTMLInputElement_put_defaultValue,
840 HTMLInputElement_get_defaultValue,
841 HTMLInputElement_put_readOnly,
842 HTMLInputElement_get_readOnly,
843 HTMLInputElement_createTextRange,
844 HTMLInputElement_put_indeterminate,
845 HTMLInputElement_get_indeterminate,
846 HTMLInputElement_put_defaultChecked,
847 HTMLInputElement_get_defaultChecked,
848 HTMLInputElement_put_checked,
849 HTMLInputElement_get_checked,
850 HTMLInputElement_put_border,
851 HTMLInputElement_get_border,
852 HTMLInputElement_put_vspace,
853 HTMLInputElement_get_vspace,
854 HTMLInputElement_put_hspace,
855 HTMLInputElement_get_hspace,
856 HTMLInputElement_put_alt,
857 HTMLInputElement_get_alt,
858 HTMLInputElement_put_src,
859 HTMLInputElement_get_src,
860 HTMLInputElement_put_lowsrc,
861 HTMLInputElement_get_lowsrc,
862 HTMLInputElement_put_vrml,
863 HTMLInputElement_get_vrml,
864 HTMLInputElement_put_dynsrc,
865 HTMLInputElement_get_dynsrc,
866 HTMLInputElement_get_readyState,
867 HTMLInputElement_get_complete,
868 HTMLInputElement_put_loop,
869 HTMLInputElement_get_loop,
870 HTMLInputElement_put_align,
871 HTMLInputElement_get_align,
872 HTMLInputElement_put_onload,
873 HTMLInputElement_get_onload,
874 HTMLInputElement_put_onerror,
875 HTMLInputElement_get_onerror,
876 HTMLInputElement_put_onabort,
877 HTMLInputElement_get_onabort,
878 HTMLInputElement_put_width,
879 HTMLInputElement_get_width,
880 HTMLInputElement_put_height,
881 HTMLInputElement_get_height,
882 HTMLInputElement_put_start,
883 HTMLInputElement_get_start
884 };
885
886 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
887 REFIID riid, void **ppv)
888 {
889 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
890
891 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
892 }
893
894 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
895 {
896 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
897
898 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
899 }
900
901 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
902 {
903 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
904
905 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
906 }
907
908 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
909 {
910 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
911 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
912 }
913
914 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
915 LCID lcid, ITypeInfo **ppTInfo)
916 {
917 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
918 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
919 ppTInfo);
920 }
921
922 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
923 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
924 {
925 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
926 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
927 cNames, lcid, rgDispId);
928 }
929
930 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
931 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
932 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
933 {
934 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
935 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
936 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
937 }
938
939 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
940 {
941 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
942
943 TRACE("(%p)->(%p)\n", This, p);
944
945 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
946 }
947
948 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
949 {
950 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
951
952 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
953
954 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
955 }
956
957 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
958 {
959 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
960
961 TRACE("(%p)->(%p)\n", This, p);
962
963 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
964 }
965
966 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
967 {
968 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
969
970 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
971
972 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
973 }
974
975 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
976 {
977 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
978
979 TRACE("(%p)->(%p)\n", This, p);
980
981 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
982 }
983
984 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
985 {
986 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
987 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
988 return E_NOTIMPL;
989 }
990
991 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
992 {
993 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
994 TRACE("(%p)->(%p)\n", This, p);
995 return E_NOTIMPL;
996 }
997
998 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
999 {
1000 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1001
1002 TRACE("(%p)->(%x)\n", This, v);
1003
1004 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1005 }
1006
1007 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1008 {
1009 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1010
1011 TRACE("(%p)->(%p)\n", This, p);
1012
1013 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1014 }
1015
1016 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1017 {
1018 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1019
1020 TRACE("(%p)->(%p)\n", This, p);
1021
1022 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1023 }
1024
1025 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1026 {
1027 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1028
1029 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1030
1031 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1032 }
1033
1034 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1035 {
1036 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1037
1038 TRACE("(%p)->(%p)\n", This, p);
1039
1040 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1041 }
1042
1043 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1044 {
1045 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1046
1047 TRACE("(%p)->(%d)\n", This, v);
1048
1049 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1050 }
1051
1052 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1053 {
1054 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1055
1056 TRACE("(%p)->(%p)\n", This, p);
1057
1058 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1059 }
1060
1061 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1062 {
1063 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1064
1065 TRACE("(%p)->(%d)\n", This, v);
1066
1067 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1068 }
1069
1070 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1071 {
1072 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1073
1074 TRACE("(%p)->(%p)\n", This, p);
1075
1076 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1077 }
1078
1079 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1080 {
1081 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1082
1083 TRACE("(%p)\n", This);
1084
1085 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1086 }
1087
1088 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1089 {
1090 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1091
1092 TRACE("(%p)->()\n", This);
1093
1094 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1095 }
1096
1097 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1098 {
1099 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1100
1101 TRACE("(%p)->(%p)\n", This, p);
1102
1103 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1104 }
1105
1106 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1107 {
1108 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1109
1110 TRACE("(%p)->()\n", This);
1111
1112 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1113 }
1114
1115 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1116 {
1117 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1118
1119 TRACE("(%p)->(%p)\n", This, p);
1120
1121 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1122 }
1123
1124 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1125 {
1126 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1127
1128 TRACE("(%p)->(%x)\n", This, v);
1129
1130 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1131 }
1132
1133 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1134 {
1135 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1136
1137 TRACE("(%p)->(%p)\n", This, p);
1138
1139 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1140 }
1141
1142 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1143 {
1144 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1145
1146 TRACE("(%p)->(%p)\n", This, range);
1147
1148 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1149 }
1150
1151 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1152 HTMLInputTextElement_QueryInterface,
1153 HTMLInputTextElement_AddRef,
1154 HTMLInputTextElement_Release,
1155 HTMLInputTextElement_GetTypeInfoCount,
1156 HTMLInputTextElement_GetTypeInfo,
1157 HTMLInputTextElement_GetIDsOfNames,
1158 HTMLInputTextElement_Invoke,
1159 HTMLInputTextElement_get_type,
1160 HTMLInputTextElement_put_value,
1161 HTMLInputTextElement_get_value,
1162 HTMLInputTextElement_put_name,
1163 HTMLInputTextElement_get_name,
1164 HTMLInputTextElement_put_status,
1165 HTMLInputTextElement_get_status,
1166 HTMLInputTextElement_put_disabled,
1167 HTMLInputTextElement_get_disabled,
1168 HTMLInputTextElement_get_form,
1169 HTMLInputTextElement_put_defaultValue,
1170 HTMLInputTextElement_get_defaultValue,
1171 HTMLInputTextElement_put_size,
1172 HTMLInputTextElement_get_size,
1173 HTMLInputTextElement_put_maxLength,
1174 HTMLInputTextElement_get_maxLength,
1175 HTMLInputTextElement_select,
1176 HTMLInputTextElement_put_onchange,
1177 HTMLInputTextElement_get_onchange,
1178 HTMLInputTextElement_put_onselect,
1179 HTMLInputTextElement_get_onselect,
1180 HTMLInputTextElement_put_readOnly,
1181 HTMLInputTextElement_get_readOnly,
1182 HTMLInputTextElement_createTextRange
1183 };
1184
1185 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1186 {
1187 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1188 }
1189
1190 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1191 {
1192 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1193
1194 *ppv = NULL;
1195
1196 if(IsEqualGUID(&IID_IUnknown, riid)) {
1197 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1198 *ppv = &This->IHTMLInputElement_iface;
1199 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1200 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1201 *ppv = &This->IHTMLInputElement_iface;
1202 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1203 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1204 *ppv = &This->IHTMLInputElement_iface;
1205 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1206 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1207 *ppv = &This->IHTMLInputTextElement_iface;
1208 }
1209
1210 if(*ppv) {
1211 IUnknown_AddRef((IUnknown*)*ppv);
1212 return S_OK;
1213 }
1214
1215 return HTMLElement_QI(&This->element.node, riid, ppv);
1216 }
1217
1218 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1219 {
1220 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1221
1222 if(eid == EVENTID_CLICK) {
1223 nsresult nsres;
1224
1225 *handled = TRUE;
1226
1227 nsres = nsIDOMHTMLElement_Click(This->element.nselem);
1228 if(NS_FAILED(nsres)) {
1229 ERR("Click failed: %08x\n", nsres);
1230 return E_FAIL;
1231 }
1232 }
1233
1234 return S_OK;
1235 }
1236
1237 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1238 {
1239 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1240 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1241 }
1242
1243 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1244 {
1245 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1246 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1247 }
1248
1249 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
1250 {
1251 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1252 const PRUnichar *type;
1253 nsAString nsstr;
1254 nsresult nsres;
1255 BOOL ret = FALSE;
1256
1257 static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
1258 static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
1259 static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
1260 static const WCHAR resetW[] = {'r','e','s','e','t',0};
1261 static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
1262 static const WCHAR textW[] = {'t','e','x','t',0};
1263
1264 nsAString_Init(&nsstr, NULL);
1265 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
1266 if(NS_SUCCEEDED(nsres)) {
1267 nsAString_GetData(&nsstr, &type);
1268 ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW)
1269 || !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW);
1270 }
1271 nsAString_Finish(&nsstr);
1272 return ret;
1273 }
1274
1275 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1276 {
1277 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1278
1279 if(This->nsinput)
1280 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1281 }
1282
1283 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1284 {
1285 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1286
1287 if(This->nsinput) {
1288 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1289
1290 This->nsinput = NULL;
1291 nsIDOMHTMLInputElement_Release(nsinput);
1292 }
1293 }
1294
1295 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1296 HTMLInputElement_QI,
1297 HTMLElement_destructor,
1298 HTMLElement_cpc,
1299 HTMLElement_clone,
1300 HTMLElement_handle_event,
1301 HTMLElement_get_attr_col,
1302 NULL,
1303 HTMLInputElementImpl_fire_event,
1304 HTMLInputElementImpl_put_disabled,
1305 HTMLInputElementImpl_get_disabled,
1306 NULL,
1307 NULL,
1308 NULL,
1309 NULL,
1310 NULL,
1311 HTMLInputElement_traverse,
1312 HTMLInputElement_unlink,
1313 HTMLInputElement_is_text_edit
1314 };
1315
1316 static const tid_t HTMLInputElement_iface_tids[] = {
1317 HTMLELEMENT_TIDS,
1318 IHTMLInputElement_tid,
1319 0
1320 };
1321 static dispex_static_data_t HTMLInputElement_dispex = {
1322 NULL,
1323 DispHTMLInputElement_tid,
1324 NULL,
1325 HTMLInputElement_iface_tids
1326 };
1327
1328 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1329 {
1330 HTMLInputElement *ret;
1331 nsresult nsres;
1332
1333 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1334 if(!ret)
1335 return E_OUTOFMEMORY;
1336
1337 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1338 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1339 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1340
1341 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1342
1343 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1344 assert(nsres == NS_OK);
1345
1346 *elem = &ret->element;
1347 return S_OK;
1348 }
1349
1350 typedef struct {
1351 HTMLElement element;
1352
1353 IHTMLLabelElement IHTMLLabelElement_iface;
1354 } HTMLLabelElement;
1355
1356 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1357 {
1358 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1359 }
1360
1361 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1362 REFIID riid, void **ppv)
1363 {
1364 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1365
1366 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1367 }
1368
1369 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1370 {
1371 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1372
1373 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1374 }
1375
1376 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1377 {
1378 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1379
1380 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1381 }
1382
1383 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1384 {
1385 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1386
1387 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1388 }
1389
1390 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1391 LCID lcid, ITypeInfo **ppTInfo)
1392 {
1393 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1394
1395 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1396 }
1397
1398 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1399 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1400 {
1401 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1402
1403 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1404 cNames, lcid, rgDispId);
1405 }
1406
1407 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1408 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1409 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1410 {
1411 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1412
1413 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1414 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1415 }
1416
1417 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1418 {
1419 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1420 nsAString for_str, val_str;
1421 nsresult nsres;
1422
1423 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1424
1425 nsAString_InitDepend(&for_str, forW);
1426 nsAString_InitDepend(&val_str, v);
1427 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1428 nsAString_Finish(&for_str);
1429 nsAString_Finish(&val_str);
1430 if(NS_FAILED(nsres)) {
1431 ERR("SetAttribute failed: %08x\n", nsres);
1432 return E_FAIL;
1433 }
1434
1435 return S_OK;
1436 }
1437
1438 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1439 {
1440 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1441
1442 TRACE("(%p)->(%p)\n", This, p);
1443
1444 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1445 }
1446
1447 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1448 {
1449 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1450 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1451 return E_NOTIMPL;
1452 }
1453
1454 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1455 {
1456 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1457 FIXME("(%p)->(%p)\n", This, p);
1458 return E_NOTIMPL;
1459 }
1460
1461 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1462 HTMLLabelElement_QueryInterface,
1463 HTMLLabelElement_AddRef,
1464 HTMLLabelElement_Release,
1465 HTMLLabelElement_GetTypeInfoCount,
1466 HTMLLabelElement_GetTypeInfo,
1467 HTMLLabelElement_GetIDsOfNames,
1468 HTMLLabelElement_Invoke,
1469 HTMLLabelElement_put_htmlFor,
1470 HTMLLabelElement_get_htmlFor,
1471 HTMLLabelElement_put_accessKey,
1472 HTMLLabelElement_get_accessKey
1473 };
1474
1475 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1476 {
1477 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1478 }
1479
1480 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1481 {
1482 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1483
1484 *ppv = NULL;
1485
1486 if(IsEqualGUID(&IID_IUnknown, riid)) {
1487 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1488 *ppv = &This->IHTMLLabelElement_iface;
1489 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1490 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1491 *ppv = &This->IHTMLLabelElement_iface;
1492 }else {
1493 return HTMLElement_QI(&This->element.node, riid, ppv);
1494 }
1495
1496 IUnknown_AddRef((IUnknown*)*ppv);
1497 return S_OK;
1498 }
1499
1500 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1501 HTMLLabelElement_QI,
1502 HTMLElement_destructor,
1503 HTMLElement_cpc,
1504 HTMLElement_clone,
1505 HTMLElement_handle_event,
1506 HTMLElement_get_attr_col,
1507 };
1508
1509 static const tid_t HTMLLabelElement_iface_tids[] = {
1510 HTMLELEMENT_TIDS,
1511 IHTMLLabelElement_tid,
1512 0
1513 };
1514
1515 static dispex_static_data_t HTMLLabelElement_dispex = {
1516 NULL,
1517 DispHTMLLabelElement_tid,
1518 NULL,
1519 HTMLLabelElement_iface_tids
1520 };
1521
1522 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1523 {
1524 HTMLLabelElement *ret;
1525
1526 ret = heap_alloc_zero(sizeof(*ret));
1527 if(!ret)
1528 return E_OUTOFMEMORY;
1529
1530 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1531 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1532
1533 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1534 *elem = &ret->element;
1535 return S_OK;
1536 }
1537
1538 typedef struct {
1539 HTMLElement element;
1540
1541 IHTMLButtonElement IHTMLButtonElement_iface;
1542
1543 nsIDOMHTMLButtonElement *nsbutton;
1544 } HTMLButtonElement;
1545
1546 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1547 {
1548 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1549 }
1550
1551 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1552 REFIID riid, void **ppv)
1553 {
1554 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1555
1556 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1557 }
1558
1559 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1560 {
1561 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1562
1563 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1564 }
1565
1566 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1567 {
1568 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1569
1570 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1571 }
1572
1573 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1574 {
1575 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1576
1577 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1578 }
1579
1580 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1581 LCID lcid, ITypeInfo **ppTInfo)
1582 {
1583 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1584
1585 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1586 }
1587
1588 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1589 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1590 {
1591 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1592
1593 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1594 cNames, lcid, rgDispId);
1595 }
1596
1597 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1598 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1599 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1600 {
1601 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1602
1603 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1604 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1605 }
1606
1607 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1608 {
1609 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1610 FIXME("(%p)->(%p)\n", This, p);
1611 return E_NOTIMPL;
1612 }
1613
1614 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1615 {
1616 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1617 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1618 return E_NOTIMPL;
1619 }
1620
1621 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1622 {
1623 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1624 FIXME("(%p)->(%p)\n", This, p);
1625 return E_NOTIMPL;
1626 }
1627
1628 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1629 {
1630 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1631 nsAString name_str;
1632 nsresult nsres;
1633
1634 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1635
1636 nsAString_InitDepend(&name_str, v);
1637 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1638 nsAString_Finish(&name_str);
1639 if(NS_FAILED(nsres)) {
1640 ERR("SetName failed: %08x\n", nsres);
1641 return E_FAIL;
1642 }
1643
1644 return S_OK;
1645 }
1646
1647 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1648 {
1649 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1650 nsAString name_str;
1651 nsresult nsres;
1652
1653 TRACE("(%p)->(%p)\n", This, p);
1654
1655 nsAString_Init(&name_str, NULL);
1656 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1657 return return_nsstr(nsres, &name_str, p);
1658 }
1659
1660 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1661 {
1662 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1663 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1664 return E_NOTIMPL;
1665 }
1666
1667 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1668 {
1669 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1670 FIXME("(%p)->(%p)\n", This, p);
1671 return E_NOTIMPL;
1672 }
1673
1674 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1675 {
1676 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1677 nsresult nsres;
1678
1679 TRACE("(%p)->(%x)\n", This, v);
1680
1681 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1682 if(NS_FAILED(nsres)) {
1683 ERR("SetDisabled failed: %08x\n", nsres);
1684 return E_FAIL;
1685 }
1686
1687 return S_OK;
1688 }
1689
1690 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1691 {
1692 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1693 cpp_bool disabled;
1694 nsresult nsres;
1695
1696 TRACE("(%p)->(%p)\n", This, p);
1697
1698 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1699 if(NS_FAILED(nsres)) {
1700 ERR("GetDisabled failed: %08x\n", nsres);
1701 return E_FAIL;
1702 }
1703
1704 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1705 return S_OK;
1706 }
1707
1708 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1709 {
1710 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1711 FIXME("(%p)->(%p)\n", This, p);
1712 return E_NOTIMPL;
1713 }
1714
1715 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1716 {
1717 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1718 FIXME("(%p)->(%p)\n", This, range);
1719 return E_NOTIMPL;
1720 }
1721
1722 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1723 HTMLButtonElement_QueryInterface,
1724 HTMLButtonElement_AddRef,
1725 HTMLButtonElement_Release,
1726 HTMLButtonElement_GetTypeInfoCount,
1727 HTMLButtonElement_GetTypeInfo,
1728 HTMLButtonElement_GetIDsOfNames,
1729 HTMLButtonElement_Invoke,
1730 HTMLButtonElement_get_type,
1731 HTMLButtonElement_put_value,
1732 HTMLButtonElement_get_value,
1733 HTMLButtonElement_put_name,
1734 HTMLButtonElement_get_name,
1735 HTMLButtonElement_put_status,
1736 HTMLButtonElement_get_status,
1737 HTMLButtonElement_put_disabled,
1738 HTMLButtonElement_get_disabled,
1739 HTMLButtonElement_get_form,
1740 HTMLButtonElement_createTextRange
1741 };
1742
1743 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1744 {
1745 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1746 }
1747
1748 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1749 {
1750 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1751
1752 *ppv = NULL;
1753
1754 if(IsEqualGUID(&IID_IUnknown, riid)) {
1755 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1756 *ppv = &This->IHTMLButtonElement_iface;
1757 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1758 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1759 *ppv = &This->IHTMLButtonElement_iface;
1760 }else {
1761 return HTMLElement_QI(&This->element.node, riid, ppv);
1762 }
1763
1764 IUnknown_AddRef((IUnknown*)*ppv);
1765 return S_OK;
1766 }
1767
1768 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1769 {
1770 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1771 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1772 }
1773
1774 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1775 {
1776 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1777 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1778 }
1779
1780 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
1781 {
1782 return TRUE;
1783 }
1784
1785 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1786 {
1787 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1788
1789 if(This->nsbutton)
1790 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1791 }
1792
1793 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1794 {
1795 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1796
1797 if(This->nsbutton) {
1798 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
1799
1800 This->nsbutton = NULL;
1801 nsIDOMHTMLButtonElement_Release(nsbutton);
1802 }
1803 }
1804
1805 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1806 HTMLButtonElement_QI,
1807 HTMLElement_destructor,
1808 HTMLElement_cpc,
1809 HTMLElement_clone,
1810 HTMLElement_handle_event,
1811 HTMLElement_get_attr_col,
1812 NULL,
1813 NULL,
1814 HTMLButtonElementImpl_put_disabled,
1815 HTMLButtonElementImpl_get_disabled,
1816 NULL,
1817 NULL,
1818 NULL,
1819 NULL,
1820 NULL,
1821 HTMLButtonElement_traverse,
1822 HTMLButtonElement_unlink,
1823 HTMLButtonElement_is_text_edit
1824 };
1825
1826 static const tid_t HTMLButtonElement_iface_tids[] = {
1827 HTMLELEMENT_TIDS,
1828 IHTMLButtonElement_tid,
1829 0
1830 };
1831
1832 static dispex_static_data_t HTMLButtonElement_dispex = {
1833 NULL,
1834 DispHTMLButtonElement_tid,
1835 NULL,
1836 HTMLButtonElement_iface_tids
1837 };
1838
1839 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1840 {
1841 HTMLButtonElement *ret;
1842 nsresult nsres;
1843
1844 ret = heap_alloc_zero(sizeof(*ret));
1845 if(!ret)
1846 return E_OUTOFMEMORY;
1847
1848 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1849 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1850
1851 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1852
1853 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1854 assert(nsres == NS_OK);
1855
1856 *elem = &ret->element;
1857 return S_OK;
1858 }