msxml3: CDATA nodes can't have children.
[wine.git] / dlls / mshtml / htmlinput.c
blobc660ca85f1769fcbc7a1d148ef32cb60c47c9b0f
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 inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
48 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
51 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
53 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
56 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
57 REFIID riid, void **ppv)
59 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
61 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
64 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
66 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
68 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
71 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
73 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
75 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
78 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
80 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
82 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
85 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
86 LCID lcid, ITypeInfo **ppTInfo)
88 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
90 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
91 ppTInfo);
94 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
95 LPOLESTR *rgszNames, UINT cNames,
96 LCID lcid, DISPID *rgDispId)
98 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
100 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
101 cNames, lcid, rgDispId);
104 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
105 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
106 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
108 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
110 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
111 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
114 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
116 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
117 nsAString type_str;
118 nsresult nsres;
120 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
123 * FIXME:
124 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
126 nsAString_InitDepend(&type_str, v);
127 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
128 nsAString_Finish(&type_str);
129 if(NS_FAILED(nsres)) {
130 ERR("SetType failed: %08x\n", nsres);
131 return E_FAIL;
134 return S_OK;
137 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
139 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
140 nsAString type_str;
141 nsresult nsres;
143 TRACE("(%p)->(%p)\n", This, p);
145 nsAString_Init(&type_str, NULL);
146 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
147 return return_nsstr(nsres, &type_str, p);
150 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
152 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
153 nsAString val_str;
154 nsresult nsres;
156 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
158 nsAString_InitDepend(&val_str, v);
159 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
160 nsAString_Finish(&val_str);
161 if(NS_FAILED(nsres))
162 ERR("SetValue failed: %08x\n", nsres);
164 return S_OK;
167 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
169 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
170 nsAString value_str;
171 nsresult nsres;
173 TRACE("(%p)->(%p)\n", This, p);
175 nsAString_Init(&value_str, NULL);
176 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
177 return return_nsstr(nsres, &value_str, p);
180 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
182 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
183 nsAString name_str;
184 nsresult nsres;
186 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
188 nsAString_InitDepend(&name_str, v);
189 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
190 nsAString_Finish(&name_str);
191 if(NS_FAILED(nsres)) {
192 ERR("SetName failed: %08x\n", nsres);
193 return E_FAIL;
196 return S_OK;
199 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
201 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
202 nsAString name_str;
203 nsresult nsres;
205 TRACE("(%p)->(%p)\n", This, p);
207 nsAString_Init(&name_str, NULL);
208 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
209 return return_nsstr(nsres, &name_str, p);
212 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
214 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
215 FIXME("(%p)->(%x)\n", This, v);
216 return E_NOTIMPL;
219 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
221 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
222 FIXME("(%p)->(%p)\n", This, p);
223 return E_NOTIMPL;
226 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
228 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
229 nsresult nsres;
231 TRACE("(%p)->(%x)\n", This, v);
233 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
234 if(NS_FAILED(nsres))
235 ERR("SetDisabled failed: %08x\n", nsres);
237 return S_OK;
240 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
242 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
243 cpp_bool disabled = FALSE;
245 TRACE("(%p)->(%p)\n", This, p);
247 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
249 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
250 return S_OK;
253 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
255 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
256 FIXME("(%p)->(%p)\n", This, p);
257 return E_NOTIMPL;
260 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
262 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
263 FIXME("(%p)->(%d)\n", This, v);
264 return E_NOTIMPL;
267 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
269 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
270 FIXME("(%p)->(%p)\n", This, p);
271 return E_NOTIMPL;
274 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
276 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
277 nsresult nsres;
279 TRACE("(%p)->(%d)\n", This, v);
281 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
282 if(NS_FAILED(nsres)) {
283 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
284 FIXME("SetMaxLength failed\n");
285 return E_FAIL;
288 return S_OK;
291 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
293 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
294 LONG max_length;
295 nsresult nsres;
297 TRACE("(%p)->(%p)\n", This, p);
299 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
300 assert(nsres == NS_OK);
302 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
303 *p = max_length == -1 ? INT_MAX : max_length;
304 return S_OK;
307 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
309 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
310 nsresult nsres;
312 TRACE("(%p)\n", This);
314 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
315 if(NS_FAILED(nsres)) {
316 ERR("Select failed: %08x\n", nsres);
317 return E_FAIL;
320 return S_OK;
323 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
325 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
327 TRACE("(%p)->()\n", This);
329 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
332 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
334 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
336 TRACE("(%p)->(%p)\n", This, p);
338 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
341 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
343 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
344 FIXME("(%p)->()\n", This);
345 return E_NOTIMPL;
348 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
350 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
351 FIXME("(%p)->(%p)\n", This, p);
352 return E_NOTIMPL;
355 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
357 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
358 nsAString nsstr;
359 nsresult nsres;
361 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
363 nsAString_InitDepend(&nsstr, v);
364 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
365 nsAString_Finish(&nsstr);
366 if(NS_FAILED(nsres)) {
367 ERR("SetValue failed: %08x\n", nsres);
368 return E_FAIL;
371 return S_OK;
374 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
376 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
377 nsAString nsstr;
378 nsresult nsres;
380 TRACE("(%p)->(%p)\n", This, p);
382 nsAString_Init(&nsstr, NULL);
383 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
384 return return_nsstr(nsres, &nsstr, p);
387 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
389 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
390 FIXME("(%p)->(%x)\n", This, v);
391 return E_NOTIMPL;
394 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
396 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
397 FIXME("(%p)->(%p)\n", This, p);
398 return E_NOTIMPL;
401 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
403 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
404 FIXME("(%p)->(%p)\n", This, range);
405 return E_NOTIMPL;
408 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
410 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
411 FIXME("(%p)->(%x)\n", This, v);
412 return E_NOTIMPL;
415 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
417 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
418 FIXME("(%p)->(%p)\n", This, p);
419 return E_NOTIMPL;
422 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
424 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
425 nsresult nsres;
427 TRACE("(%p)->(%x)\n", This, v);
429 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
430 if(NS_FAILED(nsres)) {
431 ERR("SetDefaultChecked failed: %08x\n", nsres);
432 return E_FAIL;
435 return S_OK;
438 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
440 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
441 cpp_bool default_checked = FALSE;
442 nsresult nsres;
444 TRACE("(%p)->(%p)\n", This, p);
446 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
447 if(NS_FAILED(nsres)) {
448 ERR("GetDefaultChecked failed: %08x\n", nsres);
449 return E_FAIL;
452 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
453 return S_OK;
456 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
458 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
459 nsresult nsres;
461 TRACE("(%p)->(%x)\n", This, v);
463 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
464 if(NS_FAILED(nsres)) {
465 ERR("SetChecked failed: %08x\n", nsres);
466 return E_FAIL;
469 return S_OK;
472 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
474 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
475 cpp_bool checked;
476 nsresult nsres;
478 TRACE("(%p)->(%p)\n", This, p);
480 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
481 if(NS_FAILED(nsres)) {
482 ERR("GetChecked failed: %08x\n", nsres);
483 return E_FAIL;
486 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
487 TRACE("checked=%x\n", *p);
488 return S_OK;
491 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
493 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
494 FIXME("(%p)->()\n", This);
495 return E_NOTIMPL;
498 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
500 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
501 FIXME("(%p)->(%p)\n", This, p);
502 return E_NOTIMPL;
505 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
507 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
508 FIXME("(%p)->(%d)\n", This, v);
509 return E_NOTIMPL;
512 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
514 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
515 FIXME("(%p)->(%p)\n", This, p);
516 return E_NOTIMPL;
519 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
521 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
522 FIXME("(%p)->(%d)\n", This, v);
523 return E_NOTIMPL;
526 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
528 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
529 FIXME("(%p)->(%p)\n", This, p);
530 return E_NOTIMPL;
533 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
535 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
536 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
537 return E_NOTIMPL;
540 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
542 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
543 FIXME("(%p)->(%p)\n", This, p);
544 return E_NOTIMPL;
547 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
549 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
550 nsAString nsstr;
551 nsresult nsres;
553 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
555 nsAString_InitDepend(&nsstr, v);
556 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
557 nsAString_Finish(&nsstr);
558 if(NS_FAILED(nsres))
559 ERR("SetSrc failed: %08x\n", nsres);
561 return S_OK;
564 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
566 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
567 const PRUnichar *src;
568 nsAString src_str;
569 nsresult nsres;
570 HRESULT hres;
572 TRACE("(%p)->(%p)\n", This, p);
574 nsAString_Init(&src_str, NULL);
575 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
576 if(NS_FAILED(nsres)) {
577 ERR("GetSrc failed: %08x\n", nsres);
578 return E_FAIL;
581 nsAString_GetData(&src_str, &src);
582 hres = nsuri_to_url(src, FALSE, p);
583 nsAString_Finish(&src_str);
585 return hres;
588 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
590 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
591 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
592 return E_NOTIMPL;
595 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
597 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
598 FIXME("(%p)->(%p)\n", This, p);
599 return E_NOTIMPL;
602 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
604 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
605 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
606 return E_NOTIMPL;
609 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
611 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
612 FIXME("(%p)->(%p)\n", This, p);
613 return E_NOTIMPL;
616 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
618 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
619 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
620 return E_NOTIMPL;
623 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
625 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
626 FIXME("(%p)->(%p)\n", This, p);
627 return E_NOTIMPL;
630 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
632 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
633 FIXME("(%p)->(%p)\n", This, p);
634 return E_NOTIMPL;
637 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
639 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
640 FIXME("(%p)->(%p)\n", This, p);
641 return E_NOTIMPL;
644 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
646 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
647 FIXME("(%p)->()\n", This);
648 return E_NOTIMPL;
651 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
653 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
654 FIXME("(%p)->(%p)\n", This, p);
655 return E_NOTIMPL;
658 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
660 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
661 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
662 return E_NOTIMPL;
665 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
667 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
668 FIXME("(%p)->(%p)\n", This, p);
669 return E_NOTIMPL;
672 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
674 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
675 FIXME("(%p)->()\n", This);
676 return E_NOTIMPL;
679 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
681 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
682 FIXME("(%p)->(%p)\n", This, p);
683 return E_NOTIMPL;
686 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
688 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
689 FIXME("(%p)->()\n", This);
690 return E_NOTIMPL;
693 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
695 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
696 FIXME("(%p)->(%p)\n", This, p);
697 return E_NOTIMPL;
700 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
702 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
703 FIXME("(%p)->()\n", This);
704 return E_NOTIMPL;
707 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
709 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
710 FIXME("(%p)->(%p)\n", This, p);
711 return E_NOTIMPL;
714 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
716 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
717 FIXME("(%p)->(%d)\n", This, v);
718 return E_NOTIMPL;
721 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
723 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
724 FIXME("(%p)->(%p)\n", This, p);
725 return E_NOTIMPL;
728 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
730 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
731 FIXME("(%p)->(%d)\n", This, v);
732 return E_NOTIMPL;
735 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
737 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
738 FIXME("(%p)->(%p)\n", This, p);
739 return E_NOTIMPL;
742 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
744 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
745 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
746 return E_NOTIMPL;
749 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
751 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
752 FIXME("(%p)->(%p)\n", This, p);
753 return E_NOTIMPL;
756 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
757 HTMLInputElement_QueryInterface,
758 HTMLInputElement_AddRef,
759 HTMLInputElement_Release,
760 HTMLInputElement_GetTypeInfoCount,
761 HTMLInputElement_GetTypeInfo,
762 HTMLInputElement_GetIDsOfNames,
763 HTMLInputElement_Invoke,
764 HTMLInputElement_put_type,
765 HTMLInputElement_get_type,
766 HTMLInputElement_put_value,
767 HTMLInputElement_get_value,
768 HTMLInputElement_put_name,
769 HTMLInputElement_get_name,
770 HTMLInputElement_put_status,
771 HTMLInputElement_get_status,
772 HTMLInputElement_put_disabled,
773 HTMLInputElement_get_disabled,
774 HTMLInputElement_get_form,
775 HTMLInputElement_put_size,
776 HTMLInputElement_get_size,
777 HTMLInputElement_put_maxLength,
778 HTMLInputElement_get_maxLength,
779 HTMLInputElement_select,
780 HTMLInputElement_put_onchange,
781 HTMLInputElement_get_onchange,
782 HTMLInputElement_put_onselect,
783 HTMLInputElement_get_onselect,
784 HTMLInputElement_put_defaultValue,
785 HTMLInputElement_get_defaultValue,
786 HTMLInputElement_put_readOnly,
787 HTMLInputElement_get_readOnly,
788 HTMLInputElement_createTextRange,
789 HTMLInputElement_put_indeterminate,
790 HTMLInputElement_get_indeterminate,
791 HTMLInputElement_put_defaultChecked,
792 HTMLInputElement_get_defaultChecked,
793 HTMLInputElement_put_checked,
794 HTMLInputElement_get_checked,
795 HTMLInputElement_put_border,
796 HTMLInputElement_get_border,
797 HTMLInputElement_put_vspace,
798 HTMLInputElement_get_vspace,
799 HTMLInputElement_put_hspace,
800 HTMLInputElement_get_hspace,
801 HTMLInputElement_put_alt,
802 HTMLInputElement_get_alt,
803 HTMLInputElement_put_src,
804 HTMLInputElement_get_src,
805 HTMLInputElement_put_lowsrc,
806 HTMLInputElement_get_lowsrc,
807 HTMLInputElement_put_vrml,
808 HTMLInputElement_get_vrml,
809 HTMLInputElement_put_dynsrc,
810 HTMLInputElement_get_dynsrc,
811 HTMLInputElement_get_readyState,
812 HTMLInputElement_get_complete,
813 HTMLInputElement_put_loop,
814 HTMLInputElement_get_loop,
815 HTMLInputElement_put_align,
816 HTMLInputElement_get_align,
817 HTMLInputElement_put_onload,
818 HTMLInputElement_get_onload,
819 HTMLInputElement_put_onerror,
820 HTMLInputElement_get_onerror,
821 HTMLInputElement_put_onabort,
822 HTMLInputElement_get_onabort,
823 HTMLInputElement_put_width,
824 HTMLInputElement_get_width,
825 HTMLInputElement_put_height,
826 HTMLInputElement_get_height,
827 HTMLInputElement_put_start,
828 HTMLInputElement_get_start
831 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
832 REFIID riid, void **ppv)
834 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
836 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
839 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
841 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
843 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
846 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
848 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
850 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
853 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
855 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
856 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
859 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
860 LCID lcid, ITypeInfo **ppTInfo)
862 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
863 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
864 ppTInfo);
867 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
868 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
870 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
871 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
872 cNames, lcid, rgDispId);
875 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
876 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
877 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
879 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
880 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
881 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
884 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
886 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
888 TRACE("(%p)->(%p)\n", This, p);
890 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
893 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
895 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
897 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
899 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
902 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
904 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
906 TRACE("(%p)->(%p)\n", This, p);
908 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
911 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
913 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
915 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
917 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
920 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
922 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
924 TRACE("(%p)->(%p)\n", This, p);
926 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
929 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
931 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
932 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
933 return E_NOTIMPL;
936 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
938 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
939 TRACE("(%p)->(%p)\n", This, p);
940 return E_NOTIMPL;
943 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
945 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
947 TRACE("(%p)->(%x)\n", This, v);
949 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
952 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
954 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
956 TRACE("(%p)->(%p)\n", This, p);
958 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
961 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
963 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
965 TRACE("(%p)->(%p)\n", This, p);
967 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
970 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
972 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
974 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
976 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
979 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
981 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
983 TRACE("(%p)->(%p)\n", This, p);
985 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
988 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
990 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
992 TRACE("(%p)->(%d)\n", This, v);
994 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
997 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
999 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1001 TRACE("(%p)->(%p)\n", This, p);
1003 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1006 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1008 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1010 TRACE("(%p)->(%d)\n", This, v);
1012 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1015 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1017 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1019 TRACE("(%p)->(%p)\n", This, p);
1021 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1024 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1026 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1028 TRACE("(%p)\n", This);
1030 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1033 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1035 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1037 TRACE("(%p)->()\n", This);
1039 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1042 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1044 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1046 TRACE("(%p)->(%p)\n", This, p);
1048 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1051 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1053 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1055 TRACE("(%p)->()\n", This);
1057 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1060 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1062 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1064 TRACE("(%p)->(%p)\n", This, p);
1066 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1069 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1071 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1073 TRACE("(%p)->(%x)\n", This, v);
1075 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1078 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1080 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1082 TRACE("(%p)->(%p)\n", This, p);
1084 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1087 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1089 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1091 TRACE("(%p)->(%p)\n", This, range);
1093 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1096 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1097 HTMLInputTextElement_QueryInterface,
1098 HTMLInputTextElement_AddRef,
1099 HTMLInputTextElement_Release,
1100 HTMLInputTextElement_GetTypeInfoCount,
1101 HTMLInputTextElement_GetTypeInfo,
1102 HTMLInputTextElement_GetIDsOfNames,
1103 HTMLInputTextElement_Invoke,
1104 HTMLInputTextElement_get_type,
1105 HTMLInputTextElement_put_value,
1106 HTMLInputTextElement_get_value,
1107 HTMLInputTextElement_put_name,
1108 HTMLInputTextElement_get_name,
1109 HTMLInputTextElement_put_status,
1110 HTMLInputTextElement_get_status,
1111 HTMLInputTextElement_put_disabled,
1112 HTMLInputTextElement_get_disabled,
1113 HTMLInputTextElement_get_form,
1114 HTMLInputTextElement_put_defaultValue,
1115 HTMLInputTextElement_get_defaultValue,
1116 HTMLInputTextElement_put_size,
1117 HTMLInputTextElement_get_size,
1118 HTMLInputTextElement_put_maxLength,
1119 HTMLInputTextElement_get_maxLength,
1120 HTMLInputTextElement_select,
1121 HTMLInputTextElement_put_onchange,
1122 HTMLInputTextElement_get_onchange,
1123 HTMLInputTextElement_put_onselect,
1124 HTMLInputTextElement_get_onselect,
1125 HTMLInputTextElement_put_readOnly,
1126 HTMLInputTextElement_get_readOnly,
1127 HTMLInputTextElement_createTextRange
1130 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1132 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1135 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1137 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1139 *ppv = NULL;
1141 if(IsEqualGUID(&IID_IUnknown, riid)) {
1142 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1143 *ppv = &This->IHTMLInputElement_iface;
1144 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1145 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1146 *ppv = &This->IHTMLInputElement_iface;
1147 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1148 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1149 *ppv = &This->IHTMLInputElement_iface;
1150 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1151 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1152 *ppv = &This->IHTMLInputTextElement_iface;
1155 if(*ppv) {
1156 IUnknown_AddRef((IUnknown*)*ppv);
1157 return S_OK;
1160 return HTMLElement_QI(&This->element.node, riid, ppv);
1163 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1165 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1167 if(eid == EVENTID_CLICK) {
1168 nsresult nsres;
1170 *handled = TRUE;
1172 nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1173 if(NS_FAILED(nsres)) {
1174 ERR("Click failed: %08x\n", nsres);
1175 return E_FAIL;
1179 return S_OK;
1182 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1184 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1185 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1188 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1190 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1191 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1194 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1195 HTMLInputElement_QI,
1196 HTMLElement_destructor,
1197 HTMLElement_clone,
1198 HTMLElement_handle_event,
1199 HTMLElement_get_attr_col,
1200 NULL,
1201 HTMLInputElementImpl_fire_event,
1202 HTMLInputElementImpl_put_disabled,
1203 HTMLInputElementImpl_get_disabled,
1206 static const tid_t HTMLInputElement_iface_tids[] = {
1207 HTMLELEMENT_TIDS,
1208 IHTMLInputElement_tid,
1211 static dispex_static_data_t HTMLInputElement_dispex = {
1212 NULL,
1213 DispHTMLInputElement_tid,
1214 NULL,
1215 HTMLInputElement_iface_tids
1218 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1220 HTMLInputElement *ret;
1221 nsresult nsres;
1223 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1224 if(!ret)
1225 return E_OUTOFMEMORY;
1227 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1228 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1229 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1231 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1233 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1235 /* Share nsinput reference with nsnode */
1236 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1237 nsIDOMNode_Release(ret->element.node.nsnode);
1239 *elem = &ret->element;
1240 return S_OK;
1243 typedef struct {
1244 HTMLElement element;
1246 IHTMLLabelElement IHTMLLabelElement_iface;
1247 } HTMLLabelElement;
1249 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1251 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1254 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1255 REFIID riid, void **ppv)
1257 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1259 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1262 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1264 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1266 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1269 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1271 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1273 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1276 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1278 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1280 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1283 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1284 LCID lcid, ITypeInfo **ppTInfo)
1286 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1288 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1291 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1292 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1294 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1296 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1297 cNames, lcid, rgDispId);
1300 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1301 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1302 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1304 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1306 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1307 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1310 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1312 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1313 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1314 return E_NOTIMPL;
1317 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1319 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1320 FIXME("(%p)->(%p)\n", This, p);
1321 return E_NOTIMPL;
1324 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1326 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1327 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1328 return E_NOTIMPL;
1331 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1333 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1334 FIXME("(%p)->(%p)\n", This, p);
1335 return E_NOTIMPL;
1338 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1339 HTMLLabelElement_QueryInterface,
1340 HTMLLabelElement_AddRef,
1341 HTMLLabelElement_Release,
1342 HTMLLabelElement_GetTypeInfoCount,
1343 HTMLLabelElement_GetTypeInfo,
1344 HTMLLabelElement_GetIDsOfNames,
1345 HTMLLabelElement_Invoke,
1346 HTMLLabelElement_put_htmlFor,
1347 HTMLLabelElement_get_htmlFor,
1348 HTMLLabelElement_put_accessKey,
1349 HTMLLabelElement_get_accessKey
1352 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1354 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1357 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1359 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1361 *ppv = NULL;
1363 if(IsEqualGUID(&IID_IUnknown, riid)) {
1364 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1365 *ppv = &This->IHTMLLabelElement_iface;
1366 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1367 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1368 *ppv = &This->IHTMLLabelElement_iface;
1369 }else {
1370 return HTMLElement_QI(&This->element.node, riid, ppv);
1373 IUnknown_AddRef((IUnknown*)*ppv);
1374 return S_OK;
1377 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1378 HTMLLabelElement_QI,
1379 HTMLElement_destructor,
1380 HTMLElement_clone,
1381 HTMLElement_handle_event,
1382 HTMLElement_get_attr_col,
1385 static const tid_t HTMLLabelElement_iface_tids[] = {
1386 HTMLELEMENT_TIDS,
1387 IHTMLLabelElement_tid,
1391 static dispex_static_data_t HTMLLabelElement_dispex = {
1392 NULL,
1393 DispHTMLLabelElement_tid,
1394 NULL,
1395 HTMLLabelElement_iface_tids
1398 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1400 HTMLLabelElement *ret;
1402 ret = heap_alloc_zero(sizeof(*ret));
1403 if(!ret)
1404 return E_OUTOFMEMORY;
1406 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1407 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1409 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1410 *elem = &ret->element;
1411 return S_OK;