mshtml: Added IHTMLInputElement implementation.
[wine/gsoc_dplay.git] / dlls / mshtml / htmlelem.c
bloba42d492137a9035ae4953b481f8e580c8e7bacaf
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
35 #include "mshtml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 static HRESULT HTMLElementCollection_Create(IUnknown*,HTMLElement**,DWORD,IDispatch**);
41 #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
43 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
44 REFIID riid, void **ppv)
46 HTMLElement *This = HTMLELEM_THIS(iface);
48 if(This->impl)
49 return IUnknown_QueryInterface(This->impl, riid, ppv);
51 *ppv = NULL;
53 if(IsEqualGUID(&IID_IUnknown, riid)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
55 *ppv = HTMLELEM(This);
56 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
57 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
58 *ppv = HTMLELEM(This);
59 }else if(IsEqualGUID(&IID_IHTMLDOMNode, riid)) {
60 TRACE("(%p)->(IID_IHTMLDOMNode %p)\n", This, ppv);
61 *ppv = HTMLDOMNODE(This->node);
62 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
63 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
64 *ppv = HTMLELEM(This);
67 if(*ppv) {
68 IHTMLElement_AddRef(HTMLELEM(This));
69 return S_OK;
72 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
73 return E_NOINTERFACE;
76 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
78 HTMLElement *This = HTMLELEM_THIS(iface);
80 if(This->impl)
81 return IUnknown_AddRef(This->impl);
83 TRACE("(%p)\n", This);
84 return IHTMLDocument2_AddRef(HTMLDOC(This->node->doc));
87 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
89 HTMLElement *This = HTMLELEM_THIS(iface);
91 if(This->impl)
92 return IUnknown_Release(This->impl);
94 TRACE("(%p)\n", This);
95 return IHTMLDocument2_Release(HTMLDOC(This->node->doc));
98 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
100 HTMLElement *This = HTMLELEM_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, pctinfo);
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
106 LCID lcid, ITypeInfo **ppTInfo)
108 HTMLElement *This = HTMLELEM_THIS(iface);
109 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
110 return E_NOTIMPL;
113 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
114 LPOLESTR *rgszNames, UINT cNames,
115 LCID lcid, DISPID *rgDispId)
117 HTMLElement *This = HTMLELEM_THIS(iface);
118 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
119 lcid, rgDispId);
120 return E_NOTIMPL;
123 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
124 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
125 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
127 HTMLElement *This = HTMLELEM_THIS(iface);
128 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
129 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
134 VARIANT AttributeValue, LONG lFlags)
136 HTMLElement *This = HTMLELEM_THIS(iface);
137 FIXME("(%p)->(%s . %08lx)\n", This, debugstr_w(strAttributeName), lFlags);
138 return E_NOTIMPL;
141 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
142 LONG lFlags, VARIANT *AttributeValue)
144 HTMLElement *This = HTMLELEM_THIS(iface);
145 FIXME("(%p)->(%s %08lx %p)\n", This, debugstr_w(strAttributeName), lFlags,
146 AttributeValue);
147 return E_NOTIMPL;
150 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
151 LONG lFlags, VARIANT_BOOL *pfSuccess)
153 HTMLElement *This = HTMLELEM_THIS(iface);
154 FIXME("(%p)->()\n", This);
155 return E_NOTIMPL;
158 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
160 HTMLElement *This = HTMLELEM_THIS(iface);
161 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
162 return E_NOTIMPL;
165 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
167 HTMLElement *This = HTMLELEM_THIS(iface);
168 FIXME("(%p)->(%p)\n", This, p);
169 return E_NOTIMPL;
172 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
174 HTMLElement *This = HTMLELEM_THIS(iface);
175 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
176 return E_NOTIMPL;
179 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
181 HTMLElement *This = HTMLELEM_THIS(iface);
182 FIXME("(%p)->(%p)\n", This, p);
183 return E_NOTIMPL;
186 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
188 HTMLElement *This = HTMLELEM_THIS(iface);
189 FIXME("(%p)->(%p)\n", This, p);
190 return E_NOTIMPL;
193 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
195 HTMLElement *This = HTMLELEM_THIS(iface);
196 FIXME("(%p)->(%p)\n", This, p);
197 return E_NOTIMPL;
200 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
202 HTMLElement *This = HTMLELEM_THIS(iface);
203 FIXME("(%p)->(%p)\n", This, p);
204 return E_NOTIMPL;
207 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
209 HTMLElement *This = HTMLELEM_THIS(iface);
210 FIXME("(%p)->()\n", This);
211 return E_NOTIMPL;
214 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
216 HTMLElement *This = HTMLELEM_THIS(iface);
217 FIXME("(%p)->(%p)\n", This, p);
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
223 HTMLElement *This = HTMLELEM_THIS(iface);
224 FIXME("(%p)->()\n", This);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
230 HTMLElement *This = HTMLELEM_THIS(iface);
231 FIXME("(%p)->(%p)\n", This, p);
232 return E_NOTIMPL;
235 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
237 HTMLElement *This = HTMLELEM_THIS(iface);
238 FIXME("(%p)->()\n", This);
239 return E_NOTIMPL;
242 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
244 HTMLElement *This = HTMLELEM_THIS(iface);
245 FIXME("(%p)->(%p)\n", This, p);
246 return E_NOTIMPL;
249 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
251 HTMLElement *This = HTMLELEM_THIS(iface);
252 FIXME("(%p)->()\n", This);
253 return E_NOTIMPL;
256 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
258 HTMLElement *This = HTMLELEM_THIS(iface);
259 FIXME("(%p)->(%p)\n", This, p);
260 return E_NOTIMPL;
263 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
265 HTMLElement *This = HTMLELEM_THIS(iface);
266 FIXME("(%p)->()\n", This);
267 return E_NOTIMPL;
270 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
272 HTMLElement *This = HTMLELEM_THIS(iface);
273 FIXME("(%p)->(%p)\n", This, p);
274 return E_NOTIMPL;
277 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
279 HTMLElement *This = HTMLELEM_THIS(iface);
280 FIXME("(%p)->()\n", This);
281 return E_NOTIMPL;
284 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
286 HTMLElement *This = HTMLELEM_THIS(iface);
287 FIXME("(%p)->(%p)\n", This, p);
288 return E_NOTIMPL;
291 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
293 HTMLElement *This = HTMLELEM_THIS(iface);
294 FIXME("(%p)->()\n", This);
295 return E_NOTIMPL;
298 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
300 HTMLElement *This = HTMLELEM_THIS(iface);
301 FIXME("(%p)->(%p)\n", This, p);
302 return E_NOTIMPL;
305 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
307 HTMLElement *This = HTMLELEM_THIS(iface);
308 FIXME("(%p)->()\n", This);
309 return E_NOTIMPL;
312 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
314 HTMLElement *This = HTMLELEM_THIS(iface);
315 FIXME("(%p)->(%p)\n", This, p);
316 return E_NOTIMPL;
319 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
321 HTMLElement *This = HTMLELEM_THIS(iface);
322 FIXME("(%p)->()\n", This);
323 return E_NOTIMPL;
326 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
328 HTMLElement *This = HTMLELEM_THIS(iface);
329 FIXME("(%p)->(%p)\n", This, p);
330 return E_NOTIMPL;
333 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
335 HTMLElement *This = HTMLELEM_THIS(iface);
336 FIXME("(%p)->()\n", This);
337 return E_NOTIMPL;
340 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
342 HTMLElement *This = HTMLELEM_THIS(iface);
343 FIXME("(%p)->(%p)\n", This, p);
344 return E_NOTIMPL;
347 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
349 HTMLElement *This = HTMLELEM_THIS(iface);
350 FIXME("(%p)->()\n", This);
351 return E_NOTIMPL;
354 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
356 HTMLElement *This = HTMLELEM_THIS(iface);
357 FIXME("(%p)->(%p)\n", This, p);
358 return E_NOTIMPL;
361 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
363 HTMLElement *This = HTMLELEM_THIS(iface);
364 FIXME("(%p)->(%p)\n", This, p);
365 return E_NOTIMPL;
368 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
370 HTMLElement *This = HTMLELEM_THIS(iface);
371 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
372 return E_NOTIMPL;
375 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
377 HTMLElement *This = HTMLELEM_THIS(iface);
378 FIXME("(%p)->(%p)\n", This, p);
379 return E_NOTIMPL;
382 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
384 HTMLElement *This = HTMLELEM_THIS(iface);
385 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
386 return E_NOTIMPL;
389 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
391 HTMLElement *This = HTMLELEM_THIS(iface);
392 FIXME("(%p)->(%p)\n", This, p);
393 return E_NOTIMPL;
396 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
398 HTMLElement *This = HTMLELEM_THIS(iface);
399 FIXME("(%p)->()\n", This);
400 return E_NOTIMPL;
403 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
405 HTMLElement *This = HTMLELEM_THIS(iface);
406 FIXME("(%p)->(%p)\n", This, p);
407 return E_NOTIMPL;
410 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
412 HTMLElement *This = HTMLELEM_THIS(iface);
413 FIXME("(%p)->()\n", This);
414 return E_NOTIMPL;
417 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
418 VARIANT_BOOL *pfResult)
420 HTMLElement *This = HTMLELEM_THIS(iface);
421 FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
422 return E_NOTIMPL;
425 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, long *p)
427 HTMLElement *This = HTMLELEM_THIS(iface);
428 FIXME("(%p)->(%p)\n", This, p);
429 return E_NOTIMPL;
432 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
434 HTMLElement *This = HTMLELEM_THIS(iface);
435 FIXME("(%p)->(%p)\n", This, p);
436 return E_NOTIMPL;
439 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
441 HTMLElement *This = HTMLELEM_THIS(iface);
442 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
443 return E_NOTIMPL;
446 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
448 HTMLElement *This = HTMLELEM_THIS(iface);
449 FIXME("(%p)->(%p)\n", This, p);
450 return E_NOTIMPL;
453 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, long *p)
455 HTMLElement *This = HTMLELEM_THIS(iface);
456 FIXME("(%p)->(%p)\n", This, p);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, long *p)
462 HTMLElement *This = HTMLELEM_THIS(iface);
463 FIXME("(%p)->(%p)\n", This, p);
464 return E_NOTIMPL;
467 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, long *p)
469 HTMLElement *This = HTMLELEM_THIS(iface);
470 FIXME("(%p)->(%p)\n", This, p);
471 return E_NOTIMPL;
474 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, long *p)
476 HTMLElement *This = HTMLELEM_THIS(iface);
477 FIXME("(%p)->(%p)\n", This, p);
478 return E_NOTIMPL;
481 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
483 HTMLElement *This = HTMLELEM_THIS(iface);
484 FIXME("(%p)->(%p)\n", This, p);
485 return E_NOTIMPL;
488 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
490 HTMLElement *This = HTMLELEM_THIS(iface);
491 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
492 return E_NOTIMPL;
495 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
497 HTMLElement *This = HTMLELEM_THIS(iface);
498 FIXME("(%p)->(%p)\n", This, p);
499 return E_NOTIMPL;
502 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
504 HTMLElement *This = HTMLELEM_THIS(iface);
505 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
506 return E_NOTIMPL;
509 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
511 HTMLElement *This = HTMLELEM_THIS(iface);
512 FIXME("(%p)->(%p)\n", This, p);
513 return E_NOTIMPL;
516 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
518 HTMLElement *This = HTMLELEM_THIS(iface);
519 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
520 return E_NOTIMPL;
523 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
525 HTMLElement *This = HTMLELEM_THIS(iface);
526 FIXME("(%p)->(%p)\n", This, p);
527 return E_NOTIMPL;
530 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
532 HTMLElement *This = HTMLELEM_THIS(iface);
533 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
534 return E_NOTIMPL;
537 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
539 HTMLElement *This = HTMLELEM_THIS(iface);
540 FIXME("(%p)->(%p)\n", This, p);
541 return E_NOTIMPL;
544 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
545 BSTR html)
547 HTMLElement *This = HTMLELEM_THIS(iface);
548 FIXME("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
549 return E_NOTIMPL;
552 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
553 BSTR text)
555 HTMLElement *This = HTMLELEM_THIS(iface);
556 FIXME("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
557 return E_NOTIMPL;
560 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
562 HTMLElement *This = HTMLELEM_THIS(iface);
563 FIXME("(%p)->(%p)\n", This, p);
564 return E_NOTIMPL;
567 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
569 HTMLElement *This = HTMLELEM_THIS(iface);
570 FIXME("(%p)->(%p)\n", This, p);
571 return E_NOTIMPL;
574 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
576 HTMLElement *This = HTMLELEM_THIS(iface);
577 FIXME("(%p)\n", This);
578 return E_NOTIMPL;
581 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
582 IHTMLFiltersCollection **p)
584 HTMLElement *This = HTMLELEM_THIS(iface);
585 FIXME("(%p)->(%p)\n", This, p);
586 return E_NOTIMPL;
589 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
591 HTMLElement *This = HTMLELEM_THIS(iface);
592 FIXME("(%p)->()\n", This);
593 return E_NOTIMPL;
596 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
598 HTMLElement *This = HTMLELEM_THIS(iface);
599 FIXME("(%p)->(%p)\n", This, p);
600 return E_NOTIMPL;
603 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
605 HTMLElement *This = HTMLELEM_THIS(iface);
606 FIXME("(%p)->(%p)\n", This, String);
607 return E_NOTIMPL;
610 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
612 HTMLElement *This = HTMLELEM_THIS(iface);
613 FIXME("(%p)->()\n", This);
614 return E_NOTIMPL;
617 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
619 HTMLElement *This = HTMLELEM_THIS(iface);
620 FIXME("(%p)->(%p)\n", This, p);
621 return E_NOTIMPL;
624 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
626 HTMLElement *This = HTMLELEM_THIS(iface);
627 FIXME("(%p)->()\n", This);
628 return E_NOTIMPL;
631 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
633 HTMLElement *This = HTMLELEM_THIS(iface);
634 FIXME("(%p)->(%p)\n", This, p);
635 return E_NOTIMPL;
638 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
640 HTMLElement *This = HTMLELEM_THIS(iface);
641 FIXME("(%p)->()\n", This);
642 return E_NOTIMPL;
645 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
647 HTMLElement *This = HTMLELEM_THIS(iface);
648 FIXME("(%p)->(%p)\n", This, p);
649 return E_NOTIMPL;
652 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
654 HTMLElement *This = HTMLELEM_THIS(iface);
655 FIXME("(%p)->()\n", This);
656 return E_NOTIMPL;
659 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
661 HTMLElement *This = HTMLELEM_THIS(iface);
662 FIXME("(%p)->(%p)\n", This, p);
663 return E_NOTIMPL;
666 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
668 HTMLElement *This = HTMLELEM_THIS(iface);
669 FIXME("(%p)->()\n", This);
670 return E_NOTIMPL;
673 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
675 HTMLElement *This = HTMLELEM_THIS(iface);
676 FIXME("(%p)->(%p)\n", This, p);
677 return E_NOTIMPL;
680 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
682 HTMLElement *This = HTMLELEM_THIS(iface);
683 FIXME("(%p)->()\n", This);
684 return E_NOTIMPL;
687 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
689 HTMLElement *This = HTMLELEM_THIS(iface);
690 FIXME("(%p)->(%p)\n", This, p);
691 return E_NOTIMPL;
694 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
696 HTMLElement *This = HTMLELEM_THIS(iface);
697 FIXME("(%p)->()\n", This);
698 return E_NOTIMPL;
701 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
703 HTMLElement *This = HTMLELEM_THIS(iface);
704 FIXME("(%p)->(%p)\n", This, p);
705 return E_NOTIMPL;
708 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
710 HTMLElement *This = HTMLELEM_THIS(iface);
711 FIXME("(%p)->()\n", This);
712 return E_NOTIMPL;
715 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
717 HTMLElement *This = HTMLELEM_THIS(iface);
718 FIXME("(%p)->(%p)\n", This, p);
719 return E_NOTIMPL;
722 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
724 HTMLElement *This = HTMLELEM_THIS(iface);
725 FIXME("(%p)->()\n", This);
726 return E_NOTIMPL;
729 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
731 HTMLElement *This = HTMLELEM_THIS(iface);
732 FIXME("(%p)->(%p)\n", This, p);
733 return E_NOTIMPL;
736 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
738 HTMLElement *This = HTMLELEM_THIS(iface);
739 FIXME("(%p)->(%p)\n", This, p);
740 return E_NOTIMPL;
743 static void create_all_list(HTMLDocument *doc, HTMLElement *elem, HTMLElement ***list, DWORD *size,
744 DWORD *len)
746 nsIDOMNodeList *nsnode_list;
747 nsIDOMNode *iter;
748 PRUint32 list_len = 0, i;
749 HTMLDOMNode *node;
750 nsresult nsres;
752 nsres = nsIDOMNode_GetChildNodes(elem->node->nsnode, &nsnode_list);
753 if(NS_FAILED(nsres)) {
754 ERR("GetChildNodes failed: %08lx\n", nsres);
755 return;
758 nsIDOMNodeList_GetLength(nsnode_list, &list_len);
759 if(!list_len)
760 return;
762 for(i=0; i<list_len; i++) {
763 nsres = nsIDOMNodeList_Item(nsnode_list, i, &iter);
764 if(NS_FAILED(nsres)) {
765 ERR("Item failed: %08lx\n", nsres);
766 continue;
769 node = get_node(doc, iter);
770 if(node->node_type != NT_HTMLELEM)
771 continue;
773 if(*len == *size) {
774 *size <<= 1;
775 *list = HeapReAlloc(GetProcessHeap(), 0, *list, *size * sizeof(HTMLElement**));
778 (*list)[(*len)++] = (HTMLElement*)node->impl.elem;
780 create_all_list(doc, (HTMLElement*)node->impl.elem, list, size, len);
784 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
786 HTMLElement *This = HTMLELEM_THIS(iface);
787 HTMLElement **elem_list;
788 DWORD list_size = 8, len = 0;
790 TRACE("(%p)->(%p)\n", This, p);
792 elem_list = HeapAlloc(GetProcessHeap(), 0, list_size*sizeof(HTMLElement**));
794 create_all_list(This->node->doc, This, &elem_list, &list_size, &len);
796 if(!len) {
797 HeapFree(GetProcessHeap(), 0, elem_list);
798 elem_list = NULL;
799 }else if(list_size > len) {
800 elem_list = HeapReAlloc(GetProcessHeap(), 0, elem_list, len*sizeof(HTMLElement**));
803 return HTMLElementCollection_Create((IUnknown*)HTMLELEM(This), elem_list, len, p);
806 static void HTMLElement_destructor(IUnknown *iface)
808 HTMLElement *This = HTMLELEM_THIS(iface);
810 if(This->destructor)
811 This->destructor(This->impl);
813 if(This->nselem)
814 nsIDOMHTMLElement_Release(This->nselem);
816 HeapFree(GetProcessHeap(), 0, This);
819 #undef HTMLELEM_THIS
821 static const IHTMLElementVtbl HTMLElementVtbl = {
822 HTMLElement_QueryInterface,
823 HTMLElement_AddRef,
824 HTMLElement_Release,
825 HTMLElement_GetTypeInfoCount,
826 HTMLElement_GetTypeInfo,
827 HTMLElement_GetIDsOfNames,
828 HTMLElement_Invoke,
829 HTMLElement_setAttribute,
830 HTMLElement_getAttribute,
831 HTMLElement_removeAttribute,
832 HTMLElement_put_className,
833 HTMLElement_get_className,
834 HTMLElement_put_id,
835 HTMLElement_get_id,
836 HTMLElement_get_tagName,
837 HTMLElement_get_parentElement,
838 HTMLElement_get_style,
839 HTMLElement_put_onhelp,
840 HTMLElement_get_onhelp,
841 HTMLElement_put_onclick,
842 HTMLElement_get_onclick,
843 HTMLElement_put_ondblclick,
844 HTMLElement_get_ondblclick,
845 HTMLElement_put_onkeydown,
846 HTMLElement_get_onkeydown,
847 HTMLElement_put_onkeyup,
848 HTMLElement_get_onkeyup,
849 HTMLElement_put_onkeypress,
850 HTMLElement_get_onkeypress,
851 HTMLElement_put_onmouseout,
852 HTMLElement_get_onmouseout,
853 HTMLElement_put_onmouseover,
854 HTMLElement_get_onmouseover,
855 HTMLElement_put_onmousemove,
856 HTMLElement_get_onmousemove,
857 HTMLElement_put_onmousedown,
858 HTMLElement_get_onmousedown,
859 HTMLElement_put_onmouseup,
860 HTMLElement_get_onmouseup,
861 HTMLElement_get_document,
862 HTMLElement_put_title,
863 HTMLElement_get_title,
864 HTMLElement_put_language,
865 HTMLElement_get_language,
866 HTMLElement_put_onselectstart,
867 HTMLElement_get_onselectstart,
868 HTMLElement_scrollIntoView,
869 HTMLElement_contains,
870 HTMLElement_get_sourceIndex,
871 HTMLElement_get_recordNumber,
872 HTMLElement_put_lang,
873 HTMLElement_get_lang,
874 HTMLElement_get_offsetLeft,
875 HTMLElement_get_offsetTop,
876 HTMLElement_get_offsetWidth,
877 HTMLElement_get_offsetHeight,
878 HTMLElement_get_offsetParent,
879 HTMLElement_put_innerHTML,
880 HTMLElement_get_innerHTML,
881 HTMLElement_put_innerText,
882 HTMLElement_get_innerText,
883 HTMLElement_put_outerHTML,
884 HTMLElement_get_outerHTML,
885 HTMLElement_put_outerText,
886 HTMLElement_get_outerText,
887 HTMLElement_insertAdjacentHTML,
888 HTMLElement_insertAdjacentText,
889 HTMLElement_get_parentTextEdit,
890 HTMLElement_get_isTextEdit,
891 HTMLElement_click,
892 HTMLElement_get_filters,
893 HTMLElement_put_ondragstart,
894 HTMLElement_get_ondragstart,
895 HTMLElement_toString,
896 HTMLElement_put_onbeforeupdate,
897 HTMLElement_get_onbeforeupdate,
898 HTMLElement_put_onafterupdate,
899 HTMLElement_get_onafterupdate,
900 HTMLElement_put_onerrorupdate,
901 HTMLElement_get_onerrorupdate,
902 HTMLElement_put_onrowexit,
903 HTMLElement_get_onrowexit,
904 HTMLElement_put_onrowenter,
905 HTMLElement_get_onrowenter,
906 HTMLElement_put_ondatasetchanged,
907 HTMLElement_get_ondatasetchanged,
908 HTMLElement_put_ondataavailable,
909 HTMLElement_get_ondataavailable,
910 HTMLElement_put_ondatasetcomplete,
911 HTMLElement_get_ondatasetcomplete,
912 HTMLElement_put_onfilterchange,
913 HTMLElement_get_onfilterchange,
914 HTMLElement_get_children,
915 HTMLElement_get_all
918 void HTMLElement_Create(HTMLDOMNode *node)
920 HTMLElement *ret;
921 nsAString class_name_str;
922 const PRUnichar *class_name;
923 nsresult nsres;
925 static const WCHAR wszINPUT[] = {'I','N','P','U','T',0};
927 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElement));
928 ret->lpHTMLElementVtbl = &HTMLElementVtbl;
929 ret->node = node;
930 ret->impl = NULL;
931 ret->destructor = NULL;
933 node->node_type = NT_HTMLELEM;
934 node->impl.elem = HTMLELEM(ret);
935 node->destructor = HTMLElement_destructor;
937 nsres = nsIDOMNode_QueryInterface(node->nsnode, &IID_nsIDOMHTMLElement, (void**)&ret->nselem);
938 if(NS_FAILED(nsres))
939 return;
941 nsAString_Init(&class_name_str, NULL);
942 nsIDOMHTMLElement_GetTagName(ret->nselem, &class_name_str);
944 nsAString_GetData(&class_name_str, &class_name, NULL);
946 if(!strcmpW(class_name, wszINPUT))
947 HTMLInputElement_Create(ret);
949 nsAString_Finish(&class_name_str);
952 typedef struct {
953 const IHTMLElementCollectionVtbl *lpHTMLElementCollectionVtbl;
955 IUnknown *ref_unk;
956 HTMLElement **elems;
957 DWORD len;
959 LONG ref;
960 } HTMLElementCollection;
962 #define HTMLELEMCOL(x) ((IHTMLElementCollection*) &(x)->lpHTMLElementCollectionVtbl)
964 #define ELEMCOL_THIS(iface) DEFINE_THIS(HTMLElementCollection, HTMLElementCollection, iface)
966 static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollection *iface,
967 REFIID riid, void **ppv)
969 HTMLElementCollection *This = ELEMCOL_THIS(iface);
971 *ppv = NULL;
973 if(IsEqualGUID(&IID_IUnknown, riid)) {
974 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
975 *ppv = HTMLELEMCOL(This);
976 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
977 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
978 *ppv = HTMLELEMCOL(This);
979 }else if(IsEqualGUID(&IID_IHTMLElementCollection, riid)) {
980 TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv);
981 *ppv = HTMLELEMCOL(This);
984 if(*ppv) {
985 IHTMLElementCollection_AddRef(HTMLELEMCOL(This));
986 return S_OK;
989 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
990 return E_NOINTERFACE;
993 static ULONG WINAPI HTMLElementCollection_AddRef(IHTMLElementCollection *iface)
995 HTMLElementCollection *This = ELEMCOL_THIS(iface);
996 LONG ref = InterlockedIncrement(&This->ref);
998 TRACE("(%p) ref=%ld\n", This, ref);
1000 return ref;
1003 static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
1005 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1006 LONG ref = InterlockedDecrement(&This->ref);
1008 TRACE("(%p) ref=%ld\n", This, ref);
1010 if(!ref) {
1011 IUnknown_Release(This->ref_unk);
1012 HeapFree(GetProcessHeap(), 0, This->elems);
1013 HeapFree(GetProcessHeap(), 0, This);
1016 return ref;
1019 static HRESULT WINAPI HTMLElementCollection_GetTypeInfoCount(IHTMLElementCollection *iface,
1020 UINT *pctinfo)
1022 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1023 FIXME("(%p)->(%p)\n", This, pctinfo);
1024 return E_NOTIMPL;
1027 static HRESULT WINAPI HTMLElementCollection_GetTypeInfo(IHTMLElementCollection *iface,
1028 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
1030 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1031 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
1032 return E_NOTIMPL;
1035 static HRESULT WINAPI HTMLElementCollection_GetIDsOfNames(IHTMLElementCollection *iface,
1036 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1038 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1039 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1040 lcid, rgDispId);
1041 return E_NOTIMPL;
1044 static HRESULT WINAPI HTMLElementCollection_Invoke(IHTMLElementCollection *iface,
1045 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1046 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1048 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1049 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1050 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1051 return E_NOTIMPL;
1054 static HRESULT WINAPI HTMLElementCollection_toString(IHTMLElementCollection *iface,
1055 BSTR *String)
1057 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1058 FIXME("(%p)->(%p)\n", This, String);
1059 return E_NOTIMPL;
1062 static HRESULT WINAPI HTMLElementCollection_put_length(IHTMLElementCollection *iface,
1063 long v)
1065 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1066 FIXME("(%p)->(%ld)\n", This, v);
1067 return E_NOTIMPL;
1070 static HRESULT WINAPI HTMLElementCollection_get_length(IHTMLElementCollection *iface,
1071 long *p)
1073 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1075 TRACE("(%p)->(%p)\n", This, p);
1077 *p = This->len;
1078 return S_OK;
1081 static HRESULT WINAPI HTMLElementCollection_get__newEnum(IHTMLElementCollection *iface,
1082 IUnknown **p)
1084 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1085 FIXME("(%p)->(%p)\n", This, p);
1086 return E_NOTIMPL;
1089 static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
1090 VARIANT name, VARIANT index, IDispatch **pdisp)
1092 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1094 if(V_VT(&index) != VT_I4) {
1095 WARN("Invalid index vt=%d\n", V_VT(&index));
1096 return E_INVALIDARG;
1099 if(V_VT(&name) != VT_I4 || V_I4(&name) != V_I4(&index))
1100 FIXME("Unsupproted name vt=%d\n", V_VT(&name));
1102 TRACE("(%p)->(%ld %ld %p)\n", This, V_I4(&name), V_I4(&index), pdisp);
1104 if(V_I4(&index) < 0 || V_I4(&index) >= This->len)
1105 return E_INVALIDARG;
1107 *pdisp = (IDispatch*)This->elems[V_I4(&index)];
1108 IDispatch_AddRef(*pdisp);
1109 return S_OK;
1112 static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
1113 VARIANT tagName, IDispatch **pdisp)
1115 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1116 DWORD size = 8, len = 0, i;
1117 HTMLElement **elem_list;
1118 nsAString tag_str;
1119 const PRUnichar *tag;
1121 if(V_VT(&tagName) != VT_BSTR) {
1122 WARN("Invalid arg\n");
1123 return E_INVALIDARG;
1126 TRACE("(%p)->(%s %p)\n", This, debugstr_w(V_BSTR(&tagName)), pdisp);
1128 elem_list = HeapAlloc(GetProcessHeap(), 0, size*sizeof(HTMLElement*));
1130 nsAString_Init(&tag_str, NULL);
1132 for(i=0; i<This->len; i++) {
1133 if(!This->elems[i]->nselem)
1134 continue;
1136 nsIDOMElement_GetTagName(This->elems[i]->nselem, &tag_str);
1137 nsAString_GetData(&tag_str, &tag, NULL);
1139 if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, tag, -1,
1140 V_BSTR(&tagName), -1) == CSTR_EQUAL) {
1141 if(len == size) {
1142 size <<= 2;
1143 elem_list = HeapReAlloc(GetProcessHeap(), 0, elem_list, size);
1146 elem_list[len++] = This->elems[i];
1150 nsAString_Finish(&tag_str);
1152 TRACE("fount %ld tags\n", len);
1154 if(!len) {
1155 HeapFree(GetProcessHeap(), 0, elem_list);
1156 elem_list = NULL;
1157 }else if(size > len) {
1158 HeapReAlloc(GetProcessHeap(), 0, elem_list, len);
1161 return HTMLElementCollection_Create(This->ref_unk, elem_list, len, pdisp);
1164 #undef ELEMCOL_THIS
1166 static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl = {
1167 HTMLElementCollection_QueryInterface,
1168 HTMLElementCollection_AddRef,
1169 HTMLElementCollection_Release,
1170 HTMLElementCollection_GetTypeInfoCount,
1171 HTMLElementCollection_GetTypeInfo,
1172 HTMLElementCollection_GetIDsOfNames,
1173 HTMLElementCollection_Invoke,
1174 HTMLElementCollection_toString,
1175 HTMLElementCollection_put_length,
1176 HTMLElementCollection_get_length,
1177 HTMLElementCollection_get__newEnum,
1178 HTMLElementCollection_item,
1179 HTMLElementCollection_tags
1182 static HRESULT HTMLElementCollection_Create(IUnknown *ref_unk, HTMLElement **elems, DWORD len,
1183 IDispatch **p)
1185 HTMLElementCollection *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElementCollection));
1187 ret->lpHTMLElementCollectionVtbl = &HTMLElementCollectionVtbl;
1188 ret->ref = 1;
1189 ret->elems = elems;
1190 ret->len = len;
1192 IUnknown_AddRef(ref_unk);
1193 ret->ref_unk = ref_unk;
1195 TRACE("ret=%p len=%ld\n", ret, len);
1197 *p = (IDispatch*)ret;
1198 return S_OK;