mshtml: Added IHTMLMetaElement::charset property implementation.
[wine.git] / dlls / mshtml / htmlinput.c
blobf832b8829bac53a832d4e3f856fc7e434997a288
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 FIXME("(%p)->(%d)\n", This, v);
266 return E_NOTIMPL;
269 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
271 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
272 FIXME("(%p)->(%p)\n", This, p);
273 return E_NOTIMPL;
276 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
278 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
279 nsresult nsres;
281 TRACE("(%p)->(%d)\n", This, v);
283 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
284 if(NS_FAILED(nsres)) {
285 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
286 FIXME("SetMaxLength failed\n");
287 return E_FAIL;
290 return S_OK;
293 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
295 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
296 LONG max_length;
297 nsresult nsres;
299 TRACE("(%p)->(%p)\n", This, p);
301 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
302 assert(nsres == NS_OK);
304 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
305 *p = max_length == -1 ? INT_MAX : max_length;
306 return S_OK;
309 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
311 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
312 nsresult nsres;
314 TRACE("(%p)\n", This);
316 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
317 if(NS_FAILED(nsres)) {
318 ERR("Select failed: %08x\n", nsres);
319 return E_FAIL;
322 return S_OK;
325 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
327 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
329 TRACE("(%p)->()\n", This);
331 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
334 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
336 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
338 TRACE("(%p)->(%p)\n", This, p);
340 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
343 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
345 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
346 FIXME("(%p)->()\n", This);
347 return E_NOTIMPL;
350 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
352 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
353 FIXME("(%p)->(%p)\n", This, p);
354 return E_NOTIMPL;
357 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
359 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
360 nsAString nsstr;
361 nsresult nsres;
363 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
365 nsAString_InitDepend(&nsstr, v);
366 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
367 nsAString_Finish(&nsstr);
368 if(NS_FAILED(nsres)) {
369 ERR("SetValue failed: %08x\n", nsres);
370 return E_FAIL;
373 return S_OK;
376 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
378 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
379 nsAString nsstr;
380 nsresult nsres;
382 TRACE("(%p)->(%p)\n", This, p);
384 nsAString_Init(&nsstr, NULL);
385 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
386 return return_nsstr(nsres, &nsstr, p);
389 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
391 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
392 FIXME("(%p)->(%x)\n", This, v);
393 return E_NOTIMPL;
396 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
398 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
399 FIXME("(%p)->(%p)\n", This, p);
400 return E_NOTIMPL;
403 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
405 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
406 FIXME("(%p)->(%p)\n", This, range);
407 return E_NOTIMPL;
410 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
412 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
413 FIXME("(%p)->(%x)\n", This, v);
414 return E_NOTIMPL;
417 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
419 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
420 FIXME("(%p)->(%p)\n", This, p);
421 return E_NOTIMPL;
424 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
426 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
427 nsresult nsres;
429 TRACE("(%p)->(%x)\n", This, v);
431 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
432 if(NS_FAILED(nsres)) {
433 ERR("SetDefaultChecked failed: %08x\n", nsres);
434 return E_FAIL;
437 return S_OK;
440 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
442 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
443 cpp_bool default_checked = FALSE;
444 nsresult nsres;
446 TRACE("(%p)->(%p)\n", This, p);
448 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
449 if(NS_FAILED(nsres)) {
450 ERR("GetDefaultChecked failed: %08x\n", nsres);
451 return E_FAIL;
454 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
455 return S_OK;
458 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
460 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
461 nsresult nsres;
463 TRACE("(%p)->(%x)\n", This, v);
465 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
466 if(NS_FAILED(nsres)) {
467 ERR("SetChecked failed: %08x\n", nsres);
468 return E_FAIL;
471 return S_OK;
474 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
476 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
477 cpp_bool checked;
478 nsresult nsres;
480 TRACE("(%p)->(%p)\n", This, p);
482 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
483 if(NS_FAILED(nsres)) {
484 ERR("GetChecked failed: %08x\n", nsres);
485 return E_FAIL;
488 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
489 TRACE("checked=%x\n", *p);
490 return S_OK;
493 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
495 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
496 FIXME("(%p)->()\n", This);
497 return E_NOTIMPL;
500 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
502 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
503 FIXME("(%p)->(%p)\n", This, p);
504 return E_NOTIMPL;
507 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
509 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
510 FIXME("(%p)->(%d)\n", This, v);
511 return E_NOTIMPL;
514 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
516 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
517 FIXME("(%p)->(%p)\n", This, p);
518 return E_NOTIMPL;
521 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
523 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
524 FIXME("(%p)->(%d)\n", This, v);
525 return E_NOTIMPL;
528 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
530 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
531 FIXME("(%p)->(%p)\n", This, p);
532 return E_NOTIMPL;
535 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
537 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
538 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
539 return E_NOTIMPL;
542 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
544 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
545 FIXME("(%p)->(%p)\n", This, p);
546 return E_NOTIMPL;
549 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
551 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
552 nsAString nsstr;
553 nsresult nsres;
555 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
557 nsAString_InitDepend(&nsstr, v);
558 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
559 nsAString_Finish(&nsstr);
560 if(NS_FAILED(nsres))
561 ERR("SetSrc failed: %08x\n", nsres);
563 return S_OK;
566 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
568 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
569 const PRUnichar *src;
570 nsAString src_str;
571 nsresult nsres;
572 HRESULT hres;
574 TRACE("(%p)->(%p)\n", This, p);
576 nsAString_Init(&src_str, NULL);
577 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
578 if(NS_FAILED(nsres)) {
579 ERR("GetSrc failed: %08x\n", nsres);
580 return E_FAIL;
583 nsAString_GetData(&src_str, &src);
584 hres = nsuri_to_url(src, FALSE, p);
585 nsAString_Finish(&src_str);
587 return hres;
590 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
592 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
593 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
599 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
600 FIXME("(%p)->(%p)\n", This, p);
601 return E_NOTIMPL;
604 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
606 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
607 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
608 return E_NOTIMPL;
611 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
613 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
614 FIXME("(%p)->(%p)\n", This, p);
615 return E_NOTIMPL;
618 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
620 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
621 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
622 return E_NOTIMPL;
625 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
627 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
628 FIXME("(%p)->(%p)\n", This, p);
629 return E_NOTIMPL;
632 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
634 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
635 FIXME("(%p)->(%p)\n", This, p);
636 return E_NOTIMPL;
639 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
641 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
642 FIXME("(%p)->(%p)\n", This, p);
643 return E_NOTIMPL;
646 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
648 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
649 FIXME("(%p)->()\n", This);
650 return E_NOTIMPL;
653 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
655 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
656 FIXME("(%p)->(%p)\n", This, p);
657 return E_NOTIMPL;
660 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
662 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
663 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
664 return E_NOTIMPL;
667 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
669 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
670 FIXME("(%p)->(%p)\n", This, p);
671 return E_NOTIMPL;
674 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
676 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
677 FIXME("(%p)->()\n", This);
678 return E_NOTIMPL;
681 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
683 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
684 FIXME("(%p)->(%p)\n", This, p);
685 return E_NOTIMPL;
688 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
690 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
691 FIXME("(%p)->()\n", This);
692 return E_NOTIMPL;
695 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
697 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
698 FIXME("(%p)->(%p)\n", This, p);
699 return E_NOTIMPL;
702 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
704 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
705 FIXME("(%p)->()\n", This);
706 return E_NOTIMPL;
709 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
711 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
712 FIXME("(%p)->(%p)\n", This, p);
713 return E_NOTIMPL;
716 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
718 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
719 FIXME("(%p)->(%d)\n", This, v);
720 return E_NOTIMPL;
723 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
725 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
726 FIXME("(%p)->(%p)\n", This, p);
727 return E_NOTIMPL;
730 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
732 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
733 FIXME("(%p)->(%d)\n", This, v);
734 return E_NOTIMPL;
737 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
739 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
740 FIXME("(%p)->(%p)\n", This, p);
741 return E_NOTIMPL;
744 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
746 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
747 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
748 return E_NOTIMPL;
751 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
753 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
754 FIXME("(%p)->(%p)\n", This, p);
755 return E_NOTIMPL;
758 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
759 HTMLInputElement_QueryInterface,
760 HTMLInputElement_AddRef,
761 HTMLInputElement_Release,
762 HTMLInputElement_GetTypeInfoCount,
763 HTMLInputElement_GetTypeInfo,
764 HTMLInputElement_GetIDsOfNames,
765 HTMLInputElement_Invoke,
766 HTMLInputElement_put_type,
767 HTMLInputElement_get_type,
768 HTMLInputElement_put_value,
769 HTMLInputElement_get_value,
770 HTMLInputElement_put_name,
771 HTMLInputElement_get_name,
772 HTMLInputElement_put_status,
773 HTMLInputElement_get_status,
774 HTMLInputElement_put_disabled,
775 HTMLInputElement_get_disabled,
776 HTMLInputElement_get_form,
777 HTMLInputElement_put_size,
778 HTMLInputElement_get_size,
779 HTMLInputElement_put_maxLength,
780 HTMLInputElement_get_maxLength,
781 HTMLInputElement_select,
782 HTMLInputElement_put_onchange,
783 HTMLInputElement_get_onchange,
784 HTMLInputElement_put_onselect,
785 HTMLInputElement_get_onselect,
786 HTMLInputElement_put_defaultValue,
787 HTMLInputElement_get_defaultValue,
788 HTMLInputElement_put_readOnly,
789 HTMLInputElement_get_readOnly,
790 HTMLInputElement_createTextRange,
791 HTMLInputElement_put_indeterminate,
792 HTMLInputElement_get_indeterminate,
793 HTMLInputElement_put_defaultChecked,
794 HTMLInputElement_get_defaultChecked,
795 HTMLInputElement_put_checked,
796 HTMLInputElement_get_checked,
797 HTMLInputElement_put_border,
798 HTMLInputElement_get_border,
799 HTMLInputElement_put_vspace,
800 HTMLInputElement_get_vspace,
801 HTMLInputElement_put_hspace,
802 HTMLInputElement_get_hspace,
803 HTMLInputElement_put_alt,
804 HTMLInputElement_get_alt,
805 HTMLInputElement_put_src,
806 HTMLInputElement_get_src,
807 HTMLInputElement_put_lowsrc,
808 HTMLInputElement_get_lowsrc,
809 HTMLInputElement_put_vrml,
810 HTMLInputElement_get_vrml,
811 HTMLInputElement_put_dynsrc,
812 HTMLInputElement_get_dynsrc,
813 HTMLInputElement_get_readyState,
814 HTMLInputElement_get_complete,
815 HTMLInputElement_put_loop,
816 HTMLInputElement_get_loop,
817 HTMLInputElement_put_align,
818 HTMLInputElement_get_align,
819 HTMLInputElement_put_onload,
820 HTMLInputElement_get_onload,
821 HTMLInputElement_put_onerror,
822 HTMLInputElement_get_onerror,
823 HTMLInputElement_put_onabort,
824 HTMLInputElement_get_onabort,
825 HTMLInputElement_put_width,
826 HTMLInputElement_get_width,
827 HTMLInputElement_put_height,
828 HTMLInputElement_get_height,
829 HTMLInputElement_put_start,
830 HTMLInputElement_get_start
833 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
834 REFIID riid, void **ppv)
836 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
838 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
841 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
843 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
845 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
848 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
850 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
852 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
855 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
857 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
858 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
861 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
862 LCID lcid, ITypeInfo **ppTInfo)
864 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
865 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
866 ppTInfo);
869 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
870 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
872 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
873 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
874 cNames, lcid, rgDispId);
877 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
878 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
879 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
881 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
882 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
883 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
886 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
888 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
890 TRACE("(%p)->(%p)\n", This, p);
892 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
895 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
897 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
899 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
901 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
904 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
906 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
908 TRACE("(%p)->(%p)\n", This, p);
910 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
913 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
915 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
917 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
919 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
922 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
924 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
926 TRACE("(%p)->(%p)\n", This, p);
928 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
931 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
933 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
934 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
935 return E_NOTIMPL;
938 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
940 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
941 TRACE("(%p)->(%p)\n", This, p);
942 return E_NOTIMPL;
945 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
947 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
949 TRACE("(%p)->(%x)\n", This, v);
951 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
954 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
956 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
958 TRACE("(%p)->(%p)\n", This, p);
960 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
963 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
965 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
967 TRACE("(%p)->(%p)\n", This, p);
969 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
972 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
974 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
976 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
978 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
981 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
983 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
985 TRACE("(%p)->(%p)\n", This, p);
987 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
990 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
992 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
994 TRACE("(%p)->(%d)\n", This, v);
996 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
999 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1001 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1003 TRACE("(%p)->(%p)\n", This, p);
1005 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1008 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1010 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1012 TRACE("(%p)->(%d)\n", This, v);
1014 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1017 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1019 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1021 TRACE("(%p)->(%p)\n", This, p);
1023 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1026 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1028 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1030 TRACE("(%p)\n", This);
1032 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1035 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1037 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1039 TRACE("(%p)->()\n", This);
1041 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1044 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1046 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1048 TRACE("(%p)->(%p)\n", This, p);
1050 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1053 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1055 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1057 TRACE("(%p)->()\n", This);
1059 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1062 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1064 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1066 TRACE("(%p)->(%p)\n", This, p);
1068 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1071 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1073 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1075 TRACE("(%p)->(%x)\n", This, v);
1077 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1080 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1082 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1084 TRACE("(%p)->(%p)\n", This, p);
1086 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1089 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1091 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1093 TRACE("(%p)->(%p)\n", This, range);
1095 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1098 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1099 HTMLInputTextElement_QueryInterface,
1100 HTMLInputTextElement_AddRef,
1101 HTMLInputTextElement_Release,
1102 HTMLInputTextElement_GetTypeInfoCount,
1103 HTMLInputTextElement_GetTypeInfo,
1104 HTMLInputTextElement_GetIDsOfNames,
1105 HTMLInputTextElement_Invoke,
1106 HTMLInputTextElement_get_type,
1107 HTMLInputTextElement_put_value,
1108 HTMLInputTextElement_get_value,
1109 HTMLInputTextElement_put_name,
1110 HTMLInputTextElement_get_name,
1111 HTMLInputTextElement_put_status,
1112 HTMLInputTextElement_get_status,
1113 HTMLInputTextElement_put_disabled,
1114 HTMLInputTextElement_get_disabled,
1115 HTMLInputTextElement_get_form,
1116 HTMLInputTextElement_put_defaultValue,
1117 HTMLInputTextElement_get_defaultValue,
1118 HTMLInputTextElement_put_size,
1119 HTMLInputTextElement_get_size,
1120 HTMLInputTextElement_put_maxLength,
1121 HTMLInputTextElement_get_maxLength,
1122 HTMLInputTextElement_select,
1123 HTMLInputTextElement_put_onchange,
1124 HTMLInputTextElement_get_onchange,
1125 HTMLInputTextElement_put_onselect,
1126 HTMLInputTextElement_get_onselect,
1127 HTMLInputTextElement_put_readOnly,
1128 HTMLInputTextElement_get_readOnly,
1129 HTMLInputTextElement_createTextRange
1132 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1134 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1137 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1139 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1141 *ppv = NULL;
1143 if(IsEqualGUID(&IID_IUnknown, riid)) {
1144 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1145 *ppv = &This->IHTMLInputElement_iface;
1146 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1147 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1148 *ppv = &This->IHTMLInputElement_iface;
1149 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1150 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1151 *ppv = &This->IHTMLInputElement_iface;
1152 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1153 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1154 *ppv = &This->IHTMLInputTextElement_iface;
1157 if(*ppv) {
1158 IUnknown_AddRef((IUnknown*)*ppv);
1159 return S_OK;
1162 return HTMLElement_QI(&This->element.node, riid, ppv);
1165 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1167 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1169 if(eid == EVENTID_CLICK) {
1170 nsresult nsres;
1172 *handled = TRUE;
1174 nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1175 if(NS_FAILED(nsres)) {
1176 ERR("Click failed: %08x\n", nsres);
1177 return E_FAIL;
1181 return S_OK;
1184 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1186 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1187 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1190 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1192 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1193 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1196 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1197 HTMLInputElement_QI,
1198 HTMLElement_destructor,
1199 HTMLElement_cpc,
1200 HTMLElement_clone,
1201 HTMLElement_handle_event,
1202 HTMLElement_get_attr_col,
1203 NULL,
1204 HTMLInputElementImpl_fire_event,
1205 HTMLInputElementImpl_put_disabled,
1206 HTMLInputElementImpl_get_disabled,
1209 static const tid_t HTMLInputElement_iface_tids[] = {
1210 HTMLELEMENT_TIDS,
1211 IHTMLInputElement_tid,
1214 static dispex_static_data_t HTMLInputElement_dispex = {
1215 NULL,
1216 DispHTMLInputElement_tid,
1217 NULL,
1218 HTMLInputElement_iface_tids
1221 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1223 HTMLInputElement *ret;
1224 nsresult nsres;
1226 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1227 if(!ret)
1228 return E_OUTOFMEMORY;
1230 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1231 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1232 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1234 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1236 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1238 /* Share nsinput reference with nsnode */
1239 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1240 nsIDOMNode_Release(ret->element.node.nsnode);
1242 *elem = &ret->element;
1243 return S_OK;
1246 typedef struct {
1247 HTMLElement element;
1249 IHTMLLabelElement IHTMLLabelElement_iface;
1250 } HTMLLabelElement;
1252 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1254 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1257 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1258 REFIID riid, void **ppv)
1260 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1262 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1265 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1267 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1269 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1272 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1274 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1276 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1279 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1281 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1283 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1286 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1287 LCID lcid, ITypeInfo **ppTInfo)
1289 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1291 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1294 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1295 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1297 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1299 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1300 cNames, lcid, rgDispId);
1303 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1304 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1305 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1307 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1309 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1310 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1313 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1315 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1316 nsAString for_str, val_str;
1317 nsresult nsres;
1319 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1321 nsAString_InitDepend(&for_str, forW);
1322 nsAString_InitDepend(&val_str, v);
1323 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1324 nsAString_Finish(&for_str);
1325 nsAString_Finish(&val_str);
1326 if(NS_FAILED(nsres)) {
1327 ERR("SetAttribute failed: %08x\n", nsres);
1328 return E_FAIL;
1331 return S_OK;
1334 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1336 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1338 TRACE("(%p)->(%p)\n", This, p);
1340 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1343 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1345 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1346 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1347 return E_NOTIMPL;
1350 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1352 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1353 FIXME("(%p)->(%p)\n", This, p);
1354 return E_NOTIMPL;
1357 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1358 HTMLLabelElement_QueryInterface,
1359 HTMLLabelElement_AddRef,
1360 HTMLLabelElement_Release,
1361 HTMLLabelElement_GetTypeInfoCount,
1362 HTMLLabelElement_GetTypeInfo,
1363 HTMLLabelElement_GetIDsOfNames,
1364 HTMLLabelElement_Invoke,
1365 HTMLLabelElement_put_htmlFor,
1366 HTMLLabelElement_get_htmlFor,
1367 HTMLLabelElement_put_accessKey,
1368 HTMLLabelElement_get_accessKey
1371 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1373 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1376 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1378 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1380 *ppv = NULL;
1382 if(IsEqualGUID(&IID_IUnknown, riid)) {
1383 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1384 *ppv = &This->IHTMLLabelElement_iface;
1385 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1386 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1387 *ppv = &This->IHTMLLabelElement_iface;
1388 }else {
1389 return HTMLElement_QI(&This->element.node, riid, ppv);
1392 IUnknown_AddRef((IUnknown*)*ppv);
1393 return S_OK;
1396 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1397 HTMLLabelElement_QI,
1398 HTMLElement_destructor,
1399 HTMLElement_cpc,
1400 HTMLElement_clone,
1401 HTMLElement_handle_event,
1402 HTMLElement_get_attr_col,
1405 static const tid_t HTMLLabelElement_iface_tids[] = {
1406 HTMLELEMENT_TIDS,
1407 IHTMLLabelElement_tid,
1411 static dispex_static_data_t HTMLLabelElement_dispex = {
1412 NULL,
1413 DispHTMLLabelElement_tid,
1414 NULL,
1415 HTMLLabelElement_iface_tids
1418 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1420 HTMLLabelElement *ret;
1422 ret = heap_alloc_zero(sizeof(*ret));
1423 if(!ret)
1424 return E_OUTOFMEMORY;
1426 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1427 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1429 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1430 *elem = &ret->element;
1431 return S_OK;
1434 typedef struct {
1435 HTMLElement element;
1437 IHTMLButtonElement IHTMLButtonElement_iface;
1439 nsIDOMHTMLButtonElement *nsbutton;
1440 } HTMLButtonElement;
1442 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1444 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1447 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1448 REFIID riid, void **ppv)
1450 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1452 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1455 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1457 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1459 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1462 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1464 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1466 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1469 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1471 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1473 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1476 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1477 LCID lcid, ITypeInfo **ppTInfo)
1479 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1481 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1484 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1485 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1487 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1489 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1490 cNames, lcid, rgDispId);
1493 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1494 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1495 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1497 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1499 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1500 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1503 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1505 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1506 FIXME("(%p)->(%p)\n", This, p);
1507 return E_NOTIMPL;
1510 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1512 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1513 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1514 return E_NOTIMPL;
1517 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1519 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1520 FIXME("(%p)->(%p)\n", This, p);
1521 return E_NOTIMPL;
1524 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1526 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1527 nsAString name_str;
1528 nsresult nsres;
1530 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1532 nsAString_InitDepend(&name_str, v);
1533 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1534 nsAString_Finish(&name_str);
1535 if(NS_FAILED(nsres)) {
1536 ERR("SetName failed: %08x\n", nsres);
1537 return E_FAIL;
1540 return S_OK;
1543 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1545 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1546 nsAString name_str;
1547 nsresult nsres;
1549 TRACE("(%p)->(%p)\n", This, p);
1551 nsAString_Init(&name_str, NULL);
1552 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1553 return return_nsstr(nsres, &name_str, p);
1556 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1558 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1559 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1560 return E_NOTIMPL;
1563 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1565 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1566 FIXME("(%p)->(%p)\n", This, p);
1567 return E_NOTIMPL;
1570 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1572 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1573 nsresult nsres;
1575 TRACE("(%p)->(%x)\n", This, v);
1577 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1578 if(NS_FAILED(nsres)) {
1579 ERR("SetDisabled failed: %08x\n", nsres);
1580 return E_FAIL;
1583 return S_OK;
1586 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1588 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1589 cpp_bool disabled;
1590 nsresult nsres;
1592 TRACE("(%p)->(%p)\n", This, p);
1594 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1595 if(NS_FAILED(nsres)) {
1596 ERR("GetDisabled failed: %08x\n", nsres);
1597 return E_FAIL;
1600 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1601 return S_OK;
1604 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1606 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1607 FIXME("(%p)->(%p)\n", This, p);
1608 return E_NOTIMPL;
1611 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1613 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1614 FIXME("(%p)->(%p)\n", This, range);
1615 return E_NOTIMPL;
1618 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1619 HTMLButtonElement_QueryInterface,
1620 HTMLButtonElement_AddRef,
1621 HTMLButtonElement_Release,
1622 HTMLButtonElement_GetTypeInfoCount,
1623 HTMLButtonElement_GetTypeInfo,
1624 HTMLButtonElement_GetIDsOfNames,
1625 HTMLButtonElement_Invoke,
1626 HTMLButtonElement_get_type,
1627 HTMLButtonElement_put_value,
1628 HTMLButtonElement_get_value,
1629 HTMLButtonElement_put_name,
1630 HTMLButtonElement_get_name,
1631 HTMLButtonElement_put_status,
1632 HTMLButtonElement_get_status,
1633 HTMLButtonElement_put_disabled,
1634 HTMLButtonElement_get_disabled,
1635 HTMLButtonElement_get_form,
1636 HTMLButtonElement_createTextRange
1639 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1641 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1644 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1646 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1648 *ppv = NULL;
1650 if(IsEqualGUID(&IID_IUnknown, riid)) {
1651 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1652 *ppv = &This->IHTMLButtonElement_iface;
1653 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1654 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1655 *ppv = &This->IHTMLButtonElement_iface;
1656 }else {
1657 return HTMLElement_QI(&This->element.node, riid, ppv);
1660 IUnknown_AddRef((IUnknown*)*ppv);
1661 return S_OK;
1664 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1666 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1667 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1670 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1672 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1673 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1676 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1677 HTMLButtonElement_QI,
1678 HTMLElement_destructor,
1679 HTMLElement_cpc,
1680 HTMLElement_clone,
1681 HTMLElement_handle_event,
1682 HTMLElement_get_attr_col,
1683 NULL,
1684 NULL,
1685 HTMLButtonElementImpl_put_disabled,
1686 HTMLButtonElementImpl_get_disabled
1689 static const tid_t HTMLButtonElement_iface_tids[] = {
1690 HTMLELEMENT_TIDS,
1691 IHTMLButtonElement_tid,
1695 static dispex_static_data_t HTMLButtonElement_dispex = {
1696 NULL,
1697 DispHTMLButtonElement_tid,
1698 NULL,
1699 HTMLButtonElement_iface_tids
1702 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1704 HTMLButtonElement *ret;
1705 nsresult nsres;
1707 ret = heap_alloc_zero(sizeof(*ret));
1708 if(!ret)
1709 return E_OUTOFMEMORY;
1711 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1712 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1714 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1716 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1718 /* Share nsbutton reference with nsnode */
1719 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsbutton == ret->element.node.nsnode);
1720 nsIDOMNode_Release(ret->element.node.nsnode);
1722 *elem = &ret->element;
1723 return S_OK;