gdiplus/tests: Check more return values (Coverity).
[wine.git] / dlls / mshtml / htmlinput.c
blob0dea8cb9bbb43eb0ec9751d96b7e5d4bcb3da708
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 struct HTMLInputElement {
38 HTMLElement element;
40 IHTMLInputElement IHTMLInputElement_iface;
41 IHTMLInputTextElement IHTMLInputTextElement_iface;
42 IHTMLInputTextElement2 IHTMLInputTextElement2_iface;
44 nsIDOMHTMLInputElement *nsinput;
47 static const WCHAR forW[] = {'f','o','r',0};
49 static HRESULT return_nsform(HTMLElement *elem, nsIDOMHTMLFormElement *nsform, IHTMLFormElement **p)
51 nsIDOMNode *form_node;
52 HTMLDOMNode *node;
53 nsresult nsres;
54 HRESULT hres;
56 if(!nsform) {
57 *p = NULL;
58 return S_OK;
61 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
62 nsIDOMHTMLFormElement_Release(nsform);
63 assert(nsres == NS_OK);
65 hres = get_node(elem->node.doc, form_node, TRUE, &node);
66 nsIDOMNode_Release(form_node);
67 if (FAILED(hres))
68 return hres;
70 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
71 node_release(node);
72 return hres;
75 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
77 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
80 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
82 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
85 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
86 REFIID riid, void **ppv)
88 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
90 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
93 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
95 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
97 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
100 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
102 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
104 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
107 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
109 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
111 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
114 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
115 LCID lcid, ITypeInfo **ppTInfo)
117 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
119 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
120 ppTInfo);
123 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
124 LPOLESTR *rgszNames, UINT cNames,
125 LCID lcid, DISPID *rgDispId)
127 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
129 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
130 cNames, lcid, rgDispId);
133 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
134 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
135 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
137 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
139 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
140 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
143 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
145 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
146 nsAString type_str;
147 nsresult nsres;
149 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
152 * FIXME:
153 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
155 nsAString_InitDepend(&type_str, v);
156 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
157 nsAString_Finish(&type_str);
158 if(NS_FAILED(nsres)) {
159 ERR("SetType failed: %08x\n", nsres);
160 return E_FAIL;
163 return S_OK;
166 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
168 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
169 nsAString type_str;
170 nsresult nsres;
172 TRACE("(%p)->(%p)\n", This, p);
174 nsAString_Init(&type_str, NULL);
175 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
176 return return_nsstr(nsres, &type_str, p);
179 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
181 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
182 nsAString val_str;
183 nsresult nsres;
185 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
187 nsAString_InitDepend(&val_str, v);
188 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
189 nsAString_Finish(&val_str);
190 if(NS_FAILED(nsres))
191 ERR("SetValue failed: %08x\n", nsres);
193 return S_OK;
196 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
198 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
199 nsAString value_str;
200 nsresult nsres;
202 TRACE("(%p)->(%p)\n", This, p);
204 nsAString_Init(&value_str, NULL);
205 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
206 return return_nsstr(nsres, &value_str, p);
209 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
211 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
212 nsAString name_str;
213 nsresult nsres;
215 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
217 nsAString_InitDepend(&name_str, v);
218 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
219 nsAString_Finish(&name_str);
220 if(NS_FAILED(nsres)) {
221 ERR("SetName failed: %08x\n", nsres);
222 return E_FAIL;
225 return S_OK;
228 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
230 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
231 nsAString name_str;
232 nsresult nsres;
234 TRACE("(%p)->(%p)\n", This, p);
236 nsAString_Init(&name_str, NULL);
237 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
238 return return_nsstr(nsres, &name_str, p);
241 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
243 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
244 FIXME("(%p)->(%x)\n", This, v);
245 return E_NOTIMPL;
248 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
250 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
251 FIXME("(%p)->(%p)\n", This, p);
252 return E_NOTIMPL;
255 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
257 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
258 nsresult nsres;
260 TRACE("(%p)->(%x)\n", This, v);
262 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
263 if(NS_FAILED(nsres))
264 ERR("SetDisabled failed: %08x\n", nsres);
266 return S_OK;
269 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
271 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
272 cpp_bool disabled = FALSE;
274 TRACE("(%p)->(%p)\n", This, p);
276 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
278 *p = variant_bool(disabled);
279 return S_OK;
282 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
284 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
285 nsIDOMHTMLFormElement *nsform;
286 nsresult nsres;
288 TRACE("(%p)->(%p)\n", This, p);
290 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
291 if (NS_FAILED(nsres)) {
292 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
293 return E_FAIL;
296 return return_nsform(&This->element, nsform, p);
299 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
301 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
302 UINT32 val = v;
303 nsresult nsres;
305 TRACE("(%p)->(%d)\n", This, v);
306 if (v <= 0)
307 return CTL_E_INVALIDPROPERTYVALUE;
309 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
310 if (NS_FAILED(nsres)) {
311 ERR("Set Size(%u) failed: %08x\n", val, nsres);
312 return E_FAIL;
314 return S_OK;
317 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
319 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
320 UINT32 val;
321 nsresult nsres;
323 TRACE("(%p)->(%p)\n", This, p);
324 if (p == NULL)
325 return E_INVALIDARG;
327 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
328 if (NS_FAILED(nsres)) {
329 ERR("Get Size failed: %08x\n", nsres);
330 return E_FAIL;
332 *p = val;
333 return S_OK;
336 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
338 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
339 nsresult nsres;
341 TRACE("(%p)->(%d)\n", This, v);
343 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
344 if(NS_FAILED(nsres)) {
345 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
346 FIXME("SetMaxLength failed\n");
347 return E_FAIL;
350 return S_OK;
353 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
355 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
356 LONG max_length;
357 nsresult nsres;
359 TRACE("(%p)->(%p)\n", This, p);
361 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
362 assert(nsres == NS_OK);
364 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
365 *p = max_length == -1 ? INT_MAX : max_length;
366 return S_OK;
369 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
371 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
372 nsresult nsres;
374 TRACE("(%p)\n", This);
376 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
377 if(NS_FAILED(nsres)) {
378 ERR("Select failed: %08x\n", nsres);
379 return E_FAIL;
382 return S_OK;
385 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
387 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
389 TRACE("(%p)->()\n", This);
391 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
394 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
396 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
398 TRACE("(%p)->(%p)\n", This, p);
400 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
403 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
405 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
406 FIXME("(%p)->()\n", This);
407 return E_NOTIMPL;
410 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
412 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
413 FIXME("(%p)->(%p)\n", This, p);
414 return E_NOTIMPL;
417 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
419 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
420 nsAString nsstr;
421 nsresult nsres;
423 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
425 nsAString_InitDepend(&nsstr, v);
426 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
427 nsAString_Finish(&nsstr);
428 if(NS_FAILED(nsres)) {
429 ERR("SetValue failed: %08x\n", nsres);
430 return E_FAIL;
433 return S_OK;
436 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
438 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
439 nsAString nsstr;
440 nsresult nsres;
442 TRACE("(%p)->(%p)\n", This, p);
444 nsAString_Init(&nsstr, NULL);
445 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
446 return return_nsstr(nsres, &nsstr, p);
449 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
451 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
452 nsresult nsres;
454 TRACE("(%p)->(%x)\n", This, v);
456 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
457 if (NS_FAILED(nsres)) {
458 ERR("Set ReadOnly Failed: %08x\n", nsres);
459 return E_FAIL;
461 return S_OK;
464 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
466 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
467 nsresult nsres;
468 cpp_bool b;
470 TRACE("(%p)->(%p)\n", This, p);
472 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
473 if (NS_FAILED(nsres)) {
474 ERR("Get ReadOnly Failed: %08x\n", nsres);
475 return E_FAIL;
478 *p = variant_bool(b);
479 return S_OK;
482 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
484 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
485 FIXME("(%p)->(%p)\n", This, range);
486 return E_NOTIMPL;
489 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
491 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
492 FIXME("(%p)->(%x)\n", This, v);
493 return E_NOTIMPL;
496 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
498 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
499 FIXME("(%p)->(%p)\n", This, p);
500 return E_NOTIMPL;
503 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
505 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
506 nsresult nsres;
508 TRACE("(%p)->(%x)\n", This, v);
510 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
511 if(NS_FAILED(nsres)) {
512 ERR("SetDefaultChecked failed: %08x\n", nsres);
513 return E_FAIL;
516 return S_OK;
519 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
521 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
522 cpp_bool default_checked = FALSE;
523 nsresult nsres;
525 TRACE("(%p)->(%p)\n", This, p);
527 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
528 if(NS_FAILED(nsres)) {
529 ERR("GetDefaultChecked failed: %08x\n", nsres);
530 return E_FAIL;
533 *p = variant_bool(default_checked);
534 return S_OK;
537 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
539 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
540 nsresult nsres;
542 TRACE("(%p)->(%x)\n", This, v);
544 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
545 if(NS_FAILED(nsres)) {
546 ERR("SetChecked failed: %08x\n", nsres);
547 return E_FAIL;
550 return S_OK;
553 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
555 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
556 cpp_bool checked;
557 nsresult nsres;
559 TRACE("(%p)->(%p)\n", This, p);
561 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
562 if(NS_FAILED(nsres)) {
563 ERR("GetChecked failed: %08x\n", nsres);
564 return E_FAIL;
567 *p = variant_bool(checked);
568 TRACE("checked=%x\n", *p);
569 return S_OK;
572 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
574 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
575 FIXME("(%p)->()\n", This);
576 return E_NOTIMPL;
579 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
581 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
582 FIXME("(%p)->(%p)\n", This, p);
583 return E_NOTIMPL;
586 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
588 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
589 FIXME("(%p)->(%d)\n", This, v);
590 return E_NOTIMPL;
593 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
595 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
596 FIXME("(%p)->(%p)\n", This, p);
597 return E_NOTIMPL;
600 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
602 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
603 FIXME("(%p)->(%d)\n", This, v);
604 return E_NOTIMPL;
607 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
609 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
610 FIXME("(%p)->(%p)\n", This, p);
611 return E_NOTIMPL;
614 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
616 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
617 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
618 return E_NOTIMPL;
621 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
623 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
624 FIXME("(%p)->(%p)\n", This, p);
625 return E_NOTIMPL;
628 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
630 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
631 nsAString nsstr;
632 nsresult nsres;
634 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
636 nsAString_InitDepend(&nsstr, v);
637 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
638 nsAString_Finish(&nsstr);
639 if(NS_FAILED(nsres))
640 ERR("SetSrc failed: %08x\n", nsres);
642 return S_OK;
645 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
647 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
648 const PRUnichar *src;
649 nsAString src_str;
650 nsresult nsres;
651 HRESULT hres;
653 TRACE("(%p)->(%p)\n", This, p);
655 nsAString_Init(&src_str, NULL);
656 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
657 if(NS_FAILED(nsres)) {
658 ERR("GetSrc failed: %08x\n", nsres);
659 return E_FAIL;
662 nsAString_GetData(&src_str, &src);
663 hres = nsuri_to_url(src, FALSE, p);
664 nsAString_Finish(&src_str);
666 return hres;
669 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
671 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
672 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
673 return E_NOTIMPL;
676 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
678 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
679 FIXME("(%p)->(%p)\n", This, p);
680 return E_NOTIMPL;
683 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
685 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
686 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
687 return E_NOTIMPL;
690 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
692 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
693 FIXME("(%p)->(%p)\n", This, p);
694 return E_NOTIMPL;
697 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
699 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
700 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
701 return E_NOTIMPL;
704 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
706 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
707 FIXME("(%p)->(%p)\n", This, p);
708 return E_NOTIMPL;
711 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
713 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
714 FIXME("(%p)->(%p)\n", This, p);
715 return E_NOTIMPL;
718 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
720 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
721 FIXME("(%p)->(%p)\n", This, p);
722 return E_NOTIMPL;
725 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
727 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
728 FIXME("(%p)->()\n", This);
729 return E_NOTIMPL;
732 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
734 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
735 FIXME("(%p)->(%p)\n", This, p);
736 return E_NOTIMPL;
739 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
741 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
742 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
743 return E_NOTIMPL;
746 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
748 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
749 FIXME("(%p)->(%p)\n", This, p);
750 return E_NOTIMPL;
753 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
755 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
756 FIXME("(%p)->()\n", This);
757 return E_NOTIMPL;
760 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
762 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
763 FIXME("(%p)->(%p)\n", This, p);
764 return E_NOTIMPL;
767 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
769 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
770 FIXME("(%p)->()\n", This);
771 return E_NOTIMPL;
774 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
776 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
777 FIXME("(%p)->(%p)\n", This, p);
778 return E_NOTIMPL;
781 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
783 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
784 FIXME("(%p)->()\n", This);
785 return E_NOTIMPL;
788 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
790 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
791 FIXME("(%p)->(%p)\n", This, p);
792 return E_NOTIMPL;
795 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
797 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
798 FIXME("(%p)->(%d)\n", This, v);
799 return E_NOTIMPL;
802 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
804 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
805 FIXME("(%p)->(%p)\n", This, p);
806 return E_NOTIMPL;
809 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
811 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
812 FIXME("(%p)->(%d)\n", This, v);
813 return E_NOTIMPL;
816 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
818 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
819 FIXME("(%p)->(%p)\n", This, p);
820 return E_NOTIMPL;
823 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
825 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
826 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
827 return E_NOTIMPL;
830 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
832 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
833 FIXME("(%p)->(%p)\n", This, p);
834 return E_NOTIMPL;
837 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
838 HTMLInputElement_QueryInterface,
839 HTMLInputElement_AddRef,
840 HTMLInputElement_Release,
841 HTMLInputElement_GetTypeInfoCount,
842 HTMLInputElement_GetTypeInfo,
843 HTMLInputElement_GetIDsOfNames,
844 HTMLInputElement_Invoke,
845 HTMLInputElement_put_type,
846 HTMLInputElement_get_type,
847 HTMLInputElement_put_value,
848 HTMLInputElement_get_value,
849 HTMLInputElement_put_name,
850 HTMLInputElement_get_name,
851 HTMLInputElement_put_status,
852 HTMLInputElement_get_status,
853 HTMLInputElement_put_disabled,
854 HTMLInputElement_get_disabled,
855 HTMLInputElement_get_form,
856 HTMLInputElement_put_size,
857 HTMLInputElement_get_size,
858 HTMLInputElement_put_maxLength,
859 HTMLInputElement_get_maxLength,
860 HTMLInputElement_select,
861 HTMLInputElement_put_onchange,
862 HTMLInputElement_get_onchange,
863 HTMLInputElement_put_onselect,
864 HTMLInputElement_get_onselect,
865 HTMLInputElement_put_defaultValue,
866 HTMLInputElement_get_defaultValue,
867 HTMLInputElement_put_readOnly,
868 HTMLInputElement_get_readOnly,
869 HTMLInputElement_createTextRange,
870 HTMLInputElement_put_indeterminate,
871 HTMLInputElement_get_indeterminate,
872 HTMLInputElement_put_defaultChecked,
873 HTMLInputElement_get_defaultChecked,
874 HTMLInputElement_put_checked,
875 HTMLInputElement_get_checked,
876 HTMLInputElement_put_border,
877 HTMLInputElement_get_border,
878 HTMLInputElement_put_vspace,
879 HTMLInputElement_get_vspace,
880 HTMLInputElement_put_hspace,
881 HTMLInputElement_get_hspace,
882 HTMLInputElement_put_alt,
883 HTMLInputElement_get_alt,
884 HTMLInputElement_put_src,
885 HTMLInputElement_get_src,
886 HTMLInputElement_put_lowsrc,
887 HTMLInputElement_get_lowsrc,
888 HTMLInputElement_put_vrml,
889 HTMLInputElement_get_vrml,
890 HTMLInputElement_put_dynsrc,
891 HTMLInputElement_get_dynsrc,
892 HTMLInputElement_get_readyState,
893 HTMLInputElement_get_complete,
894 HTMLInputElement_put_loop,
895 HTMLInputElement_get_loop,
896 HTMLInputElement_put_align,
897 HTMLInputElement_get_align,
898 HTMLInputElement_put_onload,
899 HTMLInputElement_get_onload,
900 HTMLInputElement_put_onerror,
901 HTMLInputElement_get_onerror,
902 HTMLInputElement_put_onabort,
903 HTMLInputElement_get_onabort,
904 HTMLInputElement_put_width,
905 HTMLInputElement_get_width,
906 HTMLInputElement_put_height,
907 HTMLInputElement_get_height,
908 HTMLInputElement_put_start,
909 HTMLInputElement_get_start
912 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
913 REFIID riid, void **ppv)
915 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
917 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
920 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
922 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
924 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
927 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
929 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
931 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
934 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
936 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
937 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
940 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
941 LCID lcid, ITypeInfo **ppTInfo)
943 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
944 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
945 ppTInfo);
948 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
949 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
951 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
952 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
953 cNames, lcid, rgDispId);
956 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
957 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
958 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
960 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
961 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
962 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
965 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
967 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
969 TRACE("(%p)->(%p)\n", This, p);
971 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
974 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
976 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
978 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
980 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
983 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
985 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
987 TRACE("(%p)->(%p)\n", This, p);
989 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
992 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
994 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
996 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
998 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
1001 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
1003 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1005 TRACE("(%p)->(%p)\n", This, p);
1007 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
1010 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
1012 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1013 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1014 return E_NOTIMPL;
1017 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
1019 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1020 TRACE("(%p)->(%p)\n", This, p);
1021 return E_NOTIMPL;
1024 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1026 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1028 TRACE("(%p)->(%x)\n", This, v);
1030 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1033 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1035 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1037 TRACE("(%p)->(%p)\n", This, p);
1039 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1042 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1044 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1046 TRACE("(%p)->(%p)\n", This, p);
1048 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1051 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1053 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1055 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1057 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1060 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1062 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1064 TRACE("(%p)->(%p)\n", This, p);
1066 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1069 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1071 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1073 TRACE("(%p)->(%d)\n", This, v);
1075 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1078 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1080 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1082 TRACE("(%p)->(%p)\n", This, p);
1084 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1087 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1089 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1091 TRACE("(%p)->(%d)\n", This, v);
1093 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1096 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1098 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1100 TRACE("(%p)->(%p)\n", This, p);
1102 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1105 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1107 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1109 TRACE("(%p)\n", This);
1111 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1114 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1116 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1118 TRACE("(%p)->()\n", This);
1120 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1123 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1125 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1127 TRACE("(%p)->(%p)\n", This, p);
1129 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1132 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1134 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1136 TRACE("(%p)->()\n", This);
1138 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1141 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1143 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1145 TRACE("(%p)->(%p)\n", This, p);
1147 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1150 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1152 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1154 TRACE("(%p)->(%x)\n", This, v);
1156 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1159 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1161 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1163 TRACE("(%p)->(%p)\n", This, p);
1165 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1168 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1170 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1172 TRACE("(%p)->(%p)\n", This, range);
1174 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1177 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1178 HTMLInputTextElement_QueryInterface,
1179 HTMLInputTextElement_AddRef,
1180 HTMLInputTextElement_Release,
1181 HTMLInputTextElement_GetTypeInfoCount,
1182 HTMLInputTextElement_GetTypeInfo,
1183 HTMLInputTextElement_GetIDsOfNames,
1184 HTMLInputTextElement_Invoke,
1185 HTMLInputTextElement_get_type,
1186 HTMLInputTextElement_put_value,
1187 HTMLInputTextElement_get_value,
1188 HTMLInputTextElement_put_name,
1189 HTMLInputTextElement_get_name,
1190 HTMLInputTextElement_put_status,
1191 HTMLInputTextElement_get_status,
1192 HTMLInputTextElement_put_disabled,
1193 HTMLInputTextElement_get_disabled,
1194 HTMLInputTextElement_get_form,
1195 HTMLInputTextElement_put_defaultValue,
1196 HTMLInputTextElement_get_defaultValue,
1197 HTMLInputTextElement_put_size,
1198 HTMLInputTextElement_get_size,
1199 HTMLInputTextElement_put_maxLength,
1200 HTMLInputTextElement_get_maxLength,
1201 HTMLInputTextElement_select,
1202 HTMLInputTextElement_put_onchange,
1203 HTMLInputTextElement_get_onchange,
1204 HTMLInputTextElement_put_onselect,
1205 HTMLInputTextElement_get_onselect,
1206 HTMLInputTextElement_put_readOnly,
1207 HTMLInputTextElement_get_readOnly,
1208 HTMLInputTextElement_createTextRange
1211 static inline HTMLInputElement *impl_from_IHTMLInputTextElement2(IHTMLInputTextElement2 *iface)
1213 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement2_iface);
1216 static HRESULT WINAPI HTMLInputTextElement2_QueryInterface(IHTMLInputTextElement2 *iface, REFIID riid, void **ppv)
1218 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1219 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1222 static ULONG WINAPI HTMLInputTextElement2_AddRef(IHTMLInputTextElement2 *iface)
1224 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1225 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1228 static ULONG WINAPI HTMLInputTextElement2_Release(IHTMLInputTextElement2 *iface)
1230 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1231 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1234 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfoCount(IHTMLInputTextElement2 *iface, UINT *pctinfo)
1236 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1237 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1240 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfo(IHTMLInputTextElement2 *iface, UINT iTInfo,
1241 LCID lcid, ITypeInfo **ppTInfo)
1243 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1244 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1247 static HRESULT WINAPI HTMLInputTextElement2_GetIDsOfNames(IHTMLInputTextElement2 *iface, REFIID riid,
1248 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1250 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1251 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1252 cNames, lcid, rgDispId);
1255 static HRESULT WINAPI HTMLInputTextElement2_Invoke(IHTMLInputTextElement2 *iface, DISPID dispIdMember,
1256 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1257 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1259 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1260 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1261 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1264 static HRESULT WINAPI HTMLInputTextElement2_put_selectionStart(IHTMLInputTextElement2 *iface, LONG v)
1266 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1267 nsresult nsres;
1269 TRACE("(%p)->(%d)\n", This, v);
1271 nsres = nsIDOMHTMLInputElement_SetSelectionStart(This->nsinput, v);
1272 if(NS_FAILED(nsres)) {
1273 ERR("SetSelectionStart failed: %08x\n", nsres);
1274 return E_FAIL;
1276 return S_OK;
1279 static HRESULT WINAPI HTMLInputTextElement2_get_selectionStart(IHTMLInputTextElement2 *iface, LONG *p)
1281 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1282 INT32 selection_start;
1283 nsresult nsres;
1285 TRACE("(%p)->(%p)\n", This, p);
1287 nsres = nsIDOMHTMLInputElement_GetSelectionStart(This->nsinput, &selection_start);
1288 if(NS_FAILED(nsres)) {
1289 ERR("GetSelectionStart failed: %08x\n", nsres);
1290 return E_FAIL;
1293 *p = selection_start;
1294 return S_OK;
1297 static HRESULT WINAPI HTMLInputTextElement2_put_selectionEnd(IHTMLInputTextElement2 *iface, LONG v)
1299 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1300 nsresult nsres;
1302 TRACE("(%p)->(%d)\n", This, v);
1304 nsres = nsIDOMHTMLInputElement_SetSelectionEnd(This->nsinput, v);
1305 if(NS_FAILED(nsres)) {
1306 ERR("SetSelectionEnd failed: %08x\n", nsres);
1307 return E_FAIL;
1309 return S_OK;
1312 static HRESULT WINAPI HTMLInputTextElement2_get_selectionEnd(IHTMLInputTextElement2 *iface, LONG *p)
1314 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1315 INT32 selection_end;
1316 nsresult nsres;
1318 TRACE("(%p)->(%p)\n", This, p);
1320 nsres = nsIDOMHTMLInputElement_GetSelectionEnd(This->nsinput, &selection_end);
1321 if(NS_FAILED(nsres)) {
1322 ERR("GetSelectionEnd failed: %08x\n", nsres);
1323 return E_FAIL;
1326 *p = selection_end;
1327 return S_OK;
1330 static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElement2 *iface, LONG start, LONG end)
1332 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1333 nsAString none_str;
1334 nsresult nsres;
1336 static const WCHAR noneW[] = {'n','o','n','e',0};
1338 TRACE("(%p)->(%d %d)\n", This, start, end);
1340 nsAString_InitDepend(&none_str, noneW);
1341 nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
1342 nsAString_Finish(&none_str);
1343 if(NS_FAILED(nsres)) {
1344 ERR("SetSelectionRange failed: %08x\n", nsres);
1345 return E_FAIL;
1347 return S_OK;
1350 static const IHTMLInputTextElement2Vtbl HTMLInputTextElement2Vtbl = {
1351 HTMLInputTextElement2_QueryInterface,
1352 HTMLInputTextElement2_AddRef,
1353 HTMLInputTextElement2_Release,
1354 HTMLInputTextElement2_GetTypeInfoCount,
1355 HTMLInputTextElement2_GetTypeInfo,
1356 HTMLInputTextElement2_GetIDsOfNames,
1357 HTMLInputTextElement2_Invoke,
1358 HTMLInputTextElement2_put_selectionStart,
1359 HTMLInputTextElement2_get_selectionStart,
1360 HTMLInputTextElement2_put_selectionEnd,
1361 HTMLInputTextElement2_get_selectionEnd,
1362 HTMLInputTextElement2_setSelectionRange
1365 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1367 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1370 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1372 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1374 *ppv = NULL;
1376 if(IsEqualGUID(&IID_IUnknown, riid)) {
1377 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1378 *ppv = &This->IHTMLInputElement_iface;
1379 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1380 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1381 *ppv = &This->IHTMLInputElement_iface;
1382 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1383 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1384 *ppv = &This->IHTMLInputElement_iface;
1385 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1386 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1387 *ppv = &This->IHTMLInputTextElement_iface;
1388 }else if(IsEqualGUID(&IID_IHTMLInputTextElement2, riid)) {
1389 TRACE("(%p)->(IID_IHTMLInputTextElement2 %p)\n", This, ppv);
1390 *ppv = &This->IHTMLInputTextElement2_iface;
1393 if(*ppv) {
1394 IUnknown_AddRef((IUnknown*)*ppv);
1395 return S_OK;
1398 return HTMLElement_QI(&This->element.node, riid, ppv);
1401 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1403 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1404 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1407 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1409 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1410 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1413 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
1415 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1416 const PRUnichar *type;
1417 nsAString nsstr;
1418 nsresult nsres;
1419 BOOL ret = FALSE;
1421 static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
1422 static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
1423 static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
1424 static const WCHAR resetW[] = {'r','e','s','e','t',0};
1425 static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
1426 static const WCHAR textW[] = {'t','e','x','t',0};
1428 nsAString_Init(&nsstr, NULL);
1429 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
1430 if(NS_SUCCEEDED(nsres)) {
1431 nsAString_GetData(&nsstr, &type);
1432 ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW)
1433 || !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW);
1435 nsAString_Finish(&nsstr);
1436 return ret;
1439 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1441 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1443 if(This->nsinput)
1444 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1447 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1449 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1451 if(This->nsinput) {
1452 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1454 This->nsinput = NULL;
1455 nsIDOMHTMLInputElement_Release(nsinput);
1459 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1460 &CLSID_HTMLInputElement,
1461 HTMLInputElement_QI,
1462 HTMLElement_destructor,
1463 HTMLElement_cpc,
1464 HTMLElement_clone,
1465 HTMLElement_handle_event,
1466 HTMLElement_get_attr_col,
1467 NULL,
1468 HTMLInputElementImpl_put_disabled,
1469 HTMLInputElementImpl_get_disabled,
1470 NULL,
1471 NULL,
1472 NULL,
1473 NULL,
1474 NULL,
1475 HTMLInputElement_traverse,
1476 HTMLInputElement_unlink,
1477 HTMLInputElement_is_text_edit
1480 static const tid_t HTMLInputElement_iface_tids[] = {
1481 HTMLELEMENT_TIDS,
1482 IHTMLInputElement_tid,
1483 IHTMLInputTextElement2_tid,
1486 static dispex_static_data_t HTMLInputElement_dispex = {
1487 NULL,
1488 DispHTMLInputElement_tid,
1489 HTMLInputElement_iface_tids,
1490 HTMLElement_init_dispex_info
1493 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1495 HTMLInputElement *ret;
1496 nsresult nsres;
1498 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1499 if(!ret)
1500 return E_OUTOFMEMORY;
1502 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1503 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1504 ret->IHTMLInputTextElement2_iface.lpVtbl = &HTMLInputTextElement2Vtbl;
1505 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1507 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1509 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1510 assert(nsres == NS_OK);
1512 *elem = &ret->element;
1513 return S_OK;
1516 struct HTMLLabelElement {
1517 HTMLElement element;
1519 IHTMLLabelElement IHTMLLabelElement_iface;
1522 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1524 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1527 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1528 REFIID riid, void **ppv)
1530 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1532 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1535 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1537 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1539 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1542 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1544 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1546 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1549 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1551 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1553 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1556 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1557 LCID lcid, ITypeInfo **ppTInfo)
1559 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1561 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1564 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1565 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1567 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1569 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1570 cNames, lcid, rgDispId);
1573 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1574 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1575 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1577 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1579 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1580 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1583 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1585 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1586 nsAString for_str, val_str;
1587 nsresult nsres;
1589 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1591 nsAString_InitDepend(&for_str, forW);
1592 nsAString_InitDepend(&val_str, v);
1593 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1594 nsAString_Finish(&for_str);
1595 nsAString_Finish(&val_str);
1596 if(NS_FAILED(nsres)) {
1597 ERR("SetAttribute failed: %08x\n", nsres);
1598 return E_FAIL;
1601 return S_OK;
1604 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1606 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1608 TRACE("(%p)->(%p)\n", This, p);
1610 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1613 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1615 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1616 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1617 return E_NOTIMPL;
1620 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1622 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1623 FIXME("(%p)->(%p)\n", This, p);
1624 return E_NOTIMPL;
1627 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1628 HTMLLabelElement_QueryInterface,
1629 HTMLLabelElement_AddRef,
1630 HTMLLabelElement_Release,
1631 HTMLLabelElement_GetTypeInfoCount,
1632 HTMLLabelElement_GetTypeInfo,
1633 HTMLLabelElement_GetIDsOfNames,
1634 HTMLLabelElement_Invoke,
1635 HTMLLabelElement_put_htmlFor,
1636 HTMLLabelElement_get_htmlFor,
1637 HTMLLabelElement_put_accessKey,
1638 HTMLLabelElement_get_accessKey
1641 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1643 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1646 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1648 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1650 *ppv = NULL;
1652 if(IsEqualGUID(&IID_IUnknown, riid)) {
1653 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1654 *ppv = &This->IHTMLLabelElement_iface;
1655 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1656 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1657 *ppv = &This->IHTMLLabelElement_iface;
1658 }else {
1659 return HTMLElement_QI(&This->element.node, riid, ppv);
1662 IUnknown_AddRef((IUnknown*)*ppv);
1663 return S_OK;
1666 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1667 &CLSID_HTMLLabelElement,
1668 HTMLLabelElement_QI,
1669 HTMLElement_destructor,
1670 HTMLElement_cpc,
1671 HTMLElement_clone,
1672 HTMLElement_handle_event,
1673 HTMLElement_get_attr_col,
1676 static const tid_t HTMLLabelElement_iface_tids[] = {
1677 HTMLELEMENT_TIDS,
1678 IHTMLLabelElement_tid,
1682 static dispex_static_data_t HTMLLabelElement_dispex = {
1683 NULL,
1684 DispHTMLLabelElement_tid,
1685 HTMLLabelElement_iface_tids,
1686 HTMLElement_init_dispex_info
1689 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1691 HTMLLabelElement *ret;
1693 ret = heap_alloc_zero(sizeof(*ret));
1694 if(!ret)
1695 return E_OUTOFMEMORY;
1697 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1698 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1700 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1701 *elem = &ret->element;
1702 return S_OK;
1705 struct HTMLButtonElement {
1706 HTMLElement element;
1708 IHTMLButtonElement IHTMLButtonElement_iface;
1710 nsIDOMHTMLButtonElement *nsbutton;
1713 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1715 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1718 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1719 REFIID riid, void **ppv)
1721 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1723 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1726 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1728 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1730 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1733 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1735 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1737 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1740 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1742 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1744 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1747 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1748 LCID lcid, ITypeInfo **ppTInfo)
1750 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1752 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1755 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1756 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1758 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1760 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1761 cNames, lcid, rgDispId);
1764 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1765 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1766 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1768 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1770 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1771 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1774 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1776 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1777 nsAString type_str;
1778 nsresult nsres;
1780 TRACE("(%p)->(%p)\n", This, p);
1782 nsAString_Init(&type_str, NULL);
1783 nsres = nsIDOMHTMLButtonElement_GetType(This->nsbutton, &type_str);
1784 return return_nsstr(nsres, &type_str, p);
1787 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1789 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1790 nsAString nsstr;
1791 nsresult nsres;
1793 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1795 nsAString_InitDepend(&nsstr, v);
1796 nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
1797 nsAString_Finish(&nsstr);
1798 if(NS_FAILED(nsres)) {
1799 ERR("SetValue failed: %08x\n", nsres);
1800 return E_FAIL;
1803 return S_OK;
1806 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1808 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1809 nsAString value_str;
1810 nsresult nsres;
1812 TRACE("(%p)->(%p)\n", This, p);
1814 nsAString_Init(&value_str, NULL);
1815 nsres = nsIDOMHTMLButtonElement_GetValue(This->nsbutton, &value_str);
1816 return return_nsstr(nsres, &value_str, p);
1819 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1821 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1822 nsAString name_str;
1823 nsresult nsres;
1825 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1827 nsAString_InitDepend(&name_str, v);
1828 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1829 nsAString_Finish(&name_str);
1830 if(NS_FAILED(nsres)) {
1831 ERR("SetName failed: %08x\n", nsres);
1832 return E_FAIL;
1835 return S_OK;
1838 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1840 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1841 nsAString name_str;
1842 nsresult nsres;
1844 TRACE("(%p)->(%p)\n", This, p);
1846 nsAString_Init(&name_str, NULL);
1847 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1848 return return_nsstr(nsres, &name_str, p);
1851 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1853 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1854 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1855 return E_NOTIMPL;
1858 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1860 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1861 FIXME("(%p)->(%p)\n", This, p);
1862 return E_NOTIMPL;
1865 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1867 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1868 nsresult nsres;
1870 TRACE("(%p)->(%x)\n", This, v);
1872 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1873 if(NS_FAILED(nsres)) {
1874 ERR("SetDisabled failed: %08x\n", nsres);
1875 return E_FAIL;
1878 return S_OK;
1881 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1883 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1884 cpp_bool disabled;
1885 nsresult nsres;
1887 TRACE("(%p)->(%p)\n", This, p);
1889 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1890 if(NS_FAILED(nsres)) {
1891 ERR("GetDisabled failed: %08x\n", nsres);
1892 return E_FAIL;
1895 *p = variant_bool(disabled);
1896 return S_OK;
1899 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1901 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1902 nsIDOMHTMLFormElement *nsform;
1903 nsresult nsres;
1905 TRACE("(%p)->(%p)\n", This, p);
1907 nsres = nsIDOMHTMLButtonElement_GetForm(This->nsbutton, &nsform);
1908 if (NS_FAILED(nsres)) {
1909 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
1910 return E_FAIL;
1913 return return_nsform(&This->element, nsform, p);
1916 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1918 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1919 FIXME("(%p)->(%p)\n", This, range);
1920 return E_NOTIMPL;
1923 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1924 HTMLButtonElement_QueryInterface,
1925 HTMLButtonElement_AddRef,
1926 HTMLButtonElement_Release,
1927 HTMLButtonElement_GetTypeInfoCount,
1928 HTMLButtonElement_GetTypeInfo,
1929 HTMLButtonElement_GetIDsOfNames,
1930 HTMLButtonElement_Invoke,
1931 HTMLButtonElement_get_type,
1932 HTMLButtonElement_put_value,
1933 HTMLButtonElement_get_value,
1934 HTMLButtonElement_put_name,
1935 HTMLButtonElement_get_name,
1936 HTMLButtonElement_put_status,
1937 HTMLButtonElement_get_status,
1938 HTMLButtonElement_put_disabled,
1939 HTMLButtonElement_get_disabled,
1940 HTMLButtonElement_get_form,
1941 HTMLButtonElement_createTextRange
1944 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1946 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1949 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1951 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1953 *ppv = NULL;
1955 if(IsEqualGUID(&IID_IUnknown, riid)) {
1956 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1957 *ppv = &This->IHTMLButtonElement_iface;
1958 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1959 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1960 *ppv = &This->IHTMLButtonElement_iface;
1961 }else {
1962 return HTMLElement_QI(&This->element.node, riid, ppv);
1965 IUnknown_AddRef((IUnknown*)*ppv);
1966 return S_OK;
1969 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1971 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1972 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1975 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1977 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1978 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1981 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
1983 return TRUE;
1986 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1988 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1990 if(This->nsbutton)
1991 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1994 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1996 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1998 if(This->nsbutton) {
1999 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
2001 This->nsbutton = NULL;
2002 nsIDOMHTMLButtonElement_Release(nsbutton);
2006 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
2007 &CLSID_HTMLButtonElement,
2008 HTMLButtonElement_QI,
2009 HTMLElement_destructor,
2010 HTMLElement_cpc,
2011 HTMLElement_clone,
2012 HTMLElement_handle_event,
2013 HTMLElement_get_attr_col,
2014 NULL,
2015 HTMLButtonElementImpl_put_disabled,
2016 HTMLButtonElementImpl_get_disabled,
2017 NULL,
2018 NULL,
2019 NULL,
2020 NULL,
2021 NULL,
2022 HTMLButtonElement_traverse,
2023 HTMLButtonElement_unlink,
2024 HTMLButtonElement_is_text_edit
2027 static const tid_t HTMLButtonElement_iface_tids[] = {
2028 HTMLELEMENT_TIDS,
2029 IHTMLButtonElement_tid,
2033 static dispex_static_data_t HTMLButtonElement_dispex = {
2034 NULL,
2035 DispHTMLButtonElement_tid,
2036 HTMLButtonElement_iface_tids,
2037 HTMLElement_init_dispex_info
2040 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
2042 HTMLButtonElement *ret;
2043 nsresult nsres;
2045 ret = heap_alloc_zero(sizeof(*ret));
2046 if(!ret)
2047 return E_OUTOFMEMORY;
2049 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
2050 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
2052 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
2054 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
2055 assert(nsres == NS_OK);
2057 *elem = &ret->element;
2058 return S_OK;