mfplay: Add support for same-thread event callback.
[wine.git] / dlls / mshtml / htmlelem.c
blob930568ab2c01b8f47cc8178316ee8366146f6021
1 /*
2 * Copyright 2006-2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <assert.h>
21 #include <math.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "winreg.h"
29 #include "ole2.h"
30 #include "shlwapi.h"
31 #include "mshtmdid.h"
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
36 #include "htmlevent.h"
37 #include "htmlstyle.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
41 #define ATTRFLAG_CASESENSITIVE 0x0001
42 #define ATTRFLAG_ASSTRING 0x0002
43 #define ATTRFLAG_EXPANDURL 0x0004
45 typedef struct {
46 const WCHAR *name;
47 HRESULT (*constructor)(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
48 } tag_desc_t;
50 static const tag_desc_t tag_descs[] = {
51 {L"A", HTMLAnchorElement_Create},
52 {L"AREA", HTMLAreaElement_Create},
53 {L"BODY", HTMLBodyElement_Create},
54 {L"BUTTON", HTMLButtonElement_Create},
55 {L"EMBED", HTMLEmbedElement_Create},
56 {L"FORM", HTMLFormElement_Create},
57 {L"FRAME", HTMLFrameElement_Create},
58 {L"HEAD", HTMLHeadElement_Create},
59 {L"HTML", HTMLHtmlElement_Create},
60 {L"IFRAME", HTMLIFrame_Create},
61 {L"IMG", HTMLImgElement_Create},
62 {L"INPUT", HTMLInputElement_Create},
63 {L"LABEL", HTMLLabelElement_Create},
64 {L"LINK", HTMLLinkElement_Create},
65 {L"META", HTMLMetaElement_Create},
66 {L"OBJECT", HTMLObjectElement_Create},
67 {L"OPTION", HTMLOptionElement_Create},
68 {L"SCRIPT", HTMLScriptElement_Create},
69 {L"SELECT", HTMLSelectElement_Create},
70 {L"STYLE", HTMLStyleElement_Create},
71 {L"TABLE", HTMLTable_Create},
72 {L"TD", HTMLTableCell_Create},
73 {L"TEXTAREA", HTMLTextAreaElement_Create},
74 {L"TITLE", HTMLTitleElement_Create},
75 {L"TR", HTMLTableRow_Create}
78 static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
80 DWORD min=0, max=ARRAY_SIZE(tag_descs)-1, i;
81 int r;
83 while(min <= max) {
84 i = (min+max)/2;
85 r = wcscmp(tag_name, tag_descs[i].name);
86 if(!r)
87 return tag_descs+i;
89 if(r < 0)
90 max = i-1;
91 else
92 min = i+1;
95 return NULL;
98 HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
100 nsIDOMDocumentFragment *nsfragment;
101 nsIDOMNode *nsparent;
102 nsIDOMRange *range;
103 nsAString html_str;
104 nsresult nsres;
105 HRESULT hres = S_OK;
107 nsres = nsIDOMHTMLDocument_CreateRange(nsdoc, &range);
108 if(NS_FAILED(nsres)) {
109 ERR("CreateRange failed: %08x\n", nsres);
110 return E_FAIL;
113 nsAString_InitDepend(&html_str, html);
114 nsIDOMRange_CreateContextualFragment(range, &html_str, &nsfragment);
115 nsIDOMRange_Release(range);
116 nsAString_Finish(&html_str);
117 if(NS_FAILED(nsres)) {
118 ERR("CreateContextualFragment failed: %08x\n", nsres);
119 return E_FAIL;
122 nsres = nsIDOMNode_GetParentNode(nsnode, &nsparent);
123 if(NS_SUCCEEDED(nsres) && nsparent) {
124 nsIDOMNode *nstmp;
126 nsres = nsIDOMNode_ReplaceChild(nsparent, (nsIDOMNode*)nsfragment, nsnode, &nstmp);
127 nsIDOMNode_Release(nsparent);
128 if(NS_FAILED(nsres)) {
129 ERR("ReplaceChild failed: %08x\n", nsres);
130 hres = E_FAIL;
131 }else if(nstmp) {
132 nsIDOMNode_Release(nstmp);
134 }else {
135 ERR("GetParentNode failed: %08x\n", nsres);
136 hres = E_FAIL;
139 nsIDOMDocumentFragment_Release(nsfragment);
140 return hres;
143 nsresult get_elem_attr_value(nsIDOMElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
145 nsAString name_str;
146 nsresult nsres;
148 nsAString_InitDepend(&name_str, name);
149 nsAString_Init(val_str, NULL);
150 nsres = nsIDOMElement_GetAttribute(nselem, &name_str, val_str);
151 nsAString_Finish(&name_str);
152 if(NS_FAILED(nsres)) {
153 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name), nsres);
154 nsAString_Finish(val_str);
155 return nsres;
158 nsAString_GetData(val_str, val);
159 return NS_OK;
162 HRESULT elem_string_attr_getter(HTMLElement *elem, const WCHAR *name, BOOL use_null, BSTR *p)
164 const PRUnichar *val;
165 nsAString val_str;
166 nsresult nsres;
167 HRESULT hres = S_OK;
169 nsres = get_elem_attr_value(elem->dom_element, name, &val_str, &val);
170 if(NS_FAILED(nsres))
171 return E_FAIL;
173 TRACE("%s: returning %s\n", debugstr_w(name), debugstr_w(val));
175 if(*val || !use_null) {
176 *p = SysAllocString(val);
177 if(!*p)
178 hres = E_OUTOFMEMORY;
179 }else {
180 *p = NULL;
182 nsAString_Finish(&val_str);
183 return hres;
186 HRESULT elem_string_attr_setter(HTMLElement *elem, const WCHAR *name, const WCHAR *value)
188 nsAString name_str, val_str;
189 nsresult nsres;
191 nsAString_InitDepend(&name_str, name);
192 nsAString_InitDepend(&val_str, value);
193 nsres = nsIDOMElement_SetAttribute(elem->dom_element, &name_str, &val_str);
194 nsAString_Finish(&name_str);
195 nsAString_Finish(&val_str);
197 if(NS_FAILED(nsres)) {
198 WARN("SetAttribute failed: %08x\n", nsres);
199 return E_FAIL;
202 return S_OK;
205 HRESULT get_readystate_string(READYSTATE readystate, BSTR *p)
207 static const LPCWSTR readystate_strs[] = {
208 L"uninitialized",
209 L"loading",
210 L"loaded",
211 L"interactive",
212 L"complete"
215 assert(readystate <= READYSTATE_COMPLETE);
216 *p = SysAllocString(readystate_strs[readystate]);
217 return *p ? S_OK : E_OUTOFMEMORY;
220 typedef struct
222 DispatchEx dispex;
223 IHTMLFiltersCollection IHTMLFiltersCollection_iface;
225 LONG ref;
226 } HTMLFiltersCollection;
228 static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface)
230 return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface);
233 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret);
235 static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface)
237 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement_iface);
240 HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **ret)
242 nsAString tag_str;
243 nsresult nsres;
245 if(!doc->nsdoc) {
246 WARN("NULL nsdoc\n");
247 return E_UNEXPECTED;
250 nsAString_InitDepend(&tag_str, tag);
251 nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
252 nsAString_Finish(&tag_str);
253 if(NS_FAILED(nsres)) {
254 ERR("CreateElement failed: %08x\n", nsres);
255 return E_FAIL;
258 return S_OK;
261 HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **ret)
263 nsIDOMElement *nselem;
264 HRESULT hres;
266 /* Use owner doc if called on document fragment */
267 if(!doc->nsdoc)
268 doc = doc->node.doc;
270 hres = create_nselem(doc, tag, &nselem);
271 if(FAILED(hres))
272 return hres;
274 hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, TRUE, ret);
275 nsIDOMElement_Release(nselem);
276 return hres;
279 typedef struct {
280 DispatchEx dispex;
281 IHTMLRect IHTMLRect_iface;
283 LONG ref;
285 nsIDOMClientRect *nsrect;
286 } HTMLRect;
288 static inline HTMLRect *impl_from_IHTMLRect(IHTMLRect *iface)
290 return CONTAINING_RECORD(iface, HTMLRect, IHTMLRect_iface);
293 static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, void **ppv)
295 HTMLRect *This = impl_from_IHTMLRect(iface);
297 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
299 if(IsEqualGUID(&IID_IUnknown, riid)) {
300 *ppv = &This->IHTMLRect_iface;
301 }else if(IsEqualGUID(&IID_IHTMLRect, riid)) {
302 *ppv = &This->IHTMLRect_iface;
303 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
304 return *ppv ? S_OK : E_NOINTERFACE;
305 }else {
306 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
307 *ppv = NULL;
308 return E_NOINTERFACE;
311 IUnknown_AddRef((IUnknown*)*ppv);
312 return S_OK;
315 static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
317 HTMLRect *This = impl_from_IHTMLRect(iface);
318 LONG ref = InterlockedIncrement(&This->ref);
320 TRACE("(%p) ref=%d\n", This, ref);
322 return ref;
325 static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
327 HTMLRect *This = impl_from_IHTMLRect(iface);
328 LONG ref = InterlockedDecrement(&This->ref);
330 TRACE("(%p) ref=%d\n", This, ref);
332 if(!ref) {
333 if(This->nsrect)
334 nsIDOMClientRect_Release(This->nsrect);
335 release_dispex(&This->dispex);
336 heap_free(This);
339 return ref;
342 static HRESULT WINAPI HTMLRect_GetTypeInfoCount(IHTMLRect *iface, UINT *pctinfo)
344 HTMLRect *This = impl_from_IHTMLRect(iface);
345 FIXME("(%p)->(%p)\n", This, pctinfo);
346 return E_NOTIMPL;
349 static HRESULT WINAPI HTMLRect_GetTypeInfo(IHTMLRect *iface, UINT iTInfo,
350 LCID lcid, ITypeInfo **ppTInfo)
352 HTMLRect *This = impl_from_IHTMLRect(iface);
354 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
357 static HRESULT WINAPI HTMLRect_GetIDsOfNames(IHTMLRect *iface, REFIID riid,
358 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
360 HTMLRect *This = impl_from_IHTMLRect(iface);
362 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
363 lcid, rgDispId);
366 static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
367 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
368 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
370 HTMLRect *This = impl_from_IHTMLRect(iface);
372 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
373 pDispParams, pVarResult, pExcepInfo, puArgErr);
376 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
378 HTMLRect *This = impl_from_IHTMLRect(iface);
379 FIXME("(%p)->(%d)\n", This, v);
380 return E_NOTIMPL;
383 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
385 HTMLRect *This = impl_from_IHTMLRect(iface);
386 float left;
387 nsresult nsres;
389 TRACE("(%p)->(%p)\n", This, p);
391 nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
392 if(NS_FAILED(nsres)) {
393 ERR("GetLeft failed: %08x\n", nsres);
394 return E_FAIL;
397 *p = floor(left+0.5);
398 return S_OK;
401 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
403 HTMLRect *This = impl_from_IHTMLRect(iface);
404 FIXME("(%p)->(%d)\n", This, v);
405 return E_NOTIMPL;
408 static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
410 HTMLRect *This = impl_from_IHTMLRect(iface);
411 float top;
412 nsresult nsres;
414 TRACE("(%p)->(%p)\n", This, p);
416 nsres = nsIDOMClientRect_GetTop(This->nsrect, &top);
417 if(NS_FAILED(nsres)) {
418 ERR("GetTop failed: %08x\n", nsres);
419 return E_FAIL;
422 *p = floor(top+0.5);
423 return S_OK;
426 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
428 HTMLRect *This = impl_from_IHTMLRect(iface);
429 FIXME("(%p)->(%d)\n", This, v);
430 return E_NOTIMPL;
433 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
435 HTMLRect *This = impl_from_IHTMLRect(iface);
436 float right;
437 nsresult nsres;
439 TRACE("(%p)->(%p)\n", This, p);
441 nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
442 if(NS_FAILED(nsres)) {
443 ERR("GetRight failed: %08x\n", nsres);
444 return E_FAIL;
447 *p = floor(right+0.5);
448 return S_OK;
451 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
453 HTMLRect *This = impl_from_IHTMLRect(iface);
454 FIXME("(%p)->(%d)\n", This, v);
455 return E_NOTIMPL;
458 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
460 HTMLRect *This = impl_from_IHTMLRect(iface);
461 float bottom;
462 nsresult nsres;
464 TRACE("(%p)->(%p)\n", This, p);
466 nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
467 if(NS_FAILED(nsres)) {
468 ERR("GetBottom failed: %08x\n", nsres);
469 return E_FAIL;
472 *p = floor(bottom+0.5);
473 return S_OK;
476 static const IHTMLRectVtbl HTMLRectVtbl = {
477 HTMLRect_QueryInterface,
478 HTMLRect_AddRef,
479 HTMLRect_Release,
480 HTMLRect_GetTypeInfoCount,
481 HTMLRect_GetTypeInfo,
482 HTMLRect_GetIDsOfNames,
483 HTMLRect_Invoke,
484 HTMLRect_put_left,
485 HTMLRect_get_left,
486 HTMLRect_put_top,
487 HTMLRect_get_top,
488 HTMLRect_put_right,
489 HTMLRect_get_right,
490 HTMLRect_put_bottom,
491 HTMLRect_get_bottom
494 static const tid_t HTMLRect_iface_tids[] = {
495 IHTMLRect_tid,
498 static dispex_static_data_t HTMLRect_dispex = {
499 NULL,
500 IHTMLRect_tid,
501 HTMLRect_iface_tids
504 static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_mode, IHTMLRect **ret)
506 HTMLRect *rect;
508 rect = heap_alloc_zero(sizeof(HTMLRect));
509 if(!rect)
510 return E_OUTOFMEMORY;
512 rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl;
513 rect->ref = 1;
515 init_dispatch(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex, compat_mode);
517 nsIDOMClientRect_AddRef(nsrect);
518 rect->nsrect = nsrect;
520 *ret = &rect->IHTMLRect_iface;
521 return S_OK;
524 typedef struct {
525 DispatchEx dispex;
526 IHTMLRectCollection IHTMLRectCollection_iface;
528 LONG ref;
530 nsIDOMClientRectList *rect_list;
531 } HTMLRectCollection;
533 static inline HTMLRectCollection *impl_from_IHTMLRectCollection(IHTMLRectCollection *iface)
535 return CONTAINING_RECORD(iface, HTMLRectCollection, IHTMLRectCollection_iface);
538 static HRESULT WINAPI HTMLRectCollection_QueryInterface(IHTMLRectCollection *iface, REFIID riid, void **ppv)
540 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
542 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
544 if(IsEqualGUID(&IID_IUnknown, riid)) {
545 *ppv = &This->IHTMLRectCollection_iface;
546 }else if(IsEqualGUID(&IID_IHTMLRectCollection, riid)) {
547 *ppv = &This->IHTMLRectCollection_iface;
548 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
549 return *ppv ? S_OK : E_NOINTERFACE;
550 }else {
551 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
552 *ppv = NULL;
553 return E_NOINTERFACE;
556 IUnknown_AddRef((IUnknown*)*ppv);
557 return S_OK;
560 static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface)
562 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
563 LONG ref = InterlockedIncrement(&This->ref);
565 TRACE("(%p) ref=%d\n", This, ref);
567 return ref;
570 static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface)
572 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
573 LONG ref = InterlockedDecrement(&This->ref);
575 TRACE("(%p) ref=%d\n", This, ref);
577 if(!ref) {
578 if(This->rect_list)
579 nsIDOMClientRectList_Release(This->rect_list);
580 release_dispex(&This->dispex);
581 heap_free(This);
584 return ref;
587 static HRESULT WINAPI HTMLRectCollection_GetTypeInfoCount(IHTMLRectCollection *iface, UINT *pctinfo)
589 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
590 FIXME("(%p)->(%p)\n", This, pctinfo);
591 return E_NOTIMPL;
594 static HRESULT WINAPI HTMLRectCollection_GetTypeInfo(IHTMLRectCollection *iface, UINT iTInfo,
595 LCID lcid, ITypeInfo **ppTInfo)
597 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
598 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
601 static HRESULT WINAPI HTMLRectCollection_GetIDsOfNames(IHTMLRectCollection *iface, REFIID riid,
602 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
604 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
605 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
606 lcid, rgDispId);
609 static HRESULT WINAPI HTMLRectCollection_Invoke(IHTMLRectCollection *iface, DISPID dispIdMember,
610 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
611 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
613 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
614 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
615 pDispParams, pVarResult, pExcepInfo, puArgErr);
618 static HRESULT WINAPI HTMLRectCollection_get_length(IHTMLRectCollection *iface, LONG *p)
620 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
621 UINT32 length;
622 nsresult nsres;
624 TRACE("(%p)->(%p)\n", This, p);
626 nsres = nsIDOMClientRectList_GetLength(This->rect_list, &length);
627 assert(nsres == NS_OK);
628 *p = length;
629 return S_OK;
632 static HRESULT WINAPI HTMLRectCollection_get__newEnum(IHTMLRectCollection *iface, IUnknown **p)
634 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
635 FIXME("(%p)->(%p)\n", This, p);
636 return E_NOTIMPL;
639 static HRESULT WINAPI HTMLRectCollection_item(IHTMLRectCollection *iface, VARIANT *index, VARIANT *result)
641 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
642 nsIDOMClientRect *nsrect;
643 IHTMLRect *rect;
644 nsresult nsres;
645 HRESULT hres;
647 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(index), result);
649 if(V_VT(index) != VT_I4 || V_I4(index) < 0) {
650 FIXME("Unsupported for %s index\n", debugstr_variant(index));
651 return E_NOTIMPL;
654 nsres = nsIDOMClientRectList_Item(This->rect_list, V_I4(index), &nsrect);
655 if(NS_FAILED(nsres))
656 return map_nsresult(nsres);
657 if(!nsrect) {
658 V_VT(result) = VT_NULL;
659 return S_OK;
662 hres = create_html_rect(nsrect, dispex_compat_mode(&This->dispex), &rect);
663 nsIDOMClientRect_Release(nsrect);
664 if(FAILED(hres))
665 return hres;
667 V_VT(result) = VT_DISPATCH;
668 V_DISPATCH(result) = (IDispatch *)rect;
669 return S_OK;
672 static const IHTMLRectCollectionVtbl HTMLRectCollectionVtbl = {
673 HTMLRectCollection_QueryInterface,
674 HTMLRectCollection_AddRef,
675 HTMLRectCollection_Release,
676 HTMLRectCollection_GetTypeInfoCount,
677 HTMLRectCollection_GetTypeInfo,
678 HTMLRectCollection_GetIDsOfNames,
679 HTMLRectCollection_Invoke,
680 HTMLRectCollection_get_length,
681 HTMLRectCollection_get__newEnum,
682 HTMLRectCollection_item
685 static inline HTMLRectCollection *HTMLRectCollection_from_DispatchEx(DispatchEx *iface)
687 return CONTAINING_RECORD(iface, HTMLRectCollection, dispex);
690 static HRESULT HTMLRectCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
692 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
693 UINT32 len = 0;
694 DWORD idx = 0;
695 WCHAR *ptr;
697 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
698 idx = idx*10 + (*ptr-'0');
699 if(*ptr)
700 return DISP_E_UNKNOWNNAME;
702 nsIDOMClientRectList_GetLength(This->rect_list, &len);
703 if(idx >= len)
704 return DISP_E_UNKNOWNNAME;
706 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
707 TRACE("ret %x\n", *dispid);
708 return S_OK;
711 static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
712 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
714 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
716 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
718 switch(flags) {
719 case DISPATCH_PROPERTYGET: {
720 nsIDOMClientRect *rect;
721 IHTMLRect *html_rect;
722 nsresult nsres;
723 HRESULT hres;
725 nsres = nsIDOMClientRectList_Item(This->rect_list, id - MSHTML_DISPID_CUSTOM_MIN, &rect);
726 if(NS_FAILED(nsres) || !rect) {
727 WARN("Unknown item\n");
728 return DISP_E_UNKNOWNNAME;
731 hres = create_html_rect(rect, dispex_compat_mode(&This->dispex), &html_rect);
732 nsIDOMClientRect_Release(rect);
733 if(FAILED(hres))
734 return hres;
736 V_VT(res) = VT_DISPATCH;
737 V_DISPATCH(res) = (IDispatch*)html_rect;
738 break;
741 default:
742 FIXME("unimplemented flags %x\n", flags);
743 return E_NOTIMPL;
746 return S_OK;
749 static const dispex_static_data_vtbl_t HTMLRectCollection_dispex_vtbl = {
750 NULL,
751 HTMLRectCollection_get_dispid,
752 HTMLRectCollection_invoke,
753 NULL
755 static const tid_t HTMLRectCollection_iface_tids[] = {
756 IHTMLRectCollection_tid,
759 static dispex_static_data_t HTMLRectCollection_dispex = {
760 &HTMLRectCollection_dispex_vtbl,
761 IHTMLRectCollection_tid,
762 HTMLRectCollection_iface_tids
765 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
766 REFIID riid, void **ppv)
768 HTMLElement *This = impl_from_IHTMLElement(iface);
770 return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
773 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
775 HTMLElement *This = impl_from_IHTMLElement(iface);
777 return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
780 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
782 HTMLElement *This = impl_from_IHTMLElement(iface);
784 return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
787 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
789 HTMLElement *This = impl_from_IHTMLElement(iface);
790 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
793 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
794 LCID lcid, ITypeInfo **ppTInfo)
796 HTMLElement *This = impl_from_IHTMLElement(iface);
797 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
800 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
801 LPOLESTR *rgszNames, UINT cNames,
802 LCID lcid, DISPID *rgDispId)
804 HTMLElement *This = impl_from_IHTMLElement(iface);
805 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
806 lcid, rgDispId);
809 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
810 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
811 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
813 HTMLElement *This = impl_from_IHTMLElement(iface);
814 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
815 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
818 static HRESULT set_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *v)
820 DISPID propput_dispid = DISPID_PROPERTYPUT;
821 DISPPARAMS dp = {v, &propput_dispid, 1, 1};
822 EXCEPINFO ei;
824 if(dispid == DISPID_IHTMLELEMENT_STYLE) {
825 TRACE("Ignoring call on style attribute\n");
826 return S_OK;
829 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid,
830 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
833 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
834 VARIANT AttributeValue, LONG lFlags)
836 HTMLElement *This = impl_from_IHTMLElement(iface);
837 DISPID dispid;
838 HRESULT hres;
840 TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
842 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
843 (lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive) | fdexNameEnsure, &dispid);
844 if(FAILED(hres))
845 return hres;
847 return set_elem_attr_value_by_dispid(This, dispid, &AttributeValue);
850 HRESULT get_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *ret)
852 DISPPARAMS dispParams = {NULL, NULL, 0, 0};
853 EXCEPINFO excep;
855 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid, LOCALE_SYSTEM_DEFAULT,
856 DISPATCH_PROPERTYGET, &dispParams, ret, &excep, NULL);
859 HRESULT attr_value_to_string(VARIANT *v)
861 HRESULT hres;
863 switch(V_VT(v)) {
864 case VT_BSTR:
865 break;
866 case VT_NULL:
867 V_BSTR(v) = SysAllocString(L"null");
868 if(!V_BSTR(v))
869 return E_OUTOFMEMORY;
870 V_VT(v) = VT_BSTR;
871 break;
872 case VT_DISPATCH:
873 IDispatch_Release(V_DISPATCH(v));
874 V_VT(v) = VT_BSTR;
875 V_BSTR(v) = SysAllocString(NULL);
876 break;
877 default:
878 hres = VariantChangeType(v, v, 0, VT_BSTR);
879 if(FAILED(hres))
880 return hres;
883 return S_OK;
886 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
887 LONG lFlags, VARIANT *AttributeValue)
889 HTMLElement *This = impl_from_IHTMLElement(iface);
890 DISPID dispid;
891 HRESULT hres;
893 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
895 if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
896 FIXME("Unsupported flags %x\n", lFlags);
898 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
899 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
900 if(hres == DISP_E_UNKNOWNNAME) {
901 V_VT(AttributeValue) = VT_NULL;
902 return S_OK;
905 if(FAILED(hres)) {
906 V_VT(AttributeValue) = VT_NULL;
907 return hres;
910 hres = get_elem_attr_value_by_dispid(This, dispid, AttributeValue);
911 if(SUCCEEDED(hres) && (lFlags & ATTRFLAG_ASSTRING))
912 hres = attr_value_to_string(AttributeValue);
913 return hres;
916 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
917 LONG lFlags, VARIANT_BOOL *pfSuccess)
919 HTMLElement *This = impl_from_IHTMLElement(iface);
920 DISPID id;
921 HRESULT hres;
923 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
925 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
926 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &id);
927 if(hres == DISP_E_UNKNOWNNAME) {
928 *pfSuccess = VARIANT_FALSE;
929 return S_OK;
931 if(FAILED(hres))
932 return hres;
934 if(id == DISPID_IHTMLELEMENT_STYLE) {
935 IHTMLStyle *style;
937 TRACE("Special case: style\n");
939 hres = IHTMLElement_get_style(&This->IHTMLElement_iface, &style);
940 if(FAILED(hres))
941 return hres;
943 hres = IHTMLStyle_put_cssText(style, NULL);
944 IHTMLStyle_Release(style);
945 if(FAILED(hres))
946 return hres;
948 *pfSuccess = VARIANT_TRUE;
949 return S_OK;
952 return remove_attribute(&This->node.event_target.dispex, id, pfSuccess);
955 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
957 HTMLElement *This = impl_from_IHTMLElement(iface);
958 nsAString classname_str;
959 nsresult nsres;
961 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
963 if(!This->dom_element) {
964 FIXME("comment element\n");
965 return E_NOTIMPL;
968 nsAString_InitDepend(&classname_str, v);
969 nsres = nsIDOMElement_SetClassName(This->dom_element, &classname_str);
970 nsAString_Finish(&classname_str);
971 if(NS_FAILED(nsres))
972 ERR("SetClassName failed: %08x\n", nsres);
974 return S_OK;
977 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
979 HTMLElement *This = impl_from_IHTMLElement(iface);
980 nsAString class_str;
981 nsresult nsres;
983 TRACE("(%p)->(%p)\n", This, p);
985 if(!This->dom_element) {
986 FIXME("comment element\n");
987 return E_NOTIMPL;
990 nsAString_Init(&class_str, NULL);
991 nsres = nsIDOMElement_GetClassName(This->dom_element, &class_str);
992 return return_nsstr(nsres, &class_str, p);
995 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
997 HTMLElement *This = impl_from_IHTMLElement(iface);
998 nsAString id_str;
999 nsresult nsres;
1001 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1003 if(!This->dom_element) {
1004 FIXME("comment element\n");
1005 return S_OK;
1008 nsAString_InitDepend(&id_str, v);
1009 nsres = nsIDOMElement_SetId(This->dom_element, &id_str);
1010 nsAString_Finish(&id_str);
1011 if(NS_FAILED(nsres))
1012 ERR("SetId failed: %08x\n", nsres);
1014 return S_OK;
1017 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
1019 HTMLElement *This = impl_from_IHTMLElement(iface);
1020 nsAString id_str;
1021 nsresult nsres;
1023 TRACE("(%p)->(%p)\n", This, p);
1025 if(!This->dom_element) {
1026 *p = NULL;
1027 return S_OK;
1030 nsAString_Init(&id_str, NULL);
1031 nsres = nsIDOMElement_GetId(This->dom_element, &id_str);
1032 return return_nsstr(nsres, &id_str, p);
1035 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
1037 HTMLElement *This = impl_from_IHTMLElement(iface);
1038 nsAString tag_str;
1039 nsresult nsres;
1041 TRACE("(%p)->(%p)\n", This, p);
1043 if(!This->dom_element) {
1044 TRACE("comment element\n");
1045 *p = SysAllocString(L"!");
1046 return *p ? S_OK : E_OUTOFMEMORY;
1049 nsAString_Init(&tag_str, NULL);
1050 nsres = nsIDOMElement_GetTagName(This->dom_element, &tag_str);
1051 return return_nsstr(nsres, &tag_str, p);
1054 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
1056 HTMLElement *This = impl_from_IHTMLElement(iface);
1057 IHTMLDOMNode *node;
1058 HRESULT hres;
1060 TRACE("(%p)->(%p)\n", This, p);
1062 hres = IHTMLDOMNode_get_parentNode(&This->node.IHTMLDOMNode_iface, &node);
1063 if(FAILED(hres))
1064 return hres;
1066 if(!node) {
1067 *p = NULL;
1068 return S_OK;
1071 hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
1072 IHTMLDOMNode_Release(node);
1073 if(FAILED(hres))
1074 *p = NULL;
1076 return S_OK;
1079 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
1081 HTMLElement *This = impl_from_IHTMLElement(iface);
1083 TRACE("(%p)->(%p)\n", This, p);
1085 if(!This->style) {
1086 HRESULT hres;
1088 hres = HTMLStyle_Create(This, &This->style);
1089 if(FAILED(hres))
1090 return hres;
1093 *p = &This->style->IHTMLStyle_iface;
1094 IHTMLStyle_AddRef(*p);
1095 return S_OK;
1098 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
1100 HTMLElement *This = impl_from_IHTMLElement(iface);
1102 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1104 return set_node_event(&This->node, EVENTID_HELP, &v);
1107 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
1109 HTMLElement *This = impl_from_IHTMLElement(iface);
1111 TRACE("(%p)->(%p)\n", This, p);
1113 return get_node_event(&This->node, EVENTID_HELP, p);
1116 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
1118 HTMLElement *This = impl_from_IHTMLElement(iface);
1120 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1122 return set_node_event(&This->node, EVENTID_CLICK, &v);
1125 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
1127 HTMLElement *This = impl_from_IHTMLElement(iface);
1129 TRACE("(%p)->(%p)\n", This, p);
1131 return get_node_event(&This->node, EVENTID_CLICK, p);
1134 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
1136 HTMLElement *This = impl_from_IHTMLElement(iface);
1138 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1140 return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
1143 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
1145 HTMLElement *This = impl_from_IHTMLElement(iface);
1147 TRACE("(%p)->(%p)\n", This, p);
1149 return get_node_event(&This->node, EVENTID_DBLCLICK, p);
1152 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
1154 HTMLElement *This = impl_from_IHTMLElement(iface);
1156 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1158 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
1161 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
1163 HTMLElement *This = impl_from_IHTMLElement(iface);
1165 TRACE("(%p)->(%p)\n", This, p);
1167 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
1170 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
1172 HTMLElement *This = impl_from_IHTMLElement(iface);
1174 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1176 return set_node_event(&This->node, EVENTID_KEYUP, &v);
1179 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
1181 HTMLElement *This = impl_from_IHTMLElement(iface);
1183 TRACE("(%p)->(%p)\n", This, p);
1185 return get_node_event(&This->node, EVENTID_KEYUP, p);
1188 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
1190 HTMLElement *This = impl_from_IHTMLElement(iface);
1192 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1194 return set_node_event(&This->node, EVENTID_KEYPRESS, &v);
1197 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
1199 HTMLElement *This = impl_from_IHTMLElement(iface);
1201 TRACE("(%p)->(%p)\n", This, p);
1203 return get_node_event(&This->node, EVENTID_KEYPRESS, p);
1206 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
1208 HTMLElement *This = impl_from_IHTMLElement(iface);
1210 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1212 return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
1215 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
1217 HTMLElement *This = impl_from_IHTMLElement(iface);
1219 TRACE("(%p)->(%p)\n", This, p);
1221 return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
1224 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
1226 HTMLElement *This = impl_from_IHTMLElement(iface);
1228 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1230 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
1233 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
1235 HTMLElement *This = impl_from_IHTMLElement(iface);
1237 TRACE("(%p)->(%p)\n", This, p);
1239 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
1242 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
1244 HTMLElement *This = impl_from_IHTMLElement(iface);
1246 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1248 return set_node_event(&This->node, EVENTID_MOUSEMOVE, &v);
1251 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
1253 HTMLElement *This = impl_from_IHTMLElement(iface);
1255 TRACE("(%p)->(%p)\n", This, p);
1257 return get_node_event(&This->node, EVENTID_MOUSEMOVE, p);
1260 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
1262 HTMLElement *This = impl_from_IHTMLElement(iface);
1264 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1266 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
1269 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
1271 HTMLElement *This = impl_from_IHTMLElement(iface);
1273 TRACE("(%p)->(%p)\n", This, p);
1275 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
1278 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
1280 HTMLElement *This = impl_from_IHTMLElement(iface);
1282 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1284 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
1287 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
1289 HTMLElement *This = impl_from_IHTMLElement(iface);
1291 TRACE("(%p)->(%p)\n", This, p);
1293 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
1296 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
1298 HTMLElement *This = impl_from_IHTMLElement(iface);
1300 TRACE("(%p)->(%p)\n", This, p);
1302 if(!p)
1303 return E_POINTER;
1305 if(This->node.vtbl->get_document)
1306 return This->node.vtbl->get_document(&This->node, p);
1308 *p = (IDispatch*)&This->node.doc->basedoc.IHTMLDocument2_iface;
1309 IDispatch_AddRef(*p);
1310 return S_OK;
1313 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
1315 HTMLElement *This = impl_from_IHTMLElement(iface);
1316 nsAString title_str;
1317 nsresult nsres;
1319 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1321 if(!This->html_element) {
1322 VARIANT *var;
1323 HRESULT hres;
1325 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", TRUE, &var);
1326 if(FAILED(hres))
1327 return hres;
1329 VariantClear(var);
1330 V_VT(var) = VT_BSTR;
1331 V_BSTR(var) = v ? SysAllocString(v) : NULL;
1332 return S_OK;
1335 nsAString_InitDepend(&title_str, v);
1336 nsres = nsIDOMHTMLElement_SetTitle(This->html_element, &title_str);
1337 nsAString_Finish(&title_str);
1338 if(NS_FAILED(nsres))
1339 ERR("SetTitle failed: %08x\n", nsres);
1341 return S_OK;
1344 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
1346 HTMLElement *This = impl_from_IHTMLElement(iface);
1347 nsAString title_str;
1348 nsresult nsres;
1350 TRACE("(%p)->(%p)\n", This, p);
1352 if(!This->html_element) {
1353 VARIANT *var;
1354 HRESULT hres;
1356 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", FALSE, &var);
1357 if(hres == DISP_E_UNKNOWNNAME) {
1358 *p = NULL;
1359 }else if(V_VT(var) != VT_BSTR) {
1360 FIXME("title = %s\n", debugstr_variant(var));
1361 return E_FAIL;
1362 }else {
1363 *p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
1366 return S_OK;
1369 nsAString_Init(&title_str, NULL);
1370 nsres = nsIDOMHTMLElement_GetTitle(This->html_element, &title_str);
1371 return return_nsstr(nsres, &title_str, p);
1374 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
1376 HTMLElement *This = impl_from_IHTMLElement(iface);
1378 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1380 return elem_string_attr_setter(This, L"language", v);
1383 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
1385 HTMLElement *This = impl_from_IHTMLElement(iface);
1387 TRACE("(%p)->(%p)\n", This, p);
1389 return elem_string_attr_getter(This, L"language", TRUE, p);
1392 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
1394 HTMLElement *This = impl_from_IHTMLElement(iface);
1396 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1398 return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
1401 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
1403 HTMLElement *This = impl_from_IHTMLElement(iface);
1405 TRACE("(%p)->(%p)\n", This, p);
1407 return get_node_event(&This->node, EVENTID_SELECTSTART, p);
1410 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
1412 HTMLElement *This = impl_from_IHTMLElement(iface);
1413 cpp_bool start = TRUE;
1414 nsresult nsres;
1416 TRACE("(%p)->(%s)\n", This, debugstr_variant(&varargStart));
1418 switch(V_VT(&varargStart)) {
1419 case VT_EMPTY:
1420 case VT_ERROR:
1421 break;
1422 case VT_BOOL:
1423 start = V_BOOL(&varargStart) != VARIANT_FALSE;
1424 break;
1425 default:
1426 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart));
1429 if(!This->html_element) {
1430 FIXME("non-HTML elements\n");
1431 return E_NOTIMPL;
1434 nsres = nsIDOMHTMLElement_ScrollIntoView(This->html_element, start, 1);
1435 assert(nsres == NS_OK);
1437 return S_OK;
1440 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
1441 VARIANT_BOOL *pfResult)
1443 HTMLElement *This = impl_from_IHTMLElement(iface);
1444 cpp_bool result = FALSE;
1446 TRACE("(%p)->(%p %p)\n", This, pChild, pfResult);
1448 if(pChild) {
1449 HTMLElement *child;
1450 nsresult nsres;
1452 child = unsafe_impl_from_IHTMLElement(pChild);
1453 if(!child) {
1454 ERR("not our element\n");
1455 return E_FAIL;
1458 nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result);
1459 assert(nsres == NS_OK);
1462 *pfResult = variant_bool(result);
1463 return S_OK;
1466 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, LONG *p)
1468 HTMLElement *This = impl_from_IHTMLElement(iface);
1470 TRACE("(%p)->(%p)\n", This, p);
1472 return get_elem_source_index(This, p);
1475 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
1477 HTMLElement *This = impl_from_IHTMLElement(iface);
1478 FIXME("(%p)->(%p)\n", This, p);
1479 return E_NOTIMPL;
1482 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
1484 HTMLElement *This = impl_from_IHTMLElement(iface);
1485 nsAString nsstr;
1486 nsresult nsres;
1488 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1490 if(!This->html_element) {
1491 FIXME("non-HTML element\n");
1492 return E_NOTIMPL;
1495 nsAString_InitDepend(&nsstr, v);
1496 nsres = nsIDOMHTMLElement_SetLang(This->html_element, &nsstr);
1497 nsAString_Finish(&nsstr);
1498 if(NS_FAILED(nsres)) {
1499 ERR("SetLang failed: %08x\n", nsres);
1500 return E_FAIL;
1503 return S_OK;
1506 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
1508 HTMLElement *This = impl_from_IHTMLElement(iface);
1509 nsAString nsstr;
1510 nsresult nsres;
1512 TRACE("(%p)->(%p)\n", This, p);
1514 if(!This->html_element) {
1515 FIXME("non-HTML element\n");
1516 return E_NOTIMPL;
1519 nsAString_Init(&nsstr, NULL);
1520 nsres = nsIDOMHTMLElement_GetLang(This->html_element, &nsstr);
1521 return return_nsstr(nsres, &nsstr, p);
1524 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
1526 HTMLElement *This = impl_from_IHTMLElement(iface);
1527 nsresult nsres;
1529 TRACE("(%p)->(%p)\n", This, p);
1531 if(!This->html_element) {
1532 FIXME("non-HTML element\n");
1533 return E_NOTIMPL;
1536 nsres = nsIDOMHTMLElement_GetOffsetLeft(This->html_element, p);
1537 if(NS_FAILED(nsres)) {
1538 ERR("GetOffsetLeft failed: %08x\n", nsres);
1539 return E_FAIL;
1542 return S_OK;
1545 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
1547 HTMLElement *This = impl_from_IHTMLElement(iface);
1548 nsresult nsres;
1550 TRACE("(%p)->(%p)\n", This, p);
1552 if(!This->html_element) {
1553 FIXME("non-HTML element\n");
1554 return E_NOTIMPL;
1557 nsres = nsIDOMHTMLElement_GetOffsetTop(This->html_element, p);
1558 if(NS_FAILED(nsres)) {
1559 ERR("GetOffsetTop failed: %08x\n", nsres);
1560 return E_FAIL;
1563 return S_OK;
1566 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
1568 HTMLElement *This = impl_from_IHTMLElement(iface);
1569 nsresult nsres;
1571 TRACE("(%p)->(%p)\n", This, p);
1573 if(!This->html_element) {
1574 FIXME("non-HTML element\n");
1575 return E_NOTIMPL;
1578 nsres = nsIDOMHTMLElement_GetOffsetWidth(This->html_element, p);
1579 if(NS_FAILED(nsres)) {
1580 ERR("GetOffsetWidth failed: %08x\n", nsres);
1581 return E_FAIL;
1584 return S_OK;
1587 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
1589 HTMLElement *This = impl_from_IHTMLElement(iface);
1590 nsresult nsres;
1592 TRACE("(%p)->(%p)\n", This, p);
1594 if(!This->html_element) {
1595 FIXME("non-HTML element\n");
1596 return E_NOTIMPL;
1599 nsres = nsIDOMHTMLElement_GetOffsetHeight(This->html_element, p);
1600 if(NS_FAILED(nsres)) {
1601 ERR("GetOffsetHeight failed: %08x\n", nsres);
1602 return E_FAIL;
1605 return S_OK;
1608 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
1610 HTMLElement *This = impl_from_IHTMLElement(iface);
1611 nsIDOMElement *nsparent;
1612 HTMLElement *parent;
1613 nsresult nsres;
1614 HRESULT hres;
1616 TRACE("(%p)->(%p)\n", This, p);
1618 if(!This->html_element) {
1619 FIXME("non-HTML element\n");
1620 return E_NOTIMPL;
1623 nsres = nsIDOMHTMLElement_GetOffsetParent(This->html_element, &nsparent);
1624 if(NS_FAILED(nsres)) {
1625 ERR("GetOffsetParent failed: %08x\n", nsres);
1626 return E_FAIL;
1629 if(!nsparent) {
1630 *p = NULL;
1631 return S_OK;
1634 hres = get_element(nsparent, &parent);
1635 nsIDOMElement_Release(nsparent);
1636 if(FAILED(hres))
1637 return hres;
1639 *p = &parent->IHTMLElement_iface;
1640 return S_OK;
1643 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
1645 HTMLElement *This = impl_from_IHTMLElement(iface);
1646 nsAString html_str;
1647 nsresult nsres;
1649 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1651 if(!This->html_element) {
1652 FIXME("non-HTML element\n");
1653 return E_NOTIMPL;
1656 nsAString_InitDepend(&html_str, v);
1657 nsres = nsIDOMHTMLElement_SetInnerHTML(This->html_element, &html_str);
1658 nsAString_Finish(&html_str);
1659 if(NS_FAILED(nsres)) {
1660 FIXME("SetInnerHtml failed %08x\n", nsres);
1661 return E_FAIL;
1664 return S_OK;
1667 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
1669 HTMLElement *This = impl_from_IHTMLElement(iface);
1670 nsAString html_str;
1671 nsresult nsres;
1673 TRACE("(%p)->(%p)\n", This, p);
1675 if(!This->html_element) {
1676 FIXME("non-HTML element\n");
1677 return E_NOTIMPL;
1680 nsAString_Init(&html_str, NULL);
1681 nsres = nsIDOMHTMLElement_GetInnerHTML(This->html_element, &html_str);
1682 return return_nsstr(nsres, &html_str, p);
1685 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
1687 HTMLElement *This = impl_from_IHTMLElement(iface);
1688 nsIDOMNode *nschild, *tmp;
1689 nsIDOMText *text_node;
1690 nsAString text_str;
1691 nsresult nsres;
1693 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1695 while(1) {
1696 nsres = nsIDOMElement_GetLastChild(This->dom_element, &nschild);
1697 if(NS_FAILED(nsres)) {
1698 ERR("GetLastChild failed: %08x\n", nsres);
1699 return E_FAIL;
1701 if(!nschild)
1702 break;
1704 nsres = nsIDOMElement_RemoveChild(This->dom_element, nschild, &tmp);
1705 nsIDOMNode_Release(nschild);
1706 if(NS_FAILED(nsres)) {
1707 ERR("RemoveChild failed: %08x\n", nsres);
1708 return E_FAIL;
1710 nsIDOMNode_Release(tmp);
1713 nsAString_InitDepend(&text_str, v);
1714 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
1715 nsAString_Finish(&text_str);
1716 if(NS_FAILED(nsres)) {
1717 ERR("CreateTextNode failed: %08x\n", nsres);
1718 return E_FAIL;
1721 nsres = nsIDOMElement_AppendChild(This->dom_element, (nsIDOMNode*)text_node, &tmp);
1722 if(NS_FAILED(nsres)) {
1723 ERR("AppendChild failed: %08x\n", nsres);
1724 return E_FAIL;
1727 nsIDOMNode_Release(tmp);
1728 return S_OK;
1731 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
1733 HTMLElement *This = impl_from_IHTMLElement(iface);
1735 TRACE("(%p)->(%p)\n", This, p);
1737 return get_node_text(&This->node, p);
1740 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
1742 HTMLElement *This = impl_from_IHTMLElement(iface);
1744 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1746 return replace_node_by_html(This->node.doc->nsdoc, This->node.nsnode, v);
1749 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
1751 HTMLElement *This = impl_from_IHTMLElement(iface);
1752 nsAString html_str;
1753 HRESULT hres;
1755 WARN("(%p)->(%p) semi-stub\n", This, p);
1757 nsAString_Init(&html_str, NULL);
1758 hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
1759 if(SUCCEEDED(hres)) {
1760 const PRUnichar *html;
1762 nsAString_GetData(&html_str, &html);
1763 *p = SysAllocString(html);
1764 if(!*p)
1765 hres = E_OUTOFMEMORY;
1768 nsAString_Finish(&html_str);
1770 TRACE("ret %s\n", debugstr_w(*p));
1771 return hres;
1774 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
1776 HTMLElement *This = impl_from_IHTMLElement(iface);
1777 nsIDOMText *text_node;
1778 nsIDOMRange *range;
1779 nsAString nsstr;
1780 nsresult nsres;
1782 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1784 if(This->node.vtbl->is_settable && !This->node.vtbl->is_settable(&This->node, DISPID_IHTMLELEMENT_OUTERTEXT)) {
1785 WARN("Called on element that does not support setting the property.\n");
1786 return 0x800a0258; /* undocumented error code */
1789 if(!This->node.doc->nsdoc) {
1790 FIXME("NULL nsdoc\n");
1791 return E_FAIL;
1794 nsAString_InitDepend(&nsstr, v);
1795 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node);
1796 nsAString_Finish(&nsstr);
1797 if(NS_FAILED(nsres)) {
1798 ERR("CreateTextNode failed\n");
1799 return E_FAIL;
1802 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
1803 if(NS_SUCCEEDED(nsres)) {
1804 nsres = nsIDOMRange_SelectNode(range, This->node.nsnode);
1805 if(NS_SUCCEEDED(nsres))
1806 nsres = nsIDOMRange_DeleteContents(range);
1807 if(NS_SUCCEEDED(nsres))
1808 nsres = nsIDOMRange_InsertNode(range, (nsIDOMNode*)text_node);
1809 if(NS_SUCCEEDED(nsres))
1810 nsres = nsIDOMRange_SelectNodeContents(range, This->node.nsnode);
1811 if(NS_SUCCEEDED(nsres))
1812 nsres = nsIDOMRange_DeleteContents(range);
1813 nsIDOMRange_Release(range);
1815 nsIDOMText_Release(text_node);
1816 if(NS_FAILED(nsres)) {
1817 ERR("failed to set text: %08x\n", nsres);
1818 return E_FAIL;
1821 return S_OK;
1824 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
1826 HTMLElement *This = impl_from_IHTMLElement(iface);
1828 TRACE("(%p)->(%p)\n", This, p);
1830 /* getter is the same as innerText */
1831 return IHTMLElement_get_innerText(&This->IHTMLElement_iface, p);
1834 static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDOMNode *nsnode, HTMLDOMNode **ret_node)
1836 nsIDOMNode *ret_nsnode;
1837 nsresult nsres;
1838 HRESULT hres = S_OK;
1840 if (!wcsicmp(where, L"beforebegin")) {
1841 nsIDOMNode *parent;
1843 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1844 if(NS_FAILED(nsres))
1845 return E_FAIL;
1847 if(!parent)
1848 return E_INVALIDARG;
1850 nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &ret_nsnode);
1851 nsIDOMNode_Release(parent);
1852 }else if(!wcsicmp(where, L"afterbegin")) {
1853 nsIDOMNode *first_child;
1855 nsres = nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
1856 if(NS_FAILED(nsres))
1857 return E_FAIL;
1859 nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &ret_nsnode);
1860 if(NS_FAILED(nsres))
1861 return E_FAIL;
1863 if (first_child)
1864 nsIDOMNode_Release(first_child);
1865 }else if (!wcsicmp(where, L"beforeend")) {
1866 nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &ret_nsnode);
1867 }else if (!wcsicmp(where, L"afterend")) {
1868 nsIDOMNode *next_sibling, *parent;
1870 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1871 if(NS_FAILED(nsres))
1872 return E_FAIL;
1873 if(!parent)
1874 return E_INVALIDARG;
1876 nsres = nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
1877 if(NS_SUCCEEDED(nsres)) {
1878 if(next_sibling) {
1879 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &ret_nsnode);
1880 nsIDOMNode_Release(next_sibling);
1881 }else {
1882 nsres = nsIDOMNode_AppendChild(parent, nsnode, &ret_nsnode);
1886 nsIDOMNode_Release(parent);
1887 }else {
1888 ERR("invalid where: %s\n", debugstr_w(where));
1889 return E_INVALIDARG;
1892 if (NS_FAILED(nsres))
1893 return E_FAIL;
1895 if(ret_node)
1896 hres = get_node(ret_nsnode, TRUE, ret_node);
1897 nsIDOMNode_Release(ret_nsnode);
1898 return hres;
1901 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
1902 BSTR html)
1904 HTMLElement *This = impl_from_IHTMLElement(iface);
1905 nsIDOMRange *range;
1906 nsIDOMNode *nsnode;
1907 nsAString ns_html;
1908 nsresult nsres;
1909 HRESULT hr;
1911 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
1913 if(!This->node.doc->nsdoc) {
1914 WARN("NULL nsdoc\n");
1915 return E_UNEXPECTED;
1918 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
1919 if(NS_FAILED(nsres))
1921 ERR("CreateRange failed: %08x\n", nsres);
1922 return E_FAIL;
1925 nsIDOMRange_SetStartBefore(range, This->node.nsnode);
1927 nsAString_InitDepend(&ns_html, html);
1928 nsres = nsIDOMRange_CreateContextualFragment(range, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
1929 nsAString_Finish(&ns_html);
1930 nsIDOMRange_Release(range);
1932 if(NS_FAILED(nsres) || !nsnode)
1934 ERR("CreateTextNode failed: %08x\n", nsres);
1935 return E_FAIL;
1938 hr = insert_adjacent_node(This, where, nsnode, NULL);
1939 nsIDOMNode_Release(nsnode);
1940 return hr;
1943 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
1944 BSTR text)
1946 HTMLElement *This = impl_from_IHTMLElement(iface);
1947 nsIDOMNode *nsnode;
1948 nsAString ns_text;
1949 nsresult nsres;
1950 HRESULT hr;
1952 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
1954 if(!This->node.doc->nsdoc) {
1955 WARN("NULL nsdoc\n");
1956 return E_UNEXPECTED;
1960 nsAString_InitDepend(&ns_text, text);
1961 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
1962 nsAString_Finish(&ns_text);
1964 if(NS_FAILED(nsres) || !nsnode)
1966 ERR("CreateTextNode failed: %08x\n", nsres);
1967 return E_FAIL;
1970 hr = insert_adjacent_node(This, where, nsnode, NULL);
1971 nsIDOMNode_Release(nsnode);
1973 return hr;
1976 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
1978 HTMLElement *This = impl_from_IHTMLElement(iface);
1979 FIXME("(%p)->(%p)\n", This, p);
1980 return E_NOTIMPL;
1983 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
1985 HTMLElement *This = impl_from_IHTMLElement(iface);
1987 TRACE("(%p)->(%p)\n", This, p);
1989 *p = variant_bool(This->node.vtbl->is_text_edit && This->node.vtbl->is_text_edit(&This->node));
1990 return S_OK;
1993 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
1995 HTMLElement *This = impl_from_IHTMLElement(iface);
1996 nsresult nsres;
1998 TRACE("(%p)\n", This);
2000 if(!This->html_element) {
2001 FIXME("non-HTML element\n");
2002 return E_NOTIMPL;
2005 nsres = nsIDOMHTMLElement_Click(This->html_element);
2006 if(NS_FAILED(nsres)) {
2007 ERR("Click failed: %08x\n", nsres);
2008 return E_FAIL;
2011 return S_OK;
2014 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, IHTMLFiltersCollection **p)
2016 HTMLElement *This = impl_from_IHTMLElement(iface);
2018 TRACE("(%p)->(%p)\n", This, p);
2020 if(!p)
2021 return E_POINTER;
2023 return create_filters_collection(dispex_compat_mode(&This->node.event_target.dispex), p);
2026 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
2028 HTMLElement *This = impl_from_IHTMLElement(iface);
2030 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2032 return set_node_event(&This->node, EVENTID_DRAGSTART, &v);
2035 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
2037 HTMLElement *This = impl_from_IHTMLElement(iface);
2039 TRACE("(%p)->(%p)\n", This, p);
2041 return get_node_event(&This->node, EVENTID_DRAGSTART, p);
2044 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
2046 HTMLElement *This = impl_from_IHTMLElement(iface);
2047 FIXME("(%p)->(%p)\n", This, String);
2048 return E_NOTIMPL;
2051 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
2053 HTMLElement *This = impl_from_IHTMLElement(iface);
2054 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2055 return E_NOTIMPL;
2058 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
2060 HTMLElement *This = impl_from_IHTMLElement(iface);
2061 FIXME("(%p)->(%p)\n", This, p);
2062 return E_NOTIMPL;
2065 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
2067 HTMLElement *This = impl_from_IHTMLElement(iface);
2068 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2069 return E_NOTIMPL;
2072 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
2074 HTMLElement *This = impl_from_IHTMLElement(iface);
2075 FIXME("(%p)->(%p)\n", This, p);
2076 return E_NOTIMPL;
2079 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
2081 HTMLElement *This = impl_from_IHTMLElement(iface);
2082 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2083 return E_NOTIMPL;
2086 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
2088 HTMLElement *This = impl_from_IHTMLElement(iface);
2089 FIXME("(%p)->(%p)\n", This, p);
2090 return E_NOTIMPL;
2093 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
2095 HTMLElement *This = impl_from_IHTMLElement(iface);
2096 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2097 return E_NOTIMPL;
2100 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
2102 HTMLElement *This = impl_from_IHTMLElement(iface);
2103 FIXME("(%p)->(%p)\n", This, p);
2104 return E_NOTIMPL;
2107 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
2109 HTMLElement *This = impl_from_IHTMLElement(iface);
2110 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2111 return E_NOTIMPL;
2114 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
2116 HTMLElement *This = impl_from_IHTMLElement(iface);
2117 FIXME("(%p)->(%p)\n", This, p);
2118 return E_NOTIMPL;
2121 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
2123 HTMLElement *This = impl_from_IHTMLElement(iface);
2124 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2125 return E_NOTIMPL;
2128 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
2130 HTMLElement *This = impl_from_IHTMLElement(iface);
2131 FIXME("(%p)->(%p)\n", This, p);
2132 return E_NOTIMPL;
2135 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
2137 HTMLElement *This = impl_from_IHTMLElement(iface);
2139 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_variant(&v));
2141 return set_node_event(&This->node, EVENTID_DATAAVAILABLE, &v);
2144 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
2146 HTMLElement *This = impl_from_IHTMLElement(iface);
2148 TRACE("(%p)->(%p)\n", This, p);
2150 return get_node_event(&This->node, EVENTID_DATAAVAILABLE, p);
2153 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
2155 HTMLElement *This = impl_from_IHTMLElement(iface);
2156 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2157 return E_NOTIMPL;
2160 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
2162 HTMLElement *This = impl_from_IHTMLElement(iface);
2163 FIXME("(%p)->(%p)\n", This, p);
2164 return E_NOTIMPL;
2167 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
2169 HTMLElement *This = impl_from_IHTMLElement(iface);
2170 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2171 return E_NOTIMPL;
2174 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
2176 HTMLElement *This = impl_from_IHTMLElement(iface);
2177 FIXME("(%p)->(%p)\n", This, p);
2178 return E_NOTIMPL;
2181 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
2183 HTMLElement *This = impl_from_IHTMLElement(iface);
2184 nsIDOMNodeList *nsnode_list;
2185 nsresult nsres;
2187 TRACE("(%p)->(%p)\n", This, p);
2189 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
2190 if(NS_FAILED(nsres)) {
2191 ERR("GetChildNodes failed: %08x\n", nsres);
2192 return E_FAIL;
2195 *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode);
2197 nsIDOMNodeList_Release(nsnode_list);
2198 return S_OK;
2201 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
2203 HTMLElement *This = impl_from_IHTMLElement(iface);
2205 TRACE("(%p)->(%p)\n", This, p);
2207 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
2208 return S_OK;
2211 static const IHTMLElementVtbl HTMLElementVtbl = {
2212 HTMLElement_QueryInterface,
2213 HTMLElement_AddRef,
2214 HTMLElement_Release,
2215 HTMLElement_GetTypeInfoCount,
2216 HTMLElement_GetTypeInfo,
2217 HTMLElement_GetIDsOfNames,
2218 HTMLElement_Invoke,
2219 HTMLElement_setAttribute,
2220 HTMLElement_getAttribute,
2221 HTMLElement_removeAttribute,
2222 HTMLElement_put_className,
2223 HTMLElement_get_className,
2224 HTMLElement_put_id,
2225 HTMLElement_get_id,
2226 HTMLElement_get_tagName,
2227 HTMLElement_get_parentElement,
2228 HTMLElement_get_style,
2229 HTMLElement_put_onhelp,
2230 HTMLElement_get_onhelp,
2231 HTMLElement_put_onclick,
2232 HTMLElement_get_onclick,
2233 HTMLElement_put_ondblclick,
2234 HTMLElement_get_ondblclick,
2235 HTMLElement_put_onkeydown,
2236 HTMLElement_get_onkeydown,
2237 HTMLElement_put_onkeyup,
2238 HTMLElement_get_onkeyup,
2239 HTMLElement_put_onkeypress,
2240 HTMLElement_get_onkeypress,
2241 HTMLElement_put_onmouseout,
2242 HTMLElement_get_onmouseout,
2243 HTMLElement_put_onmouseover,
2244 HTMLElement_get_onmouseover,
2245 HTMLElement_put_onmousemove,
2246 HTMLElement_get_onmousemove,
2247 HTMLElement_put_onmousedown,
2248 HTMLElement_get_onmousedown,
2249 HTMLElement_put_onmouseup,
2250 HTMLElement_get_onmouseup,
2251 HTMLElement_get_document,
2252 HTMLElement_put_title,
2253 HTMLElement_get_title,
2254 HTMLElement_put_language,
2255 HTMLElement_get_language,
2256 HTMLElement_put_onselectstart,
2257 HTMLElement_get_onselectstart,
2258 HTMLElement_scrollIntoView,
2259 HTMLElement_contains,
2260 HTMLElement_get_sourceIndex,
2261 HTMLElement_get_recordNumber,
2262 HTMLElement_put_lang,
2263 HTMLElement_get_lang,
2264 HTMLElement_get_offsetLeft,
2265 HTMLElement_get_offsetTop,
2266 HTMLElement_get_offsetWidth,
2267 HTMLElement_get_offsetHeight,
2268 HTMLElement_get_offsetParent,
2269 HTMLElement_put_innerHTML,
2270 HTMLElement_get_innerHTML,
2271 HTMLElement_put_innerText,
2272 HTMLElement_get_innerText,
2273 HTMLElement_put_outerHTML,
2274 HTMLElement_get_outerHTML,
2275 HTMLElement_put_outerText,
2276 HTMLElement_get_outerText,
2277 HTMLElement_insertAdjacentHTML,
2278 HTMLElement_insertAdjacentText,
2279 HTMLElement_get_parentTextEdit,
2280 HTMLElement_get_isTextEdit,
2281 HTMLElement_click,
2282 HTMLElement_get_filters,
2283 HTMLElement_put_ondragstart,
2284 HTMLElement_get_ondragstart,
2285 HTMLElement_toString,
2286 HTMLElement_put_onbeforeupdate,
2287 HTMLElement_get_onbeforeupdate,
2288 HTMLElement_put_onafterupdate,
2289 HTMLElement_get_onafterupdate,
2290 HTMLElement_put_onerrorupdate,
2291 HTMLElement_get_onerrorupdate,
2292 HTMLElement_put_onrowexit,
2293 HTMLElement_get_onrowexit,
2294 HTMLElement_put_onrowenter,
2295 HTMLElement_get_onrowenter,
2296 HTMLElement_put_ondatasetchanged,
2297 HTMLElement_get_ondatasetchanged,
2298 HTMLElement_put_ondataavailable,
2299 HTMLElement_get_ondataavailable,
2300 HTMLElement_put_ondatasetcomplete,
2301 HTMLElement_get_ondatasetcomplete,
2302 HTMLElement_put_onfilterchange,
2303 HTMLElement_get_onfilterchange,
2304 HTMLElement_get_children,
2305 HTMLElement_get_all
2308 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement *iface)
2310 return iface->lpVtbl == &HTMLElementVtbl ? impl_from_IHTMLElement(iface) : NULL;
2313 static inline HTMLElement *impl_from_IHTMLElement2(IHTMLElement2 *iface)
2315 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement2_iface);
2318 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
2319 REFIID riid, void **ppv)
2321 HTMLElement *This = impl_from_IHTMLElement2(iface);
2322 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
2325 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
2327 HTMLElement *This = impl_from_IHTMLElement2(iface);
2328 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
2331 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
2333 HTMLElement *This = impl_from_IHTMLElement2(iface);
2334 return IHTMLElement_Release(&This->IHTMLElement_iface);
2337 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
2339 HTMLElement *This = impl_from_IHTMLElement2(iface);
2340 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
2343 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
2344 LCID lcid, ITypeInfo **ppTInfo)
2346 HTMLElement *This = impl_from_IHTMLElement2(iface);
2347 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2350 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
2351 LPOLESTR *rgszNames, UINT cNames,
2352 LCID lcid, DISPID *rgDispId)
2354 HTMLElement *This = impl_from_IHTMLElement2(iface);
2355 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2356 lcid, rgDispId);
2359 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
2360 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2361 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2363 HTMLElement *This = impl_from_IHTMLElement2(iface);
2364 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
2365 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2368 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
2370 HTMLElement *This = impl_from_IHTMLElement2(iface);
2371 FIXME("(%p)->(%p)\n", This, p);
2372 return E_NOTIMPL;
2375 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
2377 HTMLElement *This = impl_from_IHTMLElement2(iface);
2378 FIXME("(%p)->(%x)\n", This, containerCapture);
2379 return E_NOTIMPL;
2382 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
2384 HTMLElement *This = impl_from_IHTMLElement2(iface);
2385 FIXME("(%p)\n", This);
2386 return E_NOTIMPL;
2389 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
2391 HTMLElement *This = impl_from_IHTMLElement2(iface);
2392 FIXME("(%p)->()\n", This);
2393 return E_NOTIMPL;
2396 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
2398 HTMLElement *This = impl_from_IHTMLElement2(iface);
2399 FIXME("(%p)->(%p)\n", This, p);
2400 return E_NOTIMPL;
2403 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
2404 LONG x, LONG y, BSTR *component)
2406 HTMLElement *This = impl_from_IHTMLElement2(iface);
2407 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
2408 return E_NOTIMPL;
2411 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
2413 HTMLElement *This = impl_from_IHTMLElement2(iface);
2415 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
2417 if(!This->node.doc->content_ready
2418 || !This->node.doc->basedoc.doc_obj->in_place_active)
2419 return E_PENDING;
2421 WARN("stub\n");
2422 return S_OK;
2425 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
2427 HTMLElement *This = impl_from_IHTMLElement2(iface);
2429 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2431 return set_node_event(&This->node, EVENTID_SCROLL, &v);
2434 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
2436 HTMLElement *This = impl_from_IHTMLElement2(iface);
2438 TRACE("(%p)->(%p)\n", This, p);
2440 return get_node_event(&This->node, EVENTID_SCROLL, p);
2443 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
2445 HTMLElement *This = impl_from_IHTMLElement2(iface);
2447 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2449 return set_node_event(&This->node, EVENTID_DRAG, &v);
2452 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
2454 HTMLElement *This = impl_from_IHTMLElement2(iface);
2456 TRACE("(%p)->(%p)\n", This, p);
2458 return get_node_event(&This->node, EVENTID_DRAG, p);
2461 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
2463 HTMLElement *This = impl_from_IHTMLElement2(iface);
2464 FIXME("(%p)->()\n", This);
2465 return E_NOTIMPL;
2468 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
2470 HTMLElement *This = impl_from_IHTMLElement2(iface);
2471 FIXME("(%p)->(%p)\n", This, p);
2472 return E_NOTIMPL;
2475 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
2477 HTMLElement *This = impl_from_IHTMLElement2(iface);
2478 FIXME("(%p)->()\n", This);
2479 return E_NOTIMPL;
2482 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
2484 HTMLElement *This = impl_from_IHTMLElement2(iface);
2485 FIXME("(%p)->(%p)\n", This, p);
2486 return E_NOTIMPL;
2489 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
2491 HTMLElement *This = impl_from_IHTMLElement2(iface);
2492 FIXME("(%p)->()\n", This);
2493 return E_NOTIMPL;
2496 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
2498 HTMLElement *This = impl_from_IHTMLElement2(iface);
2499 FIXME("(%p)->(%p)\n", This, p);
2500 return E_NOTIMPL;
2503 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
2505 HTMLElement *This = impl_from_IHTMLElement2(iface);
2506 FIXME("(%p)->()\n", This);
2507 return E_NOTIMPL;
2510 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
2512 HTMLElement *This = impl_from_IHTMLElement2(iface);
2513 FIXME("(%p)->(%p)\n", This, p);
2514 return E_NOTIMPL;
2517 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
2519 HTMLElement *This = impl_from_IHTMLElement2(iface);
2520 FIXME("(%p)->()\n", This);
2521 return E_NOTIMPL;
2524 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
2526 HTMLElement *This = impl_from_IHTMLElement2(iface);
2527 FIXME("(%p)->(%p)\n", This, p);
2528 return E_NOTIMPL;
2531 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
2533 HTMLElement *This = impl_from_IHTMLElement2(iface);
2534 FIXME("(%p)->()\n", This);
2535 return E_NOTIMPL;
2538 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
2540 HTMLElement *This = impl_from_IHTMLElement2(iface);
2541 FIXME("(%p)->(%p)\n", This, p);
2542 return E_NOTIMPL;
2545 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
2547 HTMLElement *This = impl_from_IHTMLElement2(iface);
2548 FIXME("(%p)->()\n", This);
2549 return E_NOTIMPL;
2552 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
2554 HTMLElement *This = impl_from_IHTMLElement2(iface);
2555 FIXME("(%p)->(%p)\n", This, p);
2556 return E_NOTIMPL;
2559 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
2561 HTMLElement *This = impl_from_IHTMLElement2(iface);
2562 FIXME("(%p)->()\n", This);
2563 return E_NOTIMPL;
2566 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
2568 HTMLElement *This = impl_from_IHTMLElement2(iface);
2569 FIXME("(%p)->(%p)\n", This, p);
2570 return E_NOTIMPL;
2573 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
2575 HTMLElement *This = impl_from_IHTMLElement2(iface);
2576 FIXME("(%p)->()\n", This);
2577 return E_NOTIMPL;
2580 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
2582 HTMLElement *This = impl_from_IHTMLElement2(iface);
2583 FIXME("(%p)->(%p)\n", This, p);
2584 return E_NOTIMPL;
2587 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
2589 HTMLElement *This = impl_from_IHTMLElement2(iface);
2590 FIXME("(%p)->()\n", This);
2591 return E_NOTIMPL;
2594 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
2596 HTMLElement *This = impl_from_IHTMLElement2(iface);
2597 FIXME("(%p)->(%p)\n", This, p);
2598 return E_NOTIMPL;
2601 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
2603 HTMLElement *This = impl_from_IHTMLElement2(iface);
2605 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2607 return set_node_event(&This->node, EVENTID_PASTE, &v);
2610 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
2612 HTMLElement *This = impl_from_IHTMLElement2(iface);
2614 TRACE("(%p)->(%p)\n", This, p);
2616 return get_node_event(&This->node, EVENTID_PASTE, p);
2619 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
2621 HTMLElement *This = impl_from_IHTMLElement2(iface);
2623 TRACE("(%p)->(%p)\n", This, p);
2625 return HTMLCurrentStyle_Create(This, p);
2628 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
2630 HTMLElement *This = impl_from_IHTMLElement2(iface);
2631 FIXME("(%p)->()\n", This);
2632 return E_NOTIMPL;
2635 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
2637 HTMLElement *This = impl_from_IHTMLElement2(iface);
2638 FIXME("(%p)->(%p)\n", This, p);
2639 return E_NOTIMPL;
2642 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
2644 HTMLElement *This = impl_from_IHTMLElement2(iface);
2645 nsIDOMClientRectList *rect_list;
2646 HTMLRectCollection *rects;
2647 nsresult nsres;
2649 TRACE("(%p)->(%p)\n", This, pRectCol);
2651 if(!This->dom_element) {
2652 FIXME("comment element\n");
2653 return E_NOTIMPL;
2656 nsres = nsIDOMElement_GetClientRects(This->dom_element, &rect_list);
2657 if(NS_FAILED(nsres)) {
2658 WARN("GetClientRects failed: %08x\n", nsres);
2659 return map_nsresult(nsres);
2662 rects = heap_alloc_zero(sizeof(*rects));
2663 if(!rects) {
2664 nsIDOMClientRectList_Release(rect_list);
2665 return E_OUTOFMEMORY;
2668 rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl;
2669 rects->ref = 1;
2670 rects->rect_list = rect_list;
2671 init_dispatch(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface,
2672 &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
2674 *pRectCol = &rects->IHTMLRectCollection_iface;
2675 return S_OK;
2678 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
2680 HTMLElement *This = impl_from_IHTMLElement2(iface);
2681 nsIDOMClientRect *nsrect;
2682 nsresult nsres;
2683 HRESULT hres;
2685 TRACE("(%p)->(%p)\n", This, pRect);
2687 if(!This->dom_element) {
2688 FIXME("comment element\n");
2689 return E_NOTIMPL;
2692 nsres = nsIDOMElement_GetBoundingClientRect(This->dom_element, &nsrect);
2693 if(NS_FAILED(nsres) || !nsrect) {
2694 ERR("GetBoindingClientRect failed: %08x\n", nsres);
2695 return E_FAIL;
2698 hres = create_html_rect(nsrect, dispex_compat_mode(&This->node.event_target.dispex), pRect);
2700 nsIDOMClientRect_Release(nsrect);
2701 return hres;
2704 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
2705 BSTR expression, BSTR language)
2707 HTMLElement *This = impl_from_IHTMLElement2(iface);
2708 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
2709 debugstr_w(language));
2710 return E_NOTIMPL;
2713 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
2714 VARIANT *expression)
2716 HTMLElement *This = impl_from_IHTMLElement2(iface);
2717 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
2718 return E_NOTIMPL;
2721 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
2722 VARIANT_BOOL *pfSuccess)
2724 HTMLElement *This = impl_from_IHTMLElement2(iface);
2725 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
2726 return E_NOTIMPL;
2729 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
2731 HTMLElement *This = impl_from_IHTMLElement2(iface);
2732 nsresult nsres;
2734 TRACE("(%p)->(%d)\n", This, v);
2736 if(!This->html_element) {
2737 FIXME("non-HTML element\n");
2738 return E_NOTIMPL;
2741 nsres = nsIDOMHTMLElement_SetTabIndex(This->html_element, v);
2742 if(NS_FAILED(nsres))
2743 ERR("GetTabIndex failed: %08x\n", nsres);
2745 return S_OK;
2748 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
2750 HTMLElement *This = impl_from_IHTMLElement2(iface);
2751 LONG index;
2752 nsresult nsres;
2754 TRACE("(%p)->(%p)\n", This, p);
2756 if(!This->html_element) {
2757 FIXME("non-HTML element\n");
2758 return E_NOTIMPL;
2761 nsres = nsIDOMHTMLElement_GetTabIndex(This->html_element, &index);
2762 if(NS_FAILED(nsres)) {
2763 ERR("GetTabIndex failed: %08x\n", nsres);
2764 return E_FAIL;
2767 *p = index;
2768 return S_OK;
2771 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
2773 HTMLElement *This = impl_from_IHTMLElement2(iface);
2774 nsresult nsres;
2776 TRACE("(%p)\n", This);
2778 if(!This->html_element) {
2779 FIXME("non-HTML element\n");
2780 return E_NOTIMPL;
2783 nsres = nsIDOMHTMLElement_Focus(This->html_element);
2784 if(NS_FAILED(nsres))
2785 ERR("Focus failed: %08x\n", nsres);
2787 return S_OK;
2790 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
2792 HTMLElement *This = impl_from_IHTMLElement2(iface);
2793 nsAString nsstr;
2794 nsresult nsres;
2796 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2798 if(!This->html_element) {
2799 FIXME("non-HTML element\n");
2800 return E_NOTIMPL;
2803 nsAString_InitDepend(&nsstr, v);
2804 nsres = nsIDOMHTMLElement_SetAccessKey(This->html_element, &nsstr);
2805 nsAString_Finish(&nsstr);
2806 return map_nsresult(nsres);
2809 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
2811 HTMLElement *This = impl_from_IHTMLElement2(iface);
2812 nsAString nsstr;
2813 nsresult nsres;
2815 TRACE("(%p)->(%p)\n", This, p);
2817 if(!This->html_element) {
2818 FIXME("non-HTML element\n");
2819 return E_NOTIMPL;
2822 nsAString_InitDepend(&nsstr, NULL);
2823 nsres = nsIDOMHTMLElement_GetAccessKey(This->html_element, &nsstr);
2824 return return_nsstr(nsres, &nsstr, p);
2827 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
2829 HTMLElement *This = impl_from_IHTMLElement2(iface);
2831 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2833 return set_node_event(&This->node, EVENTID_BLUR, &v);
2836 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
2838 HTMLElement *This = impl_from_IHTMLElement2(iface);
2840 TRACE("(%p)->(%p)\n", This, p);
2842 return get_node_event(&This->node, EVENTID_BLUR, p);
2845 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
2847 HTMLElement *This = impl_from_IHTMLElement2(iface);
2849 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2851 return set_node_event(&This->node, EVENTID_FOCUS, &v);
2854 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
2856 HTMLElement *This = impl_from_IHTMLElement2(iface);
2858 TRACE("(%p)->(%p)\n", This, p);
2860 return get_node_event(&This->node, EVENTID_FOCUS, p);
2863 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
2865 HTMLElement *This = impl_from_IHTMLElement2(iface);
2867 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2869 return set_node_event(&This->node, EVENTID_RESIZE, &v);
2872 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
2874 HTMLElement *This = impl_from_IHTMLElement2(iface);
2876 TRACE("(%p)->(%p)\n", This, p);
2878 return get_node_event(&This->node, EVENTID_RESIZE, p);
2881 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
2883 HTMLElement *This = impl_from_IHTMLElement2(iface);
2884 nsresult nsres;
2886 TRACE("(%p)\n", This);
2888 if(!This->html_element) {
2889 FIXME("non-HTML element\n");
2890 return E_NOTIMPL;
2893 nsres = nsIDOMHTMLElement_Blur(This->html_element);
2894 if(NS_FAILED(nsres)) {
2895 ERR("Blur failed: %08x\n", nsres);
2896 return E_FAIL;
2899 return S_OK;
2902 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2904 HTMLElement *This = impl_from_IHTMLElement2(iface);
2905 FIXME("(%p)->(%p)\n", This, pUnk);
2906 return E_NOTIMPL;
2909 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2911 HTMLElement *This = impl_from_IHTMLElement2(iface);
2912 FIXME("(%p)->(%p)\n", This, pUnk);
2913 return E_NOTIMPL;
2916 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
2918 HTMLElement *This = impl_from_IHTMLElement2(iface);
2919 nsresult nsres;
2921 TRACE("(%p)->(%p)\n", This, p);
2923 if(!This->dom_element) {
2924 FIXME("Unimplemented for comment element\n");
2925 return E_NOTIMPL;
2928 nsres = nsIDOMElement_GetClientHeight(This->dom_element, p);
2929 assert(nsres == NS_OK);
2930 return S_OK;
2933 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
2935 HTMLElement *This = impl_from_IHTMLElement2(iface);
2936 nsresult nsres;
2938 TRACE("(%p)->(%p)\n", This, p);
2940 if(!This->dom_element) {
2941 FIXME("comment element\n");
2942 return E_NOTIMPL;
2945 nsres = nsIDOMElement_GetClientWidth(This->dom_element, p);
2946 assert(nsres == NS_OK);
2947 return S_OK;
2950 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
2952 HTMLElement *This = impl_from_IHTMLElement2(iface);
2953 nsresult nsres;
2955 TRACE("(%p)->(%p)\n", This, p);
2957 if(!This->dom_element) {
2958 FIXME("comment element\n");
2959 return E_NOTIMPL;
2962 nsres = nsIDOMElement_GetClientTop(This->dom_element, p);
2963 assert(nsres == NS_OK);
2965 TRACE("*p = %d\n", *p);
2966 return S_OK;
2969 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
2971 HTMLElement *This = impl_from_IHTMLElement2(iface);
2972 nsresult nsres;
2974 TRACE("(%p)->(%p)\n", This, p);
2976 if(!This->dom_element) {
2977 FIXME("comment element\n");
2978 return E_NOTIMPL;
2981 nsres = nsIDOMElement_GetClientLeft(This->dom_element, p);
2982 assert(nsres == NS_OK);
2984 TRACE("*p = %d\n", *p);
2985 return S_OK;
2988 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
2989 IDispatch *pDisp, VARIANT_BOOL *pfResult)
2991 HTMLElement *This = impl_from_IHTMLElement2(iface);
2993 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
2995 return attach_event(&This->node.event_target, event, pDisp, pfResult);
2998 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
3000 HTMLElement *This = impl_from_IHTMLElement2(iface);
3002 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
3004 return detach_event(&This->node.event_target, event, pDisp);
3007 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
3009 HTMLElement *This = impl_from_IHTMLElement2(iface);
3010 BSTR str;
3012 TRACE("(%p)->(%p)\n", This, p);
3014 if(This->node.vtbl->get_readystate) {
3015 HRESULT hres;
3017 hres = This->node.vtbl->get_readystate(&This->node, &str);
3018 if(FAILED(hres))
3019 return hres;
3020 }else {
3021 str = SysAllocString(L"complete");
3022 if(!str)
3023 return E_OUTOFMEMORY;
3026 V_VT(p) = VT_BSTR;
3027 V_BSTR(p) = str;
3028 return S_OK;
3031 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
3033 HTMLElement *This = impl_from_IHTMLElement2(iface);
3035 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3037 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
3040 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
3042 HTMLElement *This = impl_from_IHTMLElement2(iface);
3044 TRACE("(%p)->(%p)\n", This, p);
3046 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
3049 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
3051 HTMLElement *This = impl_from_IHTMLElement2(iface);
3052 FIXME("(%p)->()\n", This);
3053 return E_NOTIMPL;
3056 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
3058 HTMLElement *This = impl_from_IHTMLElement2(iface);
3059 FIXME("(%p)->(%p)\n", This, p);
3060 return E_NOTIMPL;
3063 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
3065 HTMLElement *This = impl_from_IHTMLElement2(iface);
3066 FIXME("(%p)->()\n", This);
3067 return E_NOTIMPL;
3070 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
3072 HTMLElement *This = impl_from_IHTMLElement2(iface);
3073 FIXME("(%p)->(%p)\n", This, p);
3074 return E_NOTIMPL;
3077 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
3079 HTMLElement *This = impl_from_IHTMLElement2(iface);
3080 FIXME("(%p)->()\n", This);
3081 return E_NOTIMPL;
3084 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
3086 HTMLElement *This = impl_from_IHTMLElement2(iface);
3087 FIXME("(%p)->(%p)\n", This, p);
3088 return E_NOTIMPL;
3091 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
3093 HTMLElement *This = impl_from_IHTMLElement2(iface);
3094 nsAString nsstr;
3095 nsresult nsres;
3097 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3099 if(!This->html_element) {
3100 FIXME("non-HTML element\n");
3101 return S_OK;
3104 nsAString_InitDepend(&nsstr, v);
3105 nsres = nsIDOMHTMLElement_SetDir(This->html_element, &nsstr);
3106 nsAString_Finish(&nsstr);
3107 if(NS_FAILED(nsres)) {
3108 ERR("SetDir failed: %08x\n", nsres);
3109 return E_FAIL;
3112 return S_OK;
3115 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
3117 HTMLElement *This = impl_from_IHTMLElement2(iface);
3118 nsAString dir_str;
3119 nsresult nsres;
3121 TRACE("(%p)->(%p)\n", This, p);
3123 if(!This->html_element) {
3124 if(This->dom_element)
3125 FIXME("non-HTML element\n");
3126 *p = NULL;
3127 return S_OK;
3130 nsAString_Init(&dir_str, NULL);
3131 nsres = nsIDOMHTMLElement_GetDir(This->html_element, &dir_str);
3132 return return_nsstr(nsres, &dir_str, p);
3135 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
3137 HTMLElement *This = impl_from_IHTMLElement2(iface);
3138 FIXME("(%p)->(%p)\n", This, range);
3139 return E_NOTIMPL;
3142 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
3144 HTMLElement *This = impl_from_IHTMLElement2(iface);
3145 nsresult nsres;
3147 TRACE("(%p)->(%p)\n", This, p);
3149 if(!This->dom_element) {
3150 FIXME("comment element\n");
3151 return E_NOTIMPL;
3154 nsres = nsIDOMElement_GetScrollHeight(This->dom_element, p);
3155 assert(nsres == NS_OK);
3156 TRACE("*p = %d\n", *p);
3157 return S_OK;
3160 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
3162 HTMLElement *This = impl_from_IHTMLElement2(iface);
3163 nsresult nsres;
3165 TRACE("(%p)->(%p)\n", This, p);
3167 if(!This->dom_element) {
3168 FIXME("comment element\n");
3169 return E_NOTIMPL;
3172 nsres = nsIDOMElement_GetScrollWidth(This->dom_element, p);
3173 assert(nsres == NS_OK);
3175 TRACE("*p = %d\n", *p);
3176 return S_OK;
3179 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
3181 HTMLElement *This = impl_from_IHTMLElement2(iface);
3183 TRACE("(%p)->(%d)\n", This, v);
3185 if(!This->dom_element) {
3186 FIXME("comment element\n");
3187 return E_NOTIMPL;
3190 nsIDOMElement_SetScrollTop(This->dom_element, v);
3191 return S_OK;
3194 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
3196 HTMLElement *This = impl_from_IHTMLElement2(iface);
3197 nsresult nsres;
3199 TRACE("(%p)->(%p)\n", This, p);
3201 if(!This->dom_element) {
3202 FIXME("comment element\n");
3203 return E_NOTIMPL;
3206 nsres = nsIDOMElement_GetScrollTop(This->dom_element, p);
3207 assert(nsres == NS_OK);
3209 TRACE("*p = %d\n", *p);
3210 return S_OK;
3213 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
3215 HTMLElement *This = impl_from_IHTMLElement2(iface);
3217 TRACE("(%p)->(%d)\n", This, v);
3219 if(!This->dom_element) {
3220 FIXME("comment element\n");
3221 return E_NOTIMPL;
3224 nsIDOMElement_SetScrollLeft(This->dom_element, v);
3225 return S_OK;
3228 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
3230 HTMLElement *This = impl_from_IHTMLElement2(iface);
3231 nsresult nsres;
3233 TRACE("(%p)->(%p)\n", This, p);
3235 if(!p)
3236 return E_INVALIDARG;
3238 if(!This->dom_element) {
3239 FIXME("comment element\n");
3240 return E_NOTIMPL;
3243 nsres = nsIDOMElement_GetScrollLeft(This->dom_element, p);
3244 assert(nsres == NS_OK);
3245 TRACE("*p = %d\n", *p);
3246 return S_OK;
3249 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
3251 HTMLElement *This = impl_from_IHTMLElement2(iface);
3252 FIXME("(%p)\n", This);
3253 return E_NOTIMPL;
3256 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
3258 HTMLElement *This = impl_from_IHTMLElement2(iface);
3259 FIXME("(%p)->(%p)\n", This, mergeThis);
3260 return E_NOTIMPL;
3263 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
3265 HTMLElement *This = impl_from_IHTMLElement2(iface);
3267 TRACE("(%p)->()\n", This);
3269 return set_node_event(&This->node, EVENTID_CONTEXTMENU, &v);
3272 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
3274 HTMLElement *This = impl_from_IHTMLElement2(iface);
3276 TRACE("(%p)->(%p)\n", This, p);
3278 return get_node_event(&This->node, EVENTID_CONTEXTMENU, p);
3281 static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, BSTR where,
3282 IHTMLElement *insertedElement, IHTMLElement **inserted)
3284 HTMLElement *This = impl_from_IHTMLElement2(iface);
3285 HTMLDOMNode *ret_node;
3286 HTMLElement *elem;
3287 HRESULT hres;
3289 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
3291 elem = unsafe_impl_from_IHTMLElement(insertedElement);
3292 if(!elem)
3293 return E_INVALIDARG;
3295 hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node);
3296 if(FAILED(hres))
3297 return hres;
3299 hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted);
3300 IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface);
3301 return hres;
3304 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
3305 BSTR where, IHTMLElement **applied)
3307 HTMLElement *This = impl_from_IHTMLElement2(iface);
3308 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
3309 return E_NOTIMPL;
3312 static HRESULT WINAPI HTMLElement2_getAdjacentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
3314 HTMLElement *This = impl_from_IHTMLElement2(iface);
3315 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
3316 return E_NOTIMPL;
3319 static HRESULT WINAPI HTMLElement2_replaceAdjacentText(IHTMLElement2 *iface, BSTR where,
3320 BSTR newText, BSTR *oldText)
3322 HTMLElement *This = impl_from_IHTMLElement2(iface);
3323 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
3324 return E_NOTIMPL;
3327 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
3329 HTMLElement *This = impl_from_IHTMLElement2(iface);
3330 FIXME("(%p)->(%p)\n", This, p);
3331 return E_NOTIMPL;
3334 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
3335 VARIANT *pvarFactory, LONG *pCookie)
3337 HTMLElement *This = impl_from_IHTMLElement2(iface);
3338 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
3339 return E_NOTIMPL;
3342 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
3343 VARIANT_BOOL *pfResult)
3345 HTMLElement *This = impl_from_IHTMLElement2(iface);
3346 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
3347 return E_NOTIMPL;
3350 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
3352 HTMLElement *This = impl_from_IHTMLElement2(iface);
3354 FIXME("(%p)->(%p): hack\n", This, p);
3356 /* We can't implement correct behavior on top of Gecko (although we could
3357 try a bit harder). Making runtimeStyle behave like regular style is
3358 enough for most use cases. */
3359 if(!This->runtime_style) {
3360 HRESULT hres;
3362 hres = HTMLStyle_Create(This, &This->runtime_style);
3363 if(FAILED(hres))
3364 return hres;
3367 *p = &This->runtime_style->IHTMLStyle_iface;
3368 IHTMLStyle_AddRef(*p);
3369 return S_OK;
3372 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
3374 HTMLElement *This = impl_from_IHTMLElement2(iface);
3375 FIXME("(%p)->(%p)\n", This, p);
3376 return E_NOTIMPL;
3379 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
3381 HTMLElement *This = impl_from_IHTMLElement2(iface);
3382 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3383 return E_NOTIMPL;
3386 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
3388 HTMLElement *This = impl_from_IHTMLElement2(iface);
3389 FIXME("(%p)->(%p)\n", This, p);
3390 return E_NOTIMPL;
3393 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
3395 HTMLElement *This = impl_from_IHTMLElement2(iface);
3396 FIXME("(%p)->()\n", This);
3397 return E_NOTIMPL;
3400 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
3402 HTMLElement *This = impl_from_IHTMLElement2(iface);
3403 FIXME("(%p)->(%p)\n", This, p);
3404 return E_NOTIMPL;
3407 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
3409 HTMLElement *This = impl_from_IHTMLElement2(iface);
3410 FIXME("(%p)->(%p)\n", This, p);
3411 return E_NOTIMPL;
3414 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
3415 IHTMLElementCollection **pelColl)
3417 HTMLElement *This = impl_from_IHTMLElement2(iface);
3418 nsIDOMHTMLCollection *nscol;
3419 nsAString tag_str;
3420 nsresult nsres;
3422 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
3424 if(!This->dom_element) {
3425 *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode);
3426 return S_OK;
3429 nsAString_InitDepend(&tag_str, v);
3430 nsres = nsIDOMElement_GetElementsByTagName(This->dom_element, &tag_str, &nscol);
3431 nsAString_Finish(&tag_str);
3432 if(NS_FAILED(nsres)) {
3433 ERR("GetElementByTagName failed: %08x\n", nsres);
3434 return E_FAIL;
3437 *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
3438 nsIDOMHTMLCollection_Release(nscol);
3439 return S_OK;
3442 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
3443 HTMLElement2_QueryInterface,
3444 HTMLElement2_AddRef,
3445 HTMLElement2_Release,
3446 HTMLElement2_GetTypeInfoCount,
3447 HTMLElement2_GetTypeInfo,
3448 HTMLElement2_GetIDsOfNames,
3449 HTMLElement2_Invoke,
3450 HTMLElement2_get_scopeName,
3451 HTMLElement2_setCapture,
3452 HTMLElement2_releaseCapture,
3453 HTMLElement2_put_onlosecapture,
3454 HTMLElement2_get_onlosecapture,
3455 HTMLElement2_componentFromPoint,
3456 HTMLElement2_doScroll,
3457 HTMLElement2_put_onscroll,
3458 HTMLElement2_get_onscroll,
3459 HTMLElement2_put_ondrag,
3460 HTMLElement2_get_ondrag,
3461 HTMLElement2_put_ondragend,
3462 HTMLElement2_get_ondragend,
3463 HTMLElement2_put_ondragenter,
3464 HTMLElement2_get_ondragenter,
3465 HTMLElement2_put_ondragover,
3466 HTMLElement2_get_ondragover,
3467 HTMLElement2_put_ondragleave,
3468 HTMLElement2_get_ondragleave,
3469 HTMLElement2_put_ondrop,
3470 HTMLElement2_get_ondrop,
3471 HTMLElement2_put_onbeforecut,
3472 HTMLElement2_get_onbeforecut,
3473 HTMLElement2_put_oncut,
3474 HTMLElement2_get_oncut,
3475 HTMLElement2_put_onbeforecopy,
3476 HTMLElement2_get_onbeforecopy,
3477 HTMLElement2_put_oncopy,
3478 HTMLElement2_get_oncopy,
3479 HTMLElement2_put_onbeforepaste,
3480 HTMLElement2_get_onbeforepaste,
3481 HTMLElement2_put_onpaste,
3482 HTMLElement2_get_onpaste,
3483 HTMLElement2_get_currentStyle,
3484 HTMLElement2_put_onpropertychange,
3485 HTMLElement2_get_onpropertychange,
3486 HTMLElement2_getClientRects,
3487 HTMLElement2_getBoundingClientRect,
3488 HTMLElement2_setExpression,
3489 HTMLElement2_getExpression,
3490 HTMLElement2_removeExpression,
3491 HTMLElement2_put_tabIndex,
3492 HTMLElement2_get_tabIndex,
3493 HTMLElement2_focus,
3494 HTMLElement2_put_accessKey,
3495 HTMLElement2_get_accessKey,
3496 HTMLElement2_put_onblur,
3497 HTMLElement2_get_onblur,
3498 HTMLElement2_put_onfocus,
3499 HTMLElement2_get_onfocus,
3500 HTMLElement2_put_onresize,
3501 HTMLElement2_get_onresize,
3502 HTMLElement2_blur,
3503 HTMLElement2_addFilter,
3504 HTMLElement2_removeFilter,
3505 HTMLElement2_get_clientHeight,
3506 HTMLElement2_get_clientWidth,
3507 HTMLElement2_get_clientTop,
3508 HTMLElement2_get_clientLeft,
3509 HTMLElement2_attachEvent,
3510 HTMLElement2_detachEvent,
3511 HTMLElement2_get_readyState,
3512 HTMLElement2_put_onreadystatechange,
3513 HTMLElement2_get_onreadystatechange,
3514 HTMLElement2_put_onrowsdelete,
3515 HTMLElement2_get_onrowsdelete,
3516 HTMLElement2_put_onrowsinserted,
3517 HTMLElement2_get_onrowsinserted,
3518 HTMLElement2_put_oncellchange,
3519 HTMLElement2_get_oncellchange,
3520 HTMLElement2_put_dir,
3521 HTMLElement2_get_dir,
3522 HTMLElement2_createControlRange,
3523 HTMLElement2_get_scrollHeight,
3524 HTMLElement2_get_scrollWidth,
3525 HTMLElement2_put_scrollTop,
3526 HTMLElement2_get_scrollTop,
3527 HTMLElement2_put_scrollLeft,
3528 HTMLElement2_get_scrollLeft,
3529 HTMLElement2_clearAttributes,
3530 HTMLElement2_mergeAttributes,
3531 HTMLElement2_put_oncontextmenu,
3532 HTMLElement2_get_oncontextmenu,
3533 HTMLElement2_insertAdjacentElement,
3534 HTMLElement2_applyElement,
3535 HTMLElement2_getAdjacentText,
3536 HTMLElement2_replaceAdjacentText,
3537 HTMLElement2_get_canHandleChildren,
3538 HTMLElement2_addBehavior,
3539 HTMLElement2_removeBehavior,
3540 HTMLElement2_get_runtimeStyle,
3541 HTMLElement2_get_behaviorUrns,
3542 HTMLElement2_put_tagUrn,
3543 HTMLElement2_get_tagUrn,
3544 HTMLElement2_put_onbeforeeditfocus,
3545 HTMLElement2_get_onbeforeeditfocus,
3546 HTMLElement2_get_readyStateValue,
3547 HTMLElement2_getElementsByTagName,
3550 static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
3552 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
3555 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
3556 REFIID riid, void **ppv)
3558 HTMLElement *This = impl_from_IHTMLElement3(iface);
3559 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
3562 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
3564 HTMLElement *This = impl_from_IHTMLElement3(iface);
3565 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
3568 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
3570 HTMLElement *This = impl_from_IHTMLElement3(iface);
3571 return IHTMLElement_Release(&This->IHTMLElement_iface);
3574 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
3576 HTMLElement *This = impl_from_IHTMLElement3(iface);
3577 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
3580 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
3581 LCID lcid, ITypeInfo **ppTInfo)
3583 HTMLElement *This = impl_from_IHTMLElement3(iface);
3584 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
3587 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
3588 LPOLESTR *rgszNames, UINT cNames,
3589 LCID lcid, DISPID *rgDispId)
3591 HTMLElement *This = impl_from_IHTMLElement3(iface);
3592 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
3593 lcid, rgDispId);
3596 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
3597 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3598 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3600 HTMLElement *This = impl_from_IHTMLElement3(iface);
3601 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
3602 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3605 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
3607 HTMLElement *This = impl_from_IHTMLElement3(iface);
3608 FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
3609 return E_NOTIMPL;
3612 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
3614 HTMLElement *This = impl_from_IHTMLElement3(iface);
3615 FIXME("(%p)->(%p)\n", This, p);
3616 return E_NOTIMPL;
3619 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
3621 HTMLElement *This = impl_from_IHTMLElement3(iface);
3622 FIXME("(%p)->(%p)\n", This, p);
3623 return E_NOTIMPL;
3626 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
3628 HTMLElement *This = impl_from_IHTMLElement3(iface);
3629 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3630 return E_NOTIMPL;
3633 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
3635 HTMLElement *This = impl_from_IHTMLElement3(iface);
3636 FIXME("(%p)->(%p)\n", This, p);
3637 return E_NOTIMPL;
3640 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
3642 HTMLElement *This = impl_from_IHTMLElement3(iface);
3643 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3644 return E_NOTIMPL;
3647 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
3649 HTMLElement *This = impl_from_IHTMLElement3(iface);
3650 FIXME("(%p)->(%p)\n", This, p);
3651 return E_NOTIMPL;
3654 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
3656 HTMLElement *This = impl_from_IHTMLElement3(iface);
3657 FIXME("(%p)->(%x)\n", This, v);
3658 return E_NOTIMPL;
3661 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
3663 HTMLElement *This = impl_from_IHTMLElement3(iface);
3664 FIXME("(%p)->(%p)\n", This, p);
3665 return E_NOTIMPL;
3668 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
3670 HTMLElement *This = impl_from_IHTMLElement3(iface);
3671 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3672 return E_NOTIMPL;
3675 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
3677 HTMLElement *This = impl_from_IHTMLElement3(iface);
3678 FIXME("(%p)->(%p)\n", This, p);
3679 return E_NOTIMPL;
3682 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
3684 HTMLElement *This = impl_from_IHTMLElement3(iface);
3685 FIXME("(%p)\n", This);
3686 return E_NOTIMPL;
3689 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
3691 HTMLElement *This = impl_from_IHTMLElement3(iface);
3692 nsresult nsres;
3693 nsAString str;
3695 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3697 if(!This->html_element) {
3698 FIXME("non-HTML element\n");
3699 return E_NOTIMPL;
3702 nsAString_InitDepend(&str, v);
3703 nsres = nsIDOMHTMLElement_SetContentEditable(This->html_element, &str);
3704 nsAString_Finish(&str);
3706 if (NS_FAILED(nsres)){
3707 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v));
3708 return E_FAIL;
3711 return S_OK;
3714 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
3716 HTMLElement *This = impl_from_IHTMLElement3(iface);
3717 nsresult nsres;
3718 nsAString str;
3720 TRACE("(%p)->(%p)\n", This, p);
3722 if(!This->html_element) {
3723 FIXME("non-HTML element\n");
3724 return E_NOTIMPL;
3727 nsAString_Init(&str, NULL);
3728 nsres = nsIDOMHTMLElement_GetContentEditable(This->html_element, &str);
3729 return return_nsstr(nsres, &str, p);
3732 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
3734 HTMLElement *This = impl_from_IHTMLElement3(iface);
3735 FIXME("(%p)->(%p)\n", This, p);
3736 return E_NOTIMPL;
3739 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
3741 HTMLElement *This = impl_from_IHTMLElement3(iface);
3742 FIXME("(%p)->(%x)\n", This, v);
3743 return E_NOTIMPL;
3746 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
3748 HTMLElement *This = impl_from_IHTMLElement3(iface);
3749 FIXME("(%p)->(%p)\n", This, p);
3750 return E_NOTIMPL;
3753 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
3755 HTMLElement *This = impl_from_IHTMLElement3(iface);
3756 VARIANT *var;
3757 HRESULT hres;
3759 TRACE("(%p)->(%x)\n", This, v);
3761 if(This->node.vtbl->put_disabled)
3762 return This->node.vtbl->put_disabled(&This->node, v);
3764 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", TRUE, &var);
3765 if(FAILED(hres))
3766 return hres;
3768 VariantClear(var);
3769 V_VT(var) = VT_BOOL;
3770 V_BOOL(var) = v;
3771 return S_OK;
3774 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3776 HTMLElement *This = impl_from_IHTMLElement3(iface);
3777 VARIANT *var;
3778 HRESULT hres;
3780 TRACE("(%p)->(%p)\n", This, p);
3782 if(This->node.vtbl->get_disabled)
3783 return This->node.vtbl->get_disabled(&This->node, p);
3785 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", FALSE, &var);
3786 if(hres == DISP_E_UNKNOWNNAME) {
3787 *p = VARIANT_FALSE;
3788 return S_OK;
3790 if(FAILED(hres))
3791 return hres;
3793 if(V_VT(var) != VT_BOOL) {
3794 FIXME("value is %s\n", debugstr_variant(var));
3795 return E_NOTIMPL;
3798 *p = V_BOOL(var);
3799 return S_OK;
3802 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3804 HTMLElement *This = impl_from_IHTMLElement3(iface);
3805 FIXME("(%p)->(%p)\n", This, p);
3806 return E_NOTIMPL;
3809 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
3811 HTMLElement *This = impl_from_IHTMLElement3(iface);
3812 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3813 return E_NOTIMPL;
3816 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
3818 HTMLElement *This = impl_from_IHTMLElement3(iface);
3819 FIXME("(%p)->(%p)\n", This, p);
3820 return E_NOTIMPL;
3823 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
3825 HTMLElement *This = impl_from_IHTMLElement3(iface);
3826 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3827 return E_NOTIMPL;
3830 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
3832 HTMLElement *This = impl_from_IHTMLElement3(iface);
3833 FIXME("(%p)->(%p)\n", This, p);
3834 return E_NOTIMPL;
3837 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
3838 VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
3840 HTMLElement *This = impl_from_IHTMLElement3(iface);
3842 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
3843 pfCancelled);
3845 return fire_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
3848 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
3850 HTMLElement *This = impl_from_IHTMLElement3(iface);
3851 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3852 return E_NOTIMPL;
3855 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
3857 HTMLElement *This = impl_from_IHTMLElement3(iface);
3858 FIXME("(%p)->(%p)\n", This, p);
3859 return E_NOTIMPL;
3862 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
3864 HTMLElement *This = impl_from_IHTMLElement3(iface);
3865 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3866 return E_NOTIMPL;
3869 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
3871 HTMLElement *This = impl_from_IHTMLElement3(iface);
3872 FIXME("(%p)->(%p)\n", This, p);
3873 return E_NOTIMPL;
3876 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
3878 HTMLElement *This = impl_from_IHTMLElement3(iface);
3879 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3880 return E_NOTIMPL;
3883 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
3885 HTMLElement *This = impl_from_IHTMLElement3(iface);
3886 FIXME("(%p)->(%p)\n", This, p);
3887 return E_NOTIMPL;
3890 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
3892 HTMLElement *This = impl_from_IHTMLElement3(iface);
3893 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3894 return E_NOTIMPL;
3897 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
3899 HTMLElement *This = impl_from_IHTMLElement3(iface);
3900 FIXME("(%p)->(%p)\n", This, p);
3901 return E_NOTIMPL;
3904 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
3906 HTMLElement *This = impl_from_IHTMLElement3(iface);
3907 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3908 return E_NOTIMPL;
3911 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
3913 HTMLElement *This = impl_from_IHTMLElement3(iface);
3914 FIXME("(%p)->(%p)\n", This, p);
3915 return E_NOTIMPL;
3918 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
3920 HTMLElement *This = impl_from_IHTMLElement3(iface);
3921 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3922 return E_NOTIMPL;
3925 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
3927 HTMLElement *This = impl_from_IHTMLElement3(iface);
3928 FIXME("(%p)->(%p)\n", This, p);
3929 return E_NOTIMPL;
3932 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
3934 HTMLElement *This = impl_from_IHTMLElement3(iface);
3935 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3936 return E_NOTIMPL;
3939 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
3941 HTMLElement *This = impl_from_IHTMLElement3(iface);
3942 FIXME("(%p)->(%p)\n", This, p);
3943 return E_NOTIMPL;
3946 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
3948 HTMLElement *This = impl_from_IHTMLElement3(iface);
3949 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3950 return E_NOTIMPL;
3953 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
3955 HTMLElement *This = impl_from_IHTMLElement3(iface);
3956 FIXME("(%p)->(%p)\n", This, p);
3957 return E_NOTIMPL;
3960 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
3962 HTMLElement *This = impl_from_IHTMLElement3(iface);
3963 FIXME("(%p)->(%p)\n", This, pfRet);
3964 return E_NOTIMPL;
3967 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
3969 HTMLElement *This = impl_from_IHTMLElement3(iface);
3970 FIXME("(%p)->(%p)\n", This, p);
3971 return E_NOTIMPL;
3974 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
3975 HTMLElement3_QueryInterface,
3976 HTMLElement3_AddRef,
3977 HTMLElement3_Release,
3978 HTMLElement3_GetTypeInfoCount,
3979 HTMLElement3_GetTypeInfo,
3980 HTMLElement3_GetIDsOfNames,
3981 HTMLElement3_Invoke,
3982 HTMLElement3_mergeAttributes,
3983 HTMLElement3_get_isMultiLine,
3984 HTMLElement3_get_canHaveHTML,
3985 HTMLElement3_put_onlayoutcomplete,
3986 HTMLElement3_get_onlayoutcomplete,
3987 HTMLElement3_put_onpage,
3988 HTMLElement3_get_onpage,
3989 HTMLElement3_put_inflateBlock,
3990 HTMLElement3_get_inflateBlock,
3991 HTMLElement3_put_onbeforedeactivate,
3992 HTMLElement3_get_onbeforedeactivate,
3993 HTMLElement3_setActive,
3994 HTMLElement3_put_contentEditable,
3995 HTMLElement3_get_contentEditable,
3996 HTMLElement3_get_isContentEditable,
3997 HTMLElement3_put_hideFocus,
3998 HTMLElement3_get_hideFocus,
3999 HTMLElement3_put_disabled,
4000 HTMLElement3_get_disabled,
4001 HTMLElement3_get_isDisabled,
4002 HTMLElement3_put_onmove,
4003 HTMLElement3_get_onmove,
4004 HTMLElement3_put_oncontrolselect,
4005 HTMLElement3_get_oncontrolselect,
4006 HTMLElement3_fireEvent,
4007 HTMLElement3_put_onresizestart,
4008 HTMLElement3_get_onresizestart,
4009 HTMLElement3_put_onresizeend,
4010 HTMLElement3_get_onresizeend,
4011 HTMLElement3_put_onmovestart,
4012 HTMLElement3_get_onmovestart,
4013 HTMLElement3_put_onmoveend,
4014 HTMLElement3_get_onmoveend,
4015 HTMLElement3_put_onmousecenter,
4016 HTMLElement3_get_onmousecenter,
4017 HTMLElement3_put_onmouseleave,
4018 HTMLElement3_get_onmouseleave,
4019 HTMLElement3_put_onactivate,
4020 HTMLElement3_get_onactivate,
4021 HTMLElement3_put_ondeactivate,
4022 HTMLElement3_get_ondeactivate,
4023 HTMLElement3_dragDrop,
4024 HTMLElement3_get_glyphMode
4027 static inline HTMLElement *impl_from_IHTMLElement4(IHTMLElement4 *iface)
4029 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement4_iface);
4032 static HRESULT WINAPI HTMLElement4_QueryInterface(IHTMLElement4 *iface,
4033 REFIID riid, void **ppv)
4035 HTMLElement *This = impl_from_IHTMLElement4(iface);
4036 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4039 static ULONG WINAPI HTMLElement4_AddRef(IHTMLElement4 *iface)
4041 HTMLElement *This = impl_from_IHTMLElement4(iface);
4042 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4045 static ULONG WINAPI HTMLElement4_Release(IHTMLElement4 *iface)
4047 HTMLElement *This = impl_from_IHTMLElement4(iface);
4048 return IHTMLElement_Release(&This->IHTMLElement_iface);
4051 static HRESULT WINAPI HTMLElement4_GetTypeInfoCount(IHTMLElement4 *iface, UINT *pctinfo)
4053 HTMLElement *This = impl_from_IHTMLElement4(iface);
4054 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4057 static HRESULT WINAPI HTMLElement4_GetTypeInfo(IHTMLElement4 *iface, UINT iTInfo,
4058 LCID lcid, ITypeInfo **ppTInfo)
4060 HTMLElement *This = impl_from_IHTMLElement4(iface);
4061 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4064 static HRESULT WINAPI HTMLElement4_GetIDsOfNames(IHTMLElement4 *iface, REFIID riid,
4065 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4067 HTMLElement *This = impl_from_IHTMLElement4(iface);
4068 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4069 lcid, rgDispId);
4072 static HRESULT WINAPI HTMLElement4_Invoke(IHTMLElement4 *iface, DISPID dispIdMember, REFIID riid,
4073 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4075 HTMLElement *This = impl_from_IHTMLElement4(iface);
4076 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4077 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4080 static HRESULT WINAPI HTMLElement4_put_onmousewheel(IHTMLElement4 *iface, VARIANT v)
4082 HTMLElement *This = impl_from_IHTMLElement4(iface);
4084 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4086 return set_node_event(&This->node, EVENTID_MOUSEWHEEL, &v);
4089 static HRESULT WINAPI HTMLElement4_get_onmousewheel(IHTMLElement4 *iface, VARIANT *p)
4091 HTMLElement *This = impl_from_IHTMLElement4(iface);
4093 TRACE("(%p)->(%p)\n", This, p);
4095 return get_node_event(&This->node, EVENTID_MOUSEWHEEL, p);
4098 static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
4100 HTMLElement *This = impl_from_IHTMLElement4(iface);
4101 FIXME("(%p)\n", This);
4102 return E_NOTIMPL;
4105 static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute)
4107 HTMLElement *This = impl_from_IHTMLElement4(iface);
4108 HTMLAttributeCollection *attrs;
4109 HRESULT hres;
4111 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute);
4113 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4114 if(FAILED(hres))
4115 return hres;
4117 hres = IHTMLAttributeCollection2_getNamedItem(&attrs->IHTMLAttributeCollection2_iface, bstrname, ppAttribute);
4118 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4119 return hres;
4122 static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4123 IHTMLDOMAttribute **ppretAttribute)
4125 HTMLElement *This = impl_from_IHTMLElement4(iface);
4126 HTMLDOMAttribute *attr, *iter, *replace = NULL;
4127 HTMLAttributeCollection *attrs;
4128 DISPID dispid;
4129 HRESULT hres;
4131 TRACE("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4133 attr = unsafe_impl_from_IHTMLDOMAttribute(pattr);
4134 if(!attr)
4135 return E_INVALIDARG;
4137 if(attr->elem) {
4138 WARN("Tried to set already attached attribute.\n");
4139 return E_INVALIDARG;
4142 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface,
4143 attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid);
4144 if(FAILED(hres))
4145 return hres;
4147 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4148 if(FAILED(hres))
4149 return hres;
4151 LIST_FOR_EACH_ENTRY(iter, &attrs->attrs, HTMLDOMAttribute, entry) {
4152 if(iter->dispid == dispid) {
4153 replace = iter;
4154 break;
4158 if(replace) {
4159 hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value);
4160 if(FAILED(hres)) {
4161 WARN("could not get attr value: %08x\n", hres);
4162 V_VT(&replace->value) = VT_EMPTY;
4164 if(!replace->name) {
4165 replace->name = attr->name;
4166 attr->name = NULL;
4168 list_add_head(&replace->entry, &attr->entry);
4169 list_remove(&replace->entry);
4170 replace->elem = NULL;
4171 }else {
4172 list_add_tail(&attrs->attrs, &attr->entry);
4175 IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface);
4176 attr->elem = This;
4177 attr->dispid = dispid;
4179 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4181 hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value);
4182 if(FAILED(hres))
4183 WARN("Could not set attribute value: %08x\n", hres);
4184 VariantClear(&attr->value);
4186 *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL;
4187 return S_OK;
4190 static HRESULT WINAPI HTMLElement4_removeAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4191 IHTMLDOMAttribute **ppretAttribute)
4193 HTMLElement *This = impl_from_IHTMLElement4(iface);
4194 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4195 return E_NOTIMPL;
4198 static HRESULT WINAPI HTMLElement4_put_onbeforeactivate(IHTMLElement4 *iface, VARIANT v)
4200 HTMLElement *This = impl_from_IHTMLElement4(iface);
4202 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4204 return set_node_event(&This->node, EVENTID_BEFOREACTIVATE, &v);
4207 static HRESULT WINAPI HTMLElement4_get_onbeforeactivate(IHTMLElement4 *iface, VARIANT *p)
4209 HTMLElement *This = impl_from_IHTMLElement4(iface);
4211 TRACE("(%p)->(%p)\n", This, p);
4213 return get_node_event(&This->node, EVENTID_BEFOREACTIVATE, p);
4216 static HRESULT WINAPI HTMLElement4_put_onfocusin(IHTMLElement4 *iface, VARIANT v)
4218 HTMLElement *This = impl_from_IHTMLElement4(iface);
4220 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4222 return set_node_event(&This->node, EVENTID_FOCUSIN, &v);
4225 static HRESULT WINAPI HTMLElement4_get_onfocusin(IHTMLElement4 *iface, VARIANT *p)
4227 HTMLElement *This = impl_from_IHTMLElement4(iface);
4229 TRACE("(%p)->(%p)\n", This, p);
4231 return get_node_event(&This->node, EVENTID_FOCUSIN, p);
4234 static HRESULT WINAPI HTMLElement4_put_onfocusout(IHTMLElement4 *iface, VARIANT v)
4236 HTMLElement *This = impl_from_IHTMLElement4(iface);
4238 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4240 return set_node_event(&This->node, EVENTID_FOCUSOUT, &v);
4243 static HRESULT WINAPI HTMLElement4_get_onfocusout(IHTMLElement4 *iface, VARIANT *p)
4245 HTMLElement *This = impl_from_IHTMLElement4(iface);
4247 TRACE("(%p)->(%p)\n", This, p);
4249 return get_node_event(&This->node, EVENTID_FOCUSOUT, p);
4252 static const IHTMLElement4Vtbl HTMLElement4Vtbl = {
4253 HTMLElement4_QueryInterface,
4254 HTMLElement4_AddRef,
4255 HTMLElement4_Release,
4256 HTMLElement4_GetTypeInfoCount,
4257 HTMLElement4_GetTypeInfo,
4258 HTMLElement4_GetIDsOfNames,
4259 HTMLElement4_Invoke,
4260 HTMLElement4_put_onmousewheel,
4261 HTMLElement4_get_onmousewheel,
4262 HTMLElement4_normalize,
4263 HTMLElement4_getAttributeNode,
4264 HTMLElement4_setAttributeNode,
4265 HTMLElement4_removeAttributeNode,
4266 HTMLElement4_put_onbeforeactivate,
4267 HTMLElement4_get_onbeforeactivate,
4268 HTMLElement4_put_onfocusin,
4269 HTMLElement4_get_onfocusin,
4270 HTMLElement4_put_onfocusout,
4271 HTMLElement4_get_onfocusout
4274 static inline HTMLElement *impl_from_IHTMLElement6(IHTMLElement6 *iface)
4276 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement6_iface);
4279 static HRESULT WINAPI HTMLElement6_QueryInterface(IHTMLElement6 *iface,
4280 REFIID riid, void **ppv)
4282 HTMLElement *This = impl_from_IHTMLElement6(iface);
4283 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4286 static ULONG WINAPI HTMLElement6_AddRef(IHTMLElement6 *iface)
4288 HTMLElement *This = impl_from_IHTMLElement6(iface);
4289 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4292 static ULONG WINAPI HTMLElement6_Release(IHTMLElement6 *iface)
4294 HTMLElement *This = impl_from_IHTMLElement6(iface);
4295 return IHTMLElement_Release(&This->IHTMLElement_iface);
4298 static HRESULT WINAPI HTMLElement6_GetTypeInfoCount(IHTMLElement6 *iface, UINT *pctinfo)
4300 HTMLElement *This = impl_from_IHTMLElement6(iface);
4301 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4304 static HRESULT WINAPI HTMLElement6_GetTypeInfo(IHTMLElement6 *iface, UINT iTInfo,
4305 LCID lcid, ITypeInfo **ppTInfo)
4307 HTMLElement *This = impl_from_IHTMLElement6(iface);
4308 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4311 static HRESULT WINAPI HTMLElement6_GetIDsOfNames(IHTMLElement6 *iface, REFIID riid,
4312 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4314 HTMLElement *This = impl_from_IHTMLElement6(iface);
4315 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4316 lcid, rgDispId);
4319 static HRESULT WINAPI HTMLElement6_Invoke(IHTMLElement6 *iface, DISPID dispIdMember, REFIID riid,
4320 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4322 HTMLElement *This = impl_from_IHTMLElement6(iface);
4323 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4324 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4327 static HRESULT WINAPI HTMLElement6_getAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *AttributeValue)
4329 HTMLElement *This = impl_from_IHTMLElement6(iface);
4330 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
4331 return E_NOTIMPL;
4334 static HRESULT WINAPI HTMLElement6_setAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4336 HTMLElement *This = impl_from_IHTMLElement6(iface);
4337 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), debugstr_variant(pvarAttributeValue));
4338 return E_NOTIMPL;
4341 static HRESULT WINAPI HTMLElement6_removeAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName)
4343 HTMLElement *This = impl_from_IHTMLElement6(iface);
4344 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName));
4345 return E_NOTIMPL;
4348 static HRESULT WINAPI HTMLElement6_getAttributeNodeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, IHTMLDOMAttribute2 **ppretAttribute)
4350 HTMLElement *This = impl_from_IHTMLElement6(iface);
4351 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), ppretAttribute);
4352 return E_NOTIMPL;
4355 static HRESULT WINAPI HTMLElement6_setAttributeNodeNS(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4357 HTMLElement *This = impl_from_IHTMLElement6(iface);
4358 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4359 return E_NOTIMPL;
4362 static HRESULT WINAPI HTMLElement6_hasAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, VARIANT_BOOL *pfHasAttribute)
4364 HTMLElement *This = impl_from_IHTMLElement6(iface);
4365 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), pfHasAttribute);
4366 return E_NOTIMPL;
4369 static HRESULT WINAPI HTMLElement6_getAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *AttributeValue)
4371 HTMLElement *This = impl_from_IHTMLElement6(iface);
4373 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), AttributeValue);
4375 return IHTMLElement_getAttribute(&This->IHTMLElement_iface, strAttributeName, 0, AttributeValue);
4378 static HRESULT WINAPI HTMLElement6_setAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4380 HTMLElement *This = impl_from_IHTMLElement6(iface);
4382 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), pvarAttributeValue);
4384 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, strAttributeName, *pvarAttributeValue, 0);
4387 static HRESULT WINAPI HTMLElement6_removeAttribute(IHTMLElement6 *iface, BSTR strAttributeName)
4389 HTMLElement *This = impl_from_IHTMLElement6(iface);
4390 VARIANT_BOOL success;
4392 WARN("(%p)->(%s) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName));
4394 return IHTMLElement_removeAttribute(&This->IHTMLElement_iface, strAttributeName, 0, &success);
4397 static HRESULT WINAPI HTMLElement6_getAttributeNode(IHTMLElement6 *iface, BSTR strAttributeName, IHTMLDOMAttribute2 **ppretAttribute)
4399 HTMLElement *This = impl_from_IHTMLElement6(iface);
4400 IHTMLDOMAttribute *attr;
4401 HRESULT hres;
4403 WARN("(%p)->(%s %p) forwarding to IHTMLElement4\n", This, debugstr_w(strAttributeName), ppretAttribute);
4405 hres = IHTMLElement4_getAttributeNode(&This->IHTMLElement4_iface, strAttributeName, &attr);
4406 if(FAILED(hres))
4407 return hres;
4409 if(attr) {
4410 hres = IHTMLDOMAttribute_QueryInterface(attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4411 IHTMLDOMAttribute_Release(attr);
4412 }else {
4413 *ppretAttribute = NULL;
4415 return hres;
4418 static HRESULT WINAPI HTMLElement6_setAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4420 HTMLElement *This = impl_from_IHTMLElement6(iface);
4421 IHTMLDOMAttribute *attr, *ret_attr;
4422 HRESULT hres;
4424 WARN("(%p)->(%p %p) forwarding to IHTMLElement4\n", This, pattr, ppretAttribute);
4426 hres = IHTMLDOMAttribute2_QueryInterface(pattr, &IID_IHTMLDOMAttribute, (void**)&attr);
4427 if(FAILED(hres))
4428 return hres;
4430 hres = IHTMLElement4_setAttributeNode(&This->IHTMLElement4_iface, attr, &ret_attr);
4431 if(FAILED(hres))
4432 return hres;
4434 if(ret_attr) {
4435 hres = IHTMLDOMAttribute_QueryInterface(ret_attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4436 IHTMLDOMAttribute_Release(ret_attr);
4437 }else {
4438 *ppretAttribute = NULL;
4440 return hres;
4443 static HRESULT WINAPI HTMLElement6_removeAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4445 HTMLElement *This = impl_from_IHTMLElement6(iface);
4446 FIXME("(%p)->()\n", This);
4447 return E_NOTIMPL;
4450 static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *pfHasAttribute)
4452 HTMLElement *This = impl_from_IHTMLElement6(iface);
4453 FIXME("(%p)->(%s %p)\n", This, debugstr_w(name), pfHasAttribute);
4454 return E_NOTIMPL;
4457 static HRESULT WINAPI HTMLElement6_getElementsByTagNameNS(IHTMLElement6 *iface, VARIANT *varNS, BSTR bstrLocalName, IHTMLElementCollection **pelColl)
4459 HTMLElement *This = impl_from_IHTMLElement6(iface);
4460 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(varNS), debugstr_w(bstrLocalName), pelColl);
4461 return E_NOTIMPL;
4464 static HRESULT WINAPI HTMLElement6_get_tagName(IHTMLElement6 *iface, BSTR *p)
4466 HTMLElement *This = impl_from_IHTMLElement6(iface);
4468 TRACE("(%p)->(%p)\n", This, p);
4470 return IHTMLElement_get_tagName(&This->IHTMLElement_iface, p);
4473 static HRESULT WINAPI HTMLElement6_get_nodeName(IHTMLElement6 *iface, BSTR *p)
4475 HTMLElement *This = impl_from_IHTMLElement6(iface);
4477 TRACE("(%p)->(%p)\n", This, p);
4479 return IHTMLDOMNode_get_nodeName(&This->node.IHTMLDOMNode_iface, p);
4482 static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, BSTR v, IHTMLElementCollection **pel)
4484 HTMLElement *This = impl_from_IHTMLElement6(iface);
4485 nsIDOMHTMLCollection *nscol = NULL;
4486 nsAString nsstr;
4487 nsresult nsres;
4489 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
4491 if(This->dom_element) {
4492 nsAString_InitDepend(&nsstr, v);
4493 nsres = nsIDOMElement_GetElementsByClassName(This->dom_element, &nsstr, &nscol);
4494 nsAString_Finish(&nsstr);
4495 if(NS_FAILED(nsres)) {
4496 ERR("GetElementsByClassName failed: %08x\n", nsres);
4497 return E_FAIL;
4501 *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
4502 nsIDOMHTMLCollection_Release(nscol);
4503 return S_OK;
4506 static HRESULT WINAPI HTMLElement6_msMatchesSelector(IHTMLElement6 *iface, BSTR v, VARIANT_BOOL *pfMatches)
4508 HTMLElement *This = impl_from_IHTMLElement6(iface);
4509 nsAString nsstr;
4510 cpp_bool b;
4511 nsresult nsres;
4513 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pfMatches);
4515 if(!This->dom_element) {
4516 FIXME("No dom element\n");
4517 return E_UNEXPECTED;
4520 nsAString_InitDepend(&nsstr, v);
4521 nsres = nsIDOMElement_MozMatchesSelector(This->dom_element, &nsstr, &b);
4522 nsAString_Finish(&nsstr);
4523 if(NS_FAILED(nsres)) {
4524 WARN("MozMatchesSelector failed: %08x\n", nsres);
4525 return map_nsresult(nsres);
4528 *pfMatches = b;
4529 return S_OK;
4532 static HRESULT WINAPI HTMLElement6_put_onabort(IHTMLElement6 *iface, VARIANT v)
4534 HTMLElement *This = impl_from_IHTMLElement6(iface);
4536 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4538 return set_node_event(&This->node, EVENTID_ABORT, &v);
4541 static HRESULT WINAPI HTMLElement6_get_onabort(IHTMLElement6 *iface, VARIANT *p)
4543 HTMLElement *This = impl_from_IHTMLElement6(iface);
4545 TRACE("(%p)->(%p)\n", This, p);
4547 return get_node_event(&This->node, EVENTID_ABORT, p);
4550 static HRESULT WINAPI HTMLElement6_put_oncanplay(IHTMLElement6 *iface, VARIANT v)
4552 HTMLElement *This = impl_from_IHTMLElement6(iface);
4553 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4554 return E_NOTIMPL;
4557 static HRESULT WINAPI HTMLElement6_get_oncanplay(IHTMLElement6 *iface, VARIANT *p)
4559 HTMLElement *This = impl_from_IHTMLElement6(iface);
4560 FIXME("(%p)->(%p)\n", This, p);
4561 return E_NOTIMPL;
4564 static HRESULT WINAPI HTMLElement6_put_oncanplaythrough(IHTMLElement6 *iface, VARIANT v)
4566 HTMLElement *This = impl_from_IHTMLElement6(iface);
4567 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4568 return E_NOTIMPL;
4571 static HRESULT WINAPI HTMLElement6_get_oncanplaythrough(IHTMLElement6 *iface, VARIANT *p)
4573 HTMLElement *This = impl_from_IHTMLElement6(iface);
4574 FIXME("(%p)->(%p)\n", This, p);
4575 return E_NOTIMPL;
4578 static HRESULT WINAPI HTMLElement6_put_onchange(IHTMLElement6 *iface, VARIANT v)
4580 HTMLElement *This = impl_from_IHTMLElement6(iface);
4582 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4584 return set_node_event(&This->node, EVENTID_CHANGE, &v);
4587 static HRESULT WINAPI HTMLElement6_get_onchange(IHTMLElement6 *iface, VARIANT *p)
4589 HTMLElement *This = impl_from_IHTMLElement6(iface);
4591 TRACE("(%p)->(%p)\n", This, p);
4593 return get_node_event(&This->node, EVENTID_CHANGE, p);
4596 static HRESULT WINAPI HTMLElement6_put_ondurationchange(IHTMLElement6 *iface, VARIANT v)
4598 HTMLElement *This = impl_from_IHTMLElement6(iface);
4599 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4600 return E_NOTIMPL;
4603 static HRESULT WINAPI HTMLElement6_get_ondurationchange(IHTMLElement6 *iface, VARIANT *p)
4605 HTMLElement *This = impl_from_IHTMLElement6(iface);
4606 FIXME("(%p)->(%p)\n", This, p);
4607 return E_NOTIMPL;
4610 static HRESULT WINAPI HTMLElement6_put_onemptied(IHTMLElement6 *iface, VARIANT v)
4612 HTMLElement *This = impl_from_IHTMLElement6(iface);
4613 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4614 return E_NOTIMPL;
4617 static HRESULT WINAPI HTMLElement6_get_onemptied(IHTMLElement6 *iface, VARIANT *p)
4619 HTMLElement *This = impl_from_IHTMLElement6(iface);
4620 FIXME("(%p)->(%p)\n", This, p);
4621 return E_NOTIMPL;
4624 static HRESULT WINAPI HTMLElement6_put_onended(IHTMLElement6 *iface, VARIANT v)
4626 HTMLElement *This = impl_from_IHTMLElement6(iface);
4627 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4628 return E_NOTIMPL;
4631 static HRESULT WINAPI HTMLElement6_get_onended(IHTMLElement6 *iface, VARIANT *p)
4633 HTMLElement *This = impl_from_IHTMLElement6(iface);
4634 FIXME("(%p)->(%p)\n", This, p);
4635 return E_NOTIMPL;
4638 static HRESULT WINAPI HTMLElement6_put_onerror(IHTMLElement6 *iface, VARIANT v)
4640 HTMLElement *This = impl_from_IHTMLElement6(iface);
4642 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4644 return set_node_event(&This->node, EVENTID_ERROR, &v);
4647 static HRESULT WINAPI HTMLElement6_get_onerror(IHTMLElement6 *iface, VARIANT *p)
4649 HTMLElement *This = impl_from_IHTMLElement6(iface);
4651 TRACE("(%p)->(%p)\n", This, p);
4653 return get_node_event(&This->node, EVENTID_ERROR, p);
4656 static HRESULT WINAPI HTMLElement6_put_oninput(IHTMLElement6 *iface, VARIANT v)
4658 HTMLElement *This = impl_from_IHTMLElement6(iface);
4660 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4662 return set_node_event(&This->node, EVENTID_INPUT, &v);
4665 static HRESULT WINAPI HTMLElement6_get_oninput(IHTMLElement6 *iface, VARIANT *p)
4667 HTMLElement *This = impl_from_IHTMLElement6(iface);
4669 TRACE("(%p)->(%p)\n", This, p);
4671 return get_node_event(&This->node, EVENTID_INPUT, p);
4674 static HRESULT WINAPI HTMLElement6_put_onload(IHTMLElement6 *iface, VARIANT v)
4676 HTMLElement *This = impl_from_IHTMLElement6(iface);
4678 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4680 return set_node_event(&This->node, EVENTID_LOAD, &v);
4683 static HRESULT WINAPI HTMLElement6_get_onload(IHTMLElement6 *iface, VARIANT *p)
4685 HTMLElement *This = impl_from_IHTMLElement6(iface);
4687 TRACE("(%p)->(%p)\n", This, p);
4689 return get_node_event(&This->node, EVENTID_LOAD, p);
4692 static HRESULT WINAPI HTMLElement6_put_onloadeddata(IHTMLElement6 *iface, VARIANT v)
4694 HTMLElement *This = impl_from_IHTMLElement6(iface);
4695 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4696 return E_NOTIMPL;
4699 static HRESULT WINAPI HTMLElement6_get_onloadeddata(IHTMLElement6 *iface, VARIANT *p)
4701 HTMLElement *This = impl_from_IHTMLElement6(iface);
4702 FIXME("(%p)->(%p)\n", This, p);
4703 return E_NOTIMPL;
4706 static HRESULT WINAPI HTMLElement6_put_onloadedmetadata(IHTMLElement6 *iface, VARIANT v)
4708 HTMLElement *This = impl_from_IHTMLElement6(iface);
4709 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4710 return E_NOTIMPL;
4713 static HRESULT WINAPI HTMLElement6_get_onloadedmetadata(IHTMLElement6 *iface, VARIANT *p)
4715 HTMLElement *This = impl_from_IHTMLElement6(iface);
4716 FIXME("(%p)->(%p)\n", This, p);
4717 return E_NOTIMPL;
4720 static HRESULT WINAPI HTMLElement6_put_onloadstart(IHTMLElement6 *iface, VARIANT v)
4722 HTMLElement *This = impl_from_IHTMLElement6(iface);
4723 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4724 return E_NOTIMPL;
4727 static HRESULT WINAPI HTMLElement6_get_onloadstart(IHTMLElement6 *iface, VARIANT *p)
4729 HTMLElement *This = impl_from_IHTMLElement6(iface);
4730 FIXME("(%p)->(%p)\n", This, p);
4731 return E_NOTIMPL;
4734 static HRESULT WINAPI HTMLElement6_put_onpause(IHTMLElement6 *iface, VARIANT v)
4736 HTMLElement *This = impl_from_IHTMLElement6(iface);
4737 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4738 return E_NOTIMPL;
4741 static HRESULT WINAPI HTMLElement6_get_onpause(IHTMLElement6 *iface, VARIANT *p)
4743 HTMLElement *This = impl_from_IHTMLElement6(iface);
4744 FIXME("(%p)->(%p)\n", This, p);
4745 return E_NOTIMPL;
4748 static HRESULT WINAPI HTMLElement6_put_onplay(IHTMLElement6 *iface, VARIANT v)
4750 HTMLElement *This = impl_from_IHTMLElement6(iface);
4751 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4752 return E_NOTIMPL;
4755 static HRESULT WINAPI HTMLElement6_get_onplay(IHTMLElement6 *iface, VARIANT *p)
4757 HTMLElement *This = impl_from_IHTMLElement6(iface);
4758 FIXME("(%p)->(%p)\n", This, p);
4759 return E_NOTIMPL;
4762 static HRESULT WINAPI HTMLElement6_put_onplaying(IHTMLElement6 *iface, VARIANT v)
4764 HTMLElement *This = impl_from_IHTMLElement6(iface);
4765 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4766 return E_NOTIMPL;
4769 static HRESULT WINAPI HTMLElement6_get_onplaying(IHTMLElement6 *iface, VARIANT *p)
4771 HTMLElement *This = impl_from_IHTMLElement6(iface);
4772 FIXME("(%p)->(%p)\n", This, p);
4773 return E_NOTIMPL;
4776 static HRESULT WINAPI HTMLElement6_put_onprogress(IHTMLElement6 *iface, VARIANT v)
4778 HTMLElement *This = impl_from_IHTMLElement6(iface);
4779 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4780 return E_NOTIMPL;
4783 static HRESULT WINAPI HTMLElement6_get_onprogress(IHTMLElement6 *iface, VARIANT *p)
4785 HTMLElement *This = impl_from_IHTMLElement6(iface);
4786 FIXME("(%p)->(%p)\n", This, p);
4787 return E_NOTIMPL;
4790 static HRESULT WINAPI HTMLElement6_put_onratechange(IHTMLElement6 *iface, VARIANT v)
4792 HTMLElement *This = impl_from_IHTMLElement6(iface);
4793 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4794 return E_NOTIMPL;
4797 static HRESULT WINAPI HTMLElement6_get_onratechange(IHTMLElement6 *iface, VARIANT *p)
4799 HTMLElement *This = impl_from_IHTMLElement6(iface);
4800 FIXME("(%p)->(%p)\n", This, p);
4801 return E_NOTIMPL;
4804 static HRESULT WINAPI HTMLElement6_put_onreset(IHTMLElement6 *iface, VARIANT v)
4806 HTMLElement *This = impl_from_IHTMLElement6(iface);
4807 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4808 return E_NOTIMPL;
4811 static HRESULT WINAPI HTMLElement6_get_onreset(IHTMLElement6 *iface, VARIANT *p)
4813 HTMLElement *This = impl_from_IHTMLElement6(iface);
4814 FIXME("(%p)->(%p)\n", This, p);
4815 return E_NOTIMPL;
4818 static HRESULT WINAPI HTMLElement6_put_onseeked(IHTMLElement6 *iface, VARIANT v)
4820 HTMLElement *This = impl_from_IHTMLElement6(iface);
4821 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4822 return E_NOTIMPL;
4825 static HRESULT WINAPI HTMLElement6_get_onseeked(IHTMLElement6 *iface, VARIANT *p)
4827 HTMLElement *This = impl_from_IHTMLElement6(iface);
4828 FIXME("(%p)->(%p)\n", This, p);
4829 return E_NOTIMPL;
4832 static HRESULT WINAPI HTMLElement6_put_onseeking(IHTMLElement6 *iface, VARIANT v)
4834 HTMLElement *This = impl_from_IHTMLElement6(iface);
4835 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4836 return E_NOTIMPL;
4839 static HRESULT WINAPI HTMLElement6_get_onseeking(IHTMLElement6 *iface, VARIANT *p)
4841 HTMLElement *This = impl_from_IHTMLElement6(iface);
4842 FIXME("(%p)->(%p)\n", This, p);
4843 return E_NOTIMPL;
4846 static HRESULT WINAPI HTMLElement6_put_onselect(IHTMLElement6 *iface, VARIANT v)
4848 HTMLElement *This = impl_from_IHTMLElement6(iface);
4849 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4850 return E_NOTIMPL;
4853 static HRESULT WINAPI HTMLElement6_get_onselect(IHTMLElement6 *iface, VARIANT *p)
4855 HTMLElement *This = impl_from_IHTMLElement6(iface);
4856 FIXME("(%p)->(%p)\n", This, p);
4857 return E_NOTIMPL;
4860 static HRESULT WINAPI HTMLElement6_put_onstalled(IHTMLElement6 *iface, VARIANT v)
4862 HTMLElement *This = impl_from_IHTMLElement6(iface);
4863 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4864 return E_NOTIMPL;
4867 static HRESULT WINAPI HTMLElement6_get_onstalled(IHTMLElement6 *iface, VARIANT *p)
4869 HTMLElement *This = impl_from_IHTMLElement6(iface);
4870 FIXME("(%p)->(%p)\n", This, p);
4871 return E_NOTIMPL;
4874 static HRESULT WINAPI HTMLElement6_put_onsubmit(IHTMLElement6 *iface, VARIANT v)
4876 HTMLElement *This = impl_from_IHTMLElement6(iface);
4878 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4880 return set_node_event(&This->node, EVENTID_SUBMIT, &v);
4883 static HRESULT WINAPI HTMLElement6_get_onsubmit(IHTMLElement6 *iface, VARIANT *p)
4885 HTMLElement *This = impl_from_IHTMLElement6(iface);
4887 TRACE("(%p)->(%p)\n", This, p);
4889 return get_node_event(&This->node, EVENTID_SUBMIT, p);
4892 static HRESULT WINAPI HTMLElement6_put_onsuspend(IHTMLElement6 *iface, VARIANT v)
4894 HTMLElement *This = impl_from_IHTMLElement6(iface);
4895 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4896 return E_NOTIMPL;
4899 static HRESULT WINAPI HTMLElement6_get_onsuspend(IHTMLElement6 *iface, VARIANT *p)
4901 HTMLElement *This = impl_from_IHTMLElement6(iface);
4902 FIXME("(%p)->(%p)\n", This, p);
4903 return E_NOTIMPL;
4906 static HRESULT WINAPI HTMLElement6_put_ontimeupdate(IHTMLElement6 *iface, VARIANT v)
4908 HTMLElement *This = impl_from_IHTMLElement6(iface);
4909 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4910 return E_NOTIMPL;
4913 static HRESULT WINAPI HTMLElement6_get_ontimeupdate(IHTMLElement6 *iface, VARIANT *p)
4915 HTMLElement *This = impl_from_IHTMLElement6(iface);
4916 FIXME("(%p)->(%p)\n", This, p);
4917 return E_NOTIMPL;
4920 static HRESULT WINAPI HTMLElement6_put_onvolumechange(IHTMLElement6 *iface, VARIANT v)
4922 HTMLElement *This = impl_from_IHTMLElement6(iface);
4923 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4924 return E_NOTIMPL;
4927 static HRESULT WINAPI HTMLElement6_get_onvolumechange(IHTMLElement6 *iface, VARIANT *p)
4929 HTMLElement *This = impl_from_IHTMLElement6(iface);
4930 FIXME("(%p)->(%p)\n", This, p);
4931 return E_NOTIMPL;
4934 static HRESULT WINAPI HTMLElement6_put_onwaiting(IHTMLElement6 *iface, VARIANT v)
4936 HTMLElement *This = impl_from_IHTMLElement6(iface);
4937 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4938 return E_NOTIMPL;
4941 static HRESULT WINAPI HTMLElement6_get_onwaiting(IHTMLElement6 *iface, VARIANT *p)
4943 HTMLElement *This = impl_from_IHTMLElement6(iface);
4944 FIXME("(%p)->(%p)\n", This, p);
4945 return E_NOTIMPL;
4948 static HRESULT WINAPI HTMLElement6_hasAttributes(IHTMLElement6 *iface, VARIANT_BOOL *pfHasAttributes)
4950 HTMLElement *This = impl_from_IHTMLElement6(iface);
4951 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
4952 return E_NOTIMPL;
4955 static const IHTMLElement6Vtbl HTMLElement6Vtbl = {
4956 HTMLElement6_QueryInterface,
4957 HTMLElement6_AddRef,
4958 HTMLElement6_Release,
4959 HTMLElement6_GetTypeInfoCount,
4960 HTMLElement6_GetTypeInfo,
4961 HTMLElement6_GetIDsOfNames,
4962 HTMLElement6_Invoke,
4963 HTMLElement6_getAttributeNS,
4964 HTMLElement6_setAttributeNS,
4965 HTMLElement6_removeAttributeNS,
4966 HTMLElement6_getAttributeNodeNS,
4967 HTMLElement6_setAttributeNodeNS,
4968 HTMLElement6_hasAttributeNS,
4969 HTMLElement6_getAttribute,
4970 HTMLElement6_setAttribute,
4971 HTMLElement6_removeAttribute,
4972 HTMLElement6_getAttributeNode,
4973 HTMLElement6_setAttributeNode,
4974 HTMLElement6_removeAttributeNode,
4975 HTMLElement6_hasAttribute,
4976 HTMLElement6_getElementsByTagNameNS,
4977 HTMLElement6_get_tagName,
4978 HTMLElement6_get_nodeName,
4979 HTMLElement6_getElementsByClassName,
4980 HTMLElement6_msMatchesSelector,
4981 HTMLElement6_put_onabort,
4982 HTMLElement6_get_onabort,
4983 HTMLElement6_put_oncanplay,
4984 HTMLElement6_get_oncanplay,
4985 HTMLElement6_put_oncanplaythrough,
4986 HTMLElement6_get_oncanplaythrough,
4987 HTMLElement6_put_onchange,
4988 HTMLElement6_get_onchange,
4989 HTMLElement6_put_ondurationchange,
4990 HTMLElement6_get_ondurationchange,
4991 HTMLElement6_put_onemptied,
4992 HTMLElement6_get_onemptied,
4993 HTMLElement6_put_onended,
4994 HTMLElement6_get_onended,
4995 HTMLElement6_put_onerror,
4996 HTMLElement6_get_onerror,
4997 HTMLElement6_put_oninput,
4998 HTMLElement6_get_oninput,
4999 HTMLElement6_put_onload,
5000 HTMLElement6_get_onload,
5001 HTMLElement6_put_onloadeddata,
5002 HTMLElement6_get_onloadeddata,
5003 HTMLElement6_put_onloadedmetadata,
5004 HTMLElement6_get_onloadedmetadata,
5005 HTMLElement6_put_onloadstart,
5006 HTMLElement6_get_onloadstart,
5007 HTMLElement6_put_onpause,
5008 HTMLElement6_get_onpause,
5009 HTMLElement6_put_onplay,
5010 HTMLElement6_get_onplay,
5011 HTMLElement6_put_onplaying,
5012 HTMLElement6_get_onplaying,
5013 HTMLElement6_put_onprogress,
5014 HTMLElement6_get_onprogress,
5015 HTMLElement6_put_onratechange,
5016 HTMLElement6_get_onratechange,
5017 HTMLElement6_put_onreset,
5018 HTMLElement6_get_onreset,
5019 HTMLElement6_put_onseeked,
5020 HTMLElement6_get_onseeked,
5021 HTMLElement6_put_onseeking,
5022 HTMLElement6_get_onseeking,
5023 HTMLElement6_put_onselect,
5024 HTMLElement6_get_onselect,
5025 HTMLElement6_put_onstalled,
5026 HTMLElement6_get_onstalled,
5027 HTMLElement6_put_onsubmit,
5028 HTMLElement6_get_onsubmit,
5029 HTMLElement6_put_onsuspend,
5030 HTMLElement6_get_onsuspend,
5031 HTMLElement6_put_ontimeupdate,
5032 HTMLElement6_get_ontimeupdate,
5033 HTMLElement6_put_onvolumechange,
5034 HTMLElement6_get_onvolumechange,
5035 HTMLElement6_put_onwaiting,
5036 HTMLElement6_get_onwaiting,
5037 HTMLElement6_hasAttributes
5040 static inline HTMLElement *impl_from_IHTMLElement7(IHTMLElement7 *iface)
5042 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement7_iface);
5045 static HRESULT WINAPI HTMLElement7_QueryInterface(IHTMLElement7 *iface,
5046 REFIID riid, void **ppv)
5048 HTMLElement *This = impl_from_IHTMLElement7(iface);
5049 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5052 static ULONG WINAPI HTMLElement7_AddRef(IHTMLElement7 *iface)
5054 HTMLElement *This = impl_from_IHTMLElement7(iface);
5055 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5058 static ULONG WINAPI HTMLElement7_Release(IHTMLElement7 *iface)
5060 HTMLElement *This = impl_from_IHTMLElement7(iface);
5061 return IHTMLElement_Release(&This->IHTMLElement_iface);
5064 static HRESULT WINAPI HTMLElement7_GetTypeInfoCount(IHTMLElement7 *iface, UINT *pctinfo)
5066 HTMLElement *This = impl_from_IHTMLElement7(iface);
5067 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5070 static HRESULT WINAPI HTMLElement7_GetTypeInfo(IHTMLElement7 *iface, UINT iTInfo,
5071 LCID lcid, ITypeInfo **ppTInfo)
5073 HTMLElement *This = impl_from_IHTMLElement7(iface);
5074 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5077 static HRESULT WINAPI HTMLElement7_GetIDsOfNames(IHTMLElement7 *iface, REFIID riid,
5078 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5080 HTMLElement *This = impl_from_IHTMLElement7(iface);
5081 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5082 lcid, rgDispId);
5085 static HRESULT WINAPI HTMLElement7_Invoke(IHTMLElement7 *iface, DISPID dispIdMember, REFIID riid,
5086 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5088 HTMLElement *This = impl_from_IHTMLElement7(iface);
5089 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5090 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5093 static HRESULT WINAPI HTMLElement7_put_onmspointerdown(IHTMLElement7 *iface, VARIANT v)
5095 HTMLElement *This = impl_from_IHTMLElement7(iface);
5096 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5097 return E_NOTIMPL;
5100 static HRESULT WINAPI HTMLElement7_get_onmspointerdown(IHTMLElement7 *iface, VARIANT *p)
5102 HTMLElement *This = impl_from_IHTMLElement7(iface);
5103 FIXME("(%p)->(%p)\n", This, p);
5104 return E_NOTIMPL;
5107 static HRESULT WINAPI HTMLElement7_put_onmspointermove(IHTMLElement7 *iface, VARIANT v)
5109 HTMLElement *This = impl_from_IHTMLElement7(iface);
5110 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5111 return E_NOTIMPL;
5114 static HRESULT WINAPI HTMLElement7_get_onmspointermove(IHTMLElement7 *iface, VARIANT *p)
5116 HTMLElement *This = impl_from_IHTMLElement7(iface);
5117 FIXME("(%p)->(%p)\n", This, p);
5118 return E_NOTIMPL;
5121 static HRESULT WINAPI HTMLElement7_put_onmspointerup(IHTMLElement7 *iface, VARIANT v)
5123 HTMLElement *This = impl_from_IHTMLElement7(iface);
5124 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5125 return E_NOTIMPL;
5128 static HRESULT WINAPI HTMLElement7_get_onmspointerup(IHTMLElement7 *iface, VARIANT *p)
5130 HTMLElement *This = impl_from_IHTMLElement7(iface);
5131 FIXME("(%p)->(%p)\n", This, p);
5132 return E_NOTIMPL;
5135 static HRESULT WINAPI HTMLElement7_put_onmspointerover(IHTMLElement7 *iface, VARIANT v)
5137 HTMLElement *This = impl_from_IHTMLElement7(iface);
5138 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5139 return E_NOTIMPL;
5142 static HRESULT WINAPI HTMLElement7_get_onmspointerover(IHTMLElement7 *iface, VARIANT *p)
5144 HTMLElement *This = impl_from_IHTMLElement7(iface);
5145 FIXME("(%p)->(%p)\n", This, p);
5146 return E_NOTIMPL;
5149 static HRESULT WINAPI HTMLElement7_put_onmspointerout(IHTMLElement7 *iface, VARIANT v)
5151 HTMLElement *This = impl_from_IHTMLElement7(iface);
5152 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5153 return E_NOTIMPL;
5156 static HRESULT WINAPI HTMLElement7_get_onmspointerout(IHTMLElement7 *iface, VARIANT *p)
5158 HTMLElement *This = impl_from_IHTMLElement7(iface);
5159 FIXME("(%p)->(%p)\n", This, p);
5160 return E_NOTIMPL;
5163 static HRESULT WINAPI HTMLElement7_put_onmspointercancel(IHTMLElement7 *iface, VARIANT v)
5165 HTMLElement *This = impl_from_IHTMLElement7(iface);
5166 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5167 return E_NOTIMPL;
5170 static HRESULT WINAPI HTMLElement7_get_onmspointercancel(IHTMLElement7 *iface, VARIANT *p)
5172 HTMLElement *This = impl_from_IHTMLElement7(iface);
5173 FIXME("(%p)->(%p)\n", This, p);
5174 return E_NOTIMPL;
5177 static HRESULT WINAPI HTMLElement7_put_onmspointerhover(IHTMLElement7 *iface, VARIANT v)
5179 HTMLElement *This = impl_from_IHTMLElement7(iface);
5180 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5181 return E_NOTIMPL;
5184 static HRESULT WINAPI HTMLElement7_get_onmspointerhover(IHTMLElement7 *iface, VARIANT *p)
5186 HTMLElement *This = impl_from_IHTMLElement7(iface);
5187 FIXME("(%p)->(%p)\n", This, p);
5188 return E_NOTIMPL;
5191 static HRESULT WINAPI HTMLElement7_put_onmslostpointercapture(IHTMLElement7 *iface, VARIANT v)
5193 HTMLElement *This = impl_from_IHTMLElement7(iface);
5194 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5195 return E_NOTIMPL;
5198 static HRESULT WINAPI HTMLElement7_get_onmslostpointercapture(IHTMLElement7 *iface, VARIANT *p)
5200 HTMLElement *This = impl_from_IHTMLElement7(iface);
5201 FIXME("(%p)->(%p)\n", This, p);
5202 return E_NOTIMPL;
5205 static HRESULT WINAPI HTMLElement7_put_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT v)
5207 HTMLElement *This = impl_from_IHTMLElement7(iface);
5208 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5209 return E_NOTIMPL;
5212 static HRESULT WINAPI HTMLElement7_get_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT *p)
5214 HTMLElement *This = impl_from_IHTMLElement7(iface);
5215 FIXME("(%p)->(%p)\n", This, p);
5216 return E_NOTIMPL;
5219 static HRESULT WINAPI HTMLElement7_put_onmsgesturestart(IHTMLElement7 *iface, VARIANT v)
5221 HTMLElement *This = impl_from_IHTMLElement7(iface);
5222 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5223 return E_NOTIMPL;
5226 static HRESULT WINAPI HTMLElement7_get_onmsgesturestart(IHTMLElement7 *iface, VARIANT *p)
5228 HTMLElement *This = impl_from_IHTMLElement7(iface);
5229 FIXME("(%p)->(%p)\n", This, p);
5230 return E_NOTIMPL;
5233 static HRESULT WINAPI HTMLElement7_put_onmsgesturechange(IHTMLElement7 *iface, VARIANT v)
5235 HTMLElement *This = impl_from_IHTMLElement7(iface);
5236 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5237 return E_NOTIMPL;
5240 static HRESULT WINAPI HTMLElement7_get_onmsgesturechange(IHTMLElement7 *iface, VARIANT *p)
5242 HTMLElement *This = impl_from_IHTMLElement7(iface);
5243 FIXME("(%p)->(%p)\n", This, p);
5244 return E_NOTIMPL;
5247 static HRESULT WINAPI HTMLElement7_put_onmsgestureend(IHTMLElement7 *iface, VARIANT v)
5249 HTMLElement *This = impl_from_IHTMLElement7(iface);
5250 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5251 return E_NOTIMPL;
5254 static HRESULT WINAPI HTMLElement7_get_onmsgestureend(IHTMLElement7 *iface, VARIANT *p)
5256 HTMLElement *This = impl_from_IHTMLElement7(iface);
5257 FIXME("(%p)->(%p)\n", This, p);
5258 return E_NOTIMPL;
5261 static HRESULT WINAPI HTMLElement7_put_onmsgesturehold(IHTMLElement7 *iface, VARIANT v)
5263 HTMLElement *This = impl_from_IHTMLElement7(iface);
5264 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5265 return E_NOTIMPL;
5268 static HRESULT WINAPI HTMLElement7_get_onmsgesturehold(IHTMLElement7 *iface, VARIANT *p)
5270 HTMLElement *This = impl_from_IHTMLElement7(iface);
5271 FIXME("(%p)->(%p)\n", This, p);
5272 return E_NOTIMPL;
5275 static HRESULT WINAPI HTMLElement7_put_onmsgesturetap(IHTMLElement7 *iface, VARIANT v)
5277 HTMLElement *This = impl_from_IHTMLElement7(iface);
5278 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5279 return E_NOTIMPL;
5282 static HRESULT WINAPI HTMLElement7_get_onmsgesturetap(IHTMLElement7 *iface, VARIANT *p)
5284 HTMLElement *This = impl_from_IHTMLElement7(iface);
5285 FIXME("(%p)->(%p)\n", This, p);
5286 return E_NOTIMPL;
5289 static HRESULT WINAPI HTMLElement7_put_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT v)
5291 HTMLElement *This = impl_from_IHTMLElement7(iface);
5292 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5293 return E_NOTIMPL;
5296 static HRESULT WINAPI HTMLElement7_get_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT *p)
5298 HTMLElement *This = impl_from_IHTMLElement7(iface);
5299 FIXME("(%p)->(%p)\n", This, p);
5300 return E_NOTIMPL;
5303 static HRESULT WINAPI HTMLElement7_put_onmsinertiastart(IHTMLElement7 *iface, VARIANT v)
5305 HTMLElement *This = impl_from_IHTMLElement7(iface);
5306 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5307 return E_NOTIMPL;
5310 static HRESULT WINAPI HTMLElement7_get_onmsinertiastart(IHTMLElement7 *iface, VARIANT *p)
5312 HTMLElement *This = impl_from_IHTMLElement7(iface);
5313 FIXME("(%p)->(%p)\n", This, p);
5314 return E_NOTIMPL;
5317 static HRESULT WINAPI HTMLElement7_msSetPointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5319 HTMLElement *This = impl_from_IHTMLElement7(iface);
5320 FIXME("(%p)->(%d)\n", This, pointer_id);
5321 return E_NOTIMPL;
5324 static HRESULT WINAPI HTMLElement7_msReleasePointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5326 HTMLElement *This = impl_from_IHTMLElement7(iface);
5327 FIXME("(%p)->(%d)\n", This, pointer_id);
5328 return E_NOTIMPL;
5331 static HRESULT WINAPI HTMLElement7_put_onmstransitionstart(IHTMLElement7 *iface, VARIANT v)
5333 HTMLElement *This = impl_from_IHTMLElement7(iface);
5334 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5335 return E_NOTIMPL;
5338 static HRESULT WINAPI HTMLElement7_get_onmstransitionstart(IHTMLElement7 *iface, VARIANT *p)
5340 HTMLElement *This = impl_from_IHTMLElement7(iface);
5341 FIXME("(%p)->(%p)\n", This, p);
5342 return E_NOTIMPL;
5345 static HRESULT WINAPI HTMLElement7_put_onmstransitionend(IHTMLElement7 *iface, VARIANT v)
5347 HTMLElement *This = impl_from_IHTMLElement7(iface);
5348 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5349 return E_NOTIMPL;
5352 static HRESULT WINAPI HTMLElement7_get_onmstransitionend(IHTMLElement7 *iface, VARIANT *p)
5354 HTMLElement *This = impl_from_IHTMLElement7(iface);
5355 FIXME("(%p)->(%p)\n", This, p);
5356 return E_NOTIMPL;
5359 static HRESULT WINAPI HTMLElement7_put_onmsanimationstart(IHTMLElement7 *iface, VARIANT v)
5361 HTMLElement *This = impl_from_IHTMLElement7(iface);
5362 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5363 return E_NOTIMPL;
5366 static HRESULT WINAPI HTMLElement7_get_onmsanimationstart(IHTMLElement7 *iface, VARIANT *p)
5368 HTMLElement *This = impl_from_IHTMLElement7(iface);
5369 FIXME("(%p)->(%p)\n", This, p);
5370 return E_NOTIMPL;
5373 static HRESULT WINAPI HTMLElement7_put_onmsanimationend(IHTMLElement7 *iface, VARIANT v)
5375 HTMLElement *This = impl_from_IHTMLElement7(iface);
5376 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5377 return E_NOTIMPL;
5380 static HRESULT WINAPI HTMLElement7_get_onmsanimationend(IHTMLElement7 *iface, VARIANT *p)
5382 HTMLElement *This = impl_from_IHTMLElement7(iface);
5383 FIXME("(%p)->(%p)\n", This, p);
5384 return E_NOTIMPL;
5387 static HRESULT WINAPI HTMLElement7_put_onmsanimationiteration(IHTMLElement7 *iface, VARIANT v)
5389 HTMLElement *This = impl_from_IHTMLElement7(iface);
5390 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5391 return E_NOTIMPL;
5394 static HRESULT WINAPI HTMLElement7_get_onmsanimationiteration(IHTMLElement7 *iface, VARIANT *p)
5396 HTMLElement *This = impl_from_IHTMLElement7(iface);
5397 FIXME("(%p)->(%p)\n", This, p);
5398 return E_NOTIMPL;
5401 static HRESULT WINAPI HTMLElement7_put_oninvalid(IHTMLElement7 *iface, VARIANT v)
5403 HTMLElement *This = impl_from_IHTMLElement7(iface);
5404 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5405 return E_NOTIMPL;
5408 static HRESULT WINAPI HTMLElement7_get_oninvalid(IHTMLElement7 *iface, VARIANT *p)
5410 HTMLElement *This = impl_from_IHTMLElement7(iface);
5411 FIXME("(%p)->(%p)\n", This, p);
5412 return E_NOTIMPL;
5415 static HRESULT WINAPI HTMLElement7_put_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR v)
5417 HTMLElement *This = impl_from_IHTMLElement7(iface);
5418 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
5419 return E_NOTIMPL;
5422 static HRESULT WINAPI HTMLElement7_get_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR *p)
5424 HTMLElement *This = impl_from_IHTMLElement7(iface);
5425 FIXME("(%p)->(%p)\n", This, p);
5426 return E_NOTIMPL;
5429 static HRESULT WINAPI HTMLElement7_put_spellcheck(IHTMLElement7 *iface, VARIANT v)
5431 HTMLElement *This = impl_from_IHTMLElement7(iface);
5433 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5435 if(!This->html_element) {
5436 FIXME("non-HTML element\n");
5437 return E_NOTIMPL;
5440 if(V_VT(&v) != VT_BOOL) {
5441 FIXME("unsupported argument %s\n", debugstr_variant(&v));
5442 return E_NOTIMPL;
5445 return map_nsresult(nsIDOMHTMLElement_SetSpellcheck(This->html_element, !!V_BOOL(&v)));
5448 static HRESULT WINAPI HTMLElement7_get_spellcheck(IHTMLElement7 *iface, VARIANT *p)
5450 HTMLElement *This = impl_from_IHTMLElement7(iface);
5451 cpp_bool spellcheck;
5452 nsresult nsres;
5454 TRACE("(%p)->(%p)\n", This, p);
5456 if(!This->html_element) {
5457 FIXME("non-HTML element\n");
5458 return E_NOTIMPL;
5461 nsres = nsIDOMHTMLElement_GetSpellcheck(This->html_element, &spellcheck);
5462 if(NS_FAILED(nsres))
5463 return map_nsresult(nsres);
5465 V_VT(p) = VT_BOOL;
5466 V_BOOL(p) = spellcheck ? VARIANT_TRUE : VARIANT_FALSE;
5467 return S_OK;
5470 static HRESULT WINAPI HTMLElement7_put_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT v)
5472 HTMLElement *This = impl_from_IHTMLElement7(iface);
5473 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5474 return E_NOTIMPL;
5477 static HRESULT WINAPI HTMLElement7_get_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT *p)
5479 HTMLElement *This = impl_from_IHTMLElement7(iface);
5480 FIXME("(%p)->(%p)\n", This, p);
5481 return E_NOTIMPL;
5484 static HRESULT WINAPI HTMLElement7_put_oncuechange(IHTMLElement7 *iface, VARIANT v)
5486 HTMLElement *This = impl_from_IHTMLElement7(iface);
5487 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5488 return E_NOTIMPL;
5491 static HRESULT WINAPI HTMLElement7_get_oncuechange(IHTMLElement7 *iface, VARIANT *p)
5493 HTMLElement *This = impl_from_IHTMLElement7(iface);
5494 FIXME("(%p)->(%p)\n", This, p);
5495 return E_NOTIMPL;
5498 static const IHTMLElement7Vtbl HTMLElement7Vtbl = {
5499 HTMLElement7_QueryInterface,
5500 HTMLElement7_AddRef,
5501 HTMLElement7_Release,
5502 HTMLElement7_GetTypeInfoCount,
5503 HTMLElement7_GetTypeInfo,
5504 HTMLElement7_GetIDsOfNames,
5505 HTMLElement7_Invoke,
5506 HTMLElement7_put_onmspointerdown,
5507 HTMLElement7_get_onmspointerdown,
5508 HTMLElement7_put_onmspointermove,
5509 HTMLElement7_get_onmspointermove,
5510 HTMLElement7_put_onmspointerup,
5511 HTMLElement7_get_onmspointerup,
5512 HTMLElement7_put_onmspointerover,
5513 HTMLElement7_get_onmspointerover,
5514 HTMLElement7_put_onmspointerout,
5515 HTMLElement7_get_onmspointerout,
5516 HTMLElement7_put_onmspointercancel,
5517 HTMLElement7_get_onmspointercancel,
5518 HTMLElement7_put_onmspointerhover,
5519 HTMLElement7_get_onmspointerhover,
5520 HTMLElement7_put_onmslostpointercapture,
5521 HTMLElement7_get_onmslostpointercapture,
5522 HTMLElement7_put_onmsgotpointercapture,
5523 HTMLElement7_get_onmsgotpointercapture,
5524 HTMLElement7_put_onmsgesturestart,
5525 HTMLElement7_get_onmsgesturestart,
5526 HTMLElement7_put_onmsgesturechange,
5527 HTMLElement7_get_onmsgesturechange,
5528 HTMLElement7_put_onmsgestureend,
5529 HTMLElement7_get_onmsgestureend,
5530 HTMLElement7_put_onmsgesturehold,
5531 HTMLElement7_get_onmsgesturehold,
5532 HTMLElement7_put_onmsgesturetap,
5533 HTMLElement7_get_onmsgesturetap,
5534 HTMLElement7_put_onmsgesturedoubletap,
5535 HTMLElement7_get_onmsgesturedoubletap,
5536 HTMLElement7_put_onmsinertiastart,
5537 HTMLElement7_get_onmsinertiastart,
5538 HTMLElement7_msSetPointerCapture,
5539 HTMLElement7_msReleasePointerCapture,
5540 HTMLElement7_put_onmstransitionstart,
5541 HTMLElement7_get_onmstransitionstart,
5542 HTMLElement7_put_onmstransitionend,
5543 HTMLElement7_get_onmstransitionend,
5544 HTMLElement7_put_onmsanimationstart,
5545 HTMLElement7_get_onmsanimationstart,
5546 HTMLElement7_put_onmsanimationend,
5547 HTMLElement7_get_onmsanimationend,
5548 HTMLElement7_put_onmsanimationiteration,
5549 HTMLElement7_get_onmsanimationiteration,
5550 HTMLElement7_put_oninvalid,
5551 HTMLElement7_get_oninvalid,
5552 HTMLElement7_put_xmsAcceleratorKey,
5553 HTMLElement7_get_xmsAcceleratorKey,
5554 HTMLElement7_put_spellcheck,
5555 HTMLElement7_get_spellcheck,
5556 HTMLElement7_put_onmsmanipulationstatechanged,
5557 HTMLElement7_get_onmsmanipulationstatechanged,
5558 HTMLElement7_put_oncuechange,
5559 HTMLElement7_get_oncuechange
5563 static inline HTMLElement *impl_from_IHTMLUniqueName(IHTMLUniqueName *iface)
5565 return CONTAINING_RECORD(iface, HTMLElement, IHTMLUniqueName_iface);
5568 static HRESULT WINAPI HTMLUniqueName_QueryInterface(IHTMLUniqueName *iface, REFIID riid, void **ppv)
5570 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5571 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5574 static ULONG WINAPI HTMLUniqueName_AddRef(IHTMLUniqueName *iface)
5576 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5577 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5580 static ULONG WINAPI HTMLUniqueName_Release(IHTMLUniqueName *iface)
5582 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5583 return IHTMLElement_Release(&This->IHTMLElement_iface);
5586 static HRESULT WINAPI HTMLUniqueName_GetTypeInfoCount(IHTMLUniqueName *iface, UINT *pctinfo)
5588 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5589 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5592 static HRESULT WINAPI HTMLUniqueName_GetTypeInfo(IHTMLUniqueName *iface, UINT iTInfo,
5593 LCID lcid, ITypeInfo **ppTInfo)
5595 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5596 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5599 static HRESULT WINAPI HTMLUniqueName_GetIDsOfNames(IHTMLUniqueName *iface, REFIID riid,
5600 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5602 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5603 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5604 lcid, rgDispId);
5607 static HRESULT WINAPI HTMLUniqueName_Invoke(IHTMLUniqueName *iface, DISPID dispIdMember, REFIID riid,
5608 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5610 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5611 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5612 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5615 HRESULT elem_unique_id(unsigned id, BSTR *p)
5617 WCHAR buf[32];
5619 swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
5620 *p = SysAllocString(buf);
5621 return *p ? S_OK : E_OUTOFMEMORY;
5624 static void ensure_unique_id(HTMLElement *elem)
5626 if(!elem->unique_id)
5627 elem->unique_id = ++elem->node.doc->unique_id;
5630 static HRESULT WINAPI HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName *iface, LONG *p)
5632 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5634 TRACE("(%p)->(%p)\n", This, p);
5636 ensure_unique_id(This);
5637 *p = This->unique_id;
5638 return S_OK;
5641 static HRESULT WINAPI HTMLUniqueName_get_uniqueID(IHTMLUniqueName *iface, BSTR *p)
5643 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5645 TRACE("(%p)->(%p)\n", This, p);
5647 ensure_unique_id(This);
5648 return elem_unique_id(This->unique_id, p);
5651 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl = {
5652 HTMLUniqueName_QueryInterface,
5653 HTMLUniqueName_AddRef,
5654 HTMLUniqueName_Release,
5655 HTMLUniqueName_GetTypeInfoCount,
5656 HTMLUniqueName_GetTypeInfo,
5657 HTMLUniqueName_GetIDsOfNames,
5658 HTMLUniqueName_Invoke,
5659 HTMLUniqueName_get_uniqueNumber,
5660 HTMLUniqueName_get_uniqueID
5663 static inline HTMLElement *impl_from_IElementSelector(IElementSelector *iface)
5665 return CONTAINING_RECORD(iface, HTMLElement, IElementSelector_iface);
5668 static HRESULT WINAPI ElementSelector_QueryInterface(IElementSelector *iface, REFIID riid, void **ppv)
5670 HTMLElement *This = impl_from_IElementSelector(iface);
5671 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5674 static ULONG WINAPI ElementSelector_AddRef(IElementSelector *iface)
5676 HTMLElement *This = impl_from_IElementSelector(iface);
5677 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5680 static ULONG WINAPI ElementSelector_Release(IElementSelector *iface)
5682 HTMLElement *This = impl_from_IElementSelector(iface);
5683 return IHTMLElement_Release(&This->IHTMLElement_iface);
5686 static HRESULT WINAPI ElementSelector_GetTypeInfoCount(IElementSelector *iface, UINT *pctinfo)
5688 HTMLElement *This = impl_from_IElementSelector(iface);
5689 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5692 static HRESULT WINAPI ElementSelector_GetTypeInfo(IElementSelector *iface, UINT iTInfo,
5693 LCID lcid, ITypeInfo **ppTInfo)
5695 HTMLElement *This = impl_from_IElementSelector(iface);
5696 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5699 static HRESULT WINAPI ElementSelector_GetIDsOfNames(IElementSelector *iface, REFIID riid,
5700 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5702 HTMLElement *This = impl_from_IElementSelector(iface);
5703 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
5706 static HRESULT WINAPI ElementSelector_Invoke(IElementSelector *iface, DISPID dispIdMember, REFIID riid,
5707 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5709 HTMLElement *This = impl_from_IElementSelector(iface);
5710 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
5711 pDispParams, pVarResult, pExcepInfo, puArgErr);
5714 static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BSTR v, IHTMLElement **pel)
5716 HTMLElement *This = impl_from_IElementSelector(iface);
5717 nsIDOMElement *nselem;
5718 HTMLElement *elem;
5719 nsAString nsstr;
5720 nsresult nsres;
5721 HRESULT hres;
5723 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5725 if(!This->dom_element) {
5726 FIXME("comment element\n");
5727 return E_NOTIMPL;
5730 nsAString_InitDepend(&nsstr, v);
5731 nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
5732 nsAString_Finish(&nsstr);
5733 if(NS_FAILED(nsres)) {
5734 ERR("QuerySelector failed: %08x\n", nsres);
5735 return E_FAIL;
5738 if(!nselem) {
5739 *pel = NULL;
5740 return S_OK;
5743 hres = get_element(nselem, &elem);
5744 nsIDOMElement_Release(nselem);
5745 if(FAILED(hres))
5746 return hres;
5748 *pel = &elem->IHTMLElement_iface;
5749 return S_OK;
5752 static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, BSTR v, IHTMLDOMChildrenCollection **pel)
5754 HTMLElement *This = impl_from_IElementSelector(iface);
5755 nsIDOMNodeList *node_list;
5756 nsAString nsstr;
5757 HRESULT hres;
5759 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5761 if(!This->dom_element) {
5762 FIXME("comment element\n");
5763 return E_NOTIMPL;
5766 nsAString_InitDepend(&nsstr, v);
5767 hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
5768 nsAString_Finish(&nsstr);
5769 if(FAILED(hres)) {
5770 ERR("QuerySelectorAll failed: %08x\n", hres);
5771 return hres;
5774 hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
5775 nsIDOMNodeList_Release(node_list);
5776 return hres;
5779 static const IElementSelectorVtbl ElementSelectorVtbl = {
5780 ElementSelector_QueryInterface,
5781 ElementSelector_AddRef,
5782 ElementSelector_Release,
5783 ElementSelector_GetTypeInfoCount,
5784 ElementSelector_GetTypeInfo,
5785 ElementSelector_GetIDsOfNames,
5786 ElementSelector_Invoke,
5787 ElementSelector_querySelector,
5788 ElementSelector_querySelectorAll
5791 static inline HTMLElement *impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo *iface)
5793 return CONTAINING_RECORD(iface, HTMLElement, IProvideMultipleClassInfo_iface);
5796 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo *iface,
5797 REFIID riid, void **ppv)
5799 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5800 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5803 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideMultipleClassInfo *iface)
5805 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5806 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5809 static ULONG WINAPI ProvideClassInfo_Release(IProvideMultipleClassInfo *iface)
5811 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5812 return IHTMLElement_Release(&This->IHTMLElement_iface);
5815 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *iface, ITypeInfo **ppTI)
5817 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5818 TRACE("(%p)->(%p)\n", This, ppTI);
5819 return get_class_typeinfo(This->node.vtbl->clsid, ppTI);
5822 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
5824 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5825 FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
5826 return E_NOTIMPL;
5829 static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo *iface, ULONG *pcti)
5831 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5832 FIXME("(%p)->(%p)\n", This, pcti);
5833 *pcti = 1;
5834 return S_OK;
5837 static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo *iface, ULONG iti,
5838 DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
5840 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5841 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
5842 return E_NOTIMPL;
5845 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = {
5846 ProvideClassInfo_QueryInterface,
5847 ProvideClassInfo_AddRef,
5848 ProvideClassInfo_Release,
5849 ProvideClassInfo_GetClassInfo,
5850 ProvideClassInfo2_GetGUID,
5851 ProvideMultipleClassInfo_GetMultiTypeInfoCount,
5852 ProvideMultipleClassInfo_GetInfoOfIndex
5855 static inline HTMLElement *impl_from_IElementTraversal(IElementTraversal *iface)
5857 return CONTAINING_RECORD(iface, HTMLElement, IElementTraversal_iface);
5860 static HRESULT WINAPI ElementTraversal_QueryInterface(IElementTraversal *iface, REFIID riid, void **ppv)
5862 HTMLElement *This = impl_from_IElementTraversal(iface);
5863 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5866 static ULONG WINAPI ElementTraversal_AddRef(IElementTraversal *iface)
5868 HTMLElement *This = impl_from_IElementTraversal(iface);
5870 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5873 static ULONG WINAPI ElementTraversal_Release(IElementTraversal *iface)
5875 HTMLElement *This = impl_from_IElementTraversal(iface);
5877 return IHTMLElement_Release(&This->IHTMLElement_iface);
5880 static HRESULT WINAPI ElementTraversal_GetTypeInfoCount(IElementTraversal *iface, UINT *pctinfo)
5882 HTMLElement *This = impl_from_IElementTraversal(iface);
5883 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5886 static HRESULT WINAPI ElementTraversal_GetTypeInfo(IElementTraversal *iface, UINT iTInfo,
5887 LCID lcid, ITypeInfo **ppTInfo)
5889 HTMLElement *This = impl_from_IElementTraversal(iface);
5890 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5893 static HRESULT WINAPI ElementTraversal_GetIDsOfNames(IElementTraversal *iface, REFIID riid,
5894 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5896 HTMLElement *This = impl_from_IElementTraversal(iface);
5897 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5898 lcid, rgDispId);
5901 static HRESULT WINAPI ElementTraversal_Invoke(IElementTraversal *iface, DISPID dispIdMember, REFIID riid,
5902 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5904 HTMLElement *This = impl_from_IElementTraversal(iface);
5905 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5906 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5909 static HRESULT WINAPI ElementTraversal_get_firstElementChild(IElementTraversal *iface, IHTMLElement **p)
5911 HTMLElement *This = impl_from_IElementTraversal(iface);
5912 nsIDOMElement *nselem = NULL;
5913 HTMLElement *elem;
5914 HRESULT hres;
5916 TRACE("(%p)->(%p)\n", This, p);
5918 if(!This->dom_element) {
5919 *p = NULL;
5920 return S_OK;
5923 nsIDOMElement_GetFirstElementChild(This->dom_element, &nselem);
5924 if(!nselem) {
5925 *p = NULL;
5926 return S_OK;
5929 hres = get_element(nselem, &elem);
5930 nsIDOMElement_Release(nselem);
5931 if(FAILED(hres))
5932 return hres;
5934 *p = &elem->IHTMLElement_iface;
5935 return S_OK;
5938 static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *iface, IHTMLElement **p)
5940 HTMLElement *This = impl_from_IElementTraversal(iface);
5941 FIXME("(%p)->(%p)\n", This, p);
5942 return E_NOTIMPL;
5945 static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
5947 HTMLElement *This = impl_from_IElementTraversal(iface);
5948 FIXME("(%p)->(%p)\n", This, p);
5949 return E_NOTIMPL;
5952 static HRESULT WINAPI ElementTraversal_get_nextElementSibling(IElementTraversal *iface, IHTMLElement **p)
5954 HTMLElement *This = impl_from_IElementTraversal(iface);
5955 FIXME("(%p)->(%p)\n", This, p);
5956 return E_NOTIMPL;
5959 static HRESULT WINAPI ElementTraversal_get_childElementCount(IElementTraversal *iface, LONG *p)
5961 HTMLElement *This = impl_from_IElementTraversal(iface);
5962 FIXME("(%p)->(%p)\n", This, p);
5963 return E_NOTIMPL;
5966 static const IElementTraversalVtbl ElementTraversalVtbl = {
5967 ElementTraversal_QueryInterface,
5968 ElementTraversal_AddRef,
5969 ElementTraversal_Release,
5970 ElementTraversal_GetTypeInfoCount,
5971 ElementTraversal_GetTypeInfo,
5972 ElementTraversal_GetIDsOfNames,
5973 ElementTraversal_Invoke,
5974 ElementTraversal_get_firstElementChild,
5975 ElementTraversal_get_lastElementChild,
5976 ElementTraversal_get_previousElementSibling,
5977 ElementTraversal_get_nextElementSibling,
5978 ElementTraversal_get_childElementCount
5981 static inline HTMLElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
5983 return CONTAINING_RECORD(iface, HTMLElement, node);
5986 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
5988 HTMLElement *This = impl_from_HTMLDOMNode(iface);
5990 if(IsEqualGUID(&IID_IUnknown, riid)) {
5991 *ppv = &This->IHTMLElement_iface;
5992 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
5993 *ppv = &This->IHTMLElement_iface;
5994 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
5995 *ppv = &This->IHTMLElement_iface;
5996 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
5997 *ppv = &This->IHTMLElement2_iface;
5998 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
5999 *ppv = &This->IHTMLElement3_iface;
6000 }else if(IsEqualGUID(&IID_IHTMLElement4, riid)) {
6001 *ppv = &This->IHTMLElement4_iface;
6002 }else if(IsEqualGUID(&IID_IHTMLElement6, riid)) {
6003 *ppv = &This->IHTMLElement6_iface;
6004 }else if(IsEqualGUID(&IID_IHTMLElement7, riid)) {
6005 *ppv = &This->IHTMLElement7_iface;
6006 }else if(IsEqualGUID(&IID_IHTMLUniqueName, riid)) {
6007 *ppv = &This->IHTMLUniqueName_iface;
6008 }else if(IsEqualGUID(&IID_IElementSelector, riid)) {
6009 *ppv = &This->IElementSelector_iface;
6010 }else if(IsEqualGUID(&IID_IElementTraversal, riid)) {
6011 *ppv = &This->IElementTraversal_iface;
6012 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
6013 *ppv = &This->cp_container.IConnectionPointContainer_iface;
6014 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
6015 *ppv = &This->IProvideMultipleClassInfo_iface;
6016 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
6017 *ppv = &This->IProvideMultipleClassInfo_iface;
6018 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo, riid)) {
6019 *ppv = &This->IProvideMultipleClassInfo_iface;
6020 }else {
6021 return HTMLDOMNode_QI(&This->node, riid, ppv);
6024 IUnknown_AddRef((IUnknown*)*ppv);
6025 return S_OK;
6028 void HTMLElement_destructor(HTMLDOMNode *iface)
6030 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6032 ConnectionPointContainer_Destroy(&This->cp_container);
6034 if(This->style) {
6035 This->style->elem = NULL;
6036 IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
6038 if(This->runtime_style) {
6039 This->runtime_style->elem = NULL;
6040 IHTMLStyle_Release(&This->runtime_style->IHTMLStyle_iface);
6042 if(This->attrs) {
6043 HTMLDOMAttribute *attr;
6045 LIST_FOR_EACH_ENTRY(attr, &This->attrs->attrs, HTMLDOMAttribute, entry)
6046 attr->elem = NULL;
6048 This->attrs->elem = NULL;
6049 IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface);
6052 heap_free(This->filter);
6054 HTMLDOMNode_destructor(&This->node);
6057 HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
6059 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6060 HTMLElement *new_elem;
6061 HRESULT hres;
6063 hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
6064 if(FAILED(hres))
6065 return hres;
6067 if(This->filter) {
6068 new_elem->filter = heap_strdupW(This->filter);
6069 if(!new_elem->filter) {
6070 IHTMLElement_Release(&This->IHTMLElement_iface);
6071 return E_OUTOFMEMORY;
6075 *ret = &new_elem->node;
6076 return S_OK;
6079 HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
6081 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6083 switch(eid) {
6084 case EVENTID_KEYDOWN: {
6085 nsIDOMKeyEvent *key_event;
6086 nsresult nsres;
6088 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
6089 if(NS_SUCCEEDED(nsres)) {
6090 UINT32 code = 0;
6092 nsIDOMKeyEvent_GetKeyCode(key_event, &code);
6094 if(code == VK_F1 /* DOM_VK_F1 */) {
6095 DOMEvent *help_event;
6096 HRESULT hres;
6098 TRACE("F1 pressed\n");
6100 hres = create_document_event(This->node.doc, EVENTID_HELP, &help_event);
6101 if(SUCCEEDED(hres)) {
6102 dispatch_event(&This->node.event_target, help_event);
6103 IDOMEvent_Release(&help_event->IDOMEvent_iface);
6105 *prevent_default = TRUE;
6108 nsIDOMKeyEvent_Release(key_event);
6113 return S_OK;
6116 cp_static_data_t HTMLElementEvents2_data = { HTMLElementEvents2_tid, NULL /* FIXME */, TRUE };
6118 const cpc_entry_t HTMLElement_cpc[] = {
6119 HTMLELEMENT_CPC,
6120 {NULL}
6123 static const NodeImplVtbl HTMLElementImplVtbl = {
6124 &CLSID_HTMLUnknownElement,
6125 HTMLElement_QI,
6126 HTMLElement_destructor,
6127 HTMLElement_cpc,
6128 HTMLElement_clone,
6129 HTMLElement_handle_event,
6130 HTMLElement_get_attr_col
6133 static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
6135 return CONTAINING_RECORD(iface, HTMLElement, node.event_target.dispex);
6138 static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
6139 DWORD grfdex, DISPID *pid)
6141 HTMLElement *This = impl_from_DispatchEx(dispex);
6143 if(This->node.vtbl->get_dispid)
6144 return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
6146 return DISP_E_UNKNOWNNAME;
6149 static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
6150 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
6151 IServiceProvider *caller)
6153 HTMLElement *This = impl_from_DispatchEx(dispex);
6155 if(This->node.vtbl->invoke)
6156 return This->node.vtbl->invoke(&This->node, id, lcid, flags,
6157 params, res, ei, caller);
6159 ERR("(%p): element has no invoke method\n", This);
6160 return E_NOTIMPL;
6163 static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
6165 HTMLElement *This = impl_from_DispatchEx(dispex);
6166 nsIDOMMozNamedAttrMap *attrs;
6167 nsIDOMAttr *attr;
6168 nsAString nsstr;
6169 const PRUnichar *str;
6170 BSTR name;
6171 VARIANT value;
6172 unsigned i;
6173 UINT32 len;
6174 DISPID id;
6175 nsresult nsres;
6176 HRESULT hres;
6178 if(!This->dom_element)
6179 return S_FALSE;
6181 nsres = nsIDOMElement_GetAttributes(This->dom_element, &attrs);
6182 if(NS_FAILED(nsres))
6183 return E_FAIL;
6185 nsres = nsIDOMMozNamedAttrMap_GetLength(attrs, &len);
6186 if(NS_FAILED(nsres)) {
6187 nsIDOMMozNamedAttrMap_Release(attrs);
6188 return E_FAIL;
6191 nsAString_Init(&nsstr, NULL);
6192 for(i=0; i<len; i++) {
6193 nsres = nsIDOMMozNamedAttrMap_Item(attrs, i, &attr);
6194 if(NS_FAILED(nsres))
6195 continue;
6197 nsres = nsIDOMAttr_GetNodeName(attr, &nsstr);
6198 if(NS_FAILED(nsres)) {
6199 nsIDOMAttr_Release(attr);
6200 continue;
6203 nsAString_GetData(&nsstr, &str);
6204 name = SysAllocString(str);
6205 if(!name) {
6206 nsIDOMAttr_Release(attr);
6207 continue;
6210 hres = IDispatchEx_GetDispID(&dispex->IDispatchEx_iface, name, fdexNameCaseInsensitive, &id);
6211 if(hres != DISP_E_UNKNOWNNAME) {
6212 nsIDOMAttr_Release(attr);
6213 SysFreeString(name);
6214 continue;
6217 nsres = nsIDOMAttr_GetNodeValue(attr, &nsstr);
6218 nsIDOMAttr_Release(attr);
6219 if(NS_FAILED(nsres)) {
6220 SysFreeString(name);
6221 continue;
6224 nsAString_GetData(&nsstr, &str);
6225 V_VT(&value) = VT_BSTR;
6226 if(*str) {
6227 V_BSTR(&value) = SysAllocString(str);
6228 if(!V_BSTR(&value)) {
6229 SysFreeString(name);
6230 continue;
6232 } else
6233 V_BSTR(&value) = NULL;
6235 IHTMLElement_setAttribute(&This->IHTMLElement_iface, name, value, 0);
6236 SysFreeString(name);
6237 VariantClear(&value);
6239 nsAString_Finish(&nsstr);
6241 nsIDOMMozNamedAttrMap_Release(attrs);
6242 return S_OK;
6245 static nsISupports *HTMLElement_get_gecko_target(DispatchEx *dispex)
6247 HTMLElement *This = impl_from_DispatchEx(dispex);
6248 return (nsISupports*)This->node.nsnode;
6251 static void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
6253 HTMLElement *This = impl_from_DispatchEx(dispex);
6254 ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid);
6257 static HRESULT HTMLElement_handle_event_default(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *nsevent, BOOL *prevent_default)
6259 HTMLElement *This = impl_from_DispatchEx(dispex);
6261 if(!This->node.vtbl->handle_event)
6262 return S_OK;
6263 return This->node.vtbl->handle_event(&This->node, eid, nsevent, prevent_default);
6266 static EventTarget *HTMLElement_get_parent_event_target(DispatchEx *dispex)
6268 HTMLElement *This = impl_from_DispatchEx(dispex);
6269 HTMLDOMNode *node;
6270 nsIDOMNode *nsnode;
6271 nsresult nsres;
6272 HRESULT hres;
6274 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &nsnode);
6275 assert(nsres == NS_OK);
6276 if(!nsnode)
6277 return NULL;
6279 hres = get_node(nsnode, TRUE, &node);
6280 nsIDOMNode_Release(nsnode);
6281 if(FAILED(hres))
6282 return NULL;
6284 return &node->event_target;
6287 static ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx *dispex)
6289 HTMLElement *This = impl_from_DispatchEx(dispex);
6290 IConnectionPointContainer_AddRef(&This->cp_container.IConnectionPointContainer_iface);
6291 return &This->cp_container;
6294 static IHTMLEventObj *HTMLElement_set_current_event(DispatchEx *dispex, IHTMLEventObj *event)
6296 HTMLElement *This = impl_from_DispatchEx(dispex);
6297 return default_set_current_event(This->node.doc->window, event);
6300 void HTMLElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
6302 static const dispex_hook_t elem2_ie11_hooks[] = {
6303 {DISPID_IHTMLELEMENT2_DOSCROLL, NULL},
6304 {DISPID_IHTMLELEMENT2_READYSTATE, NULL},
6305 {DISPID_UNKNOWN}
6308 HTMLDOMNode_init_dispex_info(info, mode);
6310 dispex_info_add_interface(info, IHTMLElement2_tid, mode >= COMPAT_MODE_IE11 ? elem2_ie11_hooks : NULL);
6312 if(mode >= COMPAT_MODE_IE8)
6313 dispex_info_add_interface(info, IElementSelector_tid, NULL);
6315 if(mode >= COMPAT_MODE_IE9) {
6316 dispex_info_add_interface(info, IHTMLElement6_tid, NULL);
6317 dispex_info_add_interface(info, IElementTraversal_tid, NULL);
6320 if(mode >= COMPAT_MODE_IE10)
6321 dispex_info_add_interface(info, IHTMLElement7_tid, NULL);
6324 static const tid_t HTMLElement_iface_tids[] = {
6325 HTMLELEMENT_TIDS,
6329 static event_target_vtbl_t HTMLElement_event_target_vtbl = {
6331 NULL,
6332 HTMLElement_get_dispid,
6333 HTMLElement_invoke,
6334 NULL,
6335 HTMLElement_populate_props
6337 HTMLElement_get_gecko_target,
6338 HTMLElement_bind_event,
6339 HTMLElement_get_parent_event_target,
6340 HTMLElement_handle_event_default,
6341 HTMLElement_get_cp_container,
6342 HTMLElement_set_current_event
6345 static dispex_static_data_t HTMLElement_dispex = {
6346 &HTMLElement_event_target_vtbl.dispex_vtbl,
6347 DispHTMLUnknownElement_tid,
6348 HTMLElement_iface_tids,
6349 HTMLElement_init_dispex_info
6352 void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMElement *nselem, dispex_static_data_t *dispex_data)
6354 This->IHTMLElement_iface.lpVtbl = &HTMLElementVtbl;
6355 This->IHTMLElement2_iface.lpVtbl = &HTMLElement2Vtbl;
6356 This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
6357 This->IHTMLElement4_iface.lpVtbl = &HTMLElement4Vtbl;
6358 This->IHTMLElement6_iface.lpVtbl = &HTMLElement6Vtbl;
6359 This->IHTMLElement7_iface.lpVtbl = &HTMLElement7Vtbl;
6360 This->IHTMLUniqueName_iface.lpVtbl = &HTMLUniqueNameVtbl;
6361 This->IElementSelector_iface.lpVtbl = &ElementSelectorVtbl;
6362 This->IElementTraversal_iface.lpVtbl = &ElementTraversalVtbl;
6363 This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
6365 if(dispex_data && !dispex_data->vtbl)
6366 dispex_data->vtbl = &HTMLElement_event_target_vtbl.dispex_vtbl;
6368 if(nselem) {
6369 nsIDOMHTMLElement *html_element;
6370 nsresult nsres;
6372 HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLElement_dispex);
6374 /* No AddRef, share reference with HTMLDOMNode */
6375 assert((nsIDOMNode*)nselem == This->node.nsnode);
6376 This->dom_element = nselem;
6378 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&html_element);
6379 if(NS_SUCCEEDED(nsres)) {
6380 This->html_element = html_element;
6381 /* share reference with HTMLDOMNode */
6382 assert((nsIDOMNode*)html_element == This->node.nsnode);
6383 nsIDOMHTMLElement_Release(html_element);
6387 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface, This->node.vtbl->cpc_entries);
6390 HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
6392 nsIDOMElement *nselem;
6393 nsAString tag_name_str;
6394 const PRUnichar *tag_name;
6395 const tag_desc_t *tag;
6396 HTMLElement *elem;
6397 nsresult nsres;
6398 HRESULT hres;
6400 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
6401 if(NS_FAILED(nsres)) {
6402 ERR("no nsIDOMElement iface\n");
6403 return E_FAIL;
6406 nsAString_Init(&tag_name_str, NULL);
6407 nsIDOMElement_GetTagName(nselem, &tag_name_str);
6409 nsAString_GetData(&tag_name_str, &tag_name);
6411 tag = get_tag_desc(tag_name);
6412 if(tag) {
6413 hres = tag->constructor(doc, nselem, &elem);
6414 }else {
6415 nsIDOMSVGElement *svg_element;
6417 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element);
6418 if(NS_SUCCEEDED(nsres)) {
6419 hres = create_svg_element(doc, svg_element, tag_name, &elem);
6420 nsIDOMSVGElement_Release(svg_element);
6421 }else if(use_generic) {
6422 hres = HTMLGenericElement_Create(doc, nselem, &elem);
6423 }else {
6424 elem = heap_alloc_zero(sizeof(HTMLElement));
6425 if(elem) {
6426 elem->node.vtbl = &HTMLElementImplVtbl;
6427 HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
6428 hres = S_OK;
6429 }else {
6430 hres = E_OUTOFMEMORY;
6435 TRACE("%s ret %p\n", debugstr_w(tag_name), elem);
6437 nsIDOMElement_Release(nselem);
6438 nsAString_Finish(&tag_name_str);
6439 if(FAILED(hres))
6440 return hres;
6442 *ret = elem;
6443 return S_OK;
6446 HRESULT get_element(nsIDOMElement *nselem, HTMLElement **ret)
6448 HTMLDOMNode *node;
6449 HRESULT hres;
6451 hres = get_node((nsIDOMNode*)nselem, TRUE, &node);
6452 if(FAILED(hres))
6453 return hres;
6455 *ret = impl_from_HTMLDOMNode(node);
6456 return S_OK;
6459 /* interface IHTMLFiltersCollection */
6460 static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
6462 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6464 TRACE("%p %s %p\n", This, debugstr_mshtml_guid(riid), ppv );
6466 if(IsEqualGUID(&IID_IUnknown, riid)) {
6467 *ppv = &This->IHTMLFiltersCollection_iface;
6468 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
6469 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
6470 *ppv = &This->IHTMLFiltersCollection_iface;
6471 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6472 return *ppv ? S_OK : E_NOINTERFACE;
6473 }else {
6474 *ppv = NULL;
6475 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6476 return E_NOINTERFACE;
6479 IUnknown_AddRef((IUnknown*)*ppv);
6480 return S_OK;
6483 static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
6485 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6486 LONG ref = InterlockedIncrement(&This->ref);
6488 TRACE("(%p) ref=%d\n", This, ref);
6490 return ref;
6493 static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
6495 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6496 LONG ref = InterlockedDecrement(&This->ref);
6498 TRACE("(%p) ref=%d\n", This, ref);
6500 if(!ref)
6502 heap_free(This);
6505 return ref;
6508 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
6510 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6511 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6514 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
6515 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
6517 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6518 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6521 static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
6522 REFIID riid, LPOLESTR *rgszNames, UINT cNames,
6523 LCID lcid, DISPID *rgDispId)
6525 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6526 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6527 lcid, rgDispId);
6530 static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
6531 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
6532 EXCEPINFO *pExcepInfo, UINT *puArgErr)
6534 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6535 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6536 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6539 static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
6541 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6543 if(!p)
6544 return E_POINTER;
6546 FIXME("(%p)->(%p) Always returning 0\n", This, p);
6547 *p = 0;
6549 return S_OK;
6552 static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
6554 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6555 FIXME("(%p)->(%p)\n", This, p);
6556 return E_NOTIMPL;
6559 static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
6561 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6562 FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
6563 return E_NOTIMPL;
6566 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
6567 HTMLFiltersCollection_QueryInterface,
6568 HTMLFiltersCollection_AddRef,
6569 HTMLFiltersCollection_Release,
6570 HTMLFiltersCollection_GetTypeInfoCount,
6571 HTMLFiltersCollection_GetTypeInfo,
6572 HTMLFiltersCollection_GetIDsOfNames,
6573 HTMLFiltersCollection_Invoke,
6574 HTMLFiltersCollection_get_length,
6575 HTMLFiltersCollection_get__newEnum,
6576 HTMLFiltersCollection_item
6579 static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
6581 WCHAR *ptr;
6582 int idx = 0;
6584 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
6585 idx = idx*10 + (*ptr-'0');
6586 if(*ptr)
6587 return DISP_E_UNKNOWNNAME;
6589 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
6590 TRACE("ret %x\n", *dispid);
6591 return S_OK;
6594 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
6595 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
6597 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
6599 V_VT(res) = VT_DISPATCH;
6600 V_DISPATCH(res) = NULL;
6602 FIXME("always returning NULL\n");
6604 return S_OK;
6607 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
6608 NULL,
6609 HTMLFiltersCollection_get_dispid,
6610 HTMLFiltersCollection_invoke,
6611 NULL
6614 static const tid_t HTMLFiltersCollection_iface_tids[] = {
6615 IHTMLFiltersCollection_tid,
6618 static dispex_static_data_t HTMLFiltersCollection_dispex = {
6619 &HTMLFiltersCollection_dispex_vtbl,
6620 IHTMLFiltersCollection_tid,
6621 HTMLFiltersCollection_iface_tids
6624 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret)
6626 HTMLFiltersCollection *collection;
6628 if(!(collection = heap_alloc(sizeof(HTMLFiltersCollection))))
6629 return E_OUTOFMEMORY;
6631 collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
6632 collection->ref = 1;
6634 init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface,
6635 &HTMLFiltersCollection_dispex, compat_mode);
6637 *ret = &collection->IHTMLFiltersCollection_iface;
6638 return S_OK;
6641 /* interface IHTMLAttributeCollection */
6642 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection *iface)
6644 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection_iface);
6647 static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection *iface, REFIID riid, void **ppv)
6649 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6651 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6653 if(IsEqualGUID(&IID_IUnknown, riid)) {
6654 *ppv = &This->IHTMLAttributeCollection_iface;
6655 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection, riid)) {
6656 *ppv = &This->IHTMLAttributeCollection_iface;
6657 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2, riid)) {
6658 *ppv = &This->IHTMLAttributeCollection2_iface;
6659 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3, riid)) {
6660 *ppv = &This->IHTMLAttributeCollection3_iface;
6661 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6662 return *ppv ? S_OK : E_NOINTERFACE;
6663 }else {
6664 *ppv = NULL;
6665 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6666 return E_NOINTERFACE;
6669 IUnknown_AddRef((IUnknown*)*ppv);
6670 return S_OK;
6673 static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface)
6675 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6676 LONG ref = InterlockedIncrement(&This->ref);
6678 TRACE("(%p) ref=%d\n", This, ref);
6680 return ref;
6683 static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface)
6685 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6686 LONG ref = InterlockedDecrement(&This->ref);
6688 TRACE("(%p) ref=%d\n", This, ref);
6690 if(!ref) {
6691 while(!list_empty(&This->attrs)) {
6692 HTMLDOMAttribute *attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry);
6694 list_remove(&attr->entry);
6695 attr->elem = NULL;
6696 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
6699 heap_free(This);
6702 return ref;
6705 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection *iface, UINT *pctinfo)
6707 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6708 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6711 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection *iface, UINT iTInfo,
6712 LCID lcid, ITypeInfo **ppTInfo)
6714 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6715 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6718 static HRESULT WINAPI HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection *iface, REFIID riid,
6719 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6721 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6722 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6723 lcid, rgDispId);
6726 static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *iface, DISPID dispIdMember,
6727 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6728 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6730 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6731 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6732 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6735 static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid)
6737 IDispatchEx *dispex = &This->elem->node.event_target.dispex.IDispatchEx_iface;
6738 DISPID id = DISPID_STARTENUM;
6739 LONG len = -1;
6740 HRESULT hres;
6742 FIXME("filter non-enumerable attributes out\n");
6744 while(1) {
6745 hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
6746 if(FAILED(hres))
6747 return hres;
6748 else if(hres == S_FALSE)
6749 break;
6751 len++;
6752 if(len == *idx)
6753 break;
6756 if(dispid) {
6757 *dispid = id;
6758 return *idx==len ? S_OK : DISP_E_UNKNOWNNAME;
6761 *idx = len+1;
6762 return S_OK;
6765 static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id)
6767 HRESULT hres;
6769 if(name[0]>='0' && name[0]<='9') {
6770 WCHAR *end_ptr;
6771 LONG idx;
6773 idx = wcstoul(name, &end_ptr, 10);
6774 if(!*end_ptr) {
6775 hres = get_attr_dispid_by_idx(This, &idx, id);
6776 if(SUCCEEDED(hres))
6777 return hres;
6781 if(!This->elem) {
6782 WARN("NULL elem\n");
6783 return E_UNEXPECTED;
6786 hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface,
6787 name, fdexNameCaseInsensitive, id);
6788 return hres;
6791 static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr)
6793 HTMLDOMAttribute *iter;
6794 LONG pos = 0;
6795 HRESULT hres;
6797 *attr = NULL;
6798 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
6799 if(iter->dispid == id) {
6800 *attr = iter;
6801 break;
6803 pos++;
6806 if(!*attr) {
6807 if(!This->elem) {
6808 WARN("NULL elem\n");
6809 return E_UNEXPECTED;
6812 hres = HTMLDOMAttribute_Create(NULL, This->elem, id, attr);
6813 if(FAILED(hres))
6814 return hres;
6817 IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface);
6818 if(list_pos)
6819 *list_pos = pos;
6820 return S_OK;
6823 static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p)
6825 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6826 HRESULT hres;
6828 TRACE("(%p)->(%p)\n", This, p);
6830 *p = -1;
6831 hres = get_attr_dispid_by_idx(This, p, NULL);
6832 return hres;
6835 static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p)
6837 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6838 FIXME("(%p)->(%p)\n", This, p);
6839 return E_NOTIMPL;
6842 static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem)
6844 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6845 HTMLDOMAttribute *attr;
6846 DISPID id;
6847 HRESULT hres;
6849 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(name), ppItem);
6851 switch(V_VT(name)) {
6852 case VT_I4:
6853 hres = get_attr_dispid_by_idx(This, &V_I4(name), &id);
6854 break;
6855 case VT_BSTR:
6856 hres = get_attr_dispid_by_name(This, V_BSTR(name), &id);
6857 break;
6858 default:
6859 FIXME("unsupported name %s\n", debugstr_variant(name));
6860 hres = E_NOTIMPL;
6862 if(hres == DISP_E_UNKNOWNNAME)
6863 return E_INVALIDARG;
6864 if(FAILED(hres))
6865 return hres;
6867 hres = get_domattr(This, id, NULL, &attr);
6868 if(FAILED(hres))
6869 return hres;
6871 *ppItem = (IDispatch*)&attr->IHTMLDOMAttribute_iface;
6872 return S_OK;
6875 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl = {
6876 HTMLAttributeCollection_QueryInterface,
6877 HTMLAttributeCollection_AddRef,
6878 HTMLAttributeCollection_Release,
6879 HTMLAttributeCollection_GetTypeInfoCount,
6880 HTMLAttributeCollection_GetTypeInfo,
6881 HTMLAttributeCollection_GetIDsOfNames,
6882 HTMLAttributeCollection_Invoke,
6883 HTMLAttributeCollection_get_length,
6884 HTMLAttributeCollection__newEnum,
6885 HTMLAttributeCollection_item
6888 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2 *iface)
6890 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection2_iface);
6893 static HRESULT WINAPI HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2 *iface, REFIID riid, void **ppv)
6895 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6896 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
6899 static ULONG WINAPI HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2 *iface)
6901 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6902 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
6905 static ULONG WINAPI HTMLAttributeCollection2_Release(IHTMLAttributeCollection2 *iface)
6907 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6908 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
6911 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2 *iface, UINT *pctinfo)
6913 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6914 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6917 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2 *iface, UINT iTInfo,
6918 LCID lcid, ITypeInfo **ppTInfo)
6920 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6921 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6924 static HRESULT WINAPI HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2 *iface, REFIID riid,
6925 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6927 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6928 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6929 lcid, rgDispId);
6932 static HRESULT WINAPI HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2 *iface, DISPID dispIdMember,
6933 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6934 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6936 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6937 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6938 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6941 static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2 *iface, BSTR bstrName,
6942 IHTMLDOMAttribute **newretNode)
6944 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6945 HTMLDOMAttribute *attr;
6946 DISPID id;
6947 HRESULT hres;
6949 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
6951 hres = get_attr_dispid_by_name(This, bstrName, &id);
6952 if(hres == DISP_E_UNKNOWNNAME) {
6953 *newretNode = NULL;
6954 return S_OK;
6955 } else if(FAILED(hres)) {
6956 return hres;
6959 hres = get_domattr(This, id, NULL, &attr);
6960 if(FAILED(hres))
6961 return hres;
6963 *newretNode = &attr->IHTMLDOMAttribute_iface;
6964 return S_OK;
6967 static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface,
6968 IHTMLDOMAttribute *ppNode, IHTMLDOMAttribute **newretNode)
6970 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6971 FIXME("(%p)->(%p %p)\n", This, ppNode, newretNode);
6972 return E_NOTIMPL;
6975 static HRESULT WINAPI HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2 *iface,
6976 BSTR bstrName, IHTMLDOMAttribute **newretNode)
6978 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6979 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
6980 return E_NOTIMPL;
6983 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl = {
6984 HTMLAttributeCollection2_QueryInterface,
6985 HTMLAttributeCollection2_AddRef,
6986 HTMLAttributeCollection2_Release,
6987 HTMLAttributeCollection2_GetTypeInfoCount,
6988 HTMLAttributeCollection2_GetTypeInfo,
6989 HTMLAttributeCollection2_GetIDsOfNames,
6990 HTMLAttributeCollection2_Invoke,
6991 HTMLAttributeCollection2_getNamedItem,
6992 HTMLAttributeCollection2_setNamedItem,
6993 HTMLAttributeCollection2_removeNamedItem
6996 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3 *iface)
6998 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection3_iface);
7001 static HRESULT WINAPI HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3 *iface, REFIID riid, void **ppv)
7003 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7004 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
7007 static ULONG WINAPI HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3 *iface)
7009 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7010 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
7013 static ULONG WINAPI HTMLAttributeCollection3_Release(IHTMLAttributeCollection3 *iface)
7015 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7016 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
7019 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3 *iface, UINT *pctinfo)
7021 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7022 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7025 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3 *iface, UINT iTInfo,
7026 LCID lcid, ITypeInfo **ppTInfo)
7028 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7029 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7032 static HRESULT WINAPI HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3 *iface, REFIID riid,
7033 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7035 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7036 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7037 lcid, rgDispId);
7040 static HRESULT WINAPI HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3 *iface, DISPID dispIdMember,
7041 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7042 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7044 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7045 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7046 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7049 static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3 *iface, BSTR bstrName,
7050 IHTMLDOMAttribute **ppNodeOut)
7052 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7053 return IHTMLAttributeCollection2_getNamedItem(&This->IHTMLAttributeCollection2_iface, bstrName, ppNodeOut);
7056 static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
7057 IHTMLDOMAttribute *pNodeIn, IHTMLDOMAttribute **ppNodeOut)
7059 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7060 FIXME("(%p)->(%p %p)\n", This, pNodeIn, ppNodeOut);
7061 return E_NOTIMPL;
7064 static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3 *iface,
7065 BSTR bstrName, IHTMLDOMAttribute **ppNodeOut)
7067 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7068 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
7069 return E_NOTIMPL;
7072 static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut)
7074 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7075 HTMLDOMAttribute *attr;
7076 DISPID id;
7077 HRESULT hres;
7079 TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut);
7081 hres = get_attr_dispid_by_idx(This, &index, &id);
7082 if(hres == DISP_E_UNKNOWNNAME)
7083 return E_INVALIDARG;
7084 if(FAILED(hres))
7085 return hres;
7087 hres = get_domattr(This, id, NULL, &attr);
7088 if(FAILED(hres))
7089 return hres;
7091 *ppNodeOut = &attr->IHTMLDOMAttribute_iface;
7092 return S_OK;
7095 static HRESULT WINAPI HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3 *iface, LONG *p)
7097 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7098 return IHTMLAttributeCollection_get_length(&This->IHTMLAttributeCollection_iface, p);
7101 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl = {
7102 HTMLAttributeCollection3_QueryInterface,
7103 HTMLAttributeCollection3_AddRef,
7104 HTMLAttributeCollection3_Release,
7105 HTMLAttributeCollection3_GetTypeInfoCount,
7106 HTMLAttributeCollection3_GetTypeInfo,
7107 HTMLAttributeCollection3_GetIDsOfNames,
7108 HTMLAttributeCollection3_Invoke,
7109 HTMLAttributeCollection3_getNamedItem,
7110 HTMLAttributeCollection3_setNamedItem,
7111 HTMLAttributeCollection3_removeNamedItem,
7112 HTMLAttributeCollection3_item,
7113 HTMLAttributeCollection3_get_length
7116 static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(DispatchEx *iface)
7118 return CONTAINING_RECORD(iface, HTMLAttributeCollection, dispex);
7121 static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
7123 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7124 HTMLDOMAttribute *attr;
7125 LONG pos;
7126 HRESULT hres;
7128 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
7130 hres = get_attr_dispid_by_name(This, name, dispid);
7131 if(FAILED(hres))
7132 return hres;
7134 hres = get_domattr(This, *dispid, &pos, &attr);
7135 if(FAILED(hres))
7136 return hres;
7137 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
7139 *dispid = MSHTML_DISPID_CUSTOM_MIN+pos;
7140 return S_OK;
7143 static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
7144 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
7146 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7148 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
7150 switch(flags) {
7151 case DISPATCH_PROPERTYGET: {
7152 HTMLDOMAttribute *iter;
7153 DWORD pos;
7155 pos = id-MSHTML_DISPID_CUSTOM_MIN;
7157 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
7158 if(!pos) {
7159 IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
7160 V_VT(res) = VT_DISPATCH;
7161 V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
7162 return S_OK;
7164 pos--;
7167 WARN("invalid arg\n");
7168 return E_INVALIDARG;
7171 default:
7172 FIXME("unimplemented flags %x\n", flags);
7173 return E_NOTIMPL;
7177 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = {
7178 NULL,
7179 HTMLAttributeCollection_get_dispid,
7180 HTMLAttributeCollection_invoke,
7181 NULL
7184 static const tid_t HTMLAttributeCollection_iface_tids[] = {
7185 IHTMLAttributeCollection_tid,
7186 IHTMLAttributeCollection2_tid,
7187 IHTMLAttributeCollection3_tid,
7191 static dispex_static_data_t HTMLAttributeCollection_dispex = {
7192 &HTMLAttributeCollection_dispex_vtbl,
7193 DispHTMLAttributeCollection_tid,
7194 HTMLAttributeCollection_iface_tids
7197 HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
7199 HTMLElement *This = impl_from_HTMLDOMNode(iface);
7201 if(This->attrs) {
7202 IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface);
7203 *ac = This->attrs;
7204 return S_OK;
7207 This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection));
7208 if(!This->attrs)
7209 return E_OUTOFMEMORY;
7211 This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl;
7212 This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl;
7213 This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl;
7214 This->attrs->ref = 2;
7216 This->attrs->elem = This;
7217 list_init(&This->attrs->attrs);
7218 init_dispatch(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface,
7219 &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
7221 *ac = This->attrs;
7222 return S_OK;