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
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
);
50 return IUnknown_QueryInterface(This
->impl
, riid
, ppv
);
52 hres
= HTMLElement_QI(This
, riid
, ppv
);
54 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
59 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
61 HTMLElement
*This
= HTMLELEM_THIS(iface
);
64 return IUnknown_AddRef(This
->impl
);
66 TRACE("(%p)\n", This
);
67 return IHTMLDocument2_AddRef(HTMLDOC(This
->node
->doc
));
70 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
72 HTMLElement
*This
= HTMLELEM_THIS(iface
);
75 return IUnknown_Release(This
->impl
);
77 TRACE("(%p)\n", This
);
78 return IHTMLDocument2_Release(HTMLDOC(This
->node
->doc
));
81 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
83 HTMLElement
*This
= HTMLELEM_THIS(iface
);
84 FIXME("(%p)->(%p)\n", This
, pctinfo
);
88 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
89 LCID lcid
, ITypeInfo
**ppTInfo
)
91 HTMLElement
*This
= HTMLELEM_THIS(iface
);
92 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
96 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
97 LPOLESTR
*rgszNames
, UINT cNames
,
98 LCID lcid
, DISPID
*rgDispId
)
100 HTMLElement
*This
= HTMLELEM_THIS(iface
);
101 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
106 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
107 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
108 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
110 HTMLElement
*This
= HTMLELEM_THIS(iface
);
111 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
112 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
116 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
117 VARIANT AttributeValue
, LONG lFlags
)
119 HTMLElement
*This
= HTMLELEM_THIS(iface
);
120 FIXME("(%p)->(%s . %08lx)\n", This
, debugstr_w(strAttributeName
), lFlags
);
124 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
125 LONG lFlags
, VARIANT
*AttributeValue
)
127 HTMLElement
*This
= HTMLELEM_THIS(iface
);
130 const PRUnichar
*value
;
134 WARN("(%p)->(%s %08lx %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
136 nsAString_Init(&attr_str
, strAttributeName
);
137 nsAString_Init(&value_str
, NULL
);
139 nsres
= nsIDOMHTMLElement_GetAttribute(This
->nselem
, &attr_str
, &value_str
);
140 nsAString_Finish(&attr_str
);
142 if(NS_SUCCEEDED(nsres
)) {
143 nsAString_GetData(&value_str
, &value
, NULL
);
144 V_VT(AttributeValue
) = VT_BSTR
;
145 V_BSTR(AttributeValue
) = SysAllocString(value
);;
146 TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue
)));
148 ERR("GetAttribute failed: %08lx\n", nsres
);
152 nsAString_Finish(&value_str
);
157 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
158 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
160 HTMLElement
*This
= HTMLELEM_THIS(iface
);
161 FIXME("(%p)->()\n", This
);
165 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
167 HTMLElement
*This
= HTMLELEM_THIS(iface
);
168 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
172 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
174 HTMLElement
*This
= HTMLELEM_THIS(iface
);
175 FIXME("(%p)->(%p)\n", This
, p
);
179 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
181 HTMLElement
*This
= HTMLELEM_THIS(iface
);
182 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
186 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
188 HTMLElement
*This
= HTMLELEM_THIS(iface
);
189 FIXME("(%p)->(%p)\n", This
, p
);
193 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
195 HTMLElement
*This
= HTMLELEM_THIS(iface
);
196 FIXME("(%p)->(%p)\n", This
, p
);
200 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
202 HTMLElement
*This
= HTMLELEM_THIS(iface
);
203 FIXME("(%p)->(%p)\n", This
, p
);
207 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
209 HTMLElement
*This
= HTMLELEM_THIS(iface
);
210 FIXME("(%p)->(%p)\n", This
, p
);
214 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
216 HTMLElement
*This
= HTMLELEM_THIS(iface
);
217 FIXME("(%p)->()\n", This
);
221 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
223 HTMLElement
*This
= HTMLELEM_THIS(iface
);
224 FIXME("(%p)->(%p)\n", This
, p
);
228 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
230 HTMLElement
*This
= HTMLELEM_THIS(iface
);
231 FIXME("(%p)->()\n", This
);
235 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
237 HTMLElement
*This
= HTMLELEM_THIS(iface
);
238 FIXME("(%p)->(%p)\n", This
, p
);
242 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
244 HTMLElement
*This
= HTMLELEM_THIS(iface
);
245 FIXME("(%p)->()\n", This
);
249 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
251 HTMLElement
*This
= HTMLELEM_THIS(iface
);
252 FIXME("(%p)->(%p)\n", This
, p
);
256 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
258 HTMLElement
*This
= HTMLELEM_THIS(iface
);
259 FIXME("(%p)->()\n", This
);
263 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
265 HTMLElement
*This
= HTMLELEM_THIS(iface
);
266 FIXME("(%p)->(%p)\n", This
, p
);
270 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
272 HTMLElement
*This
= HTMLELEM_THIS(iface
);
273 FIXME("(%p)->()\n", This
);
277 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
279 HTMLElement
*This
= HTMLELEM_THIS(iface
);
280 FIXME("(%p)->(%p)\n", This
, p
);
284 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
286 HTMLElement
*This
= HTMLELEM_THIS(iface
);
287 FIXME("(%p)->()\n", This
);
291 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
293 HTMLElement
*This
= HTMLELEM_THIS(iface
);
294 FIXME("(%p)->(%p)\n", This
, p
);
298 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
300 HTMLElement
*This
= HTMLELEM_THIS(iface
);
301 FIXME("(%p)->()\n", This
);
305 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
307 HTMLElement
*This
= HTMLELEM_THIS(iface
);
308 FIXME("(%p)->(%p)\n", This
, p
);
312 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
314 HTMLElement
*This
= HTMLELEM_THIS(iface
);
315 FIXME("(%p)->()\n", This
);
319 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
321 HTMLElement
*This
= HTMLELEM_THIS(iface
);
322 FIXME("(%p)->(%p)\n", This
, p
);
326 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
328 HTMLElement
*This
= HTMLELEM_THIS(iface
);
329 FIXME("(%p)->()\n", This
);
333 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
335 HTMLElement
*This
= HTMLELEM_THIS(iface
);
336 FIXME("(%p)->(%p)\n", This
, p
);
340 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
342 HTMLElement
*This
= HTMLELEM_THIS(iface
);
343 FIXME("(%p)->()\n", This
);
347 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
349 HTMLElement
*This
= HTMLELEM_THIS(iface
);
350 FIXME("(%p)->(%p)\n", This
, p
);
354 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
356 HTMLElement
*This
= HTMLELEM_THIS(iface
);
357 FIXME("(%p)->()\n", This
);
361 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
363 HTMLElement
*This
= HTMLELEM_THIS(iface
);
364 FIXME("(%p)->(%p)\n", This
, p
);
368 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
370 HTMLElement
*This
= HTMLELEM_THIS(iface
);
371 FIXME("(%p)->(%p)\n", This
, p
);
375 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
377 HTMLElement
*This
= HTMLELEM_THIS(iface
);
378 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
382 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
384 HTMLElement
*This
= HTMLELEM_THIS(iface
);
385 FIXME("(%p)->(%p)\n", This
, p
);
389 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
391 HTMLElement
*This
= HTMLELEM_THIS(iface
);
392 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
396 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
398 HTMLElement
*This
= HTMLELEM_THIS(iface
);
399 FIXME("(%p)->(%p)\n", This
, p
);
403 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
405 HTMLElement
*This
= HTMLELEM_THIS(iface
);
406 FIXME("(%p)->()\n", This
);
410 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
412 HTMLElement
*This
= HTMLELEM_THIS(iface
);
413 FIXME("(%p)->(%p)\n", This
, p
);
417 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
419 HTMLElement
*This
= HTMLELEM_THIS(iface
);
420 FIXME("(%p)->()\n", This
);
424 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
425 VARIANT_BOOL
*pfResult
)
427 HTMLElement
*This
= HTMLELEM_THIS(iface
);
428 FIXME("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
432 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, long *p
)
434 HTMLElement
*This
= HTMLELEM_THIS(iface
);
435 FIXME("(%p)->(%p)\n", This
, p
);
439 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
441 HTMLElement
*This
= HTMLELEM_THIS(iface
);
442 FIXME("(%p)->(%p)\n", This
, p
);
446 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
448 HTMLElement
*This
= HTMLELEM_THIS(iface
);
449 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
453 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
455 HTMLElement
*This
= HTMLELEM_THIS(iface
);
456 FIXME("(%p)->(%p)\n", This
, p
);
460 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, long *p
)
462 HTMLElement
*This
= HTMLELEM_THIS(iface
);
463 FIXME("(%p)->(%p)\n", This
, p
);
467 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, long *p
)
469 HTMLElement
*This
= HTMLELEM_THIS(iface
);
470 FIXME("(%p)->(%p)\n", This
, p
);
474 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, long *p
)
476 HTMLElement
*This
= HTMLELEM_THIS(iface
);
477 FIXME("(%p)->(%p)\n", This
, p
);
481 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, long *p
)
483 HTMLElement
*This
= HTMLELEM_THIS(iface
);
484 FIXME("(%p)->(%p)\n", This
, p
);
488 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
490 HTMLElement
*This
= HTMLELEM_THIS(iface
);
491 FIXME("(%p)->(%p)\n", This
, p
);
495 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
497 HTMLElement
*This
= HTMLELEM_THIS(iface
);
498 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
502 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
504 HTMLElement
*This
= HTMLELEM_THIS(iface
);
505 FIXME("(%p)->(%p)\n", This
, p
);
509 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
511 HTMLElement
*This
= HTMLELEM_THIS(iface
);
512 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
516 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
518 HTMLElement
*This
= HTMLELEM_THIS(iface
);
519 FIXME("(%p)->(%p)\n", This
, p
);
523 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
525 HTMLElement
*This
= HTMLELEM_THIS(iface
);
526 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
530 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
532 HTMLElement
*This
= HTMLELEM_THIS(iface
);
533 FIXME("(%p)->(%p)\n", This
, p
);
537 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
539 HTMLElement
*This
= HTMLELEM_THIS(iface
);
540 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
544 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
546 HTMLElement
*This
= HTMLELEM_THIS(iface
);
547 FIXME("(%p)->(%p)\n", This
, p
);
551 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
554 HTMLElement
*This
= HTMLELEM_THIS(iface
);
555 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
559 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
562 HTMLElement
*This
= HTMLELEM_THIS(iface
);
563 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
567 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
569 HTMLElement
*This
= HTMLELEM_THIS(iface
);
570 FIXME("(%p)->(%p)\n", This
, p
);
574 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
576 HTMLElement
*This
= HTMLELEM_THIS(iface
);
577 FIXME("(%p)->(%p)\n", This
, p
);
581 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
583 HTMLElement
*This
= HTMLELEM_THIS(iface
);
584 FIXME("(%p)\n", This
);
588 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
589 IHTMLFiltersCollection
**p
)
591 HTMLElement
*This
= HTMLELEM_THIS(iface
);
592 FIXME("(%p)->(%p)\n", This
, p
);
596 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
598 HTMLElement
*This
= HTMLELEM_THIS(iface
);
599 FIXME("(%p)->()\n", This
);
603 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
605 HTMLElement
*This
= HTMLELEM_THIS(iface
);
606 FIXME("(%p)->(%p)\n", This
, p
);
610 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
612 HTMLElement
*This
= HTMLELEM_THIS(iface
);
613 FIXME("(%p)->(%p)\n", This
, String
);
617 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
619 HTMLElement
*This
= HTMLELEM_THIS(iface
);
620 FIXME("(%p)->()\n", This
);
624 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
626 HTMLElement
*This
= HTMLELEM_THIS(iface
);
627 FIXME("(%p)->(%p)\n", This
, p
);
631 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
633 HTMLElement
*This
= HTMLELEM_THIS(iface
);
634 FIXME("(%p)->()\n", This
);
638 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
640 HTMLElement
*This
= HTMLELEM_THIS(iface
);
641 FIXME("(%p)->(%p)\n", This
, p
);
645 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
647 HTMLElement
*This
= HTMLELEM_THIS(iface
);
648 FIXME("(%p)->()\n", This
);
652 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
654 HTMLElement
*This
= HTMLELEM_THIS(iface
);
655 FIXME("(%p)->(%p)\n", This
, p
);
659 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
661 HTMLElement
*This
= HTMLELEM_THIS(iface
);
662 FIXME("(%p)->()\n", This
);
666 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
668 HTMLElement
*This
= HTMLELEM_THIS(iface
);
669 FIXME("(%p)->(%p)\n", This
, p
);
673 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
675 HTMLElement
*This
= HTMLELEM_THIS(iface
);
676 FIXME("(%p)->()\n", This
);
680 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
682 HTMLElement
*This
= HTMLELEM_THIS(iface
);
683 FIXME("(%p)->(%p)\n", This
, p
);
687 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
689 HTMLElement
*This
= HTMLELEM_THIS(iface
);
690 FIXME("(%p)->()\n", This
);
694 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
696 HTMLElement
*This
= HTMLELEM_THIS(iface
);
697 FIXME("(%p)->(%p)\n", This
, p
);
701 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
703 HTMLElement
*This
= HTMLELEM_THIS(iface
);
704 FIXME("(%p)->()\n", This
);
708 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
710 HTMLElement
*This
= HTMLELEM_THIS(iface
);
711 FIXME("(%p)->(%p)\n", This
, p
);
715 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
717 HTMLElement
*This
= HTMLELEM_THIS(iface
);
718 FIXME("(%p)->()\n", This
);
722 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
724 HTMLElement
*This
= HTMLELEM_THIS(iface
);
725 FIXME("(%p)->(%p)\n", This
, p
);
729 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
731 HTMLElement
*This
= HTMLELEM_THIS(iface
);
732 FIXME("(%p)->()\n", This
);
736 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
738 HTMLElement
*This
= HTMLELEM_THIS(iface
);
739 FIXME("(%p)->(%p)\n", This
, p
);
743 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
745 HTMLElement
*This
= HTMLELEM_THIS(iface
);
746 FIXME("(%p)->(%p)\n", This
, p
);
750 static void create_all_list(HTMLDocument
*doc
, HTMLElement
*elem
, HTMLElement
***list
, DWORD
*size
,
753 nsIDOMNodeList
*nsnode_list
;
755 PRUint32 list_len
= 0, i
;
759 nsres
= nsIDOMNode_GetChildNodes(elem
->node
->nsnode
, &nsnode_list
);
760 if(NS_FAILED(nsres
)) {
761 ERR("GetChildNodes failed: %08lx\n", nsres
);
765 nsIDOMNodeList_GetLength(nsnode_list
, &list_len
);
769 for(i
=0; i
<list_len
; i
++) {
770 nsres
= nsIDOMNodeList_Item(nsnode_list
, i
, &iter
);
771 if(NS_FAILED(nsres
)) {
772 ERR("Item failed: %08lx\n", nsres
);
776 node
= get_node(doc
, iter
);
777 if(node
->node_type
!= NT_HTMLELEM
)
782 *list
= HeapReAlloc(GetProcessHeap(), 0, *list
, *size
* sizeof(HTMLElement
**));
785 (*list
)[(*len
)++] = (HTMLElement
*)node
->impl
.elem
;
787 create_all_list(doc
, (HTMLElement
*)node
->impl
.elem
, list
, size
, len
);
791 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
793 HTMLElement
*This
= HTMLELEM_THIS(iface
);
794 HTMLElement
**elem_list
;
795 DWORD list_size
= 8, len
= 0;
797 TRACE("(%p)->(%p)\n", This
, p
);
799 elem_list
= HeapAlloc(GetProcessHeap(), 0, list_size
*sizeof(HTMLElement
**));
801 create_all_list(This
->node
->doc
, This
, &elem_list
, &list_size
, &len
);
804 HeapFree(GetProcessHeap(), 0, elem_list
);
806 }else if(list_size
> len
) {
807 elem_list
= HeapReAlloc(GetProcessHeap(), 0, elem_list
, len
*sizeof(HTMLElement
**));
810 return HTMLElementCollection_Create((IUnknown
*)HTMLELEM(This
), elem_list
, len
, p
);
813 static void HTMLElement_destructor(IUnknown
*iface
)
815 HTMLElement
*This
= HTMLELEM_THIS(iface
);
818 This
->destructor(This
->impl
);
821 nsIDOMHTMLElement_Release(This
->nselem
);
823 HeapFree(GetProcessHeap(), 0, This
);
828 static const IHTMLElementVtbl HTMLElementVtbl
= {
829 HTMLElement_QueryInterface
,
832 HTMLElement_GetTypeInfoCount
,
833 HTMLElement_GetTypeInfo
,
834 HTMLElement_GetIDsOfNames
,
836 HTMLElement_setAttribute
,
837 HTMLElement_getAttribute
,
838 HTMLElement_removeAttribute
,
839 HTMLElement_put_className
,
840 HTMLElement_get_className
,
843 HTMLElement_get_tagName
,
844 HTMLElement_get_parentElement
,
845 HTMLElement_get_style
,
846 HTMLElement_put_onhelp
,
847 HTMLElement_get_onhelp
,
848 HTMLElement_put_onclick
,
849 HTMLElement_get_onclick
,
850 HTMLElement_put_ondblclick
,
851 HTMLElement_get_ondblclick
,
852 HTMLElement_put_onkeydown
,
853 HTMLElement_get_onkeydown
,
854 HTMLElement_put_onkeyup
,
855 HTMLElement_get_onkeyup
,
856 HTMLElement_put_onkeypress
,
857 HTMLElement_get_onkeypress
,
858 HTMLElement_put_onmouseout
,
859 HTMLElement_get_onmouseout
,
860 HTMLElement_put_onmouseover
,
861 HTMLElement_get_onmouseover
,
862 HTMLElement_put_onmousemove
,
863 HTMLElement_get_onmousemove
,
864 HTMLElement_put_onmousedown
,
865 HTMLElement_get_onmousedown
,
866 HTMLElement_put_onmouseup
,
867 HTMLElement_get_onmouseup
,
868 HTMLElement_get_document
,
869 HTMLElement_put_title
,
870 HTMLElement_get_title
,
871 HTMLElement_put_language
,
872 HTMLElement_get_language
,
873 HTMLElement_put_onselectstart
,
874 HTMLElement_get_onselectstart
,
875 HTMLElement_scrollIntoView
,
876 HTMLElement_contains
,
877 HTMLElement_get_sourceIndex
,
878 HTMLElement_get_recordNumber
,
879 HTMLElement_put_lang
,
880 HTMLElement_get_lang
,
881 HTMLElement_get_offsetLeft
,
882 HTMLElement_get_offsetTop
,
883 HTMLElement_get_offsetWidth
,
884 HTMLElement_get_offsetHeight
,
885 HTMLElement_get_offsetParent
,
886 HTMLElement_put_innerHTML
,
887 HTMLElement_get_innerHTML
,
888 HTMLElement_put_innerText
,
889 HTMLElement_get_innerText
,
890 HTMLElement_put_outerHTML
,
891 HTMLElement_get_outerHTML
,
892 HTMLElement_put_outerText
,
893 HTMLElement_get_outerText
,
894 HTMLElement_insertAdjacentHTML
,
895 HTMLElement_insertAdjacentText
,
896 HTMLElement_get_parentTextEdit
,
897 HTMLElement_get_isTextEdit
,
899 HTMLElement_get_filters
,
900 HTMLElement_put_ondragstart
,
901 HTMLElement_get_ondragstart
,
902 HTMLElement_toString
,
903 HTMLElement_put_onbeforeupdate
,
904 HTMLElement_get_onbeforeupdate
,
905 HTMLElement_put_onafterupdate
,
906 HTMLElement_get_onafterupdate
,
907 HTMLElement_put_onerrorupdate
,
908 HTMLElement_get_onerrorupdate
,
909 HTMLElement_put_onrowexit
,
910 HTMLElement_get_onrowexit
,
911 HTMLElement_put_onrowenter
,
912 HTMLElement_get_onrowenter
,
913 HTMLElement_put_ondatasetchanged
,
914 HTMLElement_get_ondatasetchanged
,
915 HTMLElement_put_ondataavailable
,
916 HTMLElement_get_ondataavailable
,
917 HTMLElement_put_ondatasetcomplete
,
918 HTMLElement_get_ondatasetcomplete
,
919 HTMLElement_put_onfilterchange
,
920 HTMLElement_get_onfilterchange
,
921 HTMLElement_get_children
,
925 HRESULT
HTMLElement_QI(HTMLElement
*This
, REFIID riid
, void **ppv
)
929 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
930 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
931 *ppv
= HTMLELEM(This
);
932 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
933 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
934 *ppv
= HTMLELEM(This
);
935 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
936 TRACE("(%p)->(IID_IHTMLElement %p)\n", This
, ppv
);
937 *ppv
= HTMLELEM(This
);
941 IHTMLElement_AddRef(HTMLELEM(This
));
945 return HTMLDOMNode_QI(This
->node
, riid
, ppv
);
948 void HTMLElement_Create(HTMLDOMNode
*node
)
951 nsAString class_name_str
;
952 const PRUnichar
*class_name
;
955 static const WCHAR wszBODY
[] = {'B','O','D','Y',0};
956 static const WCHAR wszINPUT
[] = {'I','N','P','U','T',0};
957 static const WCHAR wszSELECT
[] = {'S','E','L','E','C','T',0};
958 static const WCHAR wszTEXTAREA
[] = {'T','E','X','T','A','R','E','A',0};
960 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElement
));
961 ret
->lpHTMLElementVtbl
= &HTMLElementVtbl
;
964 ret
->destructor
= NULL
;
966 node
->node_type
= NT_HTMLELEM
;
967 node
->impl
.elem
= HTMLELEM(ret
);
968 node
->destructor
= HTMLElement_destructor
;
970 nsres
= nsIDOMNode_QueryInterface(node
->nsnode
, &IID_nsIDOMHTMLElement
, (void**)&ret
->nselem
);
974 nsAString_Init(&class_name_str
, NULL
);
975 nsIDOMHTMLElement_GetTagName(ret
->nselem
, &class_name_str
);
977 nsAString_GetData(&class_name_str
, &class_name
, NULL
);
979 if(!strcmpW(class_name
, wszBODY
))
980 HTMLBodyElement_Create(ret
);
981 else if(!strcmpW(class_name
, wszINPUT
))
982 HTMLInputElement_Create(ret
);
983 else if(!strcmpW(class_name
, wszSELECT
))
984 HTMLSelectElement_Create(ret
);
985 else if(!strcmpW(class_name
, wszTEXTAREA
))
986 HTMLTextAreaElement_Create(ret
);
988 nsAString_Finish(&class_name_str
);
992 const IHTMLElementCollectionVtbl
*lpHTMLElementCollectionVtbl
;
999 } HTMLElementCollection
;
1001 #define HTMLELEMCOL(x) ((IHTMLElementCollection*) &(x)->lpHTMLElementCollectionVtbl)
1003 #define ELEMCOL_THIS(iface) DEFINE_THIS(HTMLElementCollection, HTMLElementCollection, iface)
1005 static HRESULT WINAPI
HTMLElementCollection_QueryInterface(IHTMLElementCollection
*iface
,
1006 REFIID riid
, void **ppv
)
1008 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1012 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1013 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1014 *ppv
= HTMLELEMCOL(This
);
1015 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1016 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1017 *ppv
= HTMLELEMCOL(This
);
1018 }else if(IsEqualGUID(&IID_IHTMLElementCollection
, riid
)) {
1019 TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This
, ppv
);
1020 *ppv
= HTMLELEMCOL(This
);
1024 IHTMLElementCollection_AddRef(HTMLELEMCOL(This
));
1028 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
1029 return E_NOINTERFACE
;
1032 static ULONG WINAPI
HTMLElementCollection_AddRef(IHTMLElementCollection
*iface
)
1034 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1035 LONG ref
= InterlockedIncrement(&This
->ref
);
1037 TRACE("(%p) ref=%ld\n", This
, ref
);
1042 static ULONG WINAPI
HTMLElementCollection_Release(IHTMLElementCollection
*iface
)
1044 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1045 LONG ref
= InterlockedDecrement(&This
->ref
);
1047 TRACE("(%p) ref=%ld\n", This
, ref
);
1050 IUnknown_Release(This
->ref_unk
);
1051 HeapFree(GetProcessHeap(), 0, This
->elems
);
1052 HeapFree(GetProcessHeap(), 0, This
);
1058 static HRESULT WINAPI
HTMLElementCollection_GetTypeInfoCount(IHTMLElementCollection
*iface
,
1061 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1062 FIXME("(%p)->(%p)\n", This
, pctinfo
);
1066 static HRESULT WINAPI
HTMLElementCollection_GetTypeInfo(IHTMLElementCollection
*iface
,
1067 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
1069 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1070 FIXME("(%p)->(%u %lu %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1074 static HRESULT WINAPI
HTMLElementCollection_GetIDsOfNames(IHTMLElementCollection
*iface
,
1075 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1077 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1078 FIXME("(%p)->(%s %p %u %lu %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
1083 static HRESULT WINAPI
HTMLElementCollection_Invoke(IHTMLElementCollection
*iface
,
1084 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1085 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1087 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1088 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1089 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1093 static HRESULT WINAPI
HTMLElementCollection_toString(IHTMLElementCollection
*iface
,
1096 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1097 FIXME("(%p)->(%p)\n", This
, String
);
1101 static HRESULT WINAPI
HTMLElementCollection_put_length(IHTMLElementCollection
*iface
,
1104 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1105 FIXME("(%p)->(%ld)\n", This
, v
);
1109 static HRESULT WINAPI
HTMLElementCollection_get_length(IHTMLElementCollection
*iface
,
1112 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1114 TRACE("(%p)->(%p)\n", This
, p
);
1120 static HRESULT WINAPI
HTMLElementCollection_get__newEnum(IHTMLElementCollection
*iface
,
1123 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1124 FIXME("(%p)->(%p)\n", This
, p
);
1128 static HRESULT WINAPI
HTMLElementCollection_item(IHTMLElementCollection
*iface
,
1129 VARIANT name
, VARIANT index
, IDispatch
**pdisp
)
1131 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1133 if(V_VT(&index
) != VT_I4
) {
1134 WARN("Invalid index vt=%d\n", V_VT(&index
));
1135 return E_INVALIDARG
;
1138 if(V_VT(&name
) != VT_I4
|| V_I4(&name
) != V_I4(&index
))
1139 FIXME("Unsupproted name vt=%d\n", V_VT(&name
));
1141 TRACE("(%p)->(%ld %ld %p)\n", This
, V_I4(&name
), V_I4(&index
), pdisp
);
1143 if(V_I4(&index
) < 0 || V_I4(&index
) >= This
->len
)
1144 return E_INVALIDARG
;
1146 *pdisp
= (IDispatch
*)This
->elems
[V_I4(&index
)];
1147 IDispatch_AddRef(*pdisp
);
1151 static HRESULT WINAPI
HTMLElementCollection_tags(IHTMLElementCollection
*iface
,
1152 VARIANT tagName
, IDispatch
**pdisp
)
1154 HTMLElementCollection
*This
= ELEMCOL_THIS(iface
);
1155 DWORD size
= 8, len
= 0, i
;
1156 HTMLElement
**elem_list
;
1158 const PRUnichar
*tag
;
1160 if(V_VT(&tagName
) != VT_BSTR
) {
1161 WARN("Invalid arg\n");
1162 return E_INVALIDARG
;
1165 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(V_BSTR(&tagName
)), pdisp
);
1167 elem_list
= HeapAlloc(GetProcessHeap(), 0, size
*sizeof(HTMLElement
*));
1169 nsAString_Init(&tag_str
, NULL
);
1171 for(i
=0; i
<This
->len
; i
++) {
1172 if(!This
->elems
[i
]->nselem
)
1175 nsIDOMElement_GetTagName(This
->elems
[i
]->nselem
, &tag_str
);
1176 nsAString_GetData(&tag_str
, &tag
, NULL
);
1178 if(CompareStringW(LOCALE_SYSTEM_DEFAULT
, NORM_IGNORECASE
, tag
, -1,
1179 V_BSTR(&tagName
), -1) == CSTR_EQUAL
) {
1182 elem_list
= HeapReAlloc(GetProcessHeap(), 0, elem_list
, size
);
1185 elem_list
[len
++] = This
->elems
[i
];
1189 nsAString_Finish(&tag_str
);
1191 TRACE("fount %ld tags\n", len
);
1194 HeapFree(GetProcessHeap(), 0, elem_list
);
1196 }else if(size
> len
) {
1197 HeapReAlloc(GetProcessHeap(), 0, elem_list
, len
);
1200 return HTMLElementCollection_Create(This
->ref_unk
, elem_list
, len
, pdisp
);
1205 static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl
= {
1206 HTMLElementCollection_QueryInterface
,
1207 HTMLElementCollection_AddRef
,
1208 HTMLElementCollection_Release
,
1209 HTMLElementCollection_GetTypeInfoCount
,
1210 HTMLElementCollection_GetTypeInfo
,
1211 HTMLElementCollection_GetIDsOfNames
,
1212 HTMLElementCollection_Invoke
,
1213 HTMLElementCollection_toString
,
1214 HTMLElementCollection_put_length
,
1215 HTMLElementCollection_get_length
,
1216 HTMLElementCollection_get__newEnum
,
1217 HTMLElementCollection_item
,
1218 HTMLElementCollection_tags
1221 static HRESULT
HTMLElementCollection_Create(IUnknown
*ref_unk
, HTMLElement
**elems
, DWORD len
,
1224 HTMLElementCollection
*ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElementCollection
));
1226 ret
->lpHTMLElementCollectionVtbl
= &HTMLElementCollectionVtbl
;
1231 IUnknown_AddRef(ref_unk
);
1232 ret
->ref_unk
= ref_unk
;
1234 TRACE("ret=%p len=%ld\n", ret
, len
);
1236 *p
= (IDispatch
*)ret
;