mshtml: Added IHTMLInputElement::readOnly property.
[wine.git] / dlls / mshtml / htmlinput.c
blobf25f437e54ec6bd93c4e31112bdf5eb7616d8d15
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <assert.h>
21 #include <limits.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
30 #include "wine/debug.h"
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 typedef struct {
38 HTMLElement element;
40 IHTMLInputElement IHTMLInputElement_iface;
41 IHTMLInputTextElement IHTMLInputTextElement_iface;
43 nsIDOMHTMLInputElement *nsinput;
44 } HTMLInputElement;
46 static const WCHAR forW[] = {'f','o','r',0};
48 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
50 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
53 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
55 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
58 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
59 REFIID riid, void **ppv)
61 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
63 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
66 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
68 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
70 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
73 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
75 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
77 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
80 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
82 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
84 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
87 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
88 LCID lcid, ITypeInfo **ppTInfo)
90 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
92 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
93 ppTInfo);
96 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
97 LPOLESTR *rgszNames, UINT cNames,
98 LCID lcid, DISPID *rgDispId)
100 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
102 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
103 cNames, lcid, rgDispId);
106 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
107 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
108 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
110 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
112 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
113 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
116 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
118 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
119 nsAString type_str;
120 nsresult nsres;
122 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
125 * FIXME:
126 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
128 nsAString_InitDepend(&type_str, v);
129 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
130 nsAString_Finish(&type_str);
131 if(NS_FAILED(nsres)) {
132 ERR("SetType failed: %08x\n", nsres);
133 return E_FAIL;
136 return S_OK;
139 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
141 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
142 nsAString type_str;
143 nsresult nsres;
145 TRACE("(%p)->(%p)\n", This, p);
147 nsAString_Init(&type_str, NULL);
148 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
149 return return_nsstr(nsres, &type_str, p);
152 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
154 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
155 nsAString val_str;
156 nsresult nsres;
158 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
160 nsAString_InitDepend(&val_str, v);
161 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
162 nsAString_Finish(&val_str);
163 if(NS_FAILED(nsres))
164 ERR("SetValue failed: %08x\n", nsres);
166 return S_OK;
169 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
171 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
172 nsAString value_str;
173 nsresult nsres;
175 TRACE("(%p)->(%p)\n", This, p);
177 nsAString_Init(&value_str, NULL);
178 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
179 return return_nsstr(nsres, &value_str, p);
182 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
184 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
185 nsAString name_str;
186 nsresult nsres;
188 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
190 nsAString_InitDepend(&name_str, v);
191 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
192 nsAString_Finish(&name_str);
193 if(NS_FAILED(nsres)) {
194 ERR("SetName failed: %08x\n", nsres);
195 return E_FAIL;
198 return S_OK;
201 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
203 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
204 nsAString name_str;
205 nsresult nsres;
207 TRACE("(%p)->(%p)\n", This, p);
209 nsAString_Init(&name_str, NULL);
210 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
211 return return_nsstr(nsres, &name_str, p);
214 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
216 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
217 FIXME("(%p)->(%x)\n", This, v);
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
223 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
224 FIXME("(%p)->(%p)\n", This, p);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
230 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
231 nsresult nsres;
233 TRACE("(%p)->(%x)\n", This, v);
235 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
236 if(NS_FAILED(nsres))
237 ERR("SetDisabled failed: %08x\n", nsres);
239 return S_OK;
242 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
244 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
245 cpp_bool disabled = FALSE;
247 TRACE("(%p)->(%p)\n", This, p);
249 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
251 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
252 return S_OK;
255 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
257 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
258 FIXME("(%p)->(%p)\n", This, p);
259 return E_NOTIMPL;
262 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
264 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
265 UINT32 val = v;
266 nsresult nsres;
268 TRACE("(%p)->(%d)\n", This, v);
269 if (v <= 0)
270 return CTL_E_INVALIDPROPERTYVALUE;
272 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
273 if (NS_FAILED(nsres)) {
274 ERR("Set Size(%u) failed: %08x\n", val, nsres);
275 return E_FAIL;
277 return S_OK;
280 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
282 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
283 UINT32 val;
284 nsresult nsres;
286 TRACE("(%p)->(%p)\n", This, p);
287 if (p == NULL)
288 return E_INVALIDARG;
290 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
291 if (NS_FAILED(nsres)) {
292 ERR("Get Size failed: %08x\n", nsres);
293 return E_FAIL;
295 *p = val;
296 return S_OK;
299 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
301 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
302 nsresult nsres;
304 TRACE("(%p)->(%d)\n", This, v);
306 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
307 if(NS_FAILED(nsres)) {
308 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
309 FIXME("SetMaxLength failed\n");
310 return E_FAIL;
313 return S_OK;
316 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
318 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
319 LONG max_length;
320 nsresult nsres;
322 TRACE("(%p)->(%p)\n", This, p);
324 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
325 assert(nsres == NS_OK);
327 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
328 *p = max_length == -1 ? INT_MAX : max_length;
329 return S_OK;
332 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
334 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
335 nsresult nsres;
337 TRACE("(%p)\n", This);
339 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
340 if(NS_FAILED(nsres)) {
341 ERR("Select failed: %08x\n", nsres);
342 return E_FAIL;
345 return S_OK;
348 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
350 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
352 TRACE("(%p)->()\n", This);
354 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
357 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
359 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
361 TRACE("(%p)->(%p)\n", This, p);
363 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
366 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
368 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
369 FIXME("(%p)->()\n", This);
370 return E_NOTIMPL;
373 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
375 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
376 FIXME("(%p)->(%p)\n", This, p);
377 return E_NOTIMPL;
380 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
382 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
383 nsAString nsstr;
384 nsresult nsres;
386 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
388 nsAString_InitDepend(&nsstr, v);
389 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
390 nsAString_Finish(&nsstr);
391 if(NS_FAILED(nsres)) {
392 ERR("SetValue failed: %08x\n", nsres);
393 return E_FAIL;
396 return S_OK;
399 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
401 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
402 nsAString nsstr;
403 nsresult nsres;
405 TRACE("(%p)->(%p)\n", This, p);
407 nsAString_Init(&nsstr, NULL);
408 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
409 return return_nsstr(nsres, &nsstr, p);
412 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
414 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
415 nsresult nsres;
417 TRACE("(%p)->(%x)\n", This, v);
419 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
420 if (NS_FAILED(nsres)) {
421 ERR("Set ReadOnly Failed: %08x\n", nsres);
422 return E_FAIL;
424 return S_OK;
427 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
429 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
430 nsresult nsres;
431 cpp_bool b;
433 TRACE("(%p)->(%p)\n", This, p);
435 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
436 if (NS_FAILED(nsres)) {
437 ERR("Get ReadOnly Failed: %08x\n", nsres);
438 return E_FAIL;
440 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
441 return S_OK;
444 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
446 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
447 FIXME("(%p)->(%p)\n", This, range);
448 return E_NOTIMPL;
451 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
453 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
454 FIXME("(%p)->(%x)\n", This, v);
455 return E_NOTIMPL;
458 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
460 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
461 FIXME("(%p)->(%p)\n", This, p);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
467 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
468 nsresult nsres;
470 TRACE("(%p)->(%x)\n", This, v);
472 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
473 if(NS_FAILED(nsres)) {
474 ERR("SetDefaultChecked failed: %08x\n", nsres);
475 return E_FAIL;
478 return S_OK;
481 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
483 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
484 cpp_bool default_checked = FALSE;
485 nsresult nsres;
487 TRACE("(%p)->(%p)\n", This, p);
489 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
490 if(NS_FAILED(nsres)) {
491 ERR("GetDefaultChecked failed: %08x\n", nsres);
492 return E_FAIL;
495 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
496 return S_OK;
499 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
501 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
502 nsresult nsres;
504 TRACE("(%p)->(%x)\n", This, v);
506 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
507 if(NS_FAILED(nsres)) {
508 ERR("SetChecked failed: %08x\n", nsres);
509 return E_FAIL;
512 return S_OK;
515 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
517 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
518 cpp_bool checked;
519 nsresult nsres;
521 TRACE("(%p)->(%p)\n", This, p);
523 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
524 if(NS_FAILED(nsres)) {
525 ERR("GetChecked failed: %08x\n", nsres);
526 return E_FAIL;
529 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
530 TRACE("checked=%x\n", *p);
531 return S_OK;
534 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
536 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
537 FIXME("(%p)->()\n", This);
538 return E_NOTIMPL;
541 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
543 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
544 FIXME("(%p)->(%p)\n", This, p);
545 return E_NOTIMPL;
548 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
550 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
551 FIXME("(%p)->(%d)\n", This, v);
552 return E_NOTIMPL;
555 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
557 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
558 FIXME("(%p)->(%p)\n", This, p);
559 return E_NOTIMPL;
562 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
564 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
565 FIXME("(%p)->(%d)\n", This, v);
566 return E_NOTIMPL;
569 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
571 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
572 FIXME("(%p)->(%p)\n", This, p);
573 return E_NOTIMPL;
576 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
578 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
579 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
580 return E_NOTIMPL;
583 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
585 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
586 FIXME("(%p)->(%p)\n", This, p);
587 return E_NOTIMPL;
590 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
592 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
593 nsAString nsstr;
594 nsresult nsres;
596 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
598 nsAString_InitDepend(&nsstr, v);
599 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
600 nsAString_Finish(&nsstr);
601 if(NS_FAILED(nsres))
602 ERR("SetSrc failed: %08x\n", nsres);
604 return S_OK;
607 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
609 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
610 const PRUnichar *src;
611 nsAString src_str;
612 nsresult nsres;
613 HRESULT hres;
615 TRACE("(%p)->(%p)\n", This, p);
617 nsAString_Init(&src_str, NULL);
618 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
619 if(NS_FAILED(nsres)) {
620 ERR("GetSrc failed: %08x\n", nsres);
621 return E_FAIL;
624 nsAString_GetData(&src_str, &src);
625 hres = nsuri_to_url(src, FALSE, p);
626 nsAString_Finish(&src_str);
628 return hres;
631 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
633 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
634 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
635 return E_NOTIMPL;
638 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
640 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
641 FIXME("(%p)->(%p)\n", This, p);
642 return E_NOTIMPL;
645 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
647 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
648 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
649 return E_NOTIMPL;
652 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
654 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
655 FIXME("(%p)->(%p)\n", This, p);
656 return E_NOTIMPL;
659 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
661 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
662 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
663 return E_NOTIMPL;
666 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
668 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
669 FIXME("(%p)->(%p)\n", This, p);
670 return E_NOTIMPL;
673 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
675 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
676 FIXME("(%p)->(%p)\n", This, p);
677 return E_NOTIMPL;
680 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
682 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
683 FIXME("(%p)->(%p)\n", This, p);
684 return E_NOTIMPL;
687 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
689 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
690 FIXME("(%p)->()\n", This);
691 return E_NOTIMPL;
694 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
696 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
697 FIXME("(%p)->(%p)\n", This, p);
698 return E_NOTIMPL;
701 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
703 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
704 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
705 return E_NOTIMPL;
708 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
710 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
711 FIXME("(%p)->(%p)\n", This, p);
712 return E_NOTIMPL;
715 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
717 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
718 FIXME("(%p)->()\n", This);
719 return E_NOTIMPL;
722 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
724 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
725 FIXME("(%p)->(%p)\n", This, p);
726 return E_NOTIMPL;
729 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
731 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
732 FIXME("(%p)->()\n", This);
733 return E_NOTIMPL;
736 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
738 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
739 FIXME("(%p)->(%p)\n", This, p);
740 return E_NOTIMPL;
743 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
745 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
746 FIXME("(%p)->()\n", This);
747 return E_NOTIMPL;
750 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
752 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
753 FIXME("(%p)->(%p)\n", This, p);
754 return E_NOTIMPL;
757 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
759 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
760 FIXME("(%p)->(%d)\n", This, v);
761 return E_NOTIMPL;
764 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
766 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
767 FIXME("(%p)->(%p)\n", This, p);
768 return E_NOTIMPL;
771 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
773 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
774 FIXME("(%p)->(%d)\n", This, v);
775 return E_NOTIMPL;
778 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
780 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
781 FIXME("(%p)->(%p)\n", This, p);
782 return E_NOTIMPL;
785 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
787 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
788 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
789 return E_NOTIMPL;
792 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
794 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
795 FIXME("(%p)->(%p)\n", This, p);
796 return E_NOTIMPL;
799 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
800 HTMLInputElement_QueryInterface,
801 HTMLInputElement_AddRef,
802 HTMLInputElement_Release,
803 HTMLInputElement_GetTypeInfoCount,
804 HTMLInputElement_GetTypeInfo,
805 HTMLInputElement_GetIDsOfNames,
806 HTMLInputElement_Invoke,
807 HTMLInputElement_put_type,
808 HTMLInputElement_get_type,
809 HTMLInputElement_put_value,
810 HTMLInputElement_get_value,
811 HTMLInputElement_put_name,
812 HTMLInputElement_get_name,
813 HTMLInputElement_put_status,
814 HTMLInputElement_get_status,
815 HTMLInputElement_put_disabled,
816 HTMLInputElement_get_disabled,
817 HTMLInputElement_get_form,
818 HTMLInputElement_put_size,
819 HTMLInputElement_get_size,
820 HTMLInputElement_put_maxLength,
821 HTMLInputElement_get_maxLength,
822 HTMLInputElement_select,
823 HTMLInputElement_put_onchange,
824 HTMLInputElement_get_onchange,
825 HTMLInputElement_put_onselect,
826 HTMLInputElement_get_onselect,
827 HTMLInputElement_put_defaultValue,
828 HTMLInputElement_get_defaultValue,
829 HTMLInputElement_put_readOnly,
830 HTMLInputElement_get_readOnly,
831 HTMLInputElement_createTextRange,
832 HTMLInputElement_put_indeterminate,
833 HTMLInputElement_get_indeterminate,
834 HTMLInputElement_put_defaultChecked,
835 HTMLInputElement_get_defaultChecked,
836 HTMLInputElement_put_checked,
837 HTMLInputElement_get_checked,
838 HTMLInputElement_put_border,
839 HTMLInputElement_get_border,
840 HTMLInputElement_put_vspace,
841 HTMLInputElement_get_vspace,
842 HTMLInputElement_put_hspace,
843 HTMLInputElement_get_hspace,
844 HTMLInputElement_put_alt,
845 HTMLInputElement_get_alt,
846 HTMLInputElement_put_src,
847 HTMLInputElement_get_src,
848 HTMLInputElement_put_lowsrc,
849 HTMLInputElement_get_lowsrc,
850 HTMLInputElement_put_vrml,
851 HTMLInputElement_get_vrml,
852 HTMLInputElement_put_dynsrc,
853 HTMLInputElement_get_dynsrc,
854 HTMLInputElement_get_readyState,
855 HTMLInputElement_get_complete,
856 HTMLInputElement_put_loop,
857 HTMLInputElement_get_loop,
858 HTMLInputElement_put_align,
859 HTMLInputElement_get_align,
860 HTMLInputElement_put_onload,
861 HTMLInputElement_get_onload,
862 HTMLInputElement_put_onerror,
863 HTMLInputElement_get_onerror,
864 HTMLInputElement_put_onabort,
865 HTMLInputElement_get_onabort,
866 HTMLInputElement_put_width,
867 HTMLInputElement_get_width,
868 HTMLInputElement_put_height,
869 HTMLInputElement_get_height,
870 HTMLInputElement_put_start,
871 HTMLInputElement_get_start
874 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
875 REFIID riid, void **ppv)
877 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
879 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
882 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
884 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
886 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
889 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
891 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
893 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
896 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
898 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
899 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
902 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
903 LCID lcid, ITypeInfo **ppTInfo)
905 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
906 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
907 ppTInfo);
910 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
911 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
913 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
914 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
915 cNames, lcid, rgDispId);
918 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
919 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
920 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
922 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
923 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
924 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
927 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
929 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
931 TRACE("(%p)->(%p)\n", This, p);
933 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
936 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
938 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
940 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
942 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
945 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
947 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
949 TRACE("(%p)->(%p)\n", This, p);
951 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
954 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
956 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
958 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
960 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
963 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
965 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
967 TRACE("(%p)->(%p)\n", This, p);
969 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
972 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
974 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
975 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
976 return E_NOTIMPL;
979 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
981 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
982 TRACE("(%p)->(%p)\n", This, p);
983 return E_NOTIMPL;
986 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
988 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
990 TRACE("(%p)->(%x)\n", This, v);
992 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
995 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
997 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
999 TRACE("(%p)->(%p)\n", This, p);
1001 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1004 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1006 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1008 TRACE("(%p)->(%p)\n", This, p);
1010 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1013 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1015 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1017 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1019 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1022 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1024 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1026 TRACE("(%p)->(%p)\n", This, p);
1028 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1031 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1033 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1035 TRACE("(%p)->(%d)\n", This, v);
1037 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1040 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1042 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1044 TRACE("(%p)->(%p)\n", This, p);
1046 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1049 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1051 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1053 TRACE("(%p)->(%d)\n", This, v);
1055 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1058 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1060 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1062 TRACE("(%p)->(%p)\n", This, p);
1064 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1067 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1069 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1071 TRACE("(%p)\n", This);
1073 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1076 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1078 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1080 TRACE("(%p)->()\n", This);
1082 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1085 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1087 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1089 TRACE("(%p)->(%p)\n", This, p);
1091 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1094 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1096 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1098 TRACE("(%p)->()\n", This);
1100 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1103 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1105 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1107 TRACE("(%p)->(%p)\n", This, p);
1109 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1112 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1114 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1116 TRACE("(%p)->(%x)\n", This, v);
1118 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1121 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1123 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1125 TRACE("(%p)->(%p)\n", This, p);
1127 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1130 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1132 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1134 TRACE("(%p)->(%p)\n", This, range);
1136 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1139 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1140 HTMLInputTextElement_QueryInterface,
1141 HTMLInputTextElement_AddRef,
1142 HTMLInputTextElement_Release,
1143 HTMLInputTextElement_GetTypeInfoCount,
1144 HTMLInputTextElement_GetTypeInfo,
1145 HTMLInputTextElement_GetIDsOfNames,
1146 HTMLInputTextElement_Invoke,
1147 HTMLInputTextElement_get_type,
1148 HTMLInputTextElement_put_value,
1149 HTMLInputTextElement_get_value,
1150 HTMLInputTextElement_put_name,
1151 HTMLInputTextElement_get_name,
1152 HTMLInputTextElement_put_status,
1153 HTMLInputTextElement_get_status,
1154 HTMLInputTextElement_put_disabled,
1155 HTMLInputTextElement_get_disabled,
1156 HTMLInputTextElement_get_form,
1157 HTMLInputTextElement_put_defaultValue,
1158 HTMLInputTextElement_get_defaultValue,
1159 HTMLInputTextElement_put_size,
1160 HTMLInputTextElement_get_size,
1161 HTMLInputTextElement_put_maxLength,
1162 HTMLInputTextElement_get_maxLength,
1163 HTMLInputTextElement_select,
1164 HTMLInputTextElement_put_onchange,
1165 HTMLInputTextElement_get_onchange,
1166 HTMLInputTextElement_put_onselect,
1167 HTMLInputTextElement_get_onselect,
1168 HTMLInputTextElement_put_readOnly,
1169 HTMLInputTextElement_get_readOnly,
1170 HTMLInputTextElement_createTextRange
1173 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1175 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1178 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1180 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1182 *ppv = NULL;
1184 if(IsEqualGUID(&IID_IUnknown, riid)) {
1185 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1186 *ppv = &This->IHTMLInputElement_iface;
1187 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1188 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1189 *ppv = &This->IHTMLInputElement_iface;
1190 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1191 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1192 *ppv = &This->IHTMLInputElement_iface;
1193 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1194 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1195 *ppv = &This->IHTMLInputTextElement_iface;
1198 if(*ppv) {
1199 IUnknown_AddRef((IUnknown*)*ppv);
1200 return S_OK;
1203 return HTMLElement_QI(&This->element.node, riid, ppv);
1206 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1208 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1210 if(eid == EVENTID_CLICK) {
1211 nsresult nsres;
1213 *handled = TRUE;
1215 nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1216 if(NS_FAILED(nsres)) {
1217 ERR("Click failed: %08x\n", nsres);
1218 return E_FAIL;
1222 return S_OK;
1225 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1227 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1228 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1231 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1233 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1234 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1237 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1238 HTMLInputElement_QI,
1239 HTMLElement_destructor,
1240 HTMLElement_cpc,
1241 HTMLElement_clone,
1242 HTMLElement_handle_event,
1243 HTMLElement_get_attr_col,
1244 NULL,
1245 HTMLInputElementImpl_fire_event,
1246 HTMLInputElementImpl_put_disabled,
1247 HTMLInputElementImpl_get_disabled,
1250 static const tid_t HTMLInputElement_iface_tids[] = {
1251 HTMLELEMENT_TIDS,
1252 IHTMLInputElement_tid,
1255 static dispex_static_data_t HTMLInputElement_dispex = {
1256 NULL,
1257 DispHTMLInputElement_tid,
1258 NULL,
1259 HTMLInputElement_iface_tids
1262 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1264 HTMLInputElement *ret;
1265 nsresult nsres;
1267 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1268 if(!ret)
1269 return E_OUTOFMEMORY;
1271 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1272 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1273 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1275 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1277 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1279 /* Share nsinput reference with nsnode */
1280 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1281 nsIDOMNode_Release(ret->element.node.nsnode);
1283 *elem = &ret->element;
1284 return S_OK;
1287 typedef struct {
1288 HTMLElement element;
1290 IHTMLLabelElement IHTMLLabelElement_iface;
1291 } HTMLLabelElement;
1293 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1295 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1298 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1299 REFIID riid, void **ppv)
1301 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1303 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1306 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1308 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1310 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1313 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1315 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1317 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1320 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1322 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1324 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1327 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1328 LCID lcid, ITypeInfo **ppTInfo)
1330 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1332 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1335 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1336 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1338 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1340 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1341 cNames, lcid, rgDispId);
1344 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1345 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1346 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1348 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1350 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1351 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1354 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1356 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1357 nsAString for_str, val_str;
1358 nsresult nsres;
1360 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1362 nsAString_InitDepend(&for_str, forW);
1363 nsAString_InitDepend(&val_str, v);
1364 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1365 nsAString_Finish(&for_str);
1366 nsAString_Finish(&val_str);
1367 if(NS_FAILED(nsres)) {
1368 ERR("SetAttribute failed: %08x\n", nsres);
1369 return E_FAIL;
1372 return S_OK;
1375 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1377 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1379 TRACE("(%p)->(%p)\n", This, p);
1381 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1384 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1386 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1387 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1388 return E_NOTIMPL;
1391 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1393 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1394 FIXME("(%p)->(%p)\n", This, p);
1395 return E_NOTIMPL;
1398 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1399 HTMLLabelElement_QueryInterface,
1400 HTMLLabelElement_AddRef,
1401 HTMLLabelElement_Release,
1402 HTMLLabelElement_GetTypeInfoCount,
1403 HTMLLabelElement_GetTypeInfo,
1404 HTMLLabelElement_GetIDsOfNames,
1405 HTMLLabelElement_Invoke,
1406 HTMLLabelElement_put_htmlFor,
1407 HTMLLabelElement_get_htmlFor,
1408 HTMLLabelElement_put_accessKey,
1409 HTMLLabelElement_get_accessKey
1412 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1414 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1417 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1419 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1421 *ppv = NULL;
1423 if(IsEqualGUID(&IID_IUnknown, riid)) {
1424 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1425 *ppv = &This->IHTMLLabelElement_iface;
1426 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1427 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1428 *ppv = &This->IHTMLLabelElement_iface;
1429 }else {
1430 return HTMLElement_QI(&This->element.node, riid, ppv);
1433 IUnknown_AddRef((IUnknown*)*ppv);
1434 return S_OK;
1437 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1438 HTMLLabelElement_QI,
1439 HTMLElement_destructor,
1440 HTMLElement_cpc,
1441 HTMLElement_clone,
1442 HTMLElement_handle_event,
1443 HTMLElement_get_attr_col,
1446 static const tid_t HTMLLabelElement_iface_tids[] = {
1447 HTMLELEMENT_TIDS,
1448 IHTMLLabelElement_tid,
1452 static dispex_static_data_t HTMLLabelElement_dispex = {
1453 NULL,
1454 DispHTMLLabelElement_tid,
1455 NULL,
1456 HTMLLabelElement_iface_tids
1459 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1461 HTMLLabelElement *ret;
1463 ret = heap_alloc_zero(sizeof(*ret));
1464 if(!ret)
1465 return E_OUTOFMEMORY;
1467 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1468 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1470 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1471 *elem = &ret->element;
1472 return S_OK;
1475 typedef struct {
1476 HTMLElement element;
1478 IHTMLButtonElement IHTMLButtonElement_iface;
1480 nsIDOMHTMLButtonElement *nsbutton;
1481 } HTMLButtonElement;
1483 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1485 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1488 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1489 REFIID riid, void **ppv)
1491 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1493 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1496 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1498 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1500 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1503 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1505 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1507 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1510 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1512 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1514 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1517 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1518 LCID lcid, ITypeInfo **ppTInfo)
1520 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1522 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1525 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1526 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1528 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1530 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1531 cNames, lcid, rgDispId);
1534 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1535 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1536 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1538 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1540 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1541 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1544 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1546 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1547 FIXME("(%p)->(%p)\n", This, p);
1548 return E_NOTIMPL;
1551 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1553 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1554 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1555 return E_NOTIMPL;
1558 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1560 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1561 FIXME("(%p)->(%p)\n", This, p);
1562 return E_NOTIMPL;
1565 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1567 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1568 nsAString name_str;
1569 nsresult nsres;
1571 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1573 nsAString_InitDepend(&name_str, v);
1574 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1575 nsAString_Finish(&name_str);
1576 if(NS_FAILED(nsres)) {
1577 ERR("SetName failed: %08x\n", nsres);
1578 return E_FAIL;
1581 return S_OK;
1584 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1586 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1587 nsAString name_str;
1588 nsresult nsres;
1590 TRACE("(%p)->(%p)\n", This, p);
1592 nsAString_Init(&name_str, NULL);
1593 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1594 return return_nsstr(nsres, &name_str, p);
1597 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1599 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1600 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1601 return E_NOTIMPL;
1604 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1606 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1607 FIXME("(%p)->(%p)\n", This, p);
1608 return E_NOTIMPL;
1611 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1613 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1614 nsresult nsres;
1616 TRACE("(%p)->(%x)\n", This, v);
1618 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1619 if(NS_FAILED(nsres)) {
1620 ERR("SetDisabled failed: %08x\n", nsres);
1621 return E_FAIL;
1624 return S_OK;
1627 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1629 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1630 cpp_bool disabled;
1631 nsresult nsres;
1633 TRACE("(%p)->(%p)\n", This, p);
1635 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1636 if(NS_FAILED(nsres)) {
1637 ERR("GetDisabled failed: %08x\n", nsres);
1638 return E_FAIL;
1641 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1642 return S_OK;
1645 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1647 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1648 FIXME("(%p)->(%p)\n", This, p);
1649 return E_NOTIMPL;
1652 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1654 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1655 FIXME("(%p)->(%p)\n", This, range);
1656 return E_NOTIMPL;
1659 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1660 HTMLButtonElement_QueryInterface,
1661 HTMLButtonElement_AddRef,
1662 HTMLButtonElement_Release,
1663 HTMLButtonElement_GetTypeInfoCount,
1664 HTMLButtonElement_GetTypeInfo,
1665 HTMLButtonElement_GetIDsOfNames,
1666 HTMLButtonElement_Invoke,
1667 HTMLButtonElement_get_type,
1668 HTMLButtonElement_put_value,
1669 HTMLButtonElement_get_value,
1670 HTMLButtonElement_put_name,
1671 HTMLButtonElement_get_name,
1672 HTMLButtonElement_put_status,
1673 HTMLButtonElement_get_status,
1674 HTMLButtonElement_put_disabled,
1675 HTMLButtonElement_get_disabled,
1676 HTMLButtonElement_get_form,
1677 HTMLButtonElement_createTextRange
1680 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1682 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1685 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1687 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1689 *ppv = NULL;
1691 if(IsEqualGUID(&IID_IUnknown, riid)) {
1692 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1693 *ppv = &This->IHTMLButtonElement_iface;
1694 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1695 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1696 *ppv = &This->IHTMLButtonElement_iface;
1697 }else {
1698 return HTMLElement_QI(&This->element.node, riid, ppv);
1701 IUnknown_AddRef((IUnknown*)*ppv);
1702 return S_OK;
1705 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1707 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1708 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1711 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1713 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1714 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1717 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1718 HTMLButtonElement_QI,
1719 HTMLElement_destructor,
1720 HTMLElement_cpc,
1721 HTMLElement_clone,
1722 HTMLElement_handle_event,
1723 HTMLElement_get_attr_col,
1724 NULL,
1725 NULL,
1726 HTMLButtonElementImpl_put_disabled,
1727 HTMLButtonElementImpl_get_disabled
1730 static const tid_t HTMLButtonElement_iface_tids[] = {
1731 HTMLELEMENT_TIDS,
1732 IHTMLButtonElement_tid,
1736 static dispex_static_data_t HTMLButtonElement_dispex = {
1737 NULL,
1738 DispHTMLButtonElement_tid,
1739 NULL,
1740 HTMLButtonElement_iface_tids
1743 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1745 HTMLButtonElement *ret;
1746 nsresult nsres;
1748 ret = heap_alloc_zero(sizeof(*ret));
1749 if(!ret)
1750 return E_OUTOFMEMORY;
1752 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1753 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1755 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1757 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1759 /* Share nsbutton reference with nsnode */
1760 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsbutton == ret->element.node.nsnode);
1761 nsIDOMNode_Release(ret->element.node.nsnode);
1763 *elem = &ret->element;
1764 return S_OK;