mshtml: Wine Gecko 2.34-beta2 release.
[wine/wine-gecko.git] / dlls / mshtml / htmlinput.c
blob4ce01b510b3e697766088405111865c073b397aa
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 nsIDOMHTMLFormElement *nsform;
259 nsIDOMNode *form_node;
260 HTMLDOMNode *node;
261 HRESULT hres;
262 nsresult nsres;
264 TRACE("(%p)->(%p)\n", This, p);
266 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
267 if (NS_FAILED(nsres) || nsform == NULL) {
268 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
269 *p = NULL;
270 return E_FAIL;
273 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
274 nsIDOMHTMLFormElement_Release(nsform);
275 assert(nsres == NS_OK);
277 hres = get_node(This->element.node.doc, form_node, TRUE, &node);
278 nsIDOMNode_Release(form_node);
279 if (FAILED(hres))
280 return hres;
282 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
284 node_release(node);
285 return hres;
288 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
290 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
291 UINT32 val = v;
292 nsresult nsres;
294 TRACE("(%p)->(%d)\n", This, v);
295 if (v <= 0)
296 return CTL_E_INVALIDPROPERTYVALUE;
298 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
299 if (NS_FAILED(nsres)) {
300 ERR("Set Size(%u) failed: %08x\n", val, nsres);
301 return E_FAIL;
303 return S_OK;
306 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
308 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
309 UINT32 val;
310 nsresult nsres;
312 TRACE("(%p)->(%p)\n", This, p);
313 if (p == NULL)
314 return E_INVALIDARG;
316 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
317 if (NS_FAILED(nsres)) {
318 ERR("Get Size failed: %08x\n", nsres);
319 return E_FAIL;
321 *p = val;
322 return S_OK;
325 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
327 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
328 nsresult nsres;
330 TRACE("(%p)->(%d)\n", This, v);
332 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
333 if(NS_FAILED(nsres)) {
334 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
335 FIXME("SetMaxLength failed\n");
336 return E_FAIL;
339 return S_OK;
342 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
344 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
345 LONG max_length;
346 nsresult nsres;
348 TRACE("(%p)->(%p)\n", This, p);
350 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
351 assert(nsres == NS_OK);
353 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
354 *p = max_length == -1 ? INT_MAX : max_length;
355 return S_OK;
358 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
360 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
361 nsresult nsres;
363 TRACE("(%p)\n", This);
365 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
366 if(NS_FAILED(nsres)) {
367 ERR("Select failed: %08x\n", nsres);
368 return E_FAIL;
371 return S_OK;
374 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
376 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
378 TRACE("(%p)->()\n", This);
380 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
383 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
385 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
387 TRACE("(%p)->(%p)\n", This, p);
389 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
392 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
394 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
395 FIXME("(%p)->()\n", This);
396 return E_NOTIMPL;
399 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
401 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
402 FIXME("(%p)->(%p)\n", This, p);
403 return E_NOTIMPL;
406 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
408 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
409 nsAString nsstr;
410 nsresult nsres;
412 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
414 nsAString_InitDepend(&nsstr, v);
415 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
416 nsAString_Finish(&nsstr);
417 if(NS_FAILED(nsres)) {
418 ERR("SetValue failed: %08x\n", nsres);
419 return E_FAIL;
422 return S_OK;
425 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
427 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
428 nsAString nsstr;
429 nsresult nsres;
431 TRACE("(%p)->(%p)\n", This, p);
433 nsAString_Init(&nsstr, NULL);
434 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
435 return return_nsstr(nsres, &nsstr, p);
438 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
440 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
441 nsresult nsres;
443 TRACE("(%p)->(%x)\n", This, v);
445 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
446 if (NS_FAILED(nsres)) {
447 ERR("Set ReadOnly Failed: %08x\n", nsres);
448 return E_FAIL;
450 return S_OK;
453 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
455 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
456 nsresult nsres;
457 cpp_bool b;
459 TRACE("(%p)->(%p)\n", This, p);
461 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
462 if (NS_FAILED(nsres)) {
463 ERR("Get ReadOnly Failed: %08x\n", nsres);
464 return E_FAIL;
466 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
467 return S_OK;
470 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
472 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
473 FIXME("(%p)->(%p)\n", This, range);
474 return E_NOTIMPL;
477 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
479 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
480 FIXME("(%p)->(%x)\n", This, v);
481 return E_NOTIMPL;
484 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
486 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
487 FIXME("(%p)->(%p)\n", This, p);
488 return E_NOTIMPL;
491 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
493 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
494 nsresult nsres;
496 TRACE("(%p)->(%x)\n", This, v);
498 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
499 if(NS_FAILED(nsres)) {
500 ERR("SetDefaultChecked failed: %08x\n", nsres);
501 return E_FAIL;
504 return S_OK;
507 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
509 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
510 cpp_bool default_checked = FALSE;
511 nsresult nsres;
513 TRACE("(%p)->(%p)\n", This, p);
515 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
516 if(NS_FAILED(nsres)) {
517 ERR("GetDefaultChecked failed: %08x\n", nsres);
518 return E_FAIL;
521 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
522 return S_OK;
525 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
527 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
528 nsresult nsres;
530 TRACE("(%p)->(%x)\n", This, v);
532 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
533 if(NS_FAILED(nsres)) {
534 ERR("SetChecked failed: %08x\n", nsres);
535 return E_FAIL;
538 return S_OK;
541 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
543 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
544 cpp_bool checked;
545 nsresult nsres;
547 TRACE("(%p)->(%p)\n", This, p);
549 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
550 if(NS_FAILED(nsres)) {
551 ERR("GetChecked failed: %08x\n", nsres);
552 return E_FAIL;
555 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
556 TRACE("checked=%x\n", *p);
557 return S_OK;
560 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
562 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
563 FIXME("(%p)->()\n", This);
564 return E_NOTIMPL;
567 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
569 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
570 FIXME("(%p)->(%p)\n", This, p);
571 return E_NOTIMPL;
574 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
576 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
577 FIXME("(%p)->(%d)\n", This, v);
578 return E_NOTIMPL;
581 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
583 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
584 FIXME("(%p)->(%p)\n", This, p);
585 return E_NOTIMPL;
588 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
590 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
591 FIXME("(%p)->(%d)\n", This, v);
592 return E_NOTIMPL;
595 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *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_alt(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_alt(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_src(IHTMLInputElement *iface, BSTR v)
618 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
619 nsAString nsstr;
620 nsresult nsres;
622 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
624 nsAString_InitDepend(&nsstr, v);
625 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
626 nsAString_Finish(&nsstr);
627 if(NS_FAILED(nsres))
628 ERR("SetSrc failed: %08x\n", nsres);
630 return S_OK;
633 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
635 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
636 const PRUnichar *src;
637 nsAString src_str;
638 nsresult nsres;
639 HRESULT hres;
641 TRACE("(%p)->(%p)\n", This, p);
643 nsAString_Init(&src_str, NULL);
644 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
645 if(NS_FAILED(nsres)) {
646 ERR("GetSrc failed: %08x\n", nsres);
647 return E_FAIL;
650 nsAString_GetData(&src_str, &src);
651 hres = nsuri_to_url(src, FALSE, p);
652 nsAString_Finish(&src_str);
654 return hres;
657 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
659 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
660 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
661 return E_NOTIMPL;
664 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
666 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
667 FIXME("(%p)->(%p)\n", This, p);
668 return E_NOTIMPL;
671 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
673 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
674 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
675 return E_NOTIMPL;
678 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
680 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
681 FIXME("(%p)->(%p)\n", This, p);
682 return E_NOTIMPL;
685 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
687 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
688 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
689 return E_NOTIMPL;
692 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
694 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
695 FIXME("(%p)->(%p)\n", This, p);
696 return E_NOTIMPL;
699 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
701 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
702 FIXME("(%p)->(%p)\n", This, p);
703 return E_NOTIMPL;
706 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
708 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
709 FIXME("(%p)->(%p)\n", This, p);
710 return E_NOTIMPL;
713 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
715 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
716 FIXME("(%p)->()\n", This);
717 return E_NOTIMPL;
720 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
722 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
723 FIXME("(%p)->(%p)\n", This, p);
724 return E_NOTIMPL;
727 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
729 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
730 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
731 return E_NOTIMPL;
734 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
736 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
737 FIXME("(%p)->(%p)\n", This, p);
738 return E_NOTIMPL;
741 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
743 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
744 FIXME("(%p)->()\n", This);
745 return E_NOTIMPL;
748 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
750 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
751 FIXME("(%p)->(%p)\n", This, p);
752 return E_NOTIMPL;
755 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
757 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
758 FIXME("(%p)->()\n", This);
759 return E_NOTIMPL;
762 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
764 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
765 FIXME("(%p)->(%p)\n", This, p);
766 return E_NOTIMPL;
769 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
771 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
772 FIXME("(%p)->()\n", This);
773 return E_NOTIMPL;
776 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
778 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
779 FIXME("(%p)->(%p)\n", This, p);
780 return E_NOTIMPL;
783 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
785 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
786 FIXME("(%p)->(%d)\n", This, v);
787 return E_NOTIMPL;
790 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
792 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
793 FIXME("(%p)->(%p)\n", This, p);
794 return E_NOTIMPL;
797 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
799 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
800 FIXME("(%p)->(%d)\n", This, v);
801 return E_NOTIMPL;
804 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
806 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
807 FIXME("(%p)->(%p)\n", This, p);
808 return E_NOTIMPL;
811 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
813 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
814 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
815 return E_NOTIMPL;
818 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
820 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
821 FIXME("(%p)->(%p)\n", This, p);
822 return E_NOTIMPL;
825 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
826 HTMLInputElement_QueryInterface,
827 HTMLInputElement_AddRef,
828 HTMLInputElement_Release,
829 HTMLInputElement_GetTypeInfoCount,
830 HTMLInputElement_GetTypeInfo,
831 HTMLInputElement_GetIDsOfNames,
832 HTMLInputElement_Invoke,
833 HTMLInputElement_put_type,
834 HTMLInputElement_get_type,
835 HTMLInputElement_put_value,
836 HTMLInputElement_get_value,
837 HTMLInputElement_put_name,
838 HTMLInputElement_get_name,
839 HTMLInputElement_put_status,
840 HTMLInputElement_get_status,
841 HTMLInputElement_put_disabled,
842 HTMLInputElement_get_disabled,
843 HTMLInputElement_get_form,
844 HTMLInputElement_put_size,
845 HTMLInputElement_get_size,
846 HTMLInputElement_put_maxLength,
847 HTMLInputElement_get_maxLength,
848 HTMLInputElement_select,
849 HTMLInputElement_put_onchange,
850 HTMLInputElement_get_onchange,
851 HTMLInputElement_put_onselect,
852 HTMLInputElement_get_onselect,
853 HTMLInputElement_put_defaultValue,
854 HTMLInputElement_get_defaultValue,
855 HTMLInputElement_put_readOnly,
856 HTMLInputElement_get_readOnly,
857 HTMLInputElement_createTextRange,
858 HTMLInputElement_put_indeterminate,
859 HTMLInputElement_get_indeterminate,
860 HTMLInputElement_put_defaultChecked,
861 HTMLInputElement_get_defaultChecked,
862 HTMLInputElement_put_checked,
863 HTMLInputElement_get_checked,
864 HTMLInputElement_put_border,
865 HTMLInputElement_get_border,
866 HTMLInputElement_put_vspace,
867 HTMLInputElement_get_vspace,
868 HTMLInputElement_put_hspace,
869 HTMLInputElement_get_hspace,
870 HTMLInputElement_put_alt,
871 HTMLInputElement_get_alt,
872 HTMLInputElement_put_src,
873 HTMLInputElement_get_src,
874 HTMLInputElement_put_lowsrc,
875 HTMLInputElement_get_lowsrc,
876 HTMLInputElement_put_vrml,
877 HTMLInputElement_get_vrml,
878 HTMLInputElement_put_dynsrc,
879 HTMLInputElement_get_dynsrc,
880 HTMLInputElement_get_readyState,
881 HTMLInputElement_get_complete,
882 HTMLInputElement_put_loop,
883 HTMLInputElement_get_loop,
884 HTMLInputElement_put_align,
885 HTMLInputElement_get_align,
886 HTMLInputElement_put_onload,
887 HTMLInputElement_get_onload,
888 HTMLInputElement_put_onerror,
889 HTMLInputElement_get_onerror,
890 HTMLInputElement_put_onabort,
891 HTMLInputElement_get_onabort,
892 HTMLInputElement_put_width,
893 HTMLInputElement_get_width,
894 HTMLInputElement_put_height,
895 HTMLInputElement_get_height,
896 HTMLInputElement_put_start,
897 HTMLInputElement_get_start
900 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
901 REFIID riid, void **ppv)
903 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
905 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
908 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
910 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
912 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
915 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
917 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
919 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
922 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
924 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
925 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
928 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
929 LCID lcid, ITypeInfo **ppTInfo)
931 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
932 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
933 ppTInfo);
936 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
937 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
939 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
940 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
941 cNames, lcid, rgDispId);
944 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
945 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
946 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
948 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
949 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
950 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
953 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
955 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
957 TRACE("(%p)->(%p)\n", This, p);
959 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
962 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
964 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
966 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
968 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
971 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
973 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
975 TRACE("(%p)->(%p)\n", This, p);
977 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
980 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
982 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
984 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
986 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
989 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
991 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
993 TRACE("(%p)->(%p)\n", This, p);
995 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
998 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
1000 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1001 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1002 return E_NOTIMPL;
1005 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
1007 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1008 TRACE("(%p)->(%p)\n", This, p);
1009 return E_NOTIMPL;
1012 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1014 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1016 TRACE("(%p)->(%x)\n", This, v);
1018 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1021 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1023 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1025 TRACE("(%p)->(%p)\n", This, p);
1027 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1030 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1032 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1034 TRACE("(%p)->(%p)\n", This, p);
1036 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1039 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1041 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1043 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1045 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1048 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1050 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1052 TRACE("(%p)->(%p)\n", This, p);
1054 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1057 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1059 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1061 TRACE("(%p)->(%d)\n", This, v);
1063 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1066 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1068 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1070 TRACE("(%p)->(%p)\n", This, p);
1072 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1075 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1077 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1079 TRACE("(%p)->(%d)\n", This, v);
1081 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1084 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1086 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1088 TRACE("(%p)->(%p)\n", This, p);
1090 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1093 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1095 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1097 TRACE("(%p)\n", This);
1099 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1102 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1104 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1106 TRACE("(%p)->()\n", This);
1108 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1111 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1113 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1115 TRACE("(%p)->(%p)\n", This, p);
1117 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1120 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1122 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1124 TRACE("(%p)->()\n", This);
1126 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1129 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1131 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1133 TRACE("(%p)->(%p)\n", This, p);
1135 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1138 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1140 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1142 TRACE("(%p)->(%x)\n", This, v);
1144 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1147 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1149 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1151 TRACE("(%p)->(%p)\n", This, p);
1153 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1156 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1158 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1160 TRACE("(%p)->(%p)\n", This, range);
1162 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1165 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1166 HTMLInputTextElement_QueryInterface,
1167 HTMLInputTextElement_AddRef,
1168 HTMLInputTextElement_Release,
1169 HTMLInputTextElement_GetTypeInfoCount,
1170 HTMLInputTextElement_GetTypeInfo,
1171 HTMLInputTextElement_GetIDsOfNames,
1172 HTMLInputTextElement_Invoke,
1173 HTMLInputTextElement_get_type,
1174 HTMLInputTextElement_put_value,
1175 HTMLInputTextElement_get_value,
1176 HTMLInputTextElement_put_name,
1177 HTMLInputTextElement_get_name,
1178 HTMLInputTextElement_put_status,
1179 HTMLInputTextElement_get_status,
1180 HTMLInputTextElement_put_disabled,
1181 HTMLInputTextElement_get_disabled,
1182 HTMLInputTextElement_get_form,
1183 HTMLInputTextElement_put_defaultValue,
1184 HTMLInputTextElement_get_defaultValue,
1185 HTMLInputTextElement_put_size,
1186 HTMLInputTextElement_get_size,
1187 HTMLInputTextElement_put_maxLength,
1188 HTMLInputTextElement_get_maxLength,
1189 HTMLInputTextElement_select,
1190 HTMLInputTextElement_put_onchange,
1191 HTMLInputTextElement_get_onchange,
1192 HTMLInputTextElement_put_onselect,
1193 HTMLInputTextElement_get_onselect,
1194 HTMLInputTextElement_put_readOnly,
1195 HTMLInputTextElement_get_readOnly,
1196 HTMLInputTextElement_createTextRange
1199 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1201 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1204 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1206 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1208 *ppv = NULL;
1210 if(IsEqualGUID(&IID_IUnknown, riid)) {
1211 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1212 *ppv = &This->IHTMLInputElement_iface;
1213 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1214 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1215 *ppv = &This->IHTMLInputElement_iface;
1216 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1217 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1218 *ppv = &This->IHTMLInputElement_iface;
1219 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1220 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1221 *ppv = &This->IHTMLInputTextElement_iface;
1224 if(*ppv) {
1225 IUnknown_AddRef((IUnknown*)*ppv);
1226 return S_OK;
1229 return HTMLElement_QI(&This->element.node, riid, ppv);
1232 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1234 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1236 if(eid == EVENTID_CLICK) {
1237 nsresult nsres;
1239 *handled = TRUE;
1241 nsres = nsIDOMHTMLElement_Click(This->element.nselem);
1242 if(NS_FAILED(nsres)) {
1243 ERR("Click failed: %08x\n", nsres);
1244 return E_FAIL;
1248 return S_OK;
1251 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1253 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1254 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1257 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1259 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1260 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1263 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1265 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1267 if(This->nsinput)
1268 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1271 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1273 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1275 if(This->nsinput) {
1276 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1278 This->nsinput = NULL;
1279 nsIDOMHTMLInputElement_Release(nsinput);
1283 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1284 HTMLInputElement_QI,
1285 HTMLElement_destructor,
1286 HTMLElement_cpc,
1287 HTMLElement_clone,
1288 HTMLElement_handle_event,
1289 HTMLElement_get_attr_col,
1290 NULL,
1291 HTMLInputElementImpl_fire_event,
1292 HTMLInputElementImpl_put_disabled,
1293 HTMLInputElementImpl_get_disabled,
1294 NULL,
1295 NULL,
1296 NULL,
1297 NULL,
1298 NULL,
1299 HTMLInputElement_traverse,
1300 HTMLInputElement_unlink
1303 static const tid_t HTMLInputElement_iface_tids[] = {
1304 HTMLELEMENT_TIDS,
1305 IHTMLInputElement_tid,
1308 static dispex_static_data_t HTMLInputElement_dispex = {
1309 NULL,
1310 DispHTMLInputElement_tid,
1311 NULL,
1312 HTMLInputElement_iface_tids
1315 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1317 HTMLInputElement *ret;
1318 nsresult nsres;
1320 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1321 if(!ret)
1322 return E_OUTOFMEMORY;
1324 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1325 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1326 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1328 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1330 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1331 assert(nsres == NS_OK);
1333 *elem = &ret->element;
1334 return S_OK;
1337 typedef struct {
1338 HTMLElement element;
1340 IHTMLLabelElement IHTMLLabelElement_iface;
1341 } HTMLLabelElement;
1343 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1345 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1348 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1349 REFIID riid, void **ppv)
1351 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1353 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1356 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1358 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1360 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1363 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1365 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1367 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1370 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1372 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1374 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1377 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1378 LCID lcid, ITypeInfo **ppTInfo)
1380 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1382 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1385 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1386 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1388 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1390 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1391 cNames, lcid, rgDispId);
1394 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1395 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1396 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1398 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1400 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1401 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1404 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1406 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1407 nsAString for_str, val_str;
1408 nsresult nsres;
1410 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1412 nsAString_InitDepend(&for_str, forW);
1413 nsAString_InitDepend(&val_str, v);
1414 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1415 nsAString_Finish(&for_str);
1416 nsAString_Finish(&val_str);
1417 if(NS_FAILED(nsres)) {
1418 ERR("SetAttribute failed: %08x\n", nsres);
1419 return E_FAIL;
1422 return S_OK;
1425 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1427 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1429 TRACE("(%p)->(%p)\n", This, p);
1431 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1434 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1436 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1437 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1438 return E_NOTIMPL;
1441 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1443 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1444 FIXME("(%p)->(%p)\n", This, p);
1445 return E_NOTIMPL;
1448 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1449 HTMLLabelElement_QueryInterface,
1450 HTMLLabelElement_AddRef,
1451 HTMLLabelElement_Release,
1452 HTMLLabelElement_GetTypeInfoCount,
1453 HTMLLabelElement_GetTypeInfo,
1454 HTMLLabelElement_GetIDsOfNames,
1455 HTMLLabelElement_Invoke,
1456 HTMLLabelElement_put_htmlFor,
1457 HTMLLabelElement_get_htmlFor,
1458 HTMLLabelElement_put_accessKey,
1459 HTMLLabelElement_get_accessKey
1462 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1464 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1467 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1469 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1471 *ppv = NULL;
1473 if(IsEqualGUID(&IID_IUnknown, riid)) {
1474 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1475 *ppv = &This->IHTMLLabelElement_iface;
1476 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1477 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1478 *ppv = &This->IHTMLLabelElement_iface;
1479 }else {
1480 return HTMLElement_QI(&This->element.node, riid, ppv);
1483 IUnknown_AddRef((IUnknown*)*ppv);
1484 return S_OK;
1487 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1488 HTMLLabelElement_QI,
1489 HTMLElement_destructor,
1490 HTMLElement_cpc,
1491 HTMLElement_clone,
1492 HTMLElement_handle_event,
1493 HTMLElement_get_attr_col,
1496 static const tid_t HTMLLabelElement_iface_tids[] = {
1497 HTMLELEMENT_TIDS,
1498 IHTMLLabelElement_tid,
1502 static dispex_static_data_t HTMLLabelElement_dispex = {
1503 NULL,
1504 DispHTMLLabelElement_tid,
1505 NULL,
1506 HTMLLabelElement_iface_tids
1509 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1511 HTMLLabelElement *ret;
1513 ret = heap_alloc_zero(sizeof(*ret));
1514 if(!ret)
1515 return E_OUTOFMEMORY;
1517 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1518 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1520 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1521 *elem = &ret->element;
1522 return S_OK;
1525 typedef struct {
1526 HTMLElement element;
1528 IHTMLButtonElement IHTMLButtonElement_iface;
1530 nsIDOMHTMLButtonElement *nsbutton;
1531 } HTMLButtonElement;
1533 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1535 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1538 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1539 REFIID riid, void **ppv)
1541 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1543 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1546 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1548 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1550 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1553 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1555 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1557 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1560 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1562 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1564 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1567 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1568 LCID lcid, ITypeInfo **ppTInfo)
1570 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1572 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1575 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1576 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1578 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1580 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1581 cNames, lcid, rgDispId);
1584 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1585 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1586 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1588 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1590 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1591 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1594 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1596 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1597 FIXME("(%p)->(%p)\n", This, p);
1598 return E_NOTIMPL;
1601 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1603 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1604 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1605 return E_NOTIMPL;
1608 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1610 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1611 FIXME("(%p)->(%p)\n", This, p);
1612 return E_NOTIMPL;
1615 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1617 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1618 nsAString name_str;
1619 nsresult nsres;
1621 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1623 nsAString_InitDepend(&name_str, v);
1624 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1625 nsAString_Finish(&name_str);
1626 if(NS_FAILED(nsres)) {
1627 ERR("SetName failed: %08x\n", nsres);
1628 return E_FAIL;
1631 return S_OK;
1634 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1636 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1637 nsAString name_str;
1638 nsresult nsres;
1640 TRACE("(%p)->(%p)\n", This, p);
1642 nsAString_Init(&name_str, NULL);
1643 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1644 return return_nsstr(nsres, &name_str, p);
1647 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1649 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1650 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1651 return E_NOTIMPL;
1654 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1656 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1657 FIXME("(%p)->(%p)\n", This, p);
1658 return E_NOTIMPL;
1661 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1663 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1664 nsresult nsres;
1666 TRACE("(%p)->(%x)\n", This, v);
1668 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1669 if(NS_FAILED(nsres)) {
1670 ERR("SetDisabled failed: %08x\n", nsres);
1671 return E_FAIL;
1674 return S_OK;
1677 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1679 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1680 cpp_bool disabled;
1681 nsresult nsres;
1683 TRACE("(%p)->(%p)\n", This, p);
1685 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1686 if(NS_FAILED(nsres)) {
1687 ERR("GetDisabled failed: %08x\n", nsres);
1688 return E_FAIL;
1691 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1692 return S_OK;
1695 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1697 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1698 FIXME("(%p)->(%p)\n", This, p);
1699 return E_NOTIMPL;
1702 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1704 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1705 FIXME("(%p)->(%p)\n", This, range);
1706 return E_NOTIMPL;
1709 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1710 HTMLButtonElement_QueryInterface,
1711 HTMLButtonElement_AddRef,
1712 HTMLButtonElement_Release,
1713 HTMLButtonElement_GetTypeInfoCount,
1714 HTMLButtonElement_GetTypeInfo,
1715 HTMLButtonElement_GetIDsOfNames,
1716 HTMLButtonElement_Invoke,
1717 HTMLButtonElement_get_type,
1718 HTMLButtonElement_put_value,
1719 HTMLButtonElement_get_value,
1720 HTMLButtonElement_put_name,
1721 HTMLButtonElement_get_name,
1722 HTMLButtonElement_put_status,
1723 HTMLButtonElement_get_status,
1724 HTMLButtonElement_put_disabled,
1725 HTMLButtonElement_get_disabled,
1726 HTMLButtonElement_get_form,
1727 HTMLButtonElement_createTextRange
1730 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1732 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1735 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1737 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1739 *ppv = NULL;
1741 if(IsEqualGUID(&IID_IUnknown, riid)) {
1742 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1743 *ppv = &This->IHTMLButtonElement_iface;
1744 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1745 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1746 *ppv = &This->IHTMLButtonElement_iface;
1747 }else {
1748 return HTMLElement_QI(&This->element.node, riid, ppv);
1751 IUnknown_AddRef((IUnknown*)*ppv);
1752 return S_OK;
1755 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1757 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1758 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1761 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1763 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1764 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1767 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1769 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1771 if(This->nsbutton)
1772 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1775 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1777 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1779 if(This->nsbutton) {
1780 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
1782 This->nsbutton = NULL;
1783 nsIDOMHTMLButtonElement_Release(nsbutton);
1787 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1788 HTMLButtonElement_QI,
1789 HTMLElement_destructor,
1790 HTMLElement_cpc,
1791 HTMLElement_clone,
1792 HTMLElement_handle_event,
1793 HTMLElement_get_attr_col,
1794 NULL,
1795 NULL,
1796 HTMLButtonElementImpl_put_disabled,
1797 HTMLButtonElementImpl_get_disabled,
1798 NULL,
1799 NULL,
1800 NULL,
1801 NULL,
1802 NULL,
1803 HTMLButtonElement_traverse,
1804 HTMLButtonElement_unlink
1807 static const tid_t HTMLButtonElement_iface_tids[] = {
1808 HTMLELEMENT_TIDS,
1809 IHTMLButtonElement_tid,
1813 static dispex_static_data_t HTMLButtonElement_dispex = {
1814 NULL,
1815 DispHTMLButtonElement_tid,
1816 NULL,
1817 HTMLButtonElement_iface_tids
1820 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1822 HTMLButtonElement *ret;
1823 nsresult nsres;
1825 ret = heap_alloc_zero(sizeof(*ret));
1826 if(!ret)
1827 return E_OUTOFMEMORY;
1829 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1830 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1832 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1834 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1835 assert(nsres == NS_OK);
1837 *elem = &ret->element;
1838 return S_OK;