windows.networking.hostname/tests: Add IHostNameFactory::CreateHostName() tests.
[wine.git] / dlls / mshtml / htmlinput.c
blobc220a2495c7611cd579eb4e497b9fac635f3217d
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 <limits.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 struct HTMLInputElement {
37 HTMLElement element;
39 IHTMLInputElement IHTMLInputElement_iface;
40 IHTMLInputTextElement IHTMLInputTextElement_iface;
41 IHTMLInputTextElement2 IHTMLInputTextElement2_iface;
43 nsIDOMHTMLInputElement *nsinput;
46 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
48 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
51 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
53 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
56 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
57 REFIID riid, void **ppv)
59 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
61 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
64 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
66 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
68 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
71 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
73 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
75 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
78 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
80 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
82 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
85 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
86 LCID lcid, ITypeInfo **ppTInfo)
88 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
90 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
91 ppTInfo);
94 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
95 LPOLESTR *rgszNames, UINT cNames,
96 LCID lcid, DISPID *rgDispId)
98 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
100 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
101 cNames, lcid, rgDispId);
104 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
105 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
106 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
108 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
110 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
111 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
114 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
116 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
117 nsAString type_str;
118 nsresult nsres;
120 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
123 * FIXME:
124 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
126 nsAString_InitDepend(&type_str, v);
127 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
128 nsAString_Finish(&type_str);
129 if(NS_FAILED(nsres)) {
130 ERR("SetType failed: %08lx\n", nsres);
131 return E_FAIL;
134 return S_OK;
137 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
139 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
140 nsAString type_str;
141 nsresult nsres;
143 TRACE("(%p)->(%p)\n", This, p);
145 nsAString_Init(&type_str, NULL);
146 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
147 return return_nsstr(nsres, &type_str, p);
150 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
152 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
153 nsAString val_str;
154 nsresult nsres;
156 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
158 nsAString_InitDepend(&val_str, v);
159 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
160 nsAString_Finish(&val_str);
161 if(NS_FAILED(nsres))
162 ERR("SetValue failed: %08lx\n", nsres);
164 return S_OK;
167 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
169 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
170 nsAString value_str;
171 nsresult nsres;
173 TRACE("(%p)->(%p)\n", This, p);
175 nsAString_Init(&value_str, NULL);
176 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
177 return return_nsstr(nsres, &value_str, p);
180 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
182 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
183 nsAString name_str;
184 nsresult nsres;
186 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
188 nsAString_InitDepend(&name_str, v);
189 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
190 nsAString_Finish(&name_str);
191 if(NS_FAILED(nsres)) {
192 ERR("SetName failed: %08lx\n", nsres);
193 return E_FAIL;
196 return S_OK;
199 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
201 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
202 nsAString name_str;
203 nsresult nsres;
205 TRACE("(%p)->(%p)\n", This, p);
207 nsAString_Init(&name_str, NULL);
208 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
209 return return_nsstr(nsres, &name_str, p);
212 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
214 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
215 FIXME("(%p)->(%x)\n", This, v);
216 return E_NOTIMPL;
219 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
221 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
222 FIXME("(%p)->(%p)\n", This, p);
223 return E_NOTIMPL;
226 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
228 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
229 nsresult nsres;
231 TRACE("(%p)->(%x)\n", This, v);
233 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
234 if(NS_FAILED(nsres))
235 ERR("SetDisabled failed: %08lx\n", nsres);
237 return S_OK;
240 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
242 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
243 cpp_bool disabled = FALSE;
245 TRACE("(%p)->(%p)\n", This, p);
247 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
249 *p = variant_bool(disabled);
250 return S_OK;
253 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
255 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
256 nsIDOMHTMLFormElement *nsform;
257 nsresult nsres;
259 TRACE("(%p)->(%p)\n", This, p);
261 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
262 return return_nsform(nsres, nsform, p);
265 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
267 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
268 UINT32 val = v;
269 nsresult nsres;
271 TRACE("(%p)->(%ld)\n", This, v);
272 if (v <= 0)
273 return CTL_E_INVALIDPROPERTYVALUE;
275 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
276 if (NS_FAILED(nsres)) {
277 ERR("Set Size(%u) failed: %08lx\n", val, nsres);
278 return E_FAIL;
280 return S_OK;
283 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
285 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
286 UINT32 val;
287 nsresult nsres;
289 TRACE("(%p)->(%p)\n", This, p);
290 if (p == NULL)
291 return E_INVALIDARG;
293 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
294 if (NS_FAILED(nsres)) {
295 ERR("Get Size failed: %08lx\n", nsres);
296 return E_FAIL;
298 *p = val;
299 return S_OK;
302 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
304 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
305 nsresult nsres;
307 TRACE("(%p)->(%ld)\n", This, v);
309 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
310 if(NS_FAILED(nsres)) {
311 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
312 FIXME("SetMaxLength failed\n");
313 return E_FAIL;
316 return S_OK;
319 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
321 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
322 LONG max_length;
323 nsresult nsres;
325 TRACE("(%p)->(%p)\n", This, p);
327 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
328 assert(nsres == NS_OK);
330 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
331 *p = max_length == -1 ? INT_MAX : max_length;
332 return S_OK;
335 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
337 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
338 nsresult nsres;
340 TRACE("(%p)\n", This);
342 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
343 if(NS_FAILED(nsres)) {
344 ERR("Select failed: %08lx\n", nsres);
345 return E_FAIL;
348 return S_OK;
351 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
353 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
355 TRACE("(%p)->()\n", This);
357 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
360 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
362 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
364 TRACE("(%p)->(%p)\n", This, p);
366 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
369 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
371 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
372 FIXME("(%p)->()\n", This);
373 return E_NOTIMPL;
376 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
378 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
379 FIXME("(%p)->(%p)\n", This, p);
380 return E_NOTIMPL;
383 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
385 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
386 nsAString nsstr;
387 nsresult nsres;
389 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
391 nsAString_InitDepend(&nsstr, v);
392 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
393 nsAString_Finish(&nsstr);
394 if(NS_FAILED(nsres)) {
395 ERR("SetValue failed: %08lx\n", nsres);
396 return E_FAIL;
399 return S_OK;
402 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
404 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
405 nsAString nsstr;
406 nsresult nsres;
408 TRACE("(%p)->(%p)\n", This, p);
410 nsAString_Init(&nsstr, NULL);
411 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
412 return return_nsstr(nsres, &nsstr, p);
415 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
417 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
418 nsresult nsres;
420 TRACE("(%p)->(%x)\n", This, v);
422 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
423 if (NS_FAILED(nsres)) {
424 ERR("Set ReadOnly Failed: %08lx\n", nsres);
425 return E_FAIL;
427 return S_OK;
430 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
432 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
433 nsresult nsres;
434 cpp_bool b;
436 TRACE("(%p)->(%p)\n", This, p);
438 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
439 if (NS_FAILED(nsres)) {
440 ERR("Get ReadOnly Failed: %08lx\n", nsres);
441 return E_FAIL;
444 *p = variant_bool(b);
445 return S_OK;
448 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
450 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
451 FIXME("(%p)->(%p)\n", This, range);
452 return E_NOTIMPL;
455 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
457 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
458 FIXME("(%p)->(%x)\n", This, v);
459 return E_NOTIMPL;
462 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
464 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
465 FIXME("(%p)->(%p)\n", This, p);
466 return E_NOTIMPL;
469 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
471 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
472 nsresult nsres;
474 TRACE("(%p)->(%x)\n", This, v);
476 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
477 if(NS_FAILED(nsres)) {
478 ERR("SetDefaultChecked failed: %08lx\n", nsres);
479 return E_FAIL;
482 return S_OK;
485 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
487 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
488 cpp_bool default_checked = FALSE;
489 nsresult nsres;
491 TRACE("(%p)->(%p)\n", This, p);
493 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
494 if(NS_FAILED(nsres)) {
495 ERR("GetDefaultChecked failed: %08lx\n", nsres);
496 return E_FAIL;
499 *p = variant_bool(default_checked);
500 return S_OK;
503 static HRESULT WINAPI HTMLInputElement_put_checked(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_SetChecked(This->nsinput, v != VARIANT_FALSE);
511 if(NS_FAILED(nsres)) {
512 ERR("SetChecked failed: %08lx\n", nsres);
513 return E_FAIL;
516 return S_OK;
519 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
521 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
522 cpp_bool checked;
523 nsresult nsres;
525 TRACE("(%p)->(%p)\n", This, p);
527 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
528 if(NS_FAILED(nsres)) {
529 ERR("GetChecked failed: %08lx\n", nsres);
530 return E_FAIL;
533 *p = variant_bool(checked);
534 TRACE("checked=%x\n", *p);
535 return S_OK;
538 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
540 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
541 FIXME("(%p)->()\n", This);
542 return E_NOTIMPL;
545 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
547 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
548 FIXME("(%p)->(%p)\n", This, p);
549 return E_NOTIMPL;
552 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
554 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
555 FIXME("(%p)->(%ld)\n", This, v);
556 return E_NOTIMPL;
559 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
561 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
562 FIXME("(%p)->(%p)\n", This, p);
563 return E_NOTIMPL;
566 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
568 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
569 FIXME("(%p)->(%ld)\n", This, v);
570 return E_NOTIMPL;
573 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
575 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
576 FIXME("(%p)->(%p)\n", This, p);
577 return E_NOTIMPL;
580 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
582 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
583 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
584 return E_NOTIMPL;
587 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
589 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
590 FIXME("(%p)->(%p)\n", This, p);
591 return E_NOTIMPL;
594 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
596 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
597 nsAString nsstr;
598 nsresult nsres;
600 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
602 nsAString_InitDepend(&nsstr, v);
603 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
604 nsAString_Finish(&nsstr);
605 if(NS_FAILED(nsres))
606 ERR("SetSrc failed: %08lx\n", nsres);
608 return S_OK;
611 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
613 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
614 const PRUnichar *src;
615 nsAString src_str;
616 nsresult nsres;
617 HRESULT hres;
619 TRACE("(%p)->(%p)\n", This, p);
621 nsAString_Init(&src_str, NULL);
622 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
623 if(NS_FAILED(nsres)) {
624 ERR("GetSrc failed: %08lx\n", nsres);
625 return E_FAIL;
628 nsAString_GetData(&src_str, &src);
629 hres = nsuri_to_url(src, FALSE, p);
630 nsAString_Finish(&src_str);
632 return hres;
635 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
637 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
638 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
639 return E_NOTIMPL;
642 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
644 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
645 FIXME("(%p)->(%p)\n", This, p);
646 return E_NOTIMPL;
649 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
651 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
652 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
653 return E_NOTIMPL;
656 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
658 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
659 FIXME("(%p)->(%p)\n", This, p);
660 return E_NOTIMPL;
663 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
665 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
666 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
667 return E_NOTIMPL;
670 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
672 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
673 FIXME("(%p)->(%p)\n", This, p);
674 return E_NOTIMPL;
677 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
679 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
680 FIXME("(%p)->(%p)\n", This, p);
681 return E_NOTIMPL;
684 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
686 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
687 cpp_bool complete;
688 nsresult nsres;
690 TRACE("(%p)->(%p)\n", This, p);
692 nsres = nsIDOMHTMLInputElement_GetComplete(This->nsinput, &complete);
693 if(NS_FAILED(nsres))
694 return map_nsresult(nsres);
696 *p = variant_bool(complete);
697 return S_OK;
700 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
702 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
703 FIXME("(%p)->()\n", This);
704 return E_NOTIMPL;
707 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
709 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
710 FIXME("(%p)->(%p)\n", This, p);
711 return E_NOTIMPL;
714 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
716 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
717 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
718 return E_NOTIMPL;
721 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
723 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
724 FIXME("(%p)->(%p)\n", This, p);
725 return E_NOTIMPL;
728 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
730 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
732 TRACE("(%p)->()\n", This);
734 return set_node_event(&This->element.node, EVENTID_LOAD, &v);
737 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
739 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
741 TRACE("(%p)->(%p)\n", This, p);
743 return get_node_event(&This->element.node, EVENTID_LOAD, p);
746 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
748 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
749 FIXME("(%p)->()\n", This);
750 return E_NOTIMPL;
753 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
755 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
756 FIXME("(%p)->(%p)\n", This, p);
757 return E_NOTIMPL;
760 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
762 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
763 FIXME("(%p)->()\n", This);
764 return E_NOTIMPL;
767 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
769 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
770 FIXME("(%p)->(%p)\n", This, p);
771 return E_NOTIMPL;
774 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
776 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
777 FIXME("(%p)->(%ld)\n", This, v);
778 return E_NOTIMPL;
781 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
783 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
784 FIXME("(%p)->(%p)\n", This, p);
785 return E_NOTIMPL;
788 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
790 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
791 FIXME("(%p)->(%ld)\n", This, v);
792 return E_NOTIMPL;
795 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
797 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
798 FIXME("(%p)->(%p)\n", This, p);
799 return E_NOTIMPL;
802 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
804 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
805 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
806 return E_NOTIMPL;
809 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
811 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
812 FIXME("(%p)->(%p)\n", This, p);
813 return E_NOTIMPL;
816 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
817 HTMLInputElement_QueryInterface,
818 HTMLInputElement_AddRef,
819 HTMLInputElement_Release,
820 HTMLInputElement_GetTypeInfoCount,
821 HTMLInputElement_GetTypeInfo,
822 HTMLInputElement_GetIDsOfNames,
823 HTMLInputElement_Invoke,
824 HTMLInputElement_put_type,
825 HTMLInputElement_get_type,
826 HTMLInputElement_put_value,
827 HTMLInputElement_get_value,
828 HTMLInputElement_put_name,
829 HTMLInputElement_get_name,
830 HTMLInputElement_put_status,
831 HTMLInputElement_get_status,
832 HTMLInputElement_put_disabled,
833 HTMLInputElement_get_disabled,
834 HTMLInputElement_get_form,
835 HTMLInputElement_put_size,
836 HTMLInputElement_get_size,
837 HTMLInputElement_put_maxLength,
838 HTMLInputElement_get_maxLength,
839 HTMLInputElement_select,
840 HTMLInputElement_put_onchange,
841 HTMLInputElement_get_onchange,
842 HTMLInputElement_put_onselect,
843 HTMLInputElement_get_onselect,
844 HTMLInputElement_put_defaultValue,
845 HTMLInputElement_get_defaultValue,
846 HTMLInputElement_put_readOnly,
847 HTMLInputElement_get_readOnly,
848 HTMLInputElement_createTextRange,
849 HTMLInputElement_put_indeterminate,
850 HTMLInputElement_get_indeterminate,
851 HTMLInputElement_put_defaultChecked,
852 HTMLInputElement_get_defaultChecked,
853 HTMLInputElement_put_checked,
854 HTMLInputElement_get_checked,
855 HTMLInputElement_put_border,
856 HTMLInputElement_get_border,
857 HTMLInputElement_put_vspace,
858 HTMLInputElement_get_vspace,
859 HTMLInputElement_put_hspace,
860 HTMLInputElement_get_hspace,
861 HTMLInputElement_put_alt,
862 HTMLInputElement_get_alt,
863 HTMLInputElement_put_src,
864 HTMLInputElement_get_src,
865 HTMLInputElement_put_lowsrc,
866 HTMLInputElement_get_lowsrc,
867 HTMLInputElement_put_vrml,
868 HTMLInputElement_get_vrml,
869 HTMLInputElement_put_dynsrc,
870 HTMLInputElement_get_dynsrc,
871 HTMLInputElement_get_readyState,
872 HTMLInputElement_get_complete,
873 HTMLInputElement_put_loop,
874 HTMLInputElement_get_loop,
875 HTMLInputElement_put_align,
876 HTMLInputElement_get_align,
877 HTMLInputElement_put_onload,
878 HTMLInputElement_get_onload,
879 HTMLInputElement_put_onerror,
880 HTMLInputElement_get_onerror,
881 HTMLInputElement_put_onabort,
882 HTMLInputElement_get_onabort,
883 HTMLInputElement_put_width,
884 HTMLInputElement_get_width,
885 HTMLInputElement_put_height,
886 HTMLInputElement_get_height,
887 HTMLInputElement_put_start,
888 HTMLInputElement_get_start
891 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
892 REFIID riid, void **ppv)
894 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
896 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
899 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
901 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
903 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
906 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
908 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
910 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
913 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
915 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
916 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
919 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
920 LCID lcid, ITypeInfo **ppTInfo)
922 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
923 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
924 ppTInfo);
927 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
928 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
930 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
931 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
932 cNames, lcid, rgDispId);
935 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
936 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
937 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
939 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
940 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
941 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
944 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
946 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
948 TRACE("(%p)->(%p)\n", This, p);
950 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
953 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
955 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
957 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
959 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
962 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
964 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
966 TRACE("(%p)->(%p)\n", This, p);
968 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
971 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
973 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
975 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
977 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
980 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
982 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
984 TRACE("(%p)->(%p)\n", This, p);
986 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
989 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
991 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
992 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
993 return E_NOTIMPL;
996 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
998 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
999 TRACE("(%p)->(%p)\n", This, p);
1000 return E_NOTIMPL;
1003 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1005 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1007 TRACE("(%p)->(%x)\n", This, v);
1009 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1012 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1014 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1016 TRACE("(%p)->(%p)\n", This, p);
1018 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1021 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1023 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1025 TRACE("(%p)->(%p)\n", This, p);
1027 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1030 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1032 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1034 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1036 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1039 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1041 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1043 TRACE("(%p)->(%p)\n", This, p);
1045 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1048 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1050 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1052 TRACE("(%p)->(%ld)\n", This, v);
1054 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1057 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1059 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1061 TRACE("(%p)->(%p)\n", This, p);
1063 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1066 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1068 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1070 TRACE("(%p)->(%ld)\n", This, v);
1072 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1075 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1077 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1079 TRACE("(%p)->(%p)\n", This, p);
1081 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1084 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1086 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1088 TRACE("(%p)\n", This);
1090 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1093 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1095 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1097 TRACE("(%p)->()\n", This);
1099 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1102 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1104 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1106 TRACE("(%p)->(%p)\n", This, p);
1108 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1111 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1113 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1115 TRACE("(%p)->()\n", This);
1117 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1120 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1122 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1124 TRACE("(%p)->(%p)\n", This, p);
1126 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1129 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1131 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1133 TRACE("(%p)->(%x)\n", This, v);
1135 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1138 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1140 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1142 TRACE("(%p)->(%p)\n", This, p);
1144 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1147 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1149 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1151 TRACE("(%p)->(%p)\n", This, range);
1153 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1156 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1157 HTMLInputTextElement_QueryInterface,
1158 HTMLInputTextElement_AddRef,
1159 HTMLInputTextElement_Release,
1160 HTMLInputTextElement_GetTypeInfoCount,
1161 HTMLInputTextElement_GetTypeInfo,
1162 HTMLInputTextElement_GetIDsOfNames,
1163 HTMLInputTextElement_Invoke,
1164 HTMLInputTextElement_get_type,
1165 HTMLInputTextElement_put_value,
1166 HTMLInputTextElement_get_value,
1167 HTMLInputTextElement_put_name,
1168 HTMLInputTextElement_get_name,
1169 HTMLInputTextElement_put_status,
1170 HTMLInputTextElement_get_status,
1171 HTMLInputTextElement_put_disabled,
1172 HTMLInputTextElement_get_disabled,
1173 HTMLInputTextElement_get_form,
1174 HTMLInputTextElement_put_defaultValue,
1175 HTMLInputTextElement_get_defaultValue,
1176 HTMLInputTextElement_put_size,
1177 HTMLInputTextElement_get_size,
1178 HTMLInputTextElement_put_maxLength,
1179 HTMLInputTextElement_get_maxLength,
1180 HTMLInputTextElement_select,
1181 HTMLInputTextElement_put_onchange,
1182 HTMLInputTextElement_get_onchange,
1183 HTMLInputTextElement_put_onselect,
1184 HTMLInputTextElement_get_onselect,
1185 HTMLInputTextElement_put_readOnly,
1186 HTMLInputTextElement_get_readOnly,
1187 HTMLInputTextElement_createTextRange
1190 static inline HTMLInputElement *impl_from_IHTMLInputTextElement2(IHTMLInputTextElement2 *iface)
1192 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement2_iface);
1195 static HRESULT WINAPI HTMLInputTextElement2_QueryInterface(IHTMLInputTextElement2 *iface, REFIID riid, void **ppv)
1197 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1198 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1201 static ULONG WINAPI HTMLInputTextElement2_AddRef(IHTMLInputTextElement2 *iface)
1203 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1204 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1207 static ULONG WINAPI HTMLInputTextElement2_Release(IHTMLInputTextElement2 *iface)
1209 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1210 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1213 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfoCount(IHTMLInputTextElement2 *iface, UINT *pctinfo)
1215 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1216 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1219 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfo(IHTMLInputTextElement2 *iface, UINT iTInfo,
1220 LCID lcid, ITypeInfo **ppTInfo)
1222 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1223 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1226 static HRESULT WINAPI HTMLInputTextElement2_GetIDsOfNames(IHTMLInputTextElement2 *iface, REFIID riid,
1227 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1229 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1230 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1231 cNames, lcid, rgDispId);
1234 static HRESULT WINAPI HTMLInputTextElement2_Invoke(IHTMLInputTextElement2 *iface, DISPID dispIdMember,
1235 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1236 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1238 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1239 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1240 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1243 static HRESULT WINAPI HTMLInputTextElement2_put_selectionStart(IHTMLInputTextElement2 *iface, LONG v)
1245 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1246 nsresult nsres;
1248 TRACE("(%p)->(%ld)\n", This, v);
1250 nsres = nsIDOMHTMLInputElement_SetSelectionStart(This->nsinput, v);
1251 if(NS_FAILED(nsres)) {
1252 ERR("SetSelectionStart failed: %08lx\n", nsres);
1253 return E_FAIL;
1255 return S_OK;
1258 static HRESULT WINAPI HTMLInputTextElement2_get_selectionStart(IHTMLInputTextElement2 *iface, LONG *p)
1260 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1261 LONG selection_start;
1262 nsresult nsres;
1264 TRACE("(%p)->(%p)\n", This, p);
1266 nsres = nsIDOMHTMLInputElement_GetSelectionStart(This->nsinput, &selection_start);
1267 if(NS_FAILED(nsres)) {
1268 ERR("GetSelectionStart failed: %08lx\n", nsres);
1269 return E_FAIL;
1272 *p = selection_start;
1273 return S_OK;
1276 static HRESULT WINAPI HTMLInputTextElement2_put_selectionEnd(IHTMLInputTextElement2 *iface, LONG v)
1278 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1279 nsresult nsres;
1281 TRACE("(%p)->(%ld)\n", This, v);
1283 nsres = nsIDOMHTMLInputElement_SetSelectionEnd(This->nsinput, v);
1284 if(NS_FAILED(nsres)) {
1285 ERR("SetSelectionEnd failed: %08lx\n", nsres);
1286 return E_FAIL;
1288 return S_OK;
1291 static HRESULT WINAPI HTMLInputTextElement2_get_selectionEnd(IHTMLInputTextElement2 *iface, LONG *p)
1293 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1294 LONG selection_end;
1295 nsresult nsres;
1297 TRACE("(%p)->(%p)\n", This, p);
1299 nsres = nsIDOMHTMLInputElement_GetSelectionEnd(This->nsinput, &selection_end);
1300 if(NS_FAILED(nsres)) {
1301 ERR("GetSelectionEnd failed: %08lx\n", nsres);
1302 return E_FAIL;
1305 *p = selection_end;
1306 return S_OK;
1309 static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElement2 *iface, LONG start, LONG end)
1311 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1312 nsAString none_str;
1313 nsresult nsres;
1315 TRACE("(%p)->(%ld %ld)\n", This, start, end);
1317 nsAString_InitDepend(&none_str, L"none");
1318 nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
1319 nsAString_Finish(&none_str);
1320 if(NS_FAILED(nsres)) {
1321 ERR("SetSelectionRange failed: %08lx\n", nsres);
1322 return E_FAIL;
1324 return S_OK;
1327 static const IHTMLInputTextElement2Vtbl HTMLInputTextElement2Vtbl = {
1328 HTMLInputTextElement2_QueryInterface,
1329 HTMLInputTextElement2_AddRef,
1330 HTMLInputTextElement2_Release,
1331 HTMLInputTextElement2_GetTypeInfoCount,
1332 HTMLInputTextElement2_GetTypeInfo,
1333 HTMLInputTextElement2_GetIDsOfNames,
1334 HTMLInputTextElement2_Invoke,
1335 HTMLInputTextElement2_put_selectionStart,
1336 HTMLInputTextElement2_get_selectionStart,
1337 HTMLInputTextElement2_put_selectionEnd,
1338 HTMLInputTextElement2_get_selectionEnd,
1339 HTMLInputTextElement2_setSelectionRange
1342 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1344 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1347 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1349 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1351 *ppv = NULL;
1353 if(IsEqualGUID(&IID_IUnknown, riid)) {
1354 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1355 *ppv = &This->IHTMLInputElement_iface;
1356 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1357 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1358 *ppv = &This->IHTMLInputElement_iface;
1359 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1360 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1361 *ppv = &This->IHTMLInputElement_iface;
1362 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1363 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1364 *ppv = &This->IHTMLInputTextElement_iface;
1365 }else if(IsEqualGUID(&IID_IHTMLInputTextElement2, riid)) {
1366 TRACE("(%p)->(IID_IHTMLInputTextElement2 %p)\n", This, ppv);
1367 *ppv = &This->IHTMLInputTextElement2_iface;
1370 if(*ppv) {
1371 IUnknown_AddRef((IUnknown*)*ppv);
1372 return S_OK;
1375 return HTMLElement_QI(&This->element.node, riid, ppv);
1378 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1380 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1381 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1384 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1386 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1387 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1390 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
1392 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1393 const PRUnichar *type;
1394 nsAString nsstr;
1395 nsresult nsres;
1396 BOOL ret = FALSE;
1398 nsAString_Init(&nsstr, NULL);
1399 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
1400 if(NS_SUCCEEDED(nsres)) {
1401 nsAString_GetData(&nsstr, &type);
1402 ret = !wcscmp(type, L"button") || !wcscmp(type, L"hidden") || !wcscmp(type, L"password")
1403 || !wcscmp(type, L"reset") || !wcscmp(type, L"submit") || !wcscmp(type, L"text");
1405 nsAString_Finish(&nsstr);
1406 return ret;
1409 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1411 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1413 if(This->nsinput)
1414 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1417 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1419 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1421 if(This->nsinput) {
1422 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1424 This->nsinput = NULL;
1425 nsIDOMHTMLInputElement_Release(nsinput);
1429 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1430 &CLSID_HTMLInputElement,
1431 HTMLInputElement_QI,
1432 HTMLElement_destructor,
1433 HTMLElement_cpc,
1434 HTMLElement_clone,
1435 HTMLElement_handle_event,
1436 HTMLElement_get_attr_col,
1437 NULL,
1438 HTMLInputElementImpl_put_disabled,
1439 HTMLInputElementImpl_get_disabled,
1440 NULL,
1441 NULL,
1442 NULL,
1443 NULL,
1444 NULL,
1445 NULL,
1446 HTMLInputElement_traverse,
1447 HTMLInputElement_unlink,
1448 HTMLInputElement_is_text_edit
1451 static const tid_t HTMLInputElement_iface_tids[] = {
1452 HTMLELEMENT_TIDS,
1453 IHTMLInputElement_tid,
1454 IHTMLInputTextElement2_tid,
1457 static dispex_static_data_t HTMLInputElement_dispex = {
1458 L"HTMLInputElement",
1459 NULL,
1460 DispHTMLInputElement_tid,
1461 HTMLInputElement_iface_tids,
1462 HTMLElement_init_dispex_info
1465 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1467 HTMLInputElement *ret;
1468 nsresult nsres;
1470 ret = calloc(1, sizeof(HTMLInputElement));
1471 if(!ret)
1472 return E_OUTOFMEMORY;
1474 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1475 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1476 ret->IHTMLInputTextElement2_iface.lpVtbl = &HTMLInputTextElement2Vtbl;
1477 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1479 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1481 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1482 assert(nsres == NS_OK);
1484 *elem = &ret->element;
1485 return S_OK;
1488 struct HTMLLabelElement {
1489 HTMLElement element;
1491 IHTMLLabelElement IHTMLLabelElement_iface;
1494 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1496 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1499 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1500 REFIID riid, void **ppv)
1502 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1504 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1507 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1509 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1511 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1514 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1516 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1518 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1521 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1523 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1525 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1528 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1529 LCID lcid, ITypeInfo **ppTInfo)
1531 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1533 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1536 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1537 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1539 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1541 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1542 cNames, lcid, rgDispId);
1545 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1546 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1547 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1549 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1551 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1552 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1555 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1557 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1558 nsAString for_str, val_str;
1559 nsresult nsres;
1561 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1563 nsAString_InitDepend(&for_str, L"for");
1564 nsAString_InitDepend(&val_str, v);
1565 nsres = nsIDOMElement_SetAttribute(This->element.dom_element, &for_str, &val_str);
1566 nsAString_Finish(&for_str);
1567 nsAString_Finish(&val_str);
1568 if(NS_FAILED(nsres)) {
1569 ERR("SetAttribute failed: %08lx\n", nsres);
1570 return E_FAIL;
1573 return S_OK;
1576 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1578 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1580 TRACE("(%p)->(%p)\n", This, p);
1582 return elem_string_attr_getter(&This->element, L"for", FALSE, p);
1585 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1587 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1588 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1589 return E_NOTIMPL;
1592 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1594 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1595 FIXME("(%p)->(%p)\n", This, p);
1596 return E_NOTIMPL;
1599 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1600 HTMLLabelElement_QueryInterface,
1601 HTMLLabelElement_AddRef,
1602 HTMLLabelElement_Release,
1603 HTMLLabelElement_GetTypeInfoCount,
1604 HTMLLabelElement_GetTypeInfo,
1605 HTMLLabelElement_GetIDsOfNames,
1606 HTMLLabelElement_Invoke,
1607 HTMLLabelElement_put_htmlFor,
1608 HTMLLabelElement_get_htmlFor,
1609 HTMLLabelElement_put_accessKey,
1610 HTMLLabelElement_get_accessKey
1613 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1615 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1618 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1620 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1622 *ppv = NULL;
1624 if(IsEqualGUID(&IID_IUnknown, riid)) {
1625 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1626 *ppv = &This->IHTMLLabelElement_iface;
1627 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1628 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1629 *ppv = &This->IHTMLLabelElement_iface;
1630 }else {
1631 return HTMLElement_QI(&This->element.node, riid, ppv);
1634 IUnknown_AddRef((IUnknown*)*ppv);
1635 return S_OK;
1638 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1639 &CLSID_HTMLLabelElement,
1640 HTMLLabelElement_QI,
1641 HTMLElement_destructor,
1642 HTMLElement_cpc,
1643 HTMLElement_clone,
1644 HTMLElement_handle_event,
1645 HTMLElement_get_attr_col,
1648 static const tid_t HTMLLabelElement_iface_tids[] = {
1649 HTMLELEMENT_TIDS,
1650 IHTMLLabelElement_tid,
1654 static dispex_static_data_t HTMLLabelElement_dispex = {
1655 L"HTMLLabelElement",
1656 NULL,
1657 DispHTMLLabelElement_tid,
1658 HTMLLabelElement_iface_tids,
1659 HTMLElement_init_dispex_info
1662 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1664 HTMLLabelElement *ret;
1666 ret = calloc(1, sizeof(*ret));
1667 if(!ret)
1668 return E_OUTOFMEMORY;
1670 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1671 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1673 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1674 *elem = &ret->element;
1675 return S_OK;
1678 struct HTMLButtonElement {
1679 HTMLElement element;
1681 IHTMLButtonElement IHTMLButtonElement_iface;
1683 nsIDOMHTMLButtonElement *nsbutton;
1686 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1688 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1691 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1692 REFIID riid, void **ppv)
1694 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1696 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1699 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1701 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1703 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1706 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1708 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1710 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1713 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1715 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1717 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1720 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1721 LCID lcid, ITypeInfo **ppTInfo)
1723 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1725 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1728 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1729 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1731 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1733 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1734 cNames, lcid, rgDispId);
1737 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1738 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1739 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1741 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1743 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1744 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1747 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1749 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1750 nsAString type_str;
1751 nsresult nsres;
1753 TRACE("(%p)->(%p)\n", This, p);
1755 nsAString_Init(&type_str, NULL);
1756 nsres = nsIDOMHTMLButtonElement_GetType(This->nsbutton, &type_str);
1757 return return_nsstr(nsres, &type_str, p);
1760 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1762 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1763 nsAString nsstr;
1764 nsresult nsres;
1766 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1768 nsAString_InitDepend(&nsstr, v);
1769 nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
1770 nsAString_Finish(&nsstr);
1771 if(NS_FAILED(nsres)) {
1772 ERR("SetValue failed: %08lx\n", nsres);
1773 return E_FAIL;
1776 return S_OK;
1779 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1781 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1782 nsAString value_str;
1783 nsresult nsres;
1785 TRACE("(%p)->(%p)\n", This, p);
1787 nsAString_Init(&value_str, NULL);
1788 nsres = nsIDOMHTMLButtonElement_GetValue(This->nsbutton, &value_str);
1789 return return_nsstr(nsres, &value_str, p);
1792 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1794 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1795 nsAString name_str;
1796 nsresult nsres;
1798 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1800 nsAString_InitDepend(&name_str, v);
1801 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1802 nsAString_Finish(&name_str);
1803 if(NS_FAILED(nsres)) {
1804 ERR("SetName failed: %08lx\n", nsres);
1805 return E_FAIL;
1808 return S_OK;
1811 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1813 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1814 nsAString name_str;
1815 nsresult nsres;
1817 TRACE("(%p)->(%p)\n", This, p);
1819 nsAString_Init(&name_str, NULL);
1820 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1821 return return_nsstr(nsres, &name_str, p);
1824 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1826 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1827 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1828 return E_NOTIMPL;
1831 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1833 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1834 FIXME("(%p)->(%p)\n", This, p);
1835 return E_NOTIMPL;
1838 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1840 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1841 nsresult nsres;
1843 TRACE("(%p)->(%x)\n", This, v);
1845 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1846 if(NS_FAILED(nsres)) {
1847 ERR("SetDisabled failed: %08lx\n", nsres);
1848 return E_FAIL;
1851 return S_OK;
1854 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1856 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1857 cpp_bool disabled;
1858 nsresult nsres;
1860 TRACE("(%p)->(%p)\n", This, p);
1862 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1863 if(NS_FAILED(nsres)) {
1864 ERR("GetDisabled failed: %08lx\n", nsres);
1865 return E_FAIL;
1868 *p = variant_bool(disabled);
1869 return S_OK;
1872 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1874 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1875 nsIDOMHTMLFormElement *nsform;
1876 nsresult nsres;
1878 TRACE("(%p)->(%p)\n", This, p);
1880 nsres = nsIDOMHTMLButtonElement_GetForm(This->nsbutton, &nsform);
1881 return return_nsform(nsres, nsform, p);
1884 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1886 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1887 FIXME("(%p)->(%p)\n", This, range);
1888 return E_NOTIMPL;
1891 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1892 HTMLButtonElement_QueryInterface,
1893 HTMLButtonElement_AddRef,
1894 HTMLButtonElement_Release,
1895 HTMLButtonElement_GetTypeInfoCount,
1896 HTMLButtonElement_GetTypeInfo,
1897 HTMLButtonElement_GetIDsOfNames,
1898 HTMLButtonElement_Invoke,
1899 HTMLButtonElement_get_type,
1900 HTMLButtonElement_put_value,
1901 HTMLButtonElement_get_value,
1902 HTMLButtonElement_put_name,
1903 HTMLButtonElement_get_name,
1904 HTMLButtonElement_put_status,
1905 HTMLButtonElement_get_status,
1906 HTMLButtonElement_put_disabled,
1907 HTMLButtonElement_get_disabled,
1908 HTMLButtonElement_get_form,
1909 HTMLButtonElement_createTextRange
1912 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1914 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1917 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1919 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1921 *ppv = NULL;
1923 if(IsEqualGUID(&IID_IUnknown, riid)) {
1924 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1925 *ppv = &This->IHTMLButtonElement_iface;
1926 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1927 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1928 *ppv = &This->IHTMLButtonElement_iface;
1929 }else {
1930 return HTMLElement_QI(&This->element.node, riid, ppv);
1933 IUnknown_AddRef((IUnknown*)*ppv);
1934 return S_OK;
1937 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1939 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1940 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1943 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1945 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1946 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1949 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
1951 return TRUE;
1954 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1956 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1958 if(This->nsbutton)
1959 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1962 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1964 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1966 if(This->nsbutton) {
1967 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
1969 This->nsbutton = NULL;
1970 nsIDOMHTMLButtonElement_Release(nsbutton);
1974 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1975 &CLSID_HTMLButtonElement,
1976 HTMLButtonElement_QI,
1977 HTMLElement_destructor,
1978 HTMLElement_cpc,
1979 HTMLElement_clone,
1980 HTMLElement_handle_event,
1981 HTMLElement_get_attr_col,
1982 NULL,
1983 HTMLButtonElementImpl_put_disabled,
1984 HTMLButtonElementImpl_get_disabled,
1985 NULL,
1986 NULL,
1987 NULL,
1988 NULL,
1989 NULL,
1990 NULL,
1991 HTMLButtonElement_traverse,
1992 HTMLButtonElement_unlink,
1993 HTMLButtonElement_is_text_edit
1996 static const tid_t HTMLButtonElement_iface_tids[] = {
1997 HTMLELEMENT_TIDS,
1998 IHTMLButtonElement_tid,
2002 static dispex_static_data_t HTMLButtonElement_dispex = {
2003 L"HTMLButtonElement",
2004 NULL,
2005 DispHTMLButtonElement_tid,
2006 HTMLButtonElement_iface_tids,
2007 HTMLElement_init_dispex_info
2010 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
2012 HTMLButtonElement *ret;
2013 nsresult nsres;
2015 ret = calloc(1, sizeof(*ret));
2016 if(!ret)
2017 return E_OUTOFMEMORY;
2019 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
2020 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
2022 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
2024 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
2025 assert(nsres == NS_OK);
2027 *elem = &ret->element;
2028 return S_OK;