wined3d: Add support for WINED3DFMT_R8G8_SINT format.
[wine.git] / dlls / mshtml / htmlinput.c
blob58919f5cb801726d6d22a1d7e04e4f2c1f46c9f7
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <assert.h>
21 #include <limits.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
30 #include "wine/debug.h"
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 typedef struct {
38 HTMLElement element;
40 IHTMLInputElement IHTMLInputElement_iface;
41 IHTMLInputTextElement IHTMLInputTextElement_iface;
43 nsIDOMHTMLInputElement *nsinput;
44 } HTMLInputElement;
46 static const WCHAR forW[] = {'f','o','r',0};
48 static HRESULT return_nsform(HTMLElement *elem, nsIDOMHTMLFormElement *nsform, IHTMLFormElement **p)
50 nsIDOMNode *form_node;
51 HTMLDOMNode *node;
52 nsresult nsres;
53 HRESULT hres;
55 if(!nsform) {
56 *p = NULL;
57 return S_OK;
60 nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node);
61 nsIDOMHTMLFormElement_Release(nsform);
62 assert(nsres == NS_OK);
64 hres = get_node(elem->node.doc, form_node, TRUE, &node);
65 nsIDOMNode_Release(form_node);
66 if (FAILED(hres))
67 return hres;
69 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
70 node_release(node);
71 return hres;
74 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
76 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
79 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
81 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
84 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
85 REFIID riid, void **ppv)
87 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
89 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
92 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
94 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
96 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
99 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
101 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
103 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
106 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
108 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
110 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
113 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
114 LCID lcid, ITypeInfo **ppTInfo)
116 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
118 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
119 ppTInfo);
122 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
123 LPOLESTR *rgszNames, UINT cNames,
124 LCID lcid, DISPID *rgDispId)
126 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
128 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
129 cNames, lcid, rgDispId);
132 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
133 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
134 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
136 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
138 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
139 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
142 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
144 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
145 nsAString type_str;
146 nsresult nsres;
148 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
151 * FIXME:
152 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
154 nsAString_InitDepend(&type_str, v);
155 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
156 nsAString_Finish(&type_str);
157 if(NS_FAILED(nsres)) {
158 ERR("SetType failed: %08x\n", nsres);
159 return E_FAIL;
162 return S_OK;
165 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
167 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
168 nsAString type_str;
169 nsresult nsres;
171 TRACE("(%p)->(%p)\n", This, p);
173 nsAString_Init(&type_str, NULL);
174 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
175 return return_nsstr(nsres, &type_str, p);
178 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
180 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
181 nsAString val_str;
182 nsresult nsres;
184 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
186 nsAString_InitDepend(&val_str, v);
187 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
188 nsAString_Finish(&val_str);
189 if(NS_FAILED(nsres))
190 ERR("SetValue failed: %08x\n", nsres);
192 return S_OK;
195 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
197 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
198 nsAString value_str;
199 nsresult nsres;
201 TRACE("(%p)->(%p)\n", This, p);
203 nsAString_Init(&value_str, NULL);
204 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
205 return return_nsstr(nsres, &value_str, p);
208 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
210 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
211 nsAString name_str;
212 nsresult nsres;
214 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
216 nsAString_InitDepend(&name_str, v);
217 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
218 nsAString_Finish(&name_str);
219 if(NS_FAILED(nsres)) {
220 ERR("SetName failed: %08x\n", nsres);
221 return E_FAIL;
224 return S_OK;
227 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
229 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
230 nsAString name_str;
231 nsresult nsres;
233 TRACE("(%p)->(%p)\n", This, p);
235 nsAString_Init(&name_str, NULL);
236 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
237 return return_nsstr(nsres, &name_str, p);
240 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
242 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
243 FIXME("(%p)->(%x)\n", This, v);
244 return E_NOTIMPL;
247 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
249 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
250 FIXME("(%p)->(%p)\n", This, p);
251 return E_NOTIMPL;
254 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
256 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
257 nsresult nsres;
259 TRACE("(%p)->(%x)\n", This, v);
261 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
262 if(NS_FAILED(nsres))
263 ERR("SetDisabled failed: %08x\n", nsres);
265 return S_OK;
268 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
270 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
271 cpp_bool disabled = FALSE;
273 TRACE("(%p)->(%p)\n", This, p);
275 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
277 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
278 return S_OK;
281 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
283 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
284 nsIDOMHTMLFormElement *nsform;
285 nsresult nsres;
287 TRACE("(%p)->(%p)\n", This, p);
289 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
290 if (NS_FAILED(nsres)) {
291 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
292 return E_FAIL;
295 return return_nsform(&This->element, nsform, p);
298 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
300 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
301 UINT32 val = v;
302 nsresult nsres;
304 TRACE("(%p)->(%d)\n", This, v);
305 if (v <= 0)
306 return CTL_E_INVALIDPROPERTYVALUE;
308 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
309 if (NS_FAILED(nsres)) {
310 ERR("Set Size(%u) failed: %08x\n", val, nsres);
311 return E_FAIL;
313 return S_OK;
316 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
318 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
319 UINT32 val;
320 nsresult nsres;
322 TRACE("(%p)->(%p)\n", This, p);
323 if (p == NULL)
324 return E_INVALIDARG;
326 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
327 if (NS_FAILED(nsres)) {
328 ERR("Get Size failed: %08x\n", nsres);
329 return E_FAIL;
331 *p = val;
332 return S_OK;
335 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
337 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
338 nsresult nsres;
340 TRACE("(%p)->(%d)\n", This, v);
342 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
343 if(NS_FAILED(nsres)) {
344 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
345 FIXME("SetMaxLength failed\n");
346 return E_FAIL;
349 return S_OK;
352 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
354 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
355 LONG max_length;
356 nsresult nsres;
358 TRACE("(%p)->(%p)\n", This, p);
360 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
361 assert(nsres == NS_OK);
363 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
364 *p = max_length == -1 ? INT_MAX : max_length;
365 return S_OK;
368 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
370 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
371 nsresult nsres;
373 TRACE("(%p)\n", This);
375 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
376 if(NS_FAILED(nsres)) {
377 ERR("Select failed: %08x\n", nsres);
378 return E_FAIL;
381 return S_OK;
384 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
386 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
388 TRACE("(%p)->()\n", This);
390 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
393 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
395 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
397 TRACE("(%p)->(%p)\n", This, p);
399 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
402 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
404 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
405 FIXME("(%p)->()\n", This);
406 return E_NOTIMPL;
409 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
411 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
412 FIXME("(%p)->(%p)\n", This, p);
413 return E_NOTIMPL;
416 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
418 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
419 nsAString nsstr;
420 nsresult nsres;
422 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
424 nsAString_InitDepend(&nsstr, v);
425 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
426 nsAString_Finish(&nsstr);
427 if(NS_FAILED(nsres)) {
428 ERR("SetValue failed: %08x\n", nsres);
429 return E_FAIL;
432 return S_OK;
435 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
437 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
438 nsAString nsstr;
439 nsresult nsres;
441 TRACE("(%p)->(%p)\n", This, p);
443 nsAString_Init(&nsstr, NULL);
444 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
445 return return_nsstr(nsres, &nsstr, p);
448 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
450 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
451 nsresult nsres;
453 TRACE("(%p)->(%x)\n", This, v);
455 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
456 if (NS_FAILED(nsres)) {
457 ERR("Set ReadOnly Failed: %08x\n", nsres);
458 return E_FAIL;
460 return S_OK;
463 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
465 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
466 nsresult nsres;
467 cpp_bool b;
469 TRACE("(%p)->(%p)\n", This, p);
471 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
472 if (NS_FAILED(nsres)) {
473 ERR("Get ReadOnly Failed: %08x\n", nsres);
474 return E_FAIL;
476 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
477 return S_OK;
480 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
482 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
483 FIXME("(%p)->(%p)\n", This, range);
484 return E_NOTIMPL;
487 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
489 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
490 FIXME("(%p)->(%x)\n", This, v);
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
496 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
501 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
503 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
504 nsresult nsres;
506 TRACE("(%p)->(%x)\n", This, v);
508 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
509 if(NS_FAILED(nsres)) {
510 ERR("SetDefaultChecked failed: %08x\n", nsres);
511 return E_FAIL;
514 return S_OK;
517 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
519 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
520 cpp_bool default_checked = FALSE;
521 nsresult nsres;
523 TRACE("(%p)->(%p)\n", This, p);
525 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
526 if(NS_FAILED(nsres)) {
527 ERR("GetDefaultChecked failed: %08x\n", nsres);
528 return E_FAIL;
531 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
532 return S_OK;
535 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
537 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
538 nsresult nsres;
540 TRACE("(%p)->(%x)\n", This, v);
542 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
543 if(NS_FAILED(nsres)) {
544 ERR("SetChecked failed: %08x\n", nsres);
545 return E_FAIL;
548 return S_OK;
551 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
553 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
554 cpp_bool checked;
555 nsresult nsres;
557 TRACE("(%p)->(%p)\n", This, p);
559 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
560 if(NS_FAILED(nsres)) {
561 ERR("GetChecked failed: %08x\n", nsres);
562 return E_FAIL;
565 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
566 TRACE("checked=%x\n", *p);
567 return S_OK;
570 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
572 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
573 FIXME("(%p)->()\n", This);
574 return E_NOTIMPL;
577 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
579 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
580 FIXME("(%p)->(%p)\n", This, p);
581 return E_NOTIMPL;
584 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
586 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
587 FIXME("(%p)->(%d)\n", This, v);
588 return E_NOTIMPL;
591 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
593 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
594 FIXME("(%p)->(%p)\n", This, p);
595 return E_NOTIMPL;
598 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
600 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
601 FIXME("(%p)->(%d)\n", This, v);
602 return E_NOTIMPL;
605 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
607 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
608 FIXME("(%p)->(%p)\n", This, p);
609 return E_NOTIMPL;
612 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
614 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
615 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
616 return E_NOTIMPL;
619 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
621 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
622 FIXME("(%p)->(%p)\n", This, p);
623 return E_NOTIMPL;
626 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
628 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
629 nsAString nsstr;
630 nsresult nsres;
632 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
634 nsAString_InitDepend(&nsstr, v);
635 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
636 nsAString_Finish(&nsstr);
637 if(NS_FAILED(nsres))
638 ERR("SetSrc failed: %08x\n", nsres);
640 return S_OK;
643 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
645 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
646 const PRUnichar *src;
647 nsAString src_str;
648 nsresult nsres;
649 HRESULT hres;
651 TRACE("(%p)->(%p)\n", This, p);
653 nsAString_Init(&src_str, NULL);
654 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
655 if(NS_FAILED(nsres)) {
656 ERR("GetSrc failed: %08x\n", nsres);
657 return E_FAIL;
660 nsAString_GetData(&src_str, &src);
661 hres = nsuri_to_url(src, FALSE, p);
662 nsAString_Finish(&src_str);
664 return hres;
667 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
669 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
670 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
671 return E_NOTIMPL;
674 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
676 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
677 FIXME("(%p)->(%p)\n", This, p);
678 return E_NOTIMPL;
681 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
683 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
684 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
685 return E_NOTIMPL;
688 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
690 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
691 FIXME("(%p)->(%p)\n", This, p);
692 return E_NOTIMPL;
695 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
697 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
698 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
699 return E_NOTIMPL;
702 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
704 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
705 FIXME("(%p)->(%p)\n", This, p);
706 return E_NOTIMPL;
709 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
711 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
712 FIXME("(%p)->(%p)\n", This, p);
713 return E_NOTIMPL;
716 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
718 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
719 FIXME("(%p)->(%p)\n", This, p);
720 return E_NOTIMPL;
723 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
725 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
726 FIXME("(%p)->()\n", This);
727 return E_NOTIMPL;
730 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
732 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
733 FIXME("(%p)->(%p)\n", This, p);
734 return E_NOTIMPL;
737 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
739 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
740 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
741 return E_NOTIMPL;
744 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
746 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
747 FIXME("(%p)->(%p)\n", This, p);
748 return E_NOTIMPL;
751 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
753 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
754 FIXME("(%p)->()\n", This);
755 return E_NOTIMPL;
758 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
760 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
761 FIXME("(%p)->(%p)\n", This, p);
762 return E_NOTIMPL;
765 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
767 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
768 FIXME("(%p)->()\n", This);
769 return E_NOTIMPL;
772 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
774 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
775 FIXME("(%p)->(%p)\n", This, p);
776 return E_NOTIMPL;
779 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
781 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
782 FIXME("(%p)->()\n", This);
783 return E_NOTIMPL;
786 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
788 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
789 FIXME("(%p)->(%p)\n", This, p);
790 return E_NOTIMPL;
793 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
795 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
796 FIXME("(%p)->(%d)\n", This, v);
797 return E_NOTIMPL;
800 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
802 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
803 FIXME("(%p)->(%p)\n", This, p);
804 return E_NOTIMPL;
807 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
809 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
810 FIXME("(%p)->(%d)\n", This, v);
811 return E_NOTIMPL;
814 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
816 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
817 FIXME("(%p)->(%p)\n", This, p);
818 return E_NOTIMPL;
821 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
823 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
824 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
825 return E_NOTIMPL;
828 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
830 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
831 FIXME("(%p)->(%p)\n", This, p);
832 return E_NOTIMPL;
835 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
836 HTMLInputElement_QueryInterface,
837 HTMLInputElement_AddRef,
838 HTMLInputElement_Release,
839 HTMLInputElement_GetTypeInfoCount,
840 HTMLInputElement_GetTypeInfo,
841 HTMLInputElement_GetIDsOfNames,
842 HTMLInputElement_Invoke,
843 HTMLInputElement_put_type,
844 HTMLInputElement_get_type,
845 HTMLInputElement_put_value,
846 HTMLInputElement_get_value,
847 HTMLInputElement_put_name,
848 HTMLInputElement_get_name,
849 HTMLInputElement_put_status,
850 HTMLInputElement_get_status,
851 HTMLInputElement_put_disabled,
852 HTMLInputElement_get_disabled,
853 HTMLInputElement_get_form,
854 HTMLInputElement_put_size,
855 HTMLInputElement_get_size,
856 HTMLInputElement_put_maxLength,
857 HTMLInputElement_get_maxLength,
858 HTMLInputElement_select,
859 HTMLInputElement_put_onchange,
860 HTMLInputElement_get_onchange,
861 HTMLInputElement_put_onselect,
862 HTMLInputElement_get_onselect,
863 HTMLInputElement_put_defaultValue,
864 HTMLInputElement_get_defaultValue,
865 HTMLInputElement_put_readOnly,
866 HTMLInputElement_get_readOnly,
867 HTMLInputElement_createTextRange,
868 HTMLInputElement_put_indeterminate,
869 HTMLInputElement_get_indeterminate,
870 HTMLInputElement_put_defaultChecked,
871 HTMLInputElement_get_defaultChecked,
872 HTMLInputElement_put_checked,
873 HTMLInputElement_get_checked,
874 HTMLInputElement_put_border,
875 HTMLInputElement_get_border,
876 HTMLInputElement_put_vspace,
877 HTMLInputElement_get_vspace,
878 HTMLInputElement_put_hspace,
879 HTMLInputElement_get_hspace,
880 HTMLInputElement_put_alt,
881 HTMLInputElement_get_alt,
882 HTMLInputElement_put_src,
883 HTMLInputElement_get_src,
884 HTMLInputElement_put_lowsrc,
885 HTMLInputElement_get_lowsrc,
886 HTMLInputElement_put_vrml,
887 HTMLInputElement_get_vrml,
888 HTMLInputElement_put_dynsrc,
889 HTMLInputElement_get_dynsrc,
890 HTMLInputElement_get_readyState,
891 HTMLInputElement_get_complete,
892 HTMLInputElement_put_loop,
893 HTMLInputElement_get_loop,
894 HTMLInputElement_put_align,
895 HTMLInputElement_get_align,
896 HTMLInputElement_put_onload,
897 HTMLInputElement_get_onload,
898 HTMLInputElement_put_onerror,
899 HTMLInputElement_get_onerror,
900 HTMLInputElement_put_onabort,
901 HTMLInputElement_get_onabort,
902 HTMLInputElement_put_width,
903 HTMLInputElement_get_width,
904 HTMLInputElement_put_height,
905 HTMLInputElement_get_height,
906 HTMLInputElement_put_start,
907 HTMLInputElement_get_start
910 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
911 REFIID riid, void **ppv)
913 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
915 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
918 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
920 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
922 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
925 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
927 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
929 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
932 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
934 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
935 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
938 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
939 LCID lcid, ITypeInfo **ppTInfo)
941 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
942 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
943 ppTInfo);
946 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
947 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
949 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
950 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
951 cNames, lcid, rgDispId);
954 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
955 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
956 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
958 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
959 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
960 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
963 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
965 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
967 TRACE("(%p)->(%p)\n", This, p);
969 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
972 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
974 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
976 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
978 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
981 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
983 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
985 TRACE("(%p)->(%p)\n", This, p);
987 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
990 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
992 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
994 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
996 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
999 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
1001 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1003 TRACE("(%p)->(%p)\n", This, p);
1005 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
1008 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
1010 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1011 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1012 return E_NOTIMPL;
1015 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
1017 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1018 TRACE("(%p)->(%p)\n", This, p);
1019 return E_NOTIMPL;
1022 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1024 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1026 TRACE("(%p)->(%x)\n", This, v);
1028 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1031 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1033 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1035 TRACE("(%p)->(%p)\n", This, p);
1037 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1040 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1042 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1044 TRACE("(%p)->(%p)\n", This, p);
1046 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1049 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1051 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1053 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1055 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1058 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1060 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1062 TRACE("(%p)->(%p)\n", This, p);
1064 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1067 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1069 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1071 TRACE("(%p)->(%d)\n", This, v);
1073 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1076 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1078 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1080 TRACE("(%p)->(%p)\n", This, p);
1082 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1085 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1087 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1089 TRACE("(%p)->(%d)\n", This, v);
1091 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1094 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1096 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1098 TRACE("(%p)->(%p)\n", This, p);
1100 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1103 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1105 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1107 TRACE("(%p)\n", This);
1109 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1112 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1114 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1116 TRACE("(%p)->()\n", This);
1118 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1121 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1123 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1125 TRACE("(%p)->(%p)\n", This, p);
1127 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1130 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1132 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1134 TRACE("(%p)->()\n", This);
1136 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1139 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1141 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1143 TRACE("(%p)->(%p)\n", This, p);
1145 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1148 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1150 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1152 TRACE("(%p)->(%x)\n", This, v);
1154 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1157 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1159 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1161 TRACE("(%p)->(%p)\n", This, p);
1163 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1166 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1168 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1170 TRACE("(%p)->(%p)\n", This, range);
1172 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1175 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1176 HTMLInputTextElement_QueryInterface,
1177 HTMLInputTextElement_AddRef,
1178 HTMLInputTextElement_Release,
1179 HTMLInputTextElement_GetTypeInfoCount,
1180 HTMLInputTextElement_GetTypeInfo,
1181 HTMLInputTextElement_GetIDsOfNames,
1182 HTMLInputTextElement_Invoke,
1183 HTMLInputTextElement_get_type,
1184 HTMLInputTextElement_put_value,
1185 HTMLInputTextElement_get_value,
1186 HTMLInputTextElement_put_name,
1187 HTMLInputTextElement_get_name,
1188 HTMLInputTextElement_put_status,
1189 HTMLInputTextElement_get_status,
1190 HTMLInputTextElement_put_disabled,
1191 HTMLInputTextElement_get_disabled,
1192 HTMLInputTextElement_get_form,
1193 HTMLInputTextElement_put_defaultValue,
1194 HTMLInputTextElement_get_defaultValue,
1195 HTMLInputTextElement_put_size,
1196 HTMLInputTextElement_get_size,
1197 HTMLInputTextElement_put_maxLength,
1198 HTMLInputTextElement_get_maxLength,
1199 HTMLInputTextElement_select,
1200 HTMLInputTextElement_put_onchange,
1201 HTMLInputTextElement_get_onchange,
1202 HTMLInputTextElement_put_onselect,
1203 HTMLInputTextElement_get_onselect,
1204 HTMLInputTextElement_put_readOnly,
1205 HTMLInputTextElement_get_readOnly,
1206 HTMLInputTextElement_createTextRange
1209 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1211 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1214 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1216 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1218 *ppv = NULL;
1220 if(IsEqualGUID(&IID_IUnknown, riid)) {
1221 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1222 *ppv = &This->IHTMLInputElement_iface;
1223 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1224 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1225 *ppv = &This->IHTMLInputElement_iface;
1226 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1227 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1228 *ppv = &This->IHTMLInputElement_iface;
1229 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1230 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1231 *ppv = &This->IHTMLInputTextElement_iface;
1234 if(*ppv) {
1235 IUnknown_AddRef((IUnknown*)*ppv);
1236 return S_OK;
1239 return HTMLElement_QI(&This->element.node, riid, ppv);
1242 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1244 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1246 if(eid == EVENTID_CLICK) {
1247 nsresult nsres;
1249 *handled = TRUE;
1251 nsres = nsIDOMHTMLElement_Click(This->element.nselem);
1252 if(NS_FAILED(nsres)) {
1253 ERR("Click failed: %08x\n", nsres);
1254 return E_FAIL;
1258 return S_OK;
1261 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1263 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1264 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1267 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1269 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1270 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1273 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
1275 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1276 const PRUnichar *type;
1277 nsAString nsstr;
1278 nsresult nsres;
1279 BOOL ret = FALSE;
1281 static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
1282 static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
1283 static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
1284 static const WCHAR resetW[] = {'r','e','s','e','t',0};
1285 static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
1286 static const WCHAR textW[] = {'t','e','x','t',0};
1288 nsAString_Init(&nsstr, NULL);
1289 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
1290 if(NS_SUCCEEDED(nsres)) {
1291 nsAString_GetData(&nsstr, &type);
1292 ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW)
1293 || !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW);
1295 nsAString_Finish(&nsstr);
1296 return ret;
1299 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1301 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1303 if(This->nsinput)
1304 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1307 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1309 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1311 if(This->nsinput) {
1312 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1314 This->nsinput = NULL;
1315 nsIDOMHTMLInputElement_Release(nsinput);
1319 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1320 HTMLInputElement_QI,
1321 HTMLElement_destructor,
1322 HTMLElement_cpc,
1323 HTMLElement_clone,
1324 HTMLElement_handle_event,
1325 HTMLElement_get_attr_col,
1326 NULL,
1327 HTMLInputElementImpl_fire_event,
1328 HTMLInputElementImpl_put_disabled,
1329 HTMLInputElementImpl_get_disabled,
1330 NULL,
1331 NULL,
1332 NULL,
1333 NULL,
1334 NULL,
1335 HTMLInputElement_traverse,
1336 HTMLInputElement_unlink,
1337 HTMLInputElement_is_text_edit
1340 static const tid_t HTMLInputElement_iface_tids[] = {
1341 HTMLELEMENT_TIDS,
1342 IHTMLInputElement_tid,
1345 static dispex_static_data_t HTMLInputElement_dispex = {
1346 NULL,
1347 DispHTMLInputElement_tid,
1348 HTMLInputElement_iface_tids,
1349 HTMLElement_init_dispex_info
1352 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1354 HTMLInputElement *ret;
1355 nsresult nsres;
1357 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1358 if(!ret)
1359 return E_OUTOFMEMORY;
1361 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1362 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1363 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1365 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1367 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1368 assert(nsres == NS_OK);
1370 *elem = &ret->element;
1371 return S_OK;
1374 typedef struct {
1375 HTMLElement element;
1377 IHTMLLabelElement IHTMLLabelElement_iface;
1378 } HTMLLabelElement;
1380 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1382 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1385 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1386 REFIID riid, void **ppv)
1388 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1390 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1393 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1395 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1397 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1400 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1402 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1404 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1407 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1409 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1411 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1414 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1415 LCID lcid, ITypeInfo **ppTInfo)
1417 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1419 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1422 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1423 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1425 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1427 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1428 cNames, lcid, rgDispId);
1431 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1432 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1433 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1435 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1437 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1438 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1441 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1443 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1444 nsAString for_str, val_str;
1445 nsresult nsres;
1447 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1449 nsAString_InitDepend(&for_str, forW);
1450 nsAString_InitDepend(&val_str, v);
1451 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1452 nsAString_Finish(&for_str);
1453 nsAString_Finish(&val_str);
1454 if(NS_FAILED(nsres)) {
1455 ERR("SetAttribute failed: %08x\n", nsres);
1456 return E_FAIL;
1459 return S_OK;
1462 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1464 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1466 TRACE("(%p)->(%p)\n", This, p);
1468 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1471 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1473 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1474 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1475 return E_NOTIMPL;
1478 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1480 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1481 FIXME("(%p)->(%p)\n", This, p);
1482 return E_NOTIMPL;
1485 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1486 HTMLLabelElement_QueryInterface,
1487 HTMLLabelElement_AddRef,
1488 HTMLLabelElement_Release,
1489 HTMLLabelElement_GetTypeInfoCount,
1490 HTMLLabelElement_GetTypeInfo,
1491 HTMLLabelElement_GetIDsOfNames,
1492 HTMLLabelElement_Invoke,
1493 HTMLLabelElement_put_htmlFor,
1494 HTMLLabelElement_get_htmlFor,
1495 HTMLLabelElement_put_accessKey,
1496 HTMLLabelElement_get_accessKey
1499 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1501 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1504 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1506 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1508 *ppv = NULL;
1510 if(IsEqualGUID(&IID_IUnknown, riid)) {
1511 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1512 *ppv = &This->IHTMLLabelElement_iface;
1513 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1514 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1515 *ppv = &This->IHTMLLabelElement_iface;
1516 }else {
1517 return HTMLElement_QI(&This->element.node, riid, ppv);
1520 IUnknown_AddRef((IUnknown*)*ppv);
1521 return S_OK;
1524 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1525 HTMLLabelElement_QI,
1526 HTMLElement_destructor,
1527 HTMLElement_cpc,
1528 HTMLElement_clone,
1529 HTMLElement_handle_event,
1530 HTMLElement_get_attr_col,
1533 static const tid_t HTMLLabelElement_iface_tids[] = {
1534 HTMLELEMENT_TIDS,
1535 IHTMLLabelElement_tid,
1539 static dispex_static_data_t HTMLLabelElement_dispex = {
1540 NULL,
1541 DispHTMLLabelElement_tid,
1542 HTMLLabelElement_iface_tids,
1543 HTMLElement_init_dispex_info
1546 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1548 HTMLLabelElement *ret;
1550 ret = heap_alloc_zero(sizeof(*ret));
1551 if(!ret)
1552 return E_OUTOFMEMORY;
1554 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1555 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1557 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1558 *elem = &ret->element;
1559 return S_OK;
1562 typedef struct {
1563 HTMLElement element;
1565 IHTMLButtonElement IHTMLButtonElement_iface;
1567 nsIDOMHTMLButtonElement *nsbutton;
1568 } HTMLButtonElement;
1570 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1572 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1575 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1576 REFIID riid, void **ppv)
1578 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1580 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1583 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1585 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1587 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1590 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1592 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1594 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1597 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1599 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1601 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1604 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1605 LCID lcid, ITypeInfo **ppTInfo)
1607 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1609 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1612 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1613 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1615 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1617 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1618 cNames, lcid, rgDispId);
1621 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1622 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1623 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1625 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1627 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1628 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1631 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1633 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1634 nsAString type_str;
1635 nsresult nsres;
1637 TRACE("(%p)->(%p)\n", This, p);
1639 nsAString_Init(&type_str, NULL);
1640 nsres = nsIDOMHTMLButtonElement_GetType(This->nsbutton, &type_str);
1641 return return_nsstr(nsres, &type_str, p);
1644 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1646 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1647 nsAString nsstr;
1648 nsresult nsres;
1650 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1652 nsAString_InitDepend(&nsstr, v);
1653 nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
1654 nsAString_Finish(&nsstr);
1655 if(NS_FAILED(nsres)) {
1656 ERR("SetValue failed: %08x\n", nsres);
1657 return E_FAIL;
1660 return S_OK;
1663 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1665 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1666 nsAString value_str;
1667 nsresult nsres;
1669 TRACE("(%p)->(%p)\n", This, p);
1671 nsAString_Init(&value_str, NULL);
1672 nsres = nsIDOMHTMLButtonElement_GetValue(This->nsbutton, &value_str);
1673 return return_nsstr(nsres, &value_str, p);
1676 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1678 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1679 nsAString name_str;
1680 nsresult nsres;
1682 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1684 nsAString_InitDepend(&name_str, v);
1685 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1686 nsAString_Finish(&name_str);
1687 if(NS_FAILED(nsres)) {
1688 ERR("SetName failed: %08x\n", nsres);
1689 return E_FAIL;
1692 return S_OK;
1695 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1697 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1698 nsAString name_str;
1699 nsresult nsres;
1701 TRACE("(%p)->(%p)\n", This, p);
1703 nsAString_Init(&name_str, NULL);
1704 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1705 return return_nsstr(nsres, &name_str, p);
1708 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1710 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1711 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1712 return E_NOTIMPL;
1715 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1717 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1718 FIXME("(%p)->(%p)\n", This, p);
1719 return E_NOTIMPL;
1722 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1724 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1725 nsresult nsres;
1727 TRACE("(%p)->(%x)\n", This, v);
1729 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1730 if(NS_FAILED(nsres)) {
1731 ERR("SetDisabled failed: %08x\n", nsres);
1732 return E_FAIL;
1735 return S_OK;
1738 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1740 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1741 cpp_bool disabled;
1742 nsresult nsres;
1744 TRACE("(%p)->(%p)\n", This, p);
1746 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1747 if(NS_FAILED(nsres)) {
1748 ERR("GetDisabled failed: %08x\n", nsres);
1749 return E_FAIL;
1752 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1753 return S_OK;
1756 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1758 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1759 nsIDOMHTMLFormElement *nsform;
1760 nsresult nsres;
1762 TRACE("(%p)->(%p)\n", This, p);
1764 nsres = nsIDOMHTMLButtonElement_GetForm(This->nsbutton, &nsform);
1765 if (NS_FAILED(nsres)) {
1766 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
1767 return E_FAIL;
1770 return return_nsform(&This->element, nsform, p);
1773 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1775 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1776 FIXME("(%p)->(%p)\n", This, range);
1777 return E_NOTIMPL;
1780 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1781 HTMLButtonElement_QueryInterface,
1782 HTMLButtonElement_AddRef,
1783 HTMLButtonElement_Release,
1784 HTMLButtonElement_GetTypeInfoCount,
1785 HTMLButtonElement_GetTypeInfo,
1786 HTMLButtonElement_GetIDsOfNames,
1787 HTMLButtonElement_Invoke,
1788 HTMLButtonElement_get_type,
1789 HTMLButtonElement_put_value,
1790 HTMLButtonElement_get_value,
1791 HTMLButtonElement_put_name,
1792 HTMLButtonElement_get_name,
1793 HTMLButtonElement_put_status,
1794 HTMLButtonElement_get_status,
1795 HTMLButtonElement_put_disabled,
1796 HTMLButtonElement_get_disabled,
1797 HTMLButtonElement_get_form,
1798 HTMLButtonElement_createTextRange
1801 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1803 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1806 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1808 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1810 *ppv = NULL;
1812 if(IsEqualGUID(&IID_IUnknown, riid)) {
1813 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1814 *ppv = &This->IHTMLButtonElement_iface;
1815 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1816 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1817 *ppv = &This->IHTMLButtonElement_iface;
1818 }else {
1819 return HTMLElement_QI(&This->element.node, riid, ppv);
1822 IUnknown_AddRef((IUnknown*)*ppv);
1823 return S_OK;
1826 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1828 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1829 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1832 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1834 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1835 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1838 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
1840 return TRUE;
1843 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1845 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1847 if(This->nsbutton)
1848 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1851 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1853 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1855 if(This->nsbutton) {
1856 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
1858 This->nsbutton = NULL;
1859 nsIDOMHTMLButtonElement_Release(nsbutton);
1863 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1864 HTMLButtonElement_QI,
1865 HTMLElement_destructor,
1866 HTMLElement_cpc,
1867 HTMLElement_clone,
1868 HTMLElement_handle_event,
1869 HTMLElement_get_attr_col,
1870 NULL,
1871 NULL,
1872 HTMLButtonElementImpl_put_disabled,
1873 HTMLButtonElementImpl_get_disabled,
1874 NULL,
1875 NULL,
1876 NULL,
1877 NULL,
1878 NULL,
1879 HTMLButtonElement_traverse,
1880 HTMLButtonElement_unlink,
1881 HTMLButtonElement_is_text_edit
1884 static const tid_t HTMLButtonElement_iface_tids[] = {
1885 HTMLELEMENT_TIDS,
1886 IHTMLButtonElement_tid,
1890 static dispex_static_data_t HTMLButtonElement_dispex = {
1891 NULL,
1892 DispHTMLButtonElement_tid,
1893 HTMLButtonElement_iface_tids,
1894 HTMLElement_init_dispex_info
1897 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1899 HTMLButtonElement *ret;
1900 nsresult nsres;
1902 ret = heap_alloc_zero(sizeof(*ret));
1903 if(!ret)
1904 return E_OUTOFMEMORY;
1906 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1907 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1909 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1911 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1912 assert(nsres == NS_OK);
1914 *elem = &ret->element;
1915 return S_OK;