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
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
**);
47 static void elem_vector_add(elem_vector
*buf
, HTMLElement
*elem
)
49 if(buf
->len
== buf
->size
) {
51 buf
->buf
= HeapReAlloc(GetProcessHeap(), 0, buf
->buf
, buf
->size
*sizeof(HTMLElement
**));
54 buf
->buf
[buf
->len
++] = elem
;
57 #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
59 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
60 REFIID riid
, void **ppv
)
62 HTMLElement
*This
= HTMLELEM_THIS(iface
);
66 return IUnknown_QueryInterface(This
->impl
, riid
, ppv
);
68 hres
= HTMLElement_QI(This
, riid
, ppv
);
70 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
75 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
77 HTMLElement
*This
= HTMLELEM_THIS(iface
);
80 return IUnknown_AddRef(This
->impl
);
82 TRACE("(%p)\n", This
);
83 return IHTMLDocument2_AddRef(HTMLDOC(This
->node
->doc
));
86 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
88 HTMLElement
*This
= HTMLELEM_THIS(iface
);
91 return IUnknown_Release(This
->impl
);
93 TRACE("(%p)\n", This
);
94 return IHTMLDocument2_Release(HTMLDOC(This
->node
->doc
));
97 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
99 HTMLElement
*This
= HTMLELEM_THIS(iface
);
100 FIXME("(%p)->(%p)\n", This
, pctinfo
);
104 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
105 LCID lcid
, ITypeInfo
**ppTInfo
)
107 HTMLElement
*This
= HTMLELEM_THIS(iface
);
108 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
112 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
113 LPOLESTR
*rgszNames
, UINT cNames
,
114 LCID lcid
, DISPID
*rgDispId
)
116 HTMLElement
*This
= HTMLELEM_THIS(iface
);
117 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
122 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
123 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
124 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
126 HTMLElement
*This
= HTMLELEM_THIS(iface
);
127 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
128 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
132 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
133 VARIANT AttributeValue
, LONG lFlags
)
135 HTMLElement
*This
= HTMLELEM_THIS(iface
);
136 FIXME("(%p)->(%s . %08lx)\n", This
, debugstr_w(strAttributeName
), lFlags
);
140 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
141 LONG lFlags
, VARIANT
*AttributeValue
)
143 HTMLElement
*This
= HTMLELEM_THIS(iface
);
146 const PRUnichar
*value
;
150 WARN("(%p)->(%s %08lx %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
152 nsAString_Init(&attr_str
, strAttributeName
);
153 nsAString_Init(&value_str
, NULL
);
155 nsres
= nsIDOMHTMLElement_GetAttribute(This
->nselem
, &attr_str
, &value_str
);
156 nsAString_Finish(&attr_str
);
158 if(NS_SUCCEEDED(nsres
)) {
159 nsAString_GetData(&value_str
, &value
, NULL
);
160 V_VT(AttributeValue
) = VT_BSTR
;
161 V_BSTR(AttributeValue
) = SysAllocString(value
);;
162 TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue
)));
164 ERR("GetAttribute failed: %08lx\n", nsres
);
168 nsAString_Finish(&value_str
);
173 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
174 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
176 HTMLElement
*This
= HTMLELEM_THIS(iface
);
177 FIXME("(%p)->()\n", This
);
181 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
183 HTMLElement
*This
= HTMLELEM_THIS(iface
);
184 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
188 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
190 HTMLElement
*This
= HTMLELEM_THIS(iface
);
191 FIXME("(%p)->(%p)\n", This
, p
);
195 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
197 HTMLElement
*This
= HTMLELEM_THIS(iface
);
198 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
202 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
204 HTMLElement
*This
= HTMLELEM_THIS(iface
);
205 FIXME("(%p)->(%p)\n", This
, p
);
209 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
211 HTMLElement
*This
= HTMLELEM_THIS(iface
);
212 FIXME("(%p)->(%p)\n", This
, p
);
216 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
218 HTMLElement
*This
= HTMLELEM_THIS(iface
);
219 FIXME("(%p)->(%p)\n", This
, p
);
223 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
225 HTMLElement
*This
= HTMLELEM_THIS(iface
);
226 FIXME("(%p)->(%p)\n", This
, p
);
230 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
232 HTMLElement
*This
= HTMLELEM_THIS(iface
);
233 FIXME("(%p)->()\n", This
);
237 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
239 HTMLElement
*This
= HTMLELEM_THIS(iface
);
240 FIXME("(%p)->(%p)\n", This
, p
);
244 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
246 HTMLElement
*This
= HTMLELEM_THIS(iface
);
247 FIXME("(%p)->()\n", This
);
251 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
253 HTMLElement
*This
= HTMLELEM_THIS(iface
);
254 FIXME("(%p)->(%p)\n", This
, p
);
258 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
260 HTMLElement
*This
= HTMLELEM_THIS(iface
);
261 FIXME("(%p)->()\n", This
);
265 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
267 HTMLElement
*This
= HTMLELEM_THIS(iface
);
268 FIXME("(%p)->(%p)\n", This
, p
);
272 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
274 HTMLElement
*This
= HTMLELEM_THIS(iface
);
275 FIXME("(%p)->()\n", This
);
279 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
281 HTMLElement
*This
= HTMLELEM_THIS(iface
);
282 FIXME("(%p)->(%p)\n", This
, p
);
286 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
288 HTMLElement
*This
= HTMLELEM_THIS(iface
);
289 FIXME("(%p)->()\n", This
);
293 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
295 HTMLElement
*This
= HTMLELEM_THIS(iface
);
296 FIXME("(%p)->(%p)\n", This
, p
);
300 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
302 HTMLElement
*This
= HTMLELEM_THIS(iface
);
303 FIXME("(%p)->()\n", This
);
307 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
309 HTMLElement
*This
= HTMLELEM_THIS(iface
);
310 FIXME("(%p)->(%p)\n", This
, p
);
314 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
316 HTMLElement
*This
= HTMLELEM_THIS(iface
);
317 FIXME("(%p)->()\n", This
);
321 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
323 HTMLElement
*This
= HTMLELEM_THIS(iface
);
324 FIXME("(%p)->(%p)\n", This
, p
);
328 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
330 HTMLElement
*This
= HTMLELEM_THIS(iface
);
331 FIXME("(%p)->()\n", This
);
335 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
337 HTMLElement
*This
= HTMLELEM_THIS(iface
);
338 FIXME("(%p)->(%p)\n", This
, p
);
342 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
344 HTMLElement
*This
= HTMLELEM_THIS(iface
);
345 FIXME("(%p)->()\n", This
);
349 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
351 HTMLElement
*This
= HTMLELEM_THIS(iface
);
352 FIXME("(%p)->(%p)\n", This
, p
);
356 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
358 HTMLElement
*This
= HTMLELEM_THIS(iface
);
359 FIXME("(%p)->()\n", This
);
363 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
365 HTMLElement
*This
= HTMLELEM_THIS(iface
);
366 FIXME("(%p)->(%p)\n", This
, p
);
370 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
372 HTMLElement
*This
= HTMLELEM_THIS(iface
);
373 FIXME("(%p)->()\n", This
);
377 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
379 HTMLElement
*This
= HTMLELEM_THIS(iface
);
380 FIXME("(%p)->(%p)\n", This
, p
);
384 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
386 HTMLElement
*This
= HTMLELEM_THIS(iface
);
387 FIXME("(%p)->(%p)\n", This
, p
);
391 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
393 HTMLElement
*This
= HTMLELEM_THIS(iface
);
394 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
398 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
400 HTMLElement
*This
= HTMLELEM_THIS(iface
);
401 FIXME("(%p)->(%p)\n", This
, p
);
405 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
407 HTMLElement
*This
= HTMLELEM_THIS(iface
);
408 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
412 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
414 HTMLElement
*This
= HTMLELEM_THIS(iface
);
415 FIXME("(%p)->(%p)\n", This
, p
);
419 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
421 HTMLElement
*This
= HTMLELEM_THIS(iface
);
422 FIXME("(%p)->()\n", This
);
426 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
428 HTMLElement
*This
= HTMLELEM_THIS(iface
);
429 FIXME("(%p)->(%p)\n", This
, p
);
433 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
435 HTMLElement
*This
= HTMLELEM_THIS(iface
);
436 FIXME("(%p)->()\n", This
);
440 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
441 VARIANT_BOOL
*pfResult
)
443 HTMLElement
*This
= HTMLELEM_THIS(iface
);
444 FIXME("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
448 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, long *p
)
450 HTMLElement
*This
= HTMLELEM_THIS(iface
);
451 FIXME("(%p)->(%p)\n", This
, p
);
455 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
457 HTMLElement
*This
= HTMLELEM_THIS(iface
);
458 FIXME("(%p)->(%p)\n", This
, p
);
462 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
464 HTMLElement
*This
= HTMLELEM_THIS(iface
);
465 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
469 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
471 HTMLElement
*This
= HTMLELEM_THIS(iface
);
472 FIXME("(%p)->(%p)\n", This
, p
);
476 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, long *p
)
478 HTMLElement
*This
= HTMLELEM_THIS(iface
);
479 FIXME("(%p)->(%p)\n", This
, p
);
483 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, long *p
)
485 HTMLElement
*This
= HTMLELEM_THIS(iface
);
486 FIXME("(%p)->(%p)\n", This
, p
);
490 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, long *p
)
492 HTMLElement
*This
= HTMLELEM_THIS(iface
);
493 FIXME("(%p)->(%p)\n", This
, p
);
497 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, long *p
)
499 HTMLElement
*This
= HTMLELEM_THIS(iface
);
500 FIXME("(%p)->(%p)\n", This
, p
);
504 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
506 HTMLElement
*This
= HTMLELEM_THIS(iface
);
507 FIXME("(%p)->(%p)\n", This
, p
);
511 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
513 HTMLElement
*This
= HTMLELEM_THIS(iface
);
514 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
518 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
520 HTMLElement
*This
= HTMLELEM_THIS(iface
);
521 FIXME("(%p)->(%p)\n", This
, p
);
525 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
527 HTMLElement
*This
= HTMLELEM_THIS(iface
);
528 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
532 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
534 HTMLElement
*This
= HTMLELEM_THIS(iface
);
535 FIXME("(%p)->(%p)\n", This
, p
);
539 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
541 HTMLElement
*This
= HTMLELEM_THIS(iface
);
542 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
546 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
548 HTMLElement
*This
= HTMLELEM_THIS(iface
);
549 FIXME("(%p)->(%p)\n", This
, p
);
553 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
555 HTMLElement
*This
= HTMLELEM_THIS(iface
);
556 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
560 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
562 HTMLElement
*This
= HTMLELEM_THIS(iface
);
563 FIXME("(%p)->(%p)\n", This
, p
);
567 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
570 HTMLElement
*This
= HTMLELEM_THIS(iface
);
571 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
575 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
578 HTMLElement
*This
= HTMLELEM_THIS(iface
);
579 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
583 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
585 HTMLElement
*This
= HTMLELEM_THIS(iface
);
586 FIXME("(%p)->(%p)\n", This
, p
);
590 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
592 HTMLElement
*This
= HTMLELEM_THIS(iface
);
593 FIXME("(%p)->(%p)\n", This
, p
);
597 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
599 HTMLElement
*This
= HTMLELEM_THIS(iface
);
600 FIXME("(%p)\n", This
);
604 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
605 IHTMLFiltersCollection
**p
)
607 HTMLElement
*This
= HTMLELEM_THIS(iface
);
608 FIXME("(%p)->(%p)\n", This
, p
);
612 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
614 HTMLElement
*This
= HTMLELEM_THIS(iface
);
615 FIXME("(%p)->()\n", This
);
619 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
621 HTMLElement
*This
= HTMLELEM_THIS(iface
);
622 FIXME("(%p)->(%p)\n", This
, p
);
626 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
628 HTMLElement
*This
= HTMLELEM_THIS(iface
);
629 FIXME("(%p)->(%p)\n", This
, String
);
633 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
635 HTMLElement
*This
= HTMLELEM_THIS(iface
);
636 FIXME("(%p)->()\n", This
);
640 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
642 HTMLElement
*This
= HTMLELEM_THIS(iface
);
643 FIXME("(%p)->(%p)\n", This
, p
);
647 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
649 HTMLElement
*This
= HTMLELEM_THIS(iface
);
650 FIXME("(%p)->()\n", This
);
654 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
656 HTMLElement
*This
= HTMLELEM_THIS(iface
);
657 FIXME("(%p)->(%p)\n", This
, p
);
661 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
663 HTMLElement
*This
= HTMLELEM_THIS(iface
);
664 FIXME("(%p)->()\n", This
);
668 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
670 HTMLElement
*This
= HTMLELEM_THIS(iface
);
671 FIXME("(%p)->(%p)\n", This
, p
);
675 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
677 HTMLElement
*This
= HTMLELEM_THIS(iface
);
678 FIXME("(%p)->()\n", This
);
682 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
684 HTMLElement
*This
= HTMLELEM_THIS(iface
);
685 FIXME("(%p)->(%p)\n", This
, p
);
689 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
691 HTMLElement
*This
= HTMLELEM_THIS(iface
);
692 FIXME("(%p)->()\n", This
);
696 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
698 HTMLElement
*This
= HTMLELEM_THIS(iface
);
699 FIXME("(%p)->(%p)\n", This
, p
);
703 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
705 HTMLElement
*This
= HTMLELEM_THIS(iface
);
706 FIXME("(%p)->()\n", This
);
710 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
712 HTMLElement
*This
= HTMLELEM_THIS(iface
);
713 FIXME("(%p)->(%p)\n", This
, p
);
717 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
719 HTMLElement
*This
= HTMLELEM_THIS(iface
);
720 FIXME("(%p)->()\n", This
);
724 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
726 HTMLElement
*This
= HTMLELEM_THIS(iface
);
727 FIXME("(%p)->(%p)\n", This
, p
);
731 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
733 HTMLElement
*This
= HTMLELEM_THIS(iface
);
734 FIXME("(%p)->()\n", This
);
738 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
740 HTMLElement
*This
= HTMLELEM_THIS(iface
);
741 FIXME("(%p)->(%p)\n", This
, p
);
745 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
747 HTMLElement
*This
= HTMLELEM_THIS(iface
);
748 FIXME("(%p)->()\n", This
);
752 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
754 HTMLElement
*This
= HTMLELEM_THIS(iface
);
755 FIXME("(%p)->(%p)\n", This
, p
);
759 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
761 HTMLElement
*This
= HTMLELEM_THIS(iface
);
762 FIXME("(%p)->(%p)\n", This
, p
);
766 static void create_all_list(HTMLDocument
*doc
, HTMLElement
*elem
, elem_vector
*buf
)
768 nsIDOMNodeList
*nsnode_list
;
770 PRUint32 list_len
= 0, i
;
774 nsres
= nsIDOMNode_GetChildNodes(elem
->node
->nsnode
, &nsnode_list
);
775 if(NS_FAILED(nsres
)) {
776 ERR("GetChildNodes failed: %08lx\n", nsres
);
780 nsIDOMNodeList_GetLength(nsnode_list
, &list_len
);
784 for(i
=0; i
<list_len
; i
++) {
785 nsres
= nsIDOMNodeList_Item(nsnode_list
, i
, &iter
);
786 if(NS_FAILED(nsres
)) {
787 ERR("Item failed: %08lx\n", nsres
);
791 node
= get_node(doc
, iter
);
792 if(node
->node_type
!= NT_HTMLELEM
)
795 elem_vector_add(buf
, (HTMLElement
*)node
->impl
.elem
);
796 create_all_list(doc
, (HTMLElement
*)node
->impl
.elem
, buf
);
800 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
802 HTMLElement
*This
= HTMLELEM_THIS(iface
);
803 elem_vector buf
= {NULL
, 0, 8};
805 TRACE("(%p)->(%p)\n", This
, p
);
807 buf
.buf
= HeapAlloc(GetProcessHeap(), 0, buf
.size
*sizeof(HTMLElement
**));
809 create_all_list(This
->node
->doc
, This
, &buf
);
812 HeapFree(GetProcessHeap(), 0, buf
.buf
);
814 }else if(buf
.size
> buf
.len
) {
815 buf
.buf
= HeapReAlloc(GetProcessHeap(), 0, buf
.buf
, buf
.len
*sizeof(HTMLElement
**));
818 return HTMLElementCollection_Create((IUnknown
*)HTMLELEM(This
), buf
.buf
, buf
.len
, p
);
821 static void HTMLElement_destructor(IUnknown
*iface
)
823 HTMLElement
*This
= HTMLELEM_THIS(iface
);
826 This
->destructor(This
->impl
);
829 nsIDOMHTMLElement_Release(This
->nselem
);
831 HeapFree(GetProcessHeap(), 0, This
);
836 static const IHTMLElementVtbl HTMLElementVtbl
= {
837 HTMLElement_QueryInterface
,
840 HTMLElement_GetTypeInfoCount
,
841 HTMLElement_GetTypeInfo
,
842 HTMLElement_GetIDsOfNames
,
844 HTMLElement_setAttribute
,
845 HTMLElement_getAttribute
,
846 HTMLElement_removeAttribute
,
847 HTMLElement_put_className
,
848 HTMLElement_get_className
,
851 HTMLElement_get_tagName
,
852 HTMLElement_get_parentElement
,
853 HTMLElement_get_style
,
854 HTMLElement_put_onhelp
,
855 HTMLElement_get_onhelp
,
856 HTMLElement_put_onclick
,
857 HTMLElement_get_onclick
,
858 HTMLElement_put_ondblclick
,
859 HTMLElement_get_ondblclick
,
860 HTMLElement_put_onkeydown
,
861 HTMLElement_get_onkeydown
,
862 HTMLElement_put_onkeyup
,
863 HTMLElement_get_onkeyup
,
864 HTMLElement_put_onkeypress
,
865 HTMLElement_get_onkeypress
,
866 HTMLElement_put_onmouseout
,
867 HTMLElement_get_onmouseout
,
868 HTMLElement_put_onmouseover
,
869 HTMLElement_get_onmouseover
,
870 HTMLElement_put_onmousemove
,
871 HTMLElement_get_onmousemove
,
872 HTMLElement_put_onmousedown
,
873 HTMLElement_get_onmousedown
,
874 HTMLElement_put_onmouseup
,
875 HTMLElement_get_onmouseup
,
876 HTMLElement_get_document
,
877 HTMLElement_put_title
,
878 HTMLElement_get_title
,
879 HTMLElement_put_language
,
880 HTMLElement_get_language
,
881 HTMLElement_put_onselectstart
,
882 HTMLElement_get_onselectstart
,
883 HTMLElement_scrollIntoView
,
884 HTMLElement_contains
,
885 HTMLElement_get_sourceIndex
,
886 HTMLElement_get_recordNumber
,
887 HTMLElement_put_lang
,
888 HTMLElement_get_lang
,
889 HTMLElement_get_offsetLeft
,
890 HTMLElement_get_offsetTop
,
891 HTMLElement_get_offsetWidth
,
892 HTMLElement_get_offsetHeight
,
893 HTMLElement_get_offsetParent
,
894 HTMLElement_put_innerHTML
,
895 HTMLElement_get_innerHTML
,
896 HTMLElement_put_innerText
,
897 HTMLElement_get_innerText
,
898 HTMLElement_put_outerHTML
,
899 HTMLElement_get_outerHTML
,
900 HTMLElement_put_outerText
,
901 HTMLElement_get_outerText
,
902 HTMLElement_insertAdjacentHTML
,
903 HTMLElement_insertAdjacentText
,
904 HTMLElement_get_parentTextEdit
,
905 HTMLElement_get_isTextEdit
,
907 HTMLElement_get_filters
,
908 HTMLElement_put_ondragstart
,
909 HTMLElement_get_ondragstart
,
910 HTMLElement_toString
,
911 HTMLElement_put_onbeforeupdate
,
912 HTMLElement_get_onbeforeupdate
,
913 HTMLElement_put_onafterupdate
,
914 HTMLElement_get_onafterupdate
,
915 HTMLElement_put_onerrorupdate
,
916 HTMLElement_get_onerrorupdate
,
917 HTMLElement_put_onrowexit
,
918 HTMLElement_get_onrowexit
,
919 HTMLElement_put_onrowenter
,
920 HTMLElement_get_onrowenter
,
921 HTMLElement_put_ondatasetchanged
,
922 HTMLElement_get_ondatasetchanged
,
923 HTMLElement_put_ondataavailable
,
924 HTMLElement_get_ondataavailable
,
925 HTMLElement_put_ondatasetcomplete
,
926 HTMLElement_get_ondatasetcomplete
,
927 HTMLElement_put_onfilterchange
,
928 HTMLElement_get_onfilterchange
,
929 HTMLElement_get_children
,
933 HRESULT
HTMLElement_QI(HTMLElement
*This
, REFIID riid
, void **ppv
)
937 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
938 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
939 *ppv
= HTMLELEM(This
);
940 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
941 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
942 *ppv
= HTMLELEM(This
);
943 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
944 TRACE("(%p)->(IID_IHTMLElement %p)\n", This
, ppv
);
945 *ppv
= HTMLELEM(This
);
946 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
947 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This
, ppv
);
948 *ppv
= HTMLELEM2(This
);
952 IHTMLElement_AddRef(HTMLELEM(This
));
956 return HTMLDOMNode_QI(This
->node
, riid
, ppv
);
959 void HTMLElement_Create(HTMLDOMNode
*node
)
962 nsAString class_name_str
;
963 const PRUnichar
*class_name
;
966 static const WCHAR wszBODY
[] = {'B','O','D','Y',0};
967 static const WCHAR wszINPUT
[] = {'I','N','P','U','T',0};
968 static const WCHAR wszSELECT
[] = {'S','E','L','E','C','T',0};
969 static const WCHAR wszTEXTAREA
[] = {'T','E','X','T','A','R','E','A',0};
971 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElement
));
972 ret
->lpHTMLElementVtbl
= &HTMLElementVtbl
;
975 ret
->destructor
= NULL
;
977 node
->node_type
= NT_HTMLELEM
;
978 node
->impl
.elem
= HTMLELEM(ret
);
979 node
->destructor
= HTMLElement_destructor
;
981 HTMLElement2_Init(ret
);
983 nsres
= nsIDOMNode_QueryInterface(node
->nsnode
, &IID_nsIDOMHTMLElement
, (void**)&ret
->nselem
);
987 nsAString_Init(&class_name_str
, NULL
);
988 nsIDOMHTMLElement_GetTagName(ret
->nselem
, &class_name_str
);
990 nsAString_GetData(&class_name_str
, &class_name
, NULL
);
992 if(!strcmpW(class_name
, wszBODY
))
993 HTMLBodyElement_Create(ret
);
994 else if(!strcmpW(class_name
, wszINPUT
))
995 HTMLInputElement_Create(ret
);
996 else if(!strcmpW(class_name
, wszSELECT
))
997 HTMLSelectElement_Create(ret
);
998 else if(!strcmpW(class_name
, wszTEXTAREA
))
999 HTMLTextAreaElement_Create(ret
);
1001 nsAString_Finish(&class_name_str
);
1005 const IHTMLElementCollectionVtbl
*lpHTMLElementCollectionVtbl
;
1008 HTMLElement
**elems
;
1012 } HTMLElementCollection
;
1014 #define HTMLELEMCOL(x) ((IHTMLElementCollection*) &(x)->lpHTMLElementCollectionVtbl)
1016 #define ELEMCOL_THIS(iface) DEFINE_THIS(HTMLElementCollection, HTMLElementCollection, iface)
1018 static HRESULT WINAPI
HTMLElementCollection_QueryInterface(IHTMLElementCollection
*iface
,
1019 REFIID riid
, void **ppv
)
1021 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1025 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1026 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1027 *ppv
= HTMLELEMCOL(This
);
1028 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1029 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1030 *ppv
= HTMLELEMCOL(This
);
1031 }else if(IsEqualGUID(&IID_IHTMLElementCollection
, riid
)) {
1032 TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This
, ppv
);
1033 *ppv
= HTMLELEMCOL(This
);
1037 IHTMLElementCollection_AddRef(HTMLELEMCOL(This
));
1041 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
1042 return E_NOINTERFACE
;
1045 static ULONG WINAPI
HTMLElementCollection_AddRef(IHTMLElementCollection
*iface
)
1047 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1048 LONG ref
= InterlockedIncrement(&This
->ref
);
1050 TRACE("(%p) ref=%ld\n", This
, ref
);
1055 static ULONG WINAPI
HTMLElementCollection_Release(IHTMLElementCollection
*iface
)
1057 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1058 LONG ref
= InterlockedDecrement(&This
->ref
);
1060 TRACE("(%p) ref=%ld\n", This
, ref
);
1063 IUnknown_Release(This
->ref_unk
);
1064 HeapFree(GetProcessHeap(), 0, This
->elems
);
1065 HeapFree(GetProcessHeap(), 0, This
);
1071 static HRESULT WINAPI
HTMLElementCollection_GetTypeInfoCount(IHTMLElementCollection
*iface
,
1074 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1075 FIXME("(%p)->(%p)\n", This
, pctinfo
);
1079 static HRESULT WINAPI
HTMLElementCollection_GetTypeInfo(IHTMLElementCollection
*iface
,
1080 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
1082 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1083 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1087 static HRESULT WINAPI
HTMLElementCollection_GetIDsOfNames(IHTMLElementCollection
*iface
,
1088 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1090 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1091 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
1096 static HRESULT WINAPI
HTMLElementCollection_Invoke(IHTMLElementCollection
*iface
,
1097 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1098 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1100 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1101 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1102 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1106 static HRESULT WINAPI
HTMLElementCollection_toString(IHTMLElementCollection
*iface
,
1109 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1110 FIXME("(%p)->(%p)\n", This
, String
);
1114 static HRESULT WINAPI
HTMLElementCollection_put_length(IHTMLElementCollection
*iface
,
1117 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1118 FIXME("(%p)->(%ld)\n", This
, v
);
1122 static HRESULT WINAPI
HTMLElementCollection_get_length(IHTMLElementCollection
*iface
,
1125 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1127 TRACE("(%p)->(%p)\n", This
, p
);
1133 static HRESULT WINAPI
HTMLElementCollection_get__newEnum(IHTMLElementCollection
*iface
,
1136 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1137 FIXME("(%p)->(%p)\n", This
, p
);
1141 static HRESULT WINAPI
HTMLElementCollection_item(IHTMLElementCollection
*iface
,
1142 VARIANT name
, VARIANT index
, IDispatch
**pdisp
)
1144 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1146 if(V_VT(&index
) != VT_I4
) {
1147 WARN("Invalid index vt=%d\n", V_VT(&index
));
1148 return E_INVALIDARG
;
1151 if(V_VT(&name
) != VT_I4
|| V_I4(&name
) != V_I4(&index
))
1152 FIXME("Unsupproted name vt=%d\n", V_VT(&name
));
1154 TRACE("(%p)->(%ld %ld %p)\n", This
, V_I4(&name
), V_I4(&index
), pdisp
);
1156 if(V_I4(&index
) < 0 || V_I4(&index
) >= This
->len
)
1157 return E_INVALIDARG
;
1159 *pdisp
= (IDispatch
*)This
->elems
[V_I4(&index
)];
1160 IDispatch_AddRef(*pdisp
);
1164 static HRESULT WINAPI
HTMLElementCollection_tags(IHTMLElementCollection
*iface
,
1165 VARIANT tagName
, IDispatch
**pdisp
)
1167 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1170 const PRUnichar
*tag
;
1171 elem_vector buf
= {NULL
, 0, 8};
1173 if(V_VT(&tagName
) != VT_BSTR
) {
1174 WARN("Invalid arg\n");
1175 return DISP_E_MEMBERNOTFOUND
;
1178 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(V_BSTR(&tagName
)), pdisp
);
1180 buf
.buf
= HeapAlloc(GetProcessHeap(), 0, buf
.size
*sizeof(HTMLElement
*));
1182 nsAString_Init(&tag_str
, NULL
);
1184 for(i
=0; i
<This
->len
; i
++) {
1185 if(!This
->elems
[i
]->nselem
)
1188 nsIDOMElement_GetTagName(This
->elems
[i
]->nselem
, &tag_str
);
1189 nsAString_GetData(&tag_str
, &tag
, NULL
);
1191 if(CompareStringW(LOCALE_SYSTEM_DEFAULT
, NORM_IGNORECASE
, tag
, -1,
1192 V_BSTR(&tagName
), -1) == CSTR_EQUAL
)
1193 elem_vector_add(&buf
, This
->elems
[i
]);
1196 nsAString_Finish(&tag_str
);
1198 TRACE("fount %ld tags\n", buf
.len
);
1201 HeapFree(GetProcessHeap(), 0, buf
.buf
);
1203 }else if(buf
.size
> buf
.len
) {
1204 buf
.buf
= HeapReAlloc(GetProcessHeap(), 0, buf
.buf
, buf
.len
);
1207 return HTMLElementCollection_Create(This
->ref_unk
, buf
.buf
, buf
.len
, pdisp
);
1212 static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl
= {
1213 HTMLElementCollection_QueryInterface
,
1214 HTMLElementCollection_AddRef
,
1215 HTMLElementCollection_Release
,
1216 HTMLElementCollection_GetTypeInfoCount
,
1217 HTMLElementCollection_GetTypeInfo
,
1218 HTMLElementCollection_GetIDsOfNames
,
1219 HTMLElementCollection_Invoke
,
1220 HTMLElementCollection_toString
,
1221 HTMLElementCollection_put_length
,
1222 HTMLElementCollection_get_length
,
1223 HTMLElementCollection_get__newEnum
,
1224 HTMLElementCollection_item
,
1225 HTMLElementCollection_tags
1228 static HRESULT
HTMLElementCollection_Create(IUnknown
*ref_unk
, HTMLElement
**elems
, DWORD len
,
1231 HTMLElementCollection
*ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElementCollection
));
1233 ret
->lpHTMLElementCollectionVtbl
= &HTMLElementCollectionVtbl
;
1238 IUnknown_AddRef(ref_unk
);
1239 ret
->ref_unk
= ref_unk
;
1241 TRACE("ret=%p len=%ld\n", ret
, len
);
1243 *p
= (IDispatch
*)ret
;