d2d1: Implement d2d_d3d_render_target_CreateBitmap().
[wine/multimedia.git] / dlls / mshtml / htmlinput.c
blob2492579843c985b75f0aa048c0915d27aa66b56a
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <assert.h>
21 #include <limits.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
30 #include "wine/debug.h"
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 typedef struct {
38 HTMLElement element;
40 IHTMLInputElement IHTMLInputElement_iface;
41 IHTMLInputTextElement IHTMLInputTextElement_iface;
43 nsIDOMHTMLInputElement *nsinput;
44 } HTMLInputElement;
46 static const WCHAR forW[] = {'f','o','r',0};
48 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
50 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
53 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
55 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
58 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
59 REFIID riid, void **ppv)
61 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
63 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
66 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
68 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
70 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
73 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
75 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
77 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
80 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
82 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
84 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
87 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
88 LCID lcid, ITypeInfo **ppTInfo)
90 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
92 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
93 ppTInfo);
96 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
97 LPOLESTR *rgszNames, UINT cNames,
98 LCID lcid, DISPID *rgDispId)
100 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
102 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
103 cNames, lcid, rgDispId);
106 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
107 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
108 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
110 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
112 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
113 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
116 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
118 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
119 nsAString type_str;
120 nsresult nsres;
122 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
125 * FIXME:
126 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
128 nsAString_InitDepend(&type_str, v);
129 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
130 nsAString_Finish(&type_str);
131 if(NS_FAILED(nsres)) {
132 ERR("SetType failed: %08x\n", nsres);
133 return E_FAIL;
136 return S_OK;
139 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
141 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
142 nsAString type_str;
143 nsresult nsres;
145 TRACE("(%p)->(%p)\n", This, p);
147 nsAString_Init(&type_str, NULL);
148 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
149 return return_nsstr(nsres, &type_str, p);
152 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
154 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
155 nsAString val_str;
156 nsresult nsres;
158 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
160 nsAString_InitDepend(&val_str, v);
161 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
162 nsAString_Finish(&val_str);
163 if(NS_FAILED(nsres))
164 ERR("SetValue failed: %08x\n", nsres);
166 return S_OK;
169 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
171 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
172 nsAString value_str;
173 nsresult nsres;
175 TRACE("(%p)->(%p)\n", This, p);
177 nsAString_Init(&value_str, NULL);
178 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
179 return return_nsstr(nsres, &value_str, p);
182 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
184 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
185 nsAString name_str;
186 nsresult nsres;
188 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
190 nsAString_InitDepend(&name_str, v);
191 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
192 nsAString_Finish(&name_str);
193 if(NS_FAILED(nsres)) {
194 ERR("SetName failed: %08x\n", nsres);
195 return E_FAIL;
198 return S_OK;
201 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
203 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
204 nsAString name_str;
205 nsresult nsres;
207 TRACE("(%p)->(%p)\n", This, p);
209 nsAString_Init(&name_str, NULL);
210 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
211 return return_nsstr(nsres, &name_str, p);
214 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
216 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
217 FIXME("(%p)->(%x)\n", This, v);
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
223 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
224 FIXME("(%p)->(%p)\n", This, p);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
230 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
231 nsresult nsres;
233 TRACE("(%p)->(%x)\n", This, v);
235 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
236 if(NS_FAILED(nsres))
237 ERR("SetDisabled failed: %08x\n", nsres);
239 return S_OK;
242 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
244 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
245 cpp_bool disabled = FALSE;
247 TRACE("(%p)->(%p)\n", This, p);
249 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
251 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
252 return S_OK;
255 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
257 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
258 nsIDOMHTMLFormElement *nsform;
259 HTMLDOMNode *node;
260 HRESULT hres;
261 nsresult nsres;
263 TRACE("(%p)->(%p)\n", This, p);
265 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
266 if (NS_FAILED(nsres) || nsform == NULL) {
267 ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform);
268 *p = NULL;
269 return E_FAIL;
272 hres = get_node(This->element.node.doc, (nsIDOMNode*)nsform, TRUE, &node);
273 nsIDOMHTMLFormElement_Release(nsform);
274 if (FAILED(hres))
275 return hres;
277 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
279 node_release(node);
280 return hres;
283 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
285 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
286 UINT32 val = v;
287 nsresult nsres;
289 TRACE("(%p)->(%d)\n", This, v);
290 if (v <= 0)
291 return CTL_E_INVALIDPROPERTYVALUE;
293 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
294 if (NS_FAILED(nsres)) {
295 ERR("Set Size(%u) failed: %08x\n", val, nsres);
296 return E_FAIL;
298 return S_OK;
301 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
303 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
304 UINT32 val;
305 nsresult nsres;
307 TRACE("(%p)->(%p)\n", This, p);
308 if (p == NULL)
309 return E_INVALIDARG;
311 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
312 if (NS_FAILED(nsres)) {
313 ERR("Get Size failed: %08x\n", nsres);
314 return E_FAIL;
316 *p = val;
317 return S_OK;
320 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
322 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
323 nsresult nsres;
325 TRACE("(%p)->(%d)\n", This, v);
327 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
328 if(NS_FAILED(nsres)) {
329 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
330 FIXME("SetMaxLength failed\n");
331 return E_FAIL;
334 return S_OK;
337 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
339 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
340 LONG max_length;
341 nsresult nsres;
343 TRACE("(%p)->(%p)\n", This, p);
345 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
346 assert(nsres == NS_OK);
348 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
349 *p = max_length == -1 ? INT_MAX : max_length;
350 return S_OK;
353 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
355 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
356 nsresult nsres;
358 TRACE("(%p)\n", This);
360 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
361 if(NS_FAILED(nsres)) {
362 ERR("Select failed: %08x\n", nsres);
363 return E_FAIL;
366 return S_OK;
369 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
371 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
373 TRACE("(%p)->()\n", This);
375 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
378 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
380 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
382 TRACE("(%p)->(%p)\n", This, p);
384 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
387 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
389 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
390 FIXME("(%p)->()\n", This);
391 return E_NOTIMPL;
394 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
396 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
397 FIXME("(%p)->(%p)\n", This, p);
398 return E_NOTIMPL;
401 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
403 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
404 nsAString nsstr;
405 nsresult nsres;
407 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
409 nsAString_InitDepend(&nsstr, v);
410 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
411 nsAString_Finish(&nsstr);
412 if(NS_FAILED(nsres)) {
413 ERR("SetValue failed: %08x\n", nsres);
414 return E_FAIL;
417 return S_OK;
420 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
422 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
423 nsAString nsstr;
424 nsresult nsres;
426 TRACE("(%p)->(%p)\n", This, p);
428 nsAString_Init(&nsstr, NULL);
429 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
430 return return_nsstr(nsres, &nsstr, p);
433 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
435 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
436 nsresult nsres;
438 TRACE("(%p)->(%x)\n", This, v);
440 nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
441 if (NS_FAILED(nsres)) {
442 ERR("Set ReadOnly Failed: %08x\n", nsres);
443 return E_FAIL;
445 return S_OK;
448 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
450 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
451 nsresult nsres;
452 cpp_bool b;
454 TRACE("(%p)->(%p)\n", This, p);
456 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
457 if (NS_FAILED(nsres)) {
458 ERR("Get ReadOnly Failed: %08x\n", nsres);
459 return E_FAIL;
461 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
462 return S_OK;
465 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
467 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
468 FIXME("(%p)->(%p)\n", This, range);
469 return E_NOTIMPL;
472 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
474 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
475 FIXME("(%p)->(%x)\n", This, v);
476 return E_NOTIMPL;
479 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
481 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
482 FIXME("(%p)->(%p)\n", This, p);
483 return E_NOTIMPL;
486 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
488 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
489 nsresult nsres;
491 TRACE("(%p)->(%x)\n", This, v);
493 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
494 if(NS_FAILED(nsres)) {
495 ERR("SetDefaultChecked failed: %08x\n", nsres);
496 return E_FAIL;
499 return S_OK;
502 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
504 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
505 cpp_bool default_checked = FALSE;
506 nsresult nsres;
508 TRACE("(%p)->(%p)\n", This, p);
510 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
511 if(NS_FAILED(nsres)) {
512 ERR("GetDefaultChecked failed: %08x\n", nsres);
513 return E_FAIL;
516 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
517 return S_OK;
520 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
522 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
523 nsresult nsres;
525 TRACE("(%p)->(%x)\n", This, v);
527 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
528 if(NS_FAILED(nsres)) {
529 ERR("SetChecked failed: %08x\n", nsres);
530 return E_FAIL;
533 return S_OK;
536 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
538 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
539 cpp_bool checked;
540 nsresult nsres;
542 TRACE("(%p)->(%p)\n", This, p);
544 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
545 if(NS_FAILED(nsres)) {
546 ERR("GetChecked failed: %08x\n", nsres);
547 return E_FAIL;
550 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
551 TRACE("checked=%x\n", *p);
552 return S_OK;
555 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
557 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
558 FIXME("(%p)->()\n", This);
559 return E_NOTIMPL;
562 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
564 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
565 FIXME("(%p)->(%p)\n", This, p);
566 return E_NOTIMPL;
569 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
571 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
572 FIXME("(%p)->(%d)\n", This, v);
573 return E_NOTIMPL;
576 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
578 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
579 FIXME("(%p)->(%p)\n", This, p);
580 return E_NOTIMPL;
583 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
585 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
586 FIXME("(%p)->(%d)\n", This, v);
587 return E_NOTIMPL;
590 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
592 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
593 FIXME("(%p)->(%p)\n", This, p);
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
599 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
600 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
601 return E_NOTIMPL;
604 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
606 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
607 FIXME("(%p)->(%p)\n", This, p);
608 return E_NOTIMPL;
611 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
613 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
614 nsAString nsstr;
615 nsresult nsres;
617 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
619 nsAString_InitDepend(&nsstr, v);
620 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
621 nsAString_Finish(&nsstr);
622 if(NS_FAILED(nsres))
623 ERR("SetSrc failed: %08x\n", nsres);
625 return S_OK;
628 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
630 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
631 const PRUnichar *src;
632 nsAString src_str;
633 nsresult nsres;
634 HRESULT hres;
636 TRACE("(%p)->(%p)\n", This, p);
638 nsAString_Init(&src_str, NULL);
639 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
640 if(NS_FAILED(nsres)) {
641 ERR("GetSrc failed: %08x\n", nsres);
642 return E_FAIL;
645 nsAString_GetData(&src_str, &src);
646 hres = nsuri_to_url(src, FALSE, p);
647 nsAString_Finish(&src_str);
649 return hres;
652 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
654 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
655 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
656 return E_NOTIMPL;
659 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
661 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
662 FIXME("(%p)->(%p)\n", This, p);
663 return E_NOTIMPL;
666 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
668 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
669 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
670 return E_NOTIMPL;
673 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
675 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
676 FIXME("(%p)->(%p)\n", This, p);
677 return E_NOTIMPL;
680 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
682 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
683 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
684 return E_NOTIMPL;
687 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
689 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
690 FIXME("(%p)->(%p)\n", This, p);
691 return E_NOTIMPL;
694 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
696 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
697 FIXME("(%p)->(%p)\n", This, p);
698 return E_NOTIMPL;
701 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
703 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
704 FIXME("(%p)->(%p)\n", This, p);
705 return E_NOTIMPL;
708 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
710 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
711 FIXME("(%p)->()\n", This);
712 return E_NOTIMPL;
715 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
717 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
718 FIXME("(%p)->(%p)\n", This, p);
719 return E_NOTIMPL;
722 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
724 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
725 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
726 return E_NOTIMPL;
729 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
731 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
732 FIXME("(%p)->(%p)\n", This, p);
733 return E_NOTIMPL;
736 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
738 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
739 FIXME("(%p)->()\n", This);
740 return E_NOTIMPL;
743 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
745 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
746 FIXME("(%p)->(%p)\n", This, p);
747 return E_NOTIMPL;
750 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
752 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
753 FIXME("(%p)->()\n", This);
754 return E_NOTIMPL;
757 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
759 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
760 FIXME("(%p)->(%p)\n", This, p);
761 return E_NOTIMPL;
764 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
766 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
767 FIXME("(%p)->()\n", This);
768 return E_NOTIMPL;
771 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
773 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
774 FIXME("(%p)->(%p)\n", This, p);
775 return E_NOTIMPL;
778 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
780 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
781 FIXME("(%p)->(%d)\n", This, v);
782 return E_NOTIMPL;
785 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
787 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
788 FIXME("(%p)->(%p)\n", This, p);
789 return E_NOTIMPL;
792 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
794 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
795 FIXME("(%p)->(%d)\n", This, v);
796 return E_NOTIMPL;
799 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
801 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
802 FIXME("(%p)->(%p)\n", This, p);
803 return E_NOTIMPL;
806 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
808 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
809 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
810 return E_NOTIMPL;
813 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
815 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
816 FIXME("(%p)->(%p)\n", This, p);
817 return E_NOTIMPL;
820 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
821 HTMLInputElement_QueryInterface,
822 HTMLInputElement_AddRef,
823 HTMLInputElement_Release,
824 HTMLInputElement_GetTypeInfoCount,
825 HTMLInputElement_GetTypeInfo,
826 HTMLInputElement_GetIDsOfNames,
827 HTMLInputElement_Invoke,
828 HTMLInputElement_put_type,
829 HTMLInputElement_get_type,
830 HTMLInputElement_put_value,
831 HTMLInputElement_get_value,
832 HTMLInputElement_put_name,
833 HTMLInputElement_get_name,
834 HTMLInputElement_put_status,
835 HTMLInputElement_get_status,
836 HTMLInputElement_put_disabled,
837 HTMLInputElement_get_disabled,
838 HTMLInputElement_get_form,
839 HTMLInputElement_put_size,
840 HTMLInputElement_get_size,
841 HTMLInputElement_put_maxLength,
842 HTMLInputElement_get_maxLength,
843 HTMLInputElement_select,
844 HTMLInputElement_put_onchange,
845 HTMLInputElement_get_onchange,
846 HTMLInputElement_put_onselect,
847 HTMLInputElement_get_onselect,
848 HTMLInputElement_put_defaultValue,
849 HTMLInputElement_get_defaultValue,
850 HTMLInputElement_put_readOnly,
851 HTMLInputElement_get_readOnly,
852 HTMLInputElement_createTextRange,
853 HTMLInputElement_put_indeterminate,
854 HTMLInputElement_get_indeterminate,
855 HTMLInputElement_put_defaultChecked,
856 HTMLInputElement_get_defaultChecked,
857 HTMLInputElement_put_checked,
858 HTMLInputElement_get_checked,
859 HTMLInputElement_put_border,
860 HTMLInputElement_get_border,
861 HTMLInputElement_put_vspace,
862 HTMLInputElement_get_vspace,
863 HTMLInputElement_put_hspace,
864 HTMLInputElement_get_hspace,
865 HTMLInputElement_put_alt,
866 HTMLInputElement_get_alt,
867 HTMLInputElement_put_src,
868 HTMLInputElement_get_src,
869 HTMLInputElement_put_lowsrc,
870 HTMLInputElement_get_lowsrc,
871 HTMLInputElement_put_vrml,
872 HTMLInputElement_get_vrml,
873 HTMLInputElement_put_dynsrc,
874 HTMLInputElement_get_dynsrc,
875 HTMLInputElement_get_readyState,
876 HTMLInputElement_get_complete,
877 HTMLInputElement_put_loop,
878 HTMLInputElement_get_loop,
879 HTMLInputElement_put_align,
880 HTMLInputElement_get_align,
881 HTMLInputElement_put_onload,
882 HTMLInputElement_get_onload,
883 HTMLInputElement_put_onerror,
884 HTMLInputElement_get_onerror,
885 HTMLInputElement_put_onabort,
886 HTMLInputElement_get_onabort,
887 HTMLInputElement_put_width,
888 HTMLInputElement_get_width,
889 HTMLInputElement_put_height,
890 HTMLInputElement_get_height,
891 HTMLInputElement_put_start,
892 HTMLInputElement_get_start
895 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
896 REFIID riid, void **ppv)
898 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
900 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
903 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
905 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
907 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
910 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
912 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
914 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
917 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
919 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
920 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
923 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
924 LCID lcid, ITypeInfo **ppTInfo)
926 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
927 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
928 ppTInfo);
931 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
932 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
934 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
935 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
936 cNames, lcid, rgDispId);
939 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
940 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
941 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
943 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
944 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
945 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
948 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
950 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
952 TRACE("(%p)->(%p)\n", This, p);
954 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
957 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
959 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
961 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
963 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
966 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
968 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
970 TRACE("(%p)->(%p)\n", This, p);
972 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
975 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
977 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
979 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
981 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
984 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
986 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
988 TRACE("(%p)->(%p)\n", This, p);
990 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
993 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
995 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
996 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
997 return E_NOTIMPL;
1000 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
1002 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1003 TRACE("(%p)->(%p)\n", This, p);
1004 return E_NOTIMPL;
1007 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1009 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1011 TRACE("(%p)->(%x)\n", This, v);
1013 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1016 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1018 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1020 TRACE("(%p)->(%p)\n", This, p);
1022 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1025 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1027 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1029 TRACE("(%p)->(%p)\n", This, p);
1031 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1034 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1036 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1038 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1040 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1043 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1045 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1047 TRACE("(%p)->(%p)\n", This, p);
1049 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1052 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1054 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1056 TRACE("(%p)->(%d)\n", This, v);
1058 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1061 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1063 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1065 TRACE("(%p)->(%p)\n", This, p);
1067 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1070 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1072 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1074 TRACE("(%p)->(%d)\n", This, v);
1076 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1079 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1081 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1083 TRACE("(%p)->(%p)\n", This, p);
1085 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1088 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1090 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1092 TRACE("(%p)\n", This);
1094 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1097 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1099 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1101 TRACE("(%p)->()\n", This);
1103 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1106 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1108 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1110 TRACE("(%p)->(%p)\n", This, p);
1112 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1115 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1117 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1119 TRACE("(%p)->()\n", This);
1121 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1124 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1126 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1128 TRACE("(%p)->(%p)\n", This, p);
1130 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1133 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1135 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1137 TRACE("(%p)->(%x)\n", This, v);
1139 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1142 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1144 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1146 TRACE("(%p)->(%p)\n", This, p);
1148 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1151 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1153 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1155 TRACE("(%p)->(%p)\n", This, range);
1157 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1160 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1161 HTMLInputTextElement_QueryInterface,
1162 HTMLInputTextElement_AddRef,
1163 HTMLInputTextElement_Release,
1164 HTMLInputTextElement_GetTypeInfoCount,
1165 HTMLInputTextElement_GetTypeInfo,
1166 HTMLInputTextElement_GetIDsOfNames,
1167 HTMLInputTextElement_Invoke,
1168 HTMLInputTextElement_get_type,
1169 HTMLInputTextElement_put_value,
1170 HTMLInputTextElement_get_value,
1171 HTMLInputTextElement_put_name,
1172 HTMLInputTextElement_get_name,
1173 HTMLInputTextElement_put_status,
1174 HTMLInputTextElement_get_status,
1175 HTMLInputTextElement_put_disabled,
1176 HTMLInputTextElement_get_disabled,
1177 HTMLInputTextElement_get_form,
1178 HTMLInputTextElement_put_defaultValue,
1179 HTMLInputTextElement_get_defaultValue,
1180 HTMLInputTextElement_put_size,
1181 HTMLInputTextElement_get_size,
1182 HTMLInputTextElement_put_maxLength,
1183 HTMLInputTextElement_get_maxLength,
1184 HTMLInputTextElement_select,
1185 HTMLInputTextElement_put_onchange,
1186 HTMLInputTextElement_get_onchange,
1187 HTMLInputTextElement_put_onselect,
1188 HTMLInputTextElement_get_onselect,
1189 HTMLInputTextElement_put_readOnly,
1190 HTMLInputTextElement_get_readOnly,
1191 HTMLInputTextElement_createTextRange
1194 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1196 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1199 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1201 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1203 *ppv = NULL;
1205 if(IsEqualGUID(&IID_IUnknown, riid)) {
1206 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1207 *ppv = &This->IHTMLInputElement_iface;
1208 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1209 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1210 *ppv = &This->IHTMLInputElement_iface;
1211 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1212 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1213 *ppv = &This->IHTMLInputElement_iface;
1214 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1215 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1216 *ppv = &This->IHTMLInputTextElement_iface;
1219 if(*ppv) {
1220 IUnknown_AddRef((IUnknown*)*ppv);
1221 return S_OK;
1224 return HTMLElement_QI(&This->element.node, riid, ppv);
1227 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1229 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1231 if(eid == EVENTID_CLICK) {
1232 nsresult nsres;
1234 *handled = TRUE;
1236 nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1237 if(NS_FAILED(nsres)) {
1238 ERR("Click failed: %08x\n", nsres);
1239 return E_FAIL;
1243 return S_OK;
1246 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1248 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1249 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1252 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1254 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1255 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1258 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1259 HTMLInputElement_QI,
1260 HTMLElement_destructor,
1261 HTMLElement_cpc,
1262 HTMLElement_clone,
1263 HTMLElement_handle_event,
1264 HTMLElement_get_attr_col,
1265 NULL,
1266 HTMLInputElementImpl_fire_event,
1267 HTMLInputElementImpl_put_disabled,
1268 HTMLInputElementImpl_get_disabled,
1271 static const tid_t HTMLInputElement_iface_tids[] = {
1272 HTMLELEMENT_TIDS,
1273 IHTMLInputElement_tid,
1276 static dispex_static_data_t HTMLInputElement_dispex = {
1277 NULL,
1278 DispHTMLInputElement_tid,
1279 NULL,
1280 HTMLInputElement_iface_tids
1283 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1285 HTMLInputElement *ret;
1286 nsresult nsres;
1288 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1289 if(!ret)
1290 return E_OUTOFMEMORY;
1292 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1293 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1294 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1296 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1298 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1300 /* Share nsinput reference with nsnode */
1301 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1302 nsIDOMNode_Release(ret->element.node.nsnode);
1304 *elem = &ret->element;
1305 return S_OK;
1308 typedef struct {
1309 HTMLElement element;
1311 IHTMLLabelElement IHTMLLabelElement_iface;
1312 } HTMLLabelElement;
1314 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1316 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1319 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1320 REFIID riid, void **ppv)
1322 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1324 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1327 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1329 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1331 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1334 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1336 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1338 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1341 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1343 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1345 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1348 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1349 LCID lcid, ITypeInfo **ppTInfo)
1351 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1353 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1356 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1357 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1359 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1361 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1362 cNames, lcid, rgDispId);
1365 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1366 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1367 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1369 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1371 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1372 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1375 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1377 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1378 nsAString for_str, val_str;
1379 nsresult nsres;
1381 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1383 nsAString_InitDepend(&for_str, forW);
1384 nsAString_InitDepend(&val_str, v);
1385 nsres = nsIDOMHTMLElement_SetAttribute(This->element.nselem, &for_str, &val_str);
1386 nsAString_Finish(&for_str);
1387 nsAString_Finish(&val_str);
1388 if(NS_FAILED(nsres)) {
1389 ERR("SetAttribute failed: %08x\n", nsres);
1390 return E_FAIL;
1393 return S_OK;
1396 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1398 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1400 TRACE("(%p)->(%p)\n", This, p);
1402 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1405 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1407 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1408 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1409 return E_NOTIMPL;
1412 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1414 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1415 FIXME("(%p)->(%p)\n", This, p);
1416 return E_NOTIMPL;
1419 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1420 HTMLLabelElement_QueryInterface,
1421 HTMLLabelElement_AddRef,
1422 HTMLLabelElement_Release,
1423 HTMLLabelElement_GetTypeInfoCount,
1424 HTMLLabelElement_GetTypeInfo,
1425 HTMLLabelElement_GetIDsOfNames,
1426 HTMLLabelElement_Invoke,
1427 HTMLLabelElement_put_htmlFor,
1428 HTMLLabelElement_get_htmlFor,
1429 HTMLLabelElement_put_accessKey,
1430 HTMLLabelElement_get_accessKey
1433 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1435 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1438 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1440 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1442 *ppv = NULL;
1444 if(IsEqualGUID(&IID_IUnknown, riid)) {
1445 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1446 *ppv = &This->IHTMLLabelElement_iface;
1447 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1448 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1449 *ppv = &This->IHTMLLabelElement_iface;
1450 }else {
1451 return HTMLElement_QI(&This->element.node, riid, ppv);
1454 IUnknown_AddRef((IUnknown*)*ppv);
1455 return S_OK;
1458 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1459 HTMLLabelElement_QI,
1460 HTMLElement_destructor,
1461 HTMLElement_cpc,
1462 HTMLElement_clone,
1463 HTMLElement_handle_event,
1464 HTMLElement_get_attr_col,
1467 static const tid_t HTMLLabelElement_iface_tids[] = {
1468 HTMLELEMENT_TIDS,
1469 IHTMLLabelElement_tid,
1473 static dispex_static_data_t HTMLLabelElement_dispex = {
1474 NULL,
1475 DispHTMLLabelElement_tid,
1476 NULL,
1477 HTMLLabelElement_iface_tids
1480 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1482 HTMLLabelElement *ret;
1484 ret = heap_alloc_zero(sizeof(*ret));
1485 if(!ret)
1486 return E_OUTOFMEMORY;
1488 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1489 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1491 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1492 *elem = &ret->element;
1493 return S_OK;
1496 typedef struct {
1497 HTMLElement element;
1499 IHTMLButtonElement IHTMLButtonElement_iface;
1501 nsIDOMHTMLButtonElement *nsbutton;
1502 } HTMLButtonElement;
1504 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1506 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1509 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1510 REFIID riid, void **ppv)
1512 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1514 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1517 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1519 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1521 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1524 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1526 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1528 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1531 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1533 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1535 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
1538 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1539 LCID lcid, ITypeInfo **ppTInfo)
1541 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1543 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1546 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1547 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1549 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1551 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
1552 cNames, lcid, rgDispId);
1555 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1556 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1557 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1559 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1561 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
1562 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1565 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1567 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1568 FIXME("(%p)->(%p)\n", This, p);
1569 return E_NOTIMPL;
1572 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1574 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1575 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1576 return E_NOTIMPL;
1579 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1581 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1582 FIXME("(%p)->(%p)\n", This, p);
1583 return E_NOTIMPL;
1586 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1588 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1589 nsAString name_str;
1590 nsresult nsres;
1592 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1594 nsAString_InitDepend(&name_str, v);
1595 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1596 nsAString_Finish(&name_str);
1597 if(NS_FAILED(nsres)) {
1598 ERR("SetName failed: %08x\n", nsres);
1599 return E_FAIL;
1602 return S_OK;
1605 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1607 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1608 nsAString name_str;
1609 nsresult nsres;
1611 TRACE("(%p)->(%p)\n", This, p);
1613 nsAString_Init(&name_str, NULL);
1614 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1615 return return_nsstr(nsres, &name_str, p);
1618 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1620 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1621 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1622 return E_NOTIMPL;
1625 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1627 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1628 FIXME("(%p)->(%p)\n", This, p);
1629 return E_NOTIMPL;
1632 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1634 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1635 nsresult nsres;
1637 TRACE("(%p)->(%x)\n", This, v);
1639 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1640 if(NS_FAILED(nsres)) {
1641 ERR("SetDisabled failed: %08x\n", nsres);
1642 return E_FAIL;
1645 return S_OK;
1648 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1650 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1651 cpp_bool disabled;
1652 nsresult nsres;
1654 TRACE("(%p)->(%p)\n", This, p);
1656 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1657 if(NS_FAILED(nsres)) {
1658 ERR("GetDisabled failed: %08x\n", nsres);
1659 return E_FAIL;
1662 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
1663 return S_OK;
1666 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1668 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1669 FIXME("(%p)->(%p)\n", This, p);
1670 return E_NOTIMPL;
1673 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1675 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1676 FIXME("(%p)->(%p)\n", This, range);
1677 return E_NOTIMPL;
1680 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1681 HTMLButtonElement_QueryInterface,
1682 HTMLButtonElement_AddRef,
1683 HTMLButtonElement_Release,
1684 HTMLButtonElement_GetTypeInfoCount,
1685 HTMLButtonElement_GetTypeInfo,
1686 HTMLButtonElement_GetIDsOfNames,
1687 HTMLButtonElement_Invoke,
1688 HTMLButtonElement_get_type,
1689 HTMLButtonElement_put_value,
1690 HTMLButtonElement_get_value,
1691 HTMLButtonElement_put_name,
1692 HTMLButtonElement_get_name,
1693 HTMLButtonElement_put_status,
1694 HTMLButtonElement_get_status,
1695 HTMLButtonElement_put_disabled,
1696 HTMLButtonElement_get_disabled,
1697 HTMLButtonElement_get_form,
1698 HTMLButtonElement_createTextRange
1701 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1703 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1706 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1708 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1710 *ppv = NULL;
1712 if(IsEqualGUID(&IID_IUnknown, riid)) {
1713 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1714 *ppv = &This->IHTMLButtonElement_iface;
1715 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1716 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1717 *ppv = &This->IHTMLButtonElement_iface;
1718 }else {
1719 return HTMLElement_QI(&This->element.node, riid, ppv);
1722 IUnknown_AddRef((IUnknown*)*ppv);
1723 return S_OK;
1726 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1728 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1729 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1732 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1734 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1735 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1738 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1739 HTMLButtonElement_QI,
1740 HTMLElement_destructor,
1741 HTMLElement_cpc,
1742 HTMLElement_clone,
1743 HTMLElement_handle_event,
1744 HTMLElement_get_attr_col,
1745 NULL,
1746 NULL,
1747 HTMLButtonElementImpl_put_disabled,
1748 HTMLButtonElementImpl_get_disabled
1751 static const tid_t HTMLButtonElement_iface_tids[] = {
1752 HTMLELEMENT_TIDS,
1753 IHTMLButtonElement_tid,
1757 static dispex_static_data_t HTMLButtonElement_dispex = {
1758 NULL,
1759 DispHTMLButtonElement_tid,
1760 NULL,
1761 HTMLButtonElement_iface_tids
1764 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1766 HTMLButtonElement *ret;
1767 nsresult nsres;
1769 ret = heap_alloc_zero(sizeof(*ret));
1770 if(!ret)
1771 return E_OUTOFMEMORY;
1773 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
1774 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
1776 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
1778 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
1780 /* Share nsbutton reference with nsnode */
1781 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsbutton == ret->element.node.nsnode);
1782 nsIDOMNode_Release(ret->element.node.nsnode);
1784 *elem = &ret->element;
1785 return S_OK;