mshtml: Initialize HTMLAttributeCollection object with compat mode.
[wine/zf.git] / dlls / mshtml / htmlelem.c
blob04e59eafdae91cec892ed88619010827fbdb6a7d
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 IHTMLFiltersCollection *HTMLFiltersCollection_Create(void);
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_dispex_with_compat_mode(&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 hres = 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,
2015 IHTMLFiltersCollection **p)
2017 HTMLElement *This = impl_from_IHTMLElement(iface);
2018 TRACE("(%p)->(%p)\n", This, p);
2020 if(!p)
2021 return E_POINTER;
2023 *p = HTMLFiltersCollection_Create();
2025 return S_OK;
2028 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
2030 HTMLElement *This = impl_from_IHTMLElement(iface);
2032 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2034 return set_node_event(&This->node, EVENTID_DRAGSTART, &v);
2037 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
2039 HTMLElement *This = impl_from_IHTMLElement(iface);
2041 TRACE("(%p)->(%p)\n", This, p);
2043 return get_node_event(&This->node, EVENTID_DRAGSTART, p);
2046 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
2048 HTMLElement *This = impl_from_IHTMLElement(iface);
2049 FIXME("(%p)->(%p)\n", This, String);
2050 return E_NOTIMPL;
2053 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
2055 HTMLElement *This = impl_from_IHTMLElement(iface);
2056 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2057 return E_NOTIMPL;
2060 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
2062 HTMLElement *This = impl_from_IHTMLElement(iface);
2063 FIXME("(%p)->(%p)\n", This, p);
2064 return E_NOTIMPL;
2067 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
2069 HTMLElement *This = impl_from_IHTMLElement(iface);
2070 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2071 return E_NOTIMPL;
2074 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
2076 HTMLElement *This = impl_from_IHTMLElement(iface);
2077 FIXME("(%p)->(%p)\n", This, p);
2078 return E_NOTIMPL;
2081 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
2083 HTMLElement *This = impl_from_IHTMLElement(iface);
2084 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2085 return E_NOTIMPL;
2088 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
2090 HTMLElement *This = impl_from_IHTMLElement(iface);
2091 FIXME("(%p)->(%p)\n", This, p);
2092 return E_NOTIMPL;
2095 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
2097 HTMLElement *This = impl_from_IHTMLElement(iface);
2098 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2099 return E_NOTIMPL;
2102 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
2104 HTMLElement *This = impl_from_IHTMLElement(iface);
2105 FIXME("(%p)->(%p)\n", This, p);
2106 return E_NOTIMPL;
2109 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
2111 HTMLElement *This = impl_from_IHTMLElement(iface);
2112 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2113 return E_NOTIMPL;
2116 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
2118 HTMLElement *This = impl_from_IHTMLElement(iface);
2119 FIXME("(%p)->(%p)\n", This, p);
2120 return E_NOTIMPL;
2123 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
2125 HTMLElement *This = impl_from_IHTMLElement(iface);
2126 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2127 return E_NOTIMPL;
2130 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
2132 HTMLElement *This = impl_from_IHTMLElement(iface);
2133 FIXME("(%p)->(%p)\n", This, p);
2134 return E_NOTIMPL;
2137 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
2139 HTMLElement *This = impl_from_IHTMLElement(iface);
2141 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_variant(&v));
2143 return set_node_event(&This->node, EVENTID_DATAAVAILABLE, &v);
2146 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
2148 HTMLElement *This = impl_from_IHTMLElement(iface);
2150 TRACE("(%p)->(%p)\n", This, p);
2152 return get_node_event(&This->node, EVENTID_DATAAVAILABLE, p);
2155 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
2157 HTMLElement *This = impl_from_IHTMLElement(iface);
2158 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2159 return E_NOTIMPL;
2162 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
2164 HTMLElement *This = impl_from_IHTMLElement(iface);
2165 FIXME("(%p)->(%p)\n", This, p);
2166 return E_NOTIMPL;
2169 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
2171 HTMLElement *This = impl_from_IHTMLElement(iface);
2172 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2173 return E_NOTIMPL;
2176 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
2178 HTMLElement *This = impl_from_IHTMLElement(iface);
2179 FIXME("(%p)->(%p)\n", This, p);
2180 return E_NOTIMPL;
2183 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
2185 HTMLElement *This = impl_from_IHTMLElement(iface);
2186 nsIDOMNodeList *nsnode_list;
2187 nsresult nsres;
2189 TRACE("(%p)->(%p)\n", This, p);
2191 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
2192 if(NS_FAILED(nsres)) {
2193 ERR("GetChildNodes failed: %08x\n", nsres);
2194 return E_FAIL;
2197 *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode);
2199 nsIDOMNodeList_Release(nsnode_list);
2200 return S_OK;
2203 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
2205 HTMLElement *This = impl_from_IHTMLElement(iface);
2207 TRACE("(%p)->(%p)\n", This, p);
2209 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
2210 return S_OK;
2213 static const IHTMLElementVtbl HTMLElementVtbl = {
2214 HTMLElement_QueryInterface,
2215 HTMLElement_AddRef,
2216 HTMLElement_Release,
2217 HTMLElement_GetTypeInfoCount,
2218 HTMLElement_GetTypeInfo,
2219 HTMLElement_GetIDsOfNames,
2220 HTMLElement_Invoke,
2221 HTMLElement_setAttribute,
2222 HTMLElement_getAttribute,
2223 HTMLElement_removeAttribute,
2224 HTMLElement_put_className,
2225 HTMLElement_get_className,
2226 HTMLElement_put_id,
2227 HTMLElement_get_id,
2228 HTMLElement_get_tagName,
2229 HTMLElement_get_parentElement,
2230 HTMLElement_get_style,
2231 HTMLElement_put_onhelp,
2232 HTMLElement_get_onhelp,
2233 HTMLElement_put_onclick,
2234 HTMLElement_get_onclick,
2235 HTMLElement_put_ondblclick,
2236 HTMLElement_get_ondblclick,
2237 HTMLElement_put_onkeydown,
2238 HTMLElement_get_onkeydown,
2239 HTMLElement_put_onkeyup,
2240 HTMLElement_get_onkeyup,
2241 HTMLElement_put_onkeypress,
2242 HTMLElement_get_onkeypress,
2243 HTMLElement_put_onmouseout,
2244 HTMLElement_get_onmouseout,
2245 HTMLElement_put_onmouseover,
2246 HTMLElement_get_onmouseover,
2247 HTMLElement_put_onmousemove,
2248 HTMLElement_get_onmousemove,
2249 HTMLElement_put_onmousedown,
2250 HTMLElement_get_onmousedown,
2251 HTMLElement_put_onmouseup,
2252 HTMLElement_get_onmouseup,
2253 HTMLElement_get_document,
2254 HTMLElement_put_title,
2255 HTMLElement_get_title,
2256 HTMLElement_put_language,
2257 HTMLElement_get_language,
2258 HTMLElement_put_onselectstart,
2259 HTMLElement_get_onselectstart,
2260 HTMLElement_scrollIntoView,
2261 HTMLElement_contains,
2262 HTMLElement_get_sourceIndex,
2263 HTMLElement_get_recordNumber,
2264 HTMLElement_put_lang,
2265 HTMLElement_get_lang,
2266 HTMLElement_get_offsetLeft,
2267 HTMLElement_get_offsetTop,
2268 HTMLElement_get_offsetWidth,
2269 HTMLElement_get_offsetHeight,
2270 HTMLElement_get_offsetParent,
2271 HTMLElement_put_innerHTML,
2272 HTMLElement_get_innerHTML,
2273 HTMLElement_put_innerText,
2274 HTMLElement_get_innerText,
2275 HTMLElement_put_outerHTML,
2276 HTMLElement_get_outerHTML,
2277 HTMLElement_put_outerText,
2278 HTMLElement_get_outerText,
2279 HTMLElement_insertAdjacentHTML,
2280 HTMLElement_insertAdjacentText,
2281 HTMLElement_get_parentTextEdit,
2282 HTMLElement_get_isTextEdit,
2283 HTMLElement_click,
2284 HTMLElement_get_filters,
2285 HTMLElement_put_ondragstart,
2286 HTMLElement_get_ondragstart,
2287 HTMLElement_toString,
2288 HTMLElement_put_onbeforeupdate,
2289 HTMLElement_get_onbeforeupdate,
2290 HTMLElement_put_onafterupdate,
2291 HTMLElement_get_onafterupdate,
2292 HTMLElement_put_onerrorupdate,
2293 HTMLElement_get_onerrorupdate,
2294 HTMLElement_put_onrowexit,
2295 HTMLElement_get_onrowexit,
2296 HTMLElement_put_onrowenter,
2297 HTMLElement_get_onrowenter,
2298 HTMLElement_put_ondatasetchanged,
2299 HTMLElement_get_ondatasetchanged,
2300 HTMLElement_put_ondataavailable,
2301 HTMLElement_get_ondataavailable,
2302 HTMLElement_put_ondatasetcomplete,
2303 HTMLElement_get_ondatasetcomplete,
2304 HTMLElement_put_onfilterchange,
2305 HTMLElement_get_onfilterchange,
2306 HTMLElement_get_children,
2307 HTMLElement_get_all
2310 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement *iface)
2312 return iface->lpVtbl == &HTMLElementVtbl ? impl_from_IHTMLElement(iface) : NULL;
2315 static inline HTMLElement *impl_from_IHTMLElement2(IHTMLElement2 *iface)
2317 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement2_iface);
2320 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
2321 REFIID riid, void **ppv)
2323 HTMLElement *This = impl_from_IHTMLElement2(iface);
2324 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
2327 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
2329 HTMLElement *This = impl_from_IHTMLElement2(iface);
2330 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
2333 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
2335 HTMLElement *This = impl_from_IHTMLElement2(iface);
2336 return IHTMLElement_Release(&This->IHTMLElement_iface);
2339 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
2341 HTMLElement *This = impl_from_IHTMLElement2(iface);
2342 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
2345 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
2346 LCID lcid, ITypeInfo **ppTInfo)
2348 HTMLElement *This = impl_from_IHTMLElement2(iface);
2349 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2352 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
2353 LPOLESTR *rgszNames, UINT cNames,
2354 LCID lcid, DISPID *rgDispId)
2356 HTMLElement *This = impl_from_IHTMLElement2(iface);
2357 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2358 lcid, rgDispId);
2361 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
2362 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2363 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2365 HTMLElement *This = impl_from_IHTMLElement2(iface);
2366 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
2367 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2370 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
2372 HTMLElement *This = impl_from_IHTMLElement2(iface);
2373 FIXME("(%p)->(%p)\n", This, p);
2374 return E_NOTIMPL;
2377 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
2379 HTMLElement *This = impl_from_IHTMLElement2(iface);
2380 FIXME("(%p)->(%x)\n", This, containerCapture);
2381 return E_NOTIMPL;
2384 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
2386 HTMLElement *This = impl_from_IHTMLElement2(iface);
2387 FIXME("(%p)\n", This);
2388 return E_NOTIMPL;
2391 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
2393 HTMLElement *This = impl_from_IHTMLElement2(iface);
2394 FIXME("(%p)->()\n", This);
2395 return E_NOTIMPL;
2398 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
2400 HTMLElement *This = impl_from_IHTMLElement2(iface);
2401 FIXME("(%p)->(%p)\n", This, p);
2402 return E_NOTIMPL;
2405 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
2406 LONG x, LONG y, BSTR *component)
2408 HTMLElement *This = impl_from_IHTMLElement2(iface);
2409 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
2410 return E_NOTIMPL;
2413 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
2415 HTMLElement *This = impl_from_IHTMLElement2(iface);
2417 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
2419 if(!This->node.doc->content_ready
2420 || !This->node.doc->basedoc.doc_obj->in_place_active)
2421 return E_PENDING;
2423 WARN("stub\n");
2424 return S_OK;
2427 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
2429 HTMLElement *This = impl_from_IHTMLElement2(iface);
2431 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2433 return set_node_event(&This->node, EVENTID_SCROLL, &v);
2436 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
2438 HTMLElement *This = impl_from_IHTMLElement2(iface);
2440 TRACE("(%p)->(%p)\n", This, p);
2442 return get_node_event(&This->node, EVENTID_SCROLL, p);
2445 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
2447 HTMLElement *This = impl_from_IHTMLElement2(iface);
2449 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2451 return set_node_event(&This->node, EVENTID_DRAG, &v);
2454 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
2456 HTMLElement *This = impl_from_IHTMLElement2(iface);
2458 TRACE("(%p)->(%p)\n", This, p);
2460 return get_node_event(&This->node, EVENTID_DRAG, p);
2463 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
2465 HTMLElement *This = impl_from_IHTMLElement2(iface);
2466 FIXME("(%p)->()\n", This);
2467 return E_NOTIMPL;
2470 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
2472 HTMLElement *This = impl_from_IHTMLElement2(iface);
2473 FIXME("(%p)->(%p)\n", This, p);
2474 return E_NOTIMPL;
2477 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
2479 HTMLElement *This = impl_from_IHTMLElement2(iface);
2480 FIXME("(%p)->()\n", This);
2481 return E_NOTIMPL;
2484 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
2486 HTMLElement *This = impl_from_IHTMLElement2(iface);
2487 FIXME("(%p)->(%p)\n", This, p);
2488 return E_NOTIMPL;
2491 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
2493 HTMLElement *This = impl_from_IHTMLElement2(iface);
2494 FIXME("(%p)->()\n", This);
2495 return E_NOTIMPL;
2498 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
2500 HTMLElement *This = impl_from_IHTMLElement2(iface);
2501 FIXME("(%p)->(%p)\n", This, p);
2502 return E_NOTIMPL;
2505 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
2507 HTMLElement *This = impl_from_IHTMLElement2(iface);
2508 FIXME("(%p)->()\n", This);
2509 return E_NOTIMPL;
2512 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
2514 HTMLElement *This = impl_from_IHTMLElement2(iface);
2515 FIXME("(%p)->(%p)\n", This, p);
2516 return E_NOTIMPL;
2519 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
2521 HTMLElement *This = impl_from_IHTMLElement2(iface);
2522 FIXME("(%p)->()\n", This);
2523 return E_NOTIMPL;
2526 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
2528 HTMLElement *This = impl_from_IHTMLElement2(iface);
2529 FIXME("(%p)->(%p)\n", This, p);
2530 return E_NOTIMPL;
2533 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
2535 HTMLElement *This = impl_from_IHTMLElement2(iface);
2536 FIXME("(%p)->()\n", This);
2537 return E_NOTIMPL;
2540 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
2542 HTMLElement *This = impl_from_IHTMLElement2(iface);
2543 FIXME("(%p)->(%p)\n", This, p);
2544 return E_NOTIMPL;
2547 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
2549 HTMLElement *This = impl_from_IHTMLElement2(iface);
2550 FIXME("(%p)->()\n", This);
2551 return E_NOTIMPL;
2554 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
2556 HTMLElement *This = impl_from_IHTMLElement2(iface);
2557 FIXME("(%p)->(%p)\n", This, p);
2558 return E_NOTIMPL;
2561 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
2563 HTMLElement *This = impl_from_IHTMLElement2(iface);
2564 FIXME("(%p)->()\n", This);
2565 return E_NOTIMPL;
2568 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
2570 HTMLElement *This = impl_from_IHTMLElement2(iface);
2571 FIXME("(%p)->(%p)\n", This, p);
2572 return E_NOTIMPL;
2575 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
2577 HTMLElement *This = impl_from_IHTMLElement2(iface);
2578 FIXME("(%p)->()\n", This);
2579 return E_NOTIMPL;
2582 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
2584 HTMLElement *This = impl_from_IHTMLElement2(iface);
2585 FIXME("(%p)->(%p)\n", This, p);
2586 return E_NOTIMPL;
2589 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
2591 HTMLElement *This = impl_from_IHTMLElement2(iface);
2592 FIXME("(%p)->()\n", This);
2593 return E_NOTIMPL;
2596 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
2598 HTMLElement *This = impl_from_IHTMLElement2(iface);
2599 FIXME("(%p)->(%p)\n", This, p);
2600 return E_NOTIMPL;
2603 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
2605 HTMLElement *This = impl_from_IHTMLElement2(iface);
2607 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2609 return set_node_event(&This->node, EVENTID_PASTE, &v);
2612 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
2614 HTMLElement *This = impl_from_IHTMLElement2(iface);
2616 TRACE("(%p)->(%p)\n", This, p);
2618 return get_node_event(&This->node, EVENTID_PASTE, p);
2621 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
2623 HTMLElement *This = impl_from_IHTMLElement2(iface);
2625 TRACE("(%p)->(%p)\n", This, p);
2627 return HTMLCurrentStyle_Create(This, p);
2630 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
2632 HTMLElement *This = impl_from_IHTMLElement2(iface);
2633 FIXME("(%p)->()\n", This);
2634 return E_NOTIMPL;
2637 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
2639 HTMLElement *This = impl_from_IHTMLElement2(iface);
2640 FIXME("(%p)->(%p)\n", This, p);
2641 return E_NOTIMPL;
2644 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
2646 HTMLElement *This = impl_from_IHTMLElement2(iface);
2647 nsIDOMClientRectList *rect_list;
2648 HTMLRectCollection *rects;
2649 nsresult nsres;
2651 TRACE("(%p)->(%p)\n", This, pRectCol);
2653 if(!This->dom_element) {
2654 FIXME("comment element\n");
2655 return E_NOTIMPL;
2658 nsres = nsIDOMElement_GetClientRects(This->dom_element, &rect_list);
2659 if(NS_FAILED(nsres)) {
2660 WARN("GetClientRects failed: %08x\n", nsres);
2661 return map_nsresult(nsres);
2664 rects = heap_alloc_zero(sizeof(*rects));
2665 if(!rects) {
2666 nsIDOMClientRectList_Release(rect_list);
2667 return E_OUTOFMEMORY;
2670 rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl;
2671 rects->ref = 1;
2672 rects->rect_list = rect_list;
2673 init_dispex_with_compat_mode(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface,
2674 &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
2676 *pRectCol = &rects->IHTMLRectCollection_iface;
2677 return S_OK;
2680 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
2682 HTMLElement *This = impl_from_IHTMLElement2(iface);
2683 nsIDOMClientRect *nsrect;
2684 nsresult nsres;
2685 HRESULT hres;
2687 TRACE("(%p)->(%p)\n", This, pRect);
2689 if(!This->dom_element) {
2690 FIXME("comment element\n");
2691 return E_NOTIMPL;
2694 nsres = nsIDOMElement_GetBoundingClientRect(This->dom_element, &nsrect);
2695 if(NS_FAILED(nsres) || !nsrect) {
2696 ERR("GetBoindingClientRect failed: %08x\n", nsres);
2697 return E_FAIL;
2700 hres = create_html_rect(nsrect, dispex_compat_mode(&This->node.event_target.dispex), pRect);
2702 nsIDOMClientRect_Release(nsrect);
2703 return hres;
2706 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
2707 BSTR expression, BSTR language)
2709 HTMLElement *This = impl_from_IHTMLElement2(iface);
2710 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
2711 debugstr_w(language));
2712 return E_NOTIMPL;
2715 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
2716 VARIANT *expression)
2718 HTMLElement *This = impl_from_IHTMLElement2(iface);
2719 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
2720 return E_NOTIMPL;
2723 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
2724 VARIANT_BOOL *pfSuccess)
2726 HTMLElement *This = impl_from_IHTMLElement2(iface);
2727 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
2728 return E_NOTIMPL;
2731 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
2733 HTMLElement *This = impl_from_IHTMLElement2(iface);
2734 nsresult nsres;
2736 TRACE("(%p)->(%d)\n", This, v);
2738 if(!This->html_element) {
2739 FIXME("non-HTML element\n");
2740 return E_NOTIMPL;
2743 nsres = nsIDOMHTMLElement_SetTabIndex(This->html_element, v);
2744 if(NS_FAILED(nsres))
2745 ERR("GetTabIndex failed: %08x\n", nsres);
2747 return S_OK;
2750 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
2752 HTMLElement *This = impl_from_IHTMLElement2(iface);
2753 LONG index;
2754 nsresult nsres;
2756 TRACE("(%p)->(%p)\n", This, p);
2758 if(!This->html_element) {
2759 FIXME("non-HTML element\n");
2760 return E_NOTIMPL;
2763 nsres = nsIDOMHTMLElement_GetTabIndex(This->html_element, &index);
2764 if(NS_FAILED(nsres)) {
2765 ERR("GetTabIndex failed: %08x\n", nsres);
2766 return E_FAIL;
2769 *p = index;
2770 return S_OK;
2773 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
2775 HTMLElement *This = impl_from_IHTMLElement2(iface);
2776 nsresult nsres;
2778 TRACE("(%p)\n", This);
2780 if(!This->html_element) {
2781 FIXME("non-HTML element\n");
2782 return E_NOTIMPL;
2785 nsres = nsIDOMHTMLElement_Focus(This->html_element);
2786 if(NS_FAILED(nsres))
2787 ERR("Focus failed: %08x\n", nsres);
2789 return S_OK;
2792 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
2794 HTMLElement *This = impl_from_IHTMLElement2(iface);
2795 VARIANT var;
2797 static WCHAR accessKeyW[] = L"accessKey";
2799 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2801 V_VT(&var) = VT_BSTR;
2802 V_BSTR(&var) = v;
2803 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, accessKeyW, var, 0);
2806 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
2808 HTMLElement *This = impl_from_IHTMLElement2(iface);
2809 FIXME("(%p)->(%p)\n", This, p);
2810 return E_NOTIMPL;
2813 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
2815 HTMLElement *This = impl_from_IHTMLElement2(iface);
2817 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2819 return set_node_event(&This->node, EVENTID_BLUR, &v);
2822 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
2824 HTMLElement *This = impl_from_IHTMLElement2(iface);
2826 TRACE("(%p)->(%p)\n", This, p);
2828 return get_node_event(&This->node, EVENTID_BLUR, p);
2831 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
2833 HTMLElement *This = impl_from_IHTMLElement2(iface);
2835 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2837 return set_node_event(&This->node, EVENTID_FOCUS, &v);
2840 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
2842 HTMLElement *This = impl_from_IHTMLElement2(iface);
2844 TRACE("(%p)->(%p)\n", This, p);
2846 return get_node_event(&This->node, EVENTID_FOCUS, p);
2849 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
2851 HTMLElement *This = impl_from_IHTMLElement2(iface);
2853 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2855 return set_node_event(&This->node, EVENTID_RESIZE, &v);
2858 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
2860 HTMLElement *This = impl_from_IHTMLElement2(iface);
2862 TRACE("(%p)->(%p)\n", This, p);
2864 return get_node_event(&This->node, EVENTID_RESIZE, p);
2867 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
2869 HTMLElement *This = impl_from_IHTMLElement2(iface);
2870 nsresult nsres;
2872 TRACE("(%p)\n", This);
2874 if(!This->html_element) {
2875 FIXME("non-HTML element\n");
2876 return E_NOTIMPL;
2879 nsres = nsIDOMHTMLElement_Blur(This->html_element);
2880 if(NS_FAILED(nsres)) {
2881 ERR("Blur failed: %08x\n", nsres);
2882 return E_FAIL;
2885 return S_OK;
2888 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2890 HTMLElement *This = impl_from_IHTMLElement2(iface);
2891 FIXME("(%p)->(%p)\n", This, pUnk);
2892 return E_NOTIMPL;
2895 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2897 HTMLElement *This = impl_from_IHTMLElement2(iface);
2898 FIXME("(%p)->(%p)\n", This, pUnk);
2899 return E_NOTIMPL;
2902 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
2904 HTMLElement *This = impl_from_IHTMLElement2(iface);
2905 nsresult nsres;
2907 TRACE("(%p)->(%p)\n", This, p);
2909 if(!This->dom_element) {
2910 FIXME("Unimplemented for comment element\n");
2911 return E_NOTIMPL;
2914 nsres = nsIDOMElement_GetClientHeight(This->dom_element, p);
2915 assert(nsres == NS_OK);
2916 return S_OK;
2919 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
2921 HTMLElement *This = impl_from_IHTMLElement2(iface);
2922 nsresult nsres;
2924 TRACE("(%p)->(%p)\n", This, p);
2926 if(!This->dom_element) {
2927 FIXME("comment element\n");
2928 return E_NOTIMPL;
2931 nsres = nsIDOMElement_GetClientWidth(This->dom_element, p);
2932 assert(nsres == NS_OK);
2933 return S_OK;
2936 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
2938 HTMLElement *This = impl_from_IHTMLElement2(iface);
2939 nsresult nsres;
2941 TRACE("(%p)->(%p)\n", This, p);
2943 if(!This->dom_element) {
2944 FIXME("comment element\n");
2945 return E_NOTIMPL;
2948 nsres = nsIDOMElement_GetClientTop(This->dom_element, p);
2949 assert(nsres == NS_OK);
2951 TRACE("*p = %d\n", *p);
2952 return S_OK;
2955 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
2957 HTMLElement *This = impl_from_IHTMLElement2(iface);
2958 nsresult nsres;
2960 TRACE("(%p)->(%p)\n", This, p);
2962 if(!This->dom_element) {
2963 FIXME("comment element\n");
2964 return E_NOTIMPL;
2967 nsres = nsIDOMElement_GetClientLeft(This->dom_element, p);
2968 assert(nsres == NS_OK);
2970 TRACE("*p = %d\n", *p);
2971 return S_OK;
2974 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
2975 IDispatch *pDisp, VARIANT_BOOL *pfResult)
2977 HTMLElement *This = impl_from_IHTMLElement2(iface);
2979 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
2981 return attach_event(&This->node.event_target, event, pDisp, pfResult);
2984 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
2986 HTMLElement *This = impl_from_IHTMLElement2(iface);
2988 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
2990 return detach_event(&This->node.event_target, event, pDisp);
2993 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
2995 HTMLElement *This = impl_from_IHTMLElement2(iface);
2996 BSTR str;
2998 TRACE("(%p)->(%p)\n", This, p);
3000 if(This->node.vtbl->get_readystate) {
3001 HRESULT hres;
3003 hres = This->node.vtbl->get_readystate(&This->node, &str);
3004 if(FAILED(hres))
3005 return hres;
3006 }else {
3007 str = SysAllocString(L"complete");
3008 if(!str)
3009 return E_OUTOFMEMORY;
3012 V_VT(p) = VT_BSTR;
3013 V_BSTR(p) = str;
3014 return S_OK;
3017 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
3019 HTMLElement *This = impl_from_IHTMLElement2(iface);
3021 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3023 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
3026 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
3028 HTMLElement *This = impl_from_IHTMLElement2(iface);
3030 TRACE("(%p)->(%p)\n", This, p);
3032 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
3035 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
3037 HTMLElement *This = impl_from_IHTMLElement2(iface);
3038 FIXME("(%p)->()\n", This);
3039 return E_NOTIMPL;
3042 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
3044 HTMLElement *This = impl_from_IHTMLElement2(iface);
3045 FIXME("(%p)->(%p)\n", This, p);
3046 return E_NOTIMPL;
3049 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(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_onrowsinserted(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_oncellchange(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_oncellchange(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_dir(IHTMLElement2 *iface, BSTR v)
3079 HTMLElement *This = impl_from_IHTMLElement2(iface);
3080 nsAString nsstr;
3081 nsresult nsres;
3083 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3085 if(!This->html_element) {
3086 FIXME("non-HTML element\n");
3087 return S_OK;
3090 nsAString_InitDepend(&nsstr, v);
3091 nsres = nsIDOMHTMLElement_SetDir(This->html_element, &nsstr);
3092 nsAString_Finish(&nsstr);
3093 if(NS_FAILED(nsres)) {
3094 ERR("SetDir failed: %08x\n", nsres);
3095 return E_FAIL;
3098 return S_OK;
3101 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
3103 HTMLElement *This = impl_from_IHTMLElement2(iface);
3104 nsAString dir_str;
3105 nsresult nsres;
3107 TRACE("(%p)->(%p)\n", This, p);
3109 if(!This->html_element) {
3110 if(This->dom_element)
3111 FIXME("non-HTML element\n");
3112 *p = NULL;
3113 return S_OK;
3116 nsAString_Init(&dir_str, NULL);
3117 nsres = nsIDOMHTMLElement_GetDir(This->html_element, &dir_str);
3118 return return_nsstr(nsres, &dir_str, p);
3121 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
3123 HTMLElement *This = impl_from_IHTMLElement2(iface);
3124 FIXME("(%p)->(%p)\n", This, range);
3125 return E_NOTIMPL;
3128 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
3130 HTMLElement *This = impl_from_IHTMLElement2(iface);
3131 nsresult nsres;
3133 TRACE("(%p)->(%p)\n", This, p);
3135 if(!This->dom_element) {
3136 FIXME("comment element\n");
3137 return E_NOTIMPL;
3140 nsres = nsIDOMElement_GetScrollHeight(This->dom_element, p);
3141 assert(nsres == NS_OK);
3142 TRACE("*p = %d\n", *p);
3143 return S_OK;
3146 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
3148 HTMLElement *This = impl_from_IHTMLElement2(iface);
3149 nsresult nsres;
3151 TRACE("(%p)->(%p)\n", This, p);
3153 if(!This->dom_element) {
3154 FIXME("comment element\n");
3155 return E_NOTIMPL;
3158 nsres = nsIDOMElement_GetScrollWidth(This->dom_element, p);
3159 assert(nsres == NS_OK);
3161 TRACE("*p = %d\n", *p);
3162 return S_OK;
3165 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
3167 HTMLElement *This = impl_from_IHTMLElement2(iface);
3169 TRACE("(%p)->(%d)\n", This, v);
3171 if(!This->dom_element) {
3172 FIXME("comment element\n");
3173 return E_NOTIMPL;
3176 nsIDOMElement_SetScrollTop(This->dom_element, v);
3177 return S_OK;
3180 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
3182 HTMLElement *This = impl_from_IHTMLElement2(iface);
3183 nsresult nsres;
3185 TRACE("(%p)->(%p)\n", This, p);
3187 if(!This->dom_element) {
3188 FIXME("comment element\n");
3189 return E_NOTIMPL;
3192 nsres = nsIDOMElement_GetScrollTop(This->dom_element, p);
3193 assert(nsres == NS_OK);
3195 TRACE("*p = %d\n", *p);
3196 return S_OK;
3199 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
3201 HTMLElement *This = impl_from_IHTMLElement2(iface);
3203 TRACE("(%p)->(%d)\n", This, v);
3205 if(!This->dom_element) {
3206 FIXME("comment element\n");
3207 return E_NOTIMPL;
3210 nsIDOMElement_SetScrollLeft(This->dom_element, v);
3211 return S_OK;
3214 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
3216 HTMLElement *This = impl_from_IHTMLElement2(iface);
3217 nsresult nsres;
3219 TRACE("(%p)->(%p)\n", This, p);
3221 if(!p)
3222 return E_INVALIDARG;
3224 if(!This->dom_element) {
3225 FIXME("comment element\n");
3226 return E_NOTIMPL;
3229 nsres = nsIDOMElement_GetScrollLeft(This->dom_element, p);
3230 assert(nsres == NS_OK);
3231 TRACE("*p = %d\n", *p);
3232 return S_OK;
3235 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
3237 HTMLElement *This = impl_from_IHTMLElement2(iface);
3238 FIXME("(%p)\n", This);
3239 return E_NOTIMPL;
3242 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
3244 HTMLElement *This = impl_from_IHTMLElement2(iface);
3245 FIXME("(%p)->(%p)\n", This, mergeThis);
3246 return E_NOTIMPL;
3249 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
3251 HTMLElement *This = impl_from_IHTMLElement2(iface);
3253 TRACE("(%p)->()\n", This);
3255 return set_node_event(&This->node, EVENTID_CONTEXTMENU, &v);
3258 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
3260 HTMLElement *This = impl_from_IHTMLElement2(iface);
3262 TRACE("(%p)->(%p)\n", This, p);
3264 return get_node_event(&This->node, EVENTID_CONTEXTMENU, p);
3267 static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, BSTR where,
3268 IHTMLElement *insertedElement, IHTMLElement **inserted)
3270 HTMLElement *This = impl_from_IHTMLElement2(iface);
3271 HTMLDOMNode *ret_node;
3272 HTMLElement *elem;
3273 HRESULT hres;
3275 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
3277 elem = unsafe_impl_from_IHTMLElement(insertedElement);
3278 if(!elem)
3279 return E_INVALIDARG;
3281 hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node);
3282 if(FAILED(hres))
3283 return hres;
3285 hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted);
3286 IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface);
3287 return hres;
3290 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
3291 BSTR where, IHTMLElement **applied)
3293 HTMLElement *This = impl_from_IHTMLElement2(iface);
3294 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
3295 return E_NOTIMPL;
3298 static HRESULT WINAPI HTMLElement2_getAdjacentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
3300 HTMLElement *This = impl_from_IHTMLElement2(iface);
3301 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
3302 return E_NOTIMPL;
3305 static HRESULT WINAPI HTMLElement2_replaceAdjacentText(IHTMLElement2 *iface, BSTR where,
3306 BSTR newText, BSTR *oldText)
3308 HTMLElement *This = impl_from_IHTMLElement2(iface);
3309 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
3310 return E_NOTIMPL;
3313 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
3315 HTMLElement *This = impl_from_IHTMLElement2(iface);
3316 FIXME("(%p)->(%p)\n", This, p);
3317 return E_NOTIMPL;
3320 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
3321 VARIANT *pvarFactory, LONG *pCookie)
3323 HTMLElement *This = impl_from_IHTMLElement2(iface);
3324 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
3325 return E_NOTIMPL;
3328 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
3329 VARIANT_BOOL *pfResult)
3331 HTMLElement *This = impl_from_IHTMLElement2(iface);
3332 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
3333 return E_NOTIMPL;
3336 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
3338 HTMLElement *This = impl_from_IHTMLElement2(iface);
3340 FIXME("(%p)->(%p): hack\n", This, p);
3342 /* We can't implement correct behavior on top of Gecko (although we could
3343 try a bit harder). Making runtimeStyle behave like regular style is
3344 enough for most use cases. */
3345 if(!This->runtime_style) {
3346 HRESULT hres;
3348 hres = HTMLStyle_Create(This, &This->runtime_style);
3349 if(FAILED(hres))
3350 return hres;
3353 *p = &This->runtime_style->IHTMLStyle_iface;
3354 IHTMLStyle_AddRef(*p);
3355 return S_OK;
3358 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
3360 HTMLElement *This = impl_from_IHTMLElement2(iface);
3361 FIXME("(%p)->(%p)\n", This, p);
3362 return E_NOTIMPL;
3365 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
3367 HTMLElement *This = impl_from_IHTMLElement2(iface);
3368 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3369 return E_NOTIMPL;
3372 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *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_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
3381 HTMLElement *This = impl_from_IHTMLElement2(iface);
3382 FIXME("(%p)->()\n", This);
3383 return E_NOTIMPL;
3386 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
3388 HTMLElement *This = impl_from_IHTMLElement2(iface);
3389 FIXME("(%p)->(%p)\n", This, p);
3390 return E_NOTIMPL;
3393 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
3395 HTMLElement *This = impl_from_IHTMLElement2(iface);
3396 FIXME("(%p)->(%p)\n", This, p);
3397 return E_NOTIMPL;
3400 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
3401 IHTMLElementCollection **pelColl)
3403 HTMLElement *This = impl_from_IHTMLElement2(iface);
3404 nsIDOMHTMLCollection *nscol;
3405 nsAString tag_str;
3406 nsresult nsres;
3408 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
3410 if(!This->dom_element) {
3411 *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode);
3412 return S_OK;
3415 nsAString_InitDepend(&tag_str, v);
3416 nsres = nsIDOMElement_GetElementsByTagName(This->dom_element, &tag_str, &nscol);
3417 nsAString_Finish(&tag_str);
3418 if(NS_FAILED(nsres)) {
3419 ERR("GetElementByTagName failed: %08x\n", nsres);
3420 return E_FAIL;
3423 *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
3424 nsIDOMHTMLCollection_Release(nscol);
3425 return S_OK;
3428 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
3429 HTMLElement2_QueryInterface,
3430 HTMLElement2_AddRef,
3431 HTMLElement2_Release,
3432 HTMLElement2_GetTypeInfoCount,
3433 HTMLElement2_GetTypeInfo,
3434 HTMLElement2_GetIDsOfNames,
3435 HTMLElement2_Invoke,
3436 HTMLElement2_get_scopeName,
3437 HTMLElement2_setCapture,
3438 HTMLElement2_releaseCapture,
3439 HTMLElement2_put_onlosecapture,
3440 HTMLElement2_get_onlosecapture,
3441 HTMLElement2_componentFromPoint,
3442 HTMLElement2_doScroll,
3443 HTMLElement2_put_onscroll,
3444 HTMLElement2_get_onscroll,
3445 HTMLElement2_put_ondrag,
3446 HTMLElement2_get_ondrag,
3447 HTMLElement2_put_ondragend,
3448 HTMLElement2_get_ondragend,
3449 HTMLElement2_put_ondragenter,
3450 HTMLElement2_get_ondragenter,
3451 HTMLElement2_put_ondragover,
3452 HTMLElement2_get_ondragover,
3453 HTMLElement2_put_ondragleave,
3454 HTMLElement2_get_ondragleave,
3455 HTMLElement2_put_ondrop,
3456 HTMLElement2_get_ondrop,
3457 HTMLElement2_put_onbeforecut,
3458 HTMLElement2_get_onbeforecut,
3459 HTMLElement2_put_oncut,
3460 HTMLElement2_get_oncut,
3461 HTMLElement2_put_onbeforecopy,
3462 HTMLElement2_get_onbeforecopy,
3463 HTMLElement2_put_oncopy,
3464 HTMLElement2_get_oncopy,
3465 HTMLElement2_put_onbeforepaste,
3466 HTMLElement2_get_onbeforepaste,
3467 HTMLElement2_put_onpaste,
3468 HTMLElement2_get_onpaste,
3469 HTMLElement2_get_currentStyle,
3470 HTMLElement2_put_onpropertychange,
3471 HTMLElement2_get_onpropertychange,
3472 HTMLElement2_getClientRects,
3473 HTMLElement2_getBoundingClientRect,
3474 HTMLElement2_setExpression,
3475 HTMLElement2_getExpression,
3476 HTMLElement2_removeExpression,
3477 HTMLElement2_put_tabIndex,
3478 HTMLElement2_get_tabIndex,
3479 HTMLElement2_focus,
3480 HTMLElement2_put_accessKey,
3481 HTMLElement2_get_accessKey,
3482 HTMLElement2_put_onblur,
3483 HTMLElement2_get_onblur,
3484 HTMLElement2_put_onfocus,
3485 HTMLElement2_get_onfocus,
3486 HTMLElement2_put_onresize,
3487 HTMLElement2_get_onresize,
3488 HTMLElement2_blur,
3489 HTMLElement2_addFilter,
3490 HTMLElement2_removeFilter,
3491 HTMLElement2_get_clientHeight,
3492 HTMLElement2_get_clientWidth,
3493 HTMLElement2_get_clientTop,
3494 HTMLElement2_get_clientLeft,
3495 HTMLElement2_attachEvent,
3496 HTMLElement2_detachEvent,
3497 HTMLElement2_get_readyState,
3498 HTMLElement2_put_onreadystatechange,
3499 HTMLElement2_get_onreadystatechange,
3500 HTMLElement2_put_onrowsdelete,
3501 HTMLElement2_get_onrowsdelete,
3502 HTMLElement2_put_onrowsinserted,
3503 HTMLElement2_get_onrowsinserted,
3504 HTMLElement2_put_oncellchange,
3505 HTMLElement2_get_oncellchange,
3506 HTMLElement2_put_dir,
3507 HTMLElement2_get_dir,
3508 HTMLElement2_createControlRange,
3509 HTMLElement2_get_scrollHeight,
3510 HTMLElement2_get_scrollWidth,
3511 HTMLElement2_put_scrollTop,
3512 HTMLElement2_get_scrollTop,
3513 HTMLElement2_put_scrollLeft,
3514 HTMLElement2_get_scrollLeft,
3515 HTMLElement2_clearAttributes,
3516 HTMLElement2_mergeAttributes,
3517 HTMLElement2_put_oncontextmenu,
3518 HTMLElement2_get_oncontextmenu,
3519 HTMLElement2_insertAdjacentElement,
3520 HTMLElement2_applyElement,
3521 HTMLElement2_getAdjacentText,
3522 HTMLElement2_replaceAdjacentText,
3523 HTMLElement2_get_canHandleChildren,
3524 HTMLElement2_addBehavior,
3525 HTMLElement2_removeBehavior,
3526 HTMLElement2_get_runtimeStyle,
3527 HTMLElement2_get_behaviorUrns,
3528 HTMLElement2_put_tagUrn,
3529 HTMLElement2_get_tagUrn,
3530 HTMLElement2_put_onbeforeeditfocus,
3531 HTMLElement2_get_onbeforeeditfocus,
3532 HTMLElement2_get_readyStateValue,
3533 HTMLElement2_getElementsByTagName,
3536 static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
3538 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
3541 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
3542 REFIID riid, void **ppv)
3544 HTMLElement *This = impl_from_IHTMLElement3(iface);
3545 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
3548 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
3550 HTMLElement *This = impl_from_IHTMLElement3(iface);
3551 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
3554 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
3556 HTMLElement *This = impl_from_IHTMLElement3(iface);
3557 return IHTMLElement_Release(&This->IHTMLElement_iface);
3560 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
3562 HTMLElement *This = impl_from_IHTMLElement3(iface);
3563 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
3566 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
3567 LCID lcid, ITypeInfo **ppTInfo)
3569 HTMLElement *This = impl_from_IHTMLElement3(iface);
3570 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
3573 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
3574 LPOLESTR *rgszNames, UINT cNames,
3575 LCID lcid, DISPID *rgDispId)
3577 HTMLElement *This = impl_from_IHTMLElement3(iface);
3578 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
3579 lcid, rgDispId);
3582 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
3583 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3584 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3586 HTMLElement *This = impl_from_IHTMLElement3(iface);
3587 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
3588 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3591 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
3593 HTMLElement *This = impl_from_IHTMLElement3(iface);
3594 FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
3595 return E_NOTIMPL;
3598 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
3600 HTMLElement *This = impl_from_IHTMLElement3(iface);
3601 FIXME("(%p)->(%p)\n", This, p);
3602 return E_NOTIMPL;
3605 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
3607 HTMLElement *This = impl_from_IHTMLElement3(iface);
3608 FIXME("(%p)->(%p)\n", This, p);
3609 return E_NOTIMPL;
3612 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
3614 HTMLElement *This = impl_from_IHTMLElement3(iface);
3615 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3616 return E_NOTIMPL;
3619 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *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_onpage(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_onpage(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_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
3642 HTMLElement *This = impl_from_IHTMLElement3(iface);
3643 FIXME("(%p)->(%x)\n", This, v);
3644 return E_NOTIMPL;
3647 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *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_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
3656 HTMLElement *This = impl_from_IHTMLElement3(iface);
3657 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3658 return E_NOTIMPL;
3661 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
3663 HTMLElement *This = impl_from_IHTMLElement3(iface);
3664 FIXME("(%p)->(%p)\n", This, p);
3665 return E_NOTIMPL;
3668 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
3670 HTMLElement *This = impl_from_IHTMLElement3(iface);
3671 FIXME("(%p)\n", This);
3672 return E_NOTIMPL;
3675 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
3677 HTMLElement *This = impl_from_IHTMLElement3(iface);
3678 nsresult nsres;
3679 nsAString str;
3681 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3683 if(!This->html_element) {
3684 FIXME("non-HTML element\n");
3685 return E_NOTIMPL;
3688 nsAString_InitDepend(&str, v);
3689 nsres = nsIDOMHTMLElement_SetContentEditable(This->html_element, &str);
3690 nsAString_Finish(&str);
3692 if (NS_FAILED(nsres)){
3693 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v));
3694 return E_FAIL;
3697 return S_OK;
3700 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
3702 HTMLElement *This = impl_from_IHTMLElement3(iface);
3703 nsresult nsres;
3704 nsAString str;
3706 TRACE("(%p)->(%p)\n", This, p);
3708 if(!This->html_element) {
3709 FIXME("non-HTML element\n");
3710 return E_NOTIMPL;
3713 nsAString_Init(&str, NULL);
3714 nsres = nsIDOMHTMLElement_GetContentEditable(This->html_element, &str);
3715 return return_nsstr(nsres, &str, p);
3718 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
3720 HTMLElement *This = impl_from_IHTMLElement3(iface);
3721 FIXME("(%p)->(%p)\n", This, p);
3722 return E_NOTIMPL;
3725 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
3727 HTMLElement *This = impl_from_IHTMLElement3(iface);
3728 FIXME("(%p)->(%x)\n", This, v);
3729 return E_NOTIMPL;
3732 static HRESULT WINAPI HTMLElement3_get_hideFocus(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_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
3741 HTMLElement *This = impl_from_IHTMLElement3(iface);
3742 VARIANT *var;
3743 HRESULT hres;
3745 TRACE("(%p)->(%x)\n", This, v);
3747 if(This->node.vtbl->put_disabled)
3748 return This->node.vtbl->put_disabled(&This->node, v);
3750 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", TRUE, &var);
3751 if(FAILED(hres))
3752 return hres;
3754 VariantClear(var);
3755 V_VT(var) = VT_BOOL;
3756 V_BOOL(var) = v;
3757 return S_OK;
3760 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3762 HTMLElement *This = impl_from_IHTMLElement3(iface);
3763 VARIANT *var;
3764 HRESULT hres;
3766 TRACE("(%p)->(%p)\n", This, p);
3768 if(This->node.vtbl->get_disabled)
3769 return This->node.vtbl->get_disabled(&This->node, p);
3771 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", FALSE, &var);
3772 if(hres == DISP_E_UNKNOWNNAME) {
3773 *p = VARIANT_FALSE;
3774 return S_OK;
3776 if(FAILED(hres))
3777 return hres;
3779 if(V_VT(var) != VT_BOOL) {
3780 FIXME("value is %s\n", debugstr_variant(var));
3781 return E_NOTIMPL;
3784 *p = V_BOOL(var);
3785 return S_OK;
3788 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3790 HTMLElement *This = impl_from_IHTMLElement3(iface);
3791 FIXME("(%p)->(%p)\n", This, p);
3792 return E_NOTIMPL;
3795 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
3797 HTMLElement *This = impl_from_IHTMLElement3(iface);
3798 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3799 return E_NOTIMPL;
3802 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *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_oncontrolselect(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_oncontrolselect(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_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
3824 VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
3826 HTMLElement *This = impl_from_IHTMLElement3(iface);
3828 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
3829 pfCancelled);
3831 return fire_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
3834 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
3836 HTMLElement *This = impl_from_IHTMLElement3(iface);
3837 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3838 return E_NOTIMPL;
3841 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
3843 HTMLElement *This = impl_from_IHTMLElement3(iface);
3844 FIXME("(%p)->(%p)\n", This, p);
3845 return E_NOTIMPL;
3848 static HRESULT WINAPI HTMLElement3_put_onresizeend(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_onresizeend(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_onmovestart(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_onmovestart(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_onmoveend(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_onmoveend(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_onmousecenter(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_onmousecenter(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_onmouseleave(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_onmouseleave(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_onactivate(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_onactivate(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_ondeactivate(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_ondeactivate(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_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
3948 HTMLElement *This = impl_from_IHTMLElement3(iface);
3949 FIXME("(%p)->(%p)\n", This, pfRet);
3950 return E_NOTIMPL;
3953 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
3955 HTMLElement *This = impl_from_IHTMLElement3(iface);
3956 FIXME("(%p)->(%p)\n", This, p);
3957 return E_NOTIMPL;
3960 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
3961 HTMLElement3_QueryInterface,
3962 HTMLElement3_AddRef,
3963 HTMLElement3_Release,
3964 HTMLElement3_GetTypeInfoCount,
3965 HTMLElement3_GetTypeInfo,
3966 HTMLElement3_GetIDsOfNames,
3967 HTMLElement3_Invoke,
3968 HTMLElement3_mergeAttributes,
3969 HTMLElement3_get_isMultiLine,
3970 HTMLElement3_get_canHaveHTML,
3971 HTMLElement3_put_onlayoutcomplete,
3972 HTMLElement3_get_onlayoutcomplete,
3973 HTMLElement3_put_onpage,
3974 HTMLElement3_get_onpage,
3975 HTMLElement3_put_inflateBlock,
3976 HTMLElement3_get_inflateBlock,
3977 HTMLElement3_put_onbeforedeactivate,
3978 HTMLElement3_get_onbeforedeactivate,
3979 HTMLElement3_setActive,
3980 HTMLElement3_put_contentEditable,
3981 HTMLElement3_get_contentEditable,
3982 HTMLElement3_get_isContentEditable,
3983 HTMLElement3_put_hideFocus,
3984 HTMLElement3_get_hideFocus,
3985 HTMLElement3_put_disabled,
3986 HTMLElement3_get_disabled,
3987 HTMLElement3_get_isDisabled,
3988 HTMLElement3_put_onmove,
3989 HTMLElement3_get_onmove,
3990 HTMLElement3_put_oncontrolselect,
3991 HTMLElement3_get_oncontrolselect,
3992 HTMLElement3_fireEvent,
3993 HTMLElement3_put_onresizestart,
3994 HTMLElement3_get_onresizestart,
3995 HTMLElement3_put_onresizeend,
3996 HTMLElement3_get_onresizeend,
3997 HTMLElement3_put_onmovestart,
3998 HTMLElement3_get_onmovestart,
3999 HTMLElement3_put_onmoveend,
4000 HTMLElement3_get_onmoveend,
4001 HTMLElement3_put_onmousecenter,
4002 HTMLElement3_get_onmousecenter,
4003 HTMLElement3_put_onmouseleave,
4004 HTMLElement3_get_onmouseleave,
4005 HTMLElement3_put_onactivate,
4006 HTMLElement3_get_onactivate,
4007 HTMLElement3_put_ondeactivate,
4008 HTMLElement3_get_ondeactivate,
4009 HTMLElement3_dragDrop,
4010 HTMLElement3_get_glyphMode
4013 static inline HTMLElement *impl_from_IHTMLElement4(IHTMLElement4 *iface)
4015 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement4_iface);
4018 static HRESULT WINAPI HTMLElement4_QueryInterface(IHTMLElement4 *iface,
4019 REFIID riid, void **ppv)
4021 HTMLElement *This = impl_from_IHTMLElement4(iface);
4022 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4025 static ULONG WINAPI HTMLElement4_AddRef(IHTMLElement4 *iface)
4027 HTMLElement *This = impl_from_IHTMLElement4(iface);
4028 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4031 static ULONG WINAPI HTMLElement4_Release(IHTMLElement4 *iface)
4033 HTMLElement *This = impl_from_IHTMLElement4(iface);
4034 return IHTMLElement_Release(&This->IHTMLElement_iface);
4037 static HRESULT WINAPI HTMLElement4_GetTypeInfoCount(IHTMLElement4 *iface, UINT *pctinfo)
4039 HTMLElement *This = impl_from_IHTMLElement4(iface);
4040 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4043 static HRESULT WINAPI HTMLElement4_GetTypeInfo(IHTMLElement4 *iface, UINT iTInfo,
4044 LCID lcid, ITypeInfo **ppTInfo)
4046 HTMLElement *This = impl_from_IHTMLElement4(iface);
4047 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4050 static HRESULT WINAPI HTMLElement4_GetIDsOfNames(IHTMLElement4 *iface, REFIID riid,
4051 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4053 HTMLElement *This = impl_from_IHTMLElement4(iface);
4054 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4055 lcid, rgDispId);
4058 static HRESULT WINAPI HTMLElement4_Invoke(IHTMLElement4 *iface, DISPID dispIdMember, REFIID riid,
4059 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4061 HTMLElement *This = impl_from_IHTMLElement4(iface);
4062 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4063 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4066 static HRESULT WINAPI HTMLElement4_put_onmousewheel(IHTMLElement4 *iface, VARIANT v)
4068 HTMLElement *This = impl_from_IHTMLElement4(iface);
4070 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4072 return set_node_event(&This->node, EVENTID_MOUSEWHEEL, &v);
4075 static HRESULT WINAPI HTMLElement4_get_onmousewheel(IHTMLElement4 *iface, VARIANT *p)
4077 HTMLElement *This = impl_from_IHTMLElement4(iface);
4079 TRACE("(%p)->(%p)\n", This, p);
4081 return get_node_event(&This->node, EVENTID_MOUSEWHEEL, p);
4084 static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
4086 HTMLElement *This = impl_from_IHTMLElement4(iface);
4087 FIXME("(%p)\n", This);
4088 return E_NOTIMPL;
4091 static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute)
4093 HTMLElement *This = impl_from_IHTMLElement4(iface);
4094 HTMLAttributeCollection *attrs;
4095 HRESULT hres;
4097 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute);
4099 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4100 if(FAILED(hres))
4101 return hres;
4103 hres = IHTMLAttributeCollection2_getNamedItem(&attrs->IHTMLAttributeCollection2_iface, bstrname, ppAttribute);
4104 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4105 return hres;
4108 static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4109 IHTMLDOMAttribute **ppretAttribute)
4111 HTMLElement *This = impl_from_IHTMLElement4(iface);
4112 HTMLDOMAttribute *attr, *iter, *replace = NULL;
4113 HTMLAttributeCollection *attrs;
4114 DISPID dispid;
4115 HRESULT hres;
4117 TRACE("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4119 attr = unsafe_impl_from_IHTMLDOMAttribute(pattr);
4120 if(!attr)
4121 return E_INVALIDARG;
4123 if(attr->elem) {
4124 WARN("Tried to set already attached attribute.\n");
4125 return E_INVALIDARG;
4128 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface,
4129 attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid);
4130 if(FAILED(hres))
4131 return hres;
4133 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4134 if(FAILED(hres))
4135 return hres;
4137 LIST_FOR_EACH_ENTRY(iter, &attrs->attrs, HTMLDOMAttribute, entry) {
4138 if(iter->dispid == dispid) {
4139 replace = iter;
4140 break;
4144 if(replace) {
4145 hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value);
4146 if(FAILED(hres)) {
4147 WARN("could not get attr value: %08x\n", hres);
4148 V_VT(&replace->value) = VT_EMPTY;
4150 if(!replace->name) {
4151 replace->name = attr->name;
4152 attr->name = NULL;
4154 list_add_head(&replace->entry, &attr->entry);
4155 list_remove(&replace->entry);
4156 replace->elem = NULL;
4157 }else {
4158 list_add_tail(&attrs->attrs, &attr->entry);
4161 IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface);
4162 attr->elem = This;
4163 attr->dispid = dispid;
4165 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4167 hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value);
4168 if(FAILED(hres))
4169 WARN("Could not set attribute value: %08x\n", hres);
4170 VariantClear(&attr->value);
4172 *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL;
4173 return S_OK;
4176 static HRESULT WINAPI HTMLElement4_removeAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4177 IHTMLDOMAttribute **ppretAttribute)
4179 HTMLElement *This = impl_from_IHTMLElement4(iface);
4180 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4181 return E_NOTIMPL;
4184 static HRESULT WINAPI HTMLElement4_put_onbeforeactivate(IHTMLElement4 *iface, VARIANT v)
4186 HTMLElement *This = impl_from_IHTMLElement4(iface);
4188 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4190 return set_node_event(&This->node, EVENTID_BEFOREACTIVATE, &v);
4193 static HRESULT WINAPI HTMLElement4_get_onbeforeactivate(IHTMLElement4 *iface, VARIANT *p)
4195 HTMLElement *This = impl_from_IHTMLElement4(iface);
4197 TRACE("(%p)->(%p)\n", This, p);
4199 return get_node_event(&This->node, EVENTID_BEFOREACTIVATE, p);
4202 static HRESULT WINAPI HTMLElement4_put_onfocusin(IHTMLElement4 *iface, VARIANT v)
4204 HTMLElement *This = impl_from_IHTMLElement4(iface);
4206 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4208 return set_node_event(&This->node, EVENTID_FOCUSIN, &v);
4211 static HRESULT WINAPI HTMLElement4_get_onfocusin(IHTMLElement4 *iface, VARIANT *p)
4213 HTMLElement *This = impl_from_IHTMLElement4(iface);
4215 TRACE("(%p)->(%p)\n", This, p);
4217 return get_node_event(&This->node, EVENTID_FOCUSIN, p);
4220 static HRESULT WINAPI HTMLElement4_put_onfocusout(IHTMLElement4 *iface, VARIANT v)
4222 HTMLElement *This = impl_from_IHTMLElement4(iface);
4224 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4226 return set_node_event(&This->node, EVENTID_FOCUSOUT, &v);
4229 static HRESULT WINAPI HTMLElement4_get_onfocusout(IHTMLElement4 *iface, VARIANT *p)
4231 HTMLElement *This = impl_from_IHTMLElement4(iface);
4233 TRACE("(%p)->(%p)\n", This, p);
4235 return get_node_event(&This->node, EVENTID_FOCUSOUT, p);
4238 static const IHTMLElement4Vtbl HTMLElement4Vtbl = {
4239 HTMLElement4_QueryInterface,
4240 HTMLElement4_AddRef,
4241 HTMLElement4_Release,
4242 HTMLElement4_GetTypeInfoCount,
4243 HTMLElement4_GetTypeInfo,
4244 HTMLElement4_GetIDsOfNames,
4245 HTMLElement4_Invoke,
4246 HTMLElement4_put_onmousewheel,
4247 HTMLElement4_get_onmousewheel,
4248 HTMLElement4_normalize,
4249 HTMLElement4_getAttributeNode,
4250 HTMLElement4_setAttributeNode,
4251 HTMLElement4_removeAttributeNode,
4252 HTMLElement4_put_onbeforeactivate,
4253 HTMLElement4_get_onbeforeactivate,
4254 HTMLElement4_put_onfocusin,
4255 HTMLElement4_get_onfocusin,
4256 HTMLElement4_put_onfocusout,
4257 HTMLElement4_get_onfocusout
4260 static inline HTMLElement *impl_from_IHTMLElement6(IHTMLElement6 *iface)
4262 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement6_iface);
4265 static HRESULT WINAPI HTMLElement6_QueryInterface(IHTMLElement6 *iface,
4266 REFIID riid, void **ppv)
4268 HTMLElement *This = impl_from_IHTMLElement6(iface);
4269 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4272 static ULONG WINAPI HTMLElement6_AddRef(IHTMLElement6 *iface)
4274 HTMLElement *This = impl_from_IHTMLElement6(iface);
4275 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4278 static ULONG WINAPI HTMLElement6_Release(IHTMLElement6 *iface)
4280 HTMLElement *This = impl_from_IHTMLElement6(iface);
4281 return IHTMLElement_Release(&This->IHTMLElement_iface);
4284 static HRESULT WINAPI HTMLElement6_GetTypeInfoCount(IHTMLElement6 *iface, UINT *pctinfo)
4286 HTMLElement *This = impl_from_IHTMLElement6(iface);
4287 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4290 static HRESULT WINAPI HTMLElement6_GetTypeInfo(IHTMLElement6 *iface, UINT iTInfo,
4291 LCID lcid, ITypeInfo **ppTInfo)
4293 HTMLElement *This = impl_from_IHTMLElement6(iface);
4294 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4297 static HRESULT WINAPI HTMLElement6_GetIDsOfNames(IHTMLElement6 *iface, REFIID riid,
4298 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4300 HTMLElement *This = impl_from_IHTMLElement6(iface);
4301 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4302 lcid, rgDispId);
4305 static HRESULT WINAPI HTMLElement6_Invoke(IHTMLElement6 *iface, DISPID dispIdMember, REFIID riid,
4306 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4308 HTMLElement *This = impl_from_IHTMLElement6(iface);
4309 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4310 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4313 static HRESULT WINAPI HTMLElement6_getAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *AttributeValue)
4315 HTMLElement *This = impl_from_IHTMLElement6(iface);
4316 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
4317 return E_NOTIMPL;
4320 static HRESULT WINAPI HTMLElement6_setAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4322 HTMLElement *This = impl_from_IHTMLElement6(iface);
4323 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), debugstr_variant(pvarAttributeValue));
4324 return E_NOTIMPL;
4327 static HRESULT WINAPI HTMLElement6_removeAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName)
4329 HTMLElement *This = impl_from_IHTMLElement6(iface);
4330 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName));
4331 return E_NOTIMPL;
4334 static HRESULT WINAPI HTMLElement6_getAttributeNodeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, IHTMLDOMAttribute2 **ppretAttribute)
4336 HTMLElement *This = impl_from_IHTMLElement6(iface);
4337 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), ppretAttribute);
4338 return E_NOTIMPL;
4341 static HRESULT WINAPI HTMLElement6_setAttributeNodeNS(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4343 HTMLElement *This = impl_from_IHTMLElement6(iface);
4344 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4345 return E_NOTIMPL;
4348 static HRESULT WINAPI HTMLElement6_hasAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, VARIANT_BOOL *pfHasAttribute)
4350 HTMLElement *This = impl_from_IHTMLElement6(iface);
4351 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), pfHasAttribute);
4352 return E_NOTIMPL;
4355 static HRESULT WINAPI HTMLElement6_getAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *AttributeValue)
4357 HTMLElement *This = impl_from_IHTMLElement6(iface);
4359 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), AttributeValue);
4361 return IHTMLElement_getAttribute(&This->IHTMLElement_iface, strAttributeName, 0, AttributeValue);
4364 static HRESULT WINAPI HTMLElement6_setAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4366 HTMLElement *This = impl_from_IHTMLElement6(iface);
4368 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), pvarAttributeValue);
4370 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, strAttributeName, *pvarAttributeValue, 0);
4373 static HRESULT WINAPI HTMLElement6_removeAttribute(IHTMLElement6 *iface, BSTR strAttributeName)
4375 HTMLElement *This = impl_from_IHTMLElement6(iface);
4376 VARIANT_BOOL success;
4378 WARN("(%p)->(%s) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName));
4380 return IHTMLElement_removeAttribute(&This->IHTMLElement_iface, strAttributeName, 0, &success);
4383 static HRESULT WINAPI HTMLElement6_getAttributeNode(IHTMLElement6 *iface, BSTR strAttributeName, IHTMLDOMAttribute2 **ppretAttribute)
4385 HTMLElement *This = impl_from_IHTMLElement6(iface);
4386 IHTMLDOMAttribute *attr;
4387 HRESULT hres;
4389 WARN("(%p)->(%s %p) forwarding to IHTMLElement4\n", This, debugstr_w(strAttributeName), ppretAttribute);
4391 hres = IHTMLElement4_getAttributeNode(&This->IHTMLElement4_iface, strAttributeName, &attr);
4392 if(FAILED(hres))
4393 return hres;
4395 if(attr) {
4396 hres = IHTMLDOMAttribute_QueryInterface(attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4397 IHTMLDOMAttribute_Release(attr);
4398 }else {
4399 *ppretAttribute = NULL;
4401 return hres;
4404 static HRESULT WINAPI HTMLElement6_setAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4406 HTMLElement *This = impl_from_IHTMLElement6(iface);
4407 IHTMLDOMAttribute *attr, *ret_attr;
4408 HRESULT hres;
4410 WARN("(%p)->(%p %p) forwarding to IHTMLElement4\n", This, pattr, ppretAttribute);
4412 hres = IHTMLDOMAttribute2_QueryInterface(pattr, &IID_IHTMLDOMAttribute, (void**)&attr);
4413 if(FAILED(hres))
4414 return hres;
4416 hres = IHTMLElement4_setAttributeNode(&This->IHTMLElement4_iface, attr, &ret_attr);
4417 if(FAILED(hres))
4418 return hres;
4420 if(ret_attr) {
4421 hres = IHTMLDOMAttribute_QueryInterface(ret_attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4422 IHTMLDOMAttribute_Release(ret_attr);
4423 }else {
4424 *ppretAttribute = NULL;
4426 return hres;
4429 static HRESULT WINAPI HTMLElement6_removeAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4431 HTMLElement *This = impl_from_IHTMLElement6(iface);
4432 FIXME("(%p)->()\n", This);
4433 return E_NOTIMPL;
4436 static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *pfHasAttribute)
4438 HTMLElement *This = impl_from_IHTMLElement6(iface);
4439 FIXME("(%p)->(%s %p)\n", This, debugstr_w(name), pfHasAttribute);
4440 return E_NOTIMPL;
4443 static HRESULT WINAPI HTMLElement6_getElementsByTagNameNS(IHTMLElement6 *iface, VARIANT *varNS, BSTR bstrLocalName, IHTMLElementCollection **pelColl)
4445 HTMLElement *This = impl_from_IHTMLElement6(iface);
4446 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(varNS), debugstr_w(bstrLocalName), pelColl);
4447 return E_NOTIMPL;
4450 static HRESULT WINAPI HTMLElement6_get_tagName(IHTMLElement6 *iface, BSTR *p)
4452 HTMLElement *This = impl_from_IHTMLElement6(iface);
4454 TRACE("(%p)->(%p)\n", This, p);
4456 return IHTMLElement_get_tagName(&This->IHTMLElement_iface, p);
4459 static HRESULT WINAPI HTMLElement6_get_nodeName(IHTMLElement6 *iface, BSTR *p)
4461 HTMLElement *This = impl_from_IHTMLElement6(iface);
4463 TRACE("(%p)->(%p)\n", This, p);
4465 return IHTMLDOMNode_get_nodeName(&This->node.IHTMLDOMNode_iface, p);
4468 static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, BSTR v, IHTMLElementCollection **pel)
4470 HTMLElement *This = impl_from_IHTMLElement6(iface);
4471 nsIDOMHTMLCollection *nscol = NULL;
4472 nsAString nsstr;
4473 nsresult nsres;
4475 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
4477 if(This->dom_element) {
4478 nsAString_InitDepend(&nsstr, v);
4479 nsres = nsIDOMElement_GetElementsByClassName(This->dom_element, &nsstr, &nscol);
4480 nsAString_Finish(&nsstr);
4481 if(NS_FAILED(nsres)) {
4482 ERR("GetElementsByClassName failed: %08x\n", nsres);
4483 return E_FAIL;
4487 *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
4488 nsIDOMHTMLCollection_Release(nscol);
4489 return S_OK;
4492 static HRESULT WINAPI HTMLElement6_msMatchesSelector(IHTMLElement6 *iface, BSTR v, VARIANT_BOOL *pfMatches)
4494 HTMLElement *This = impl_from_IHTMLElement6(iface);
4495 nsAString nsstr;
4496 cpp_bool b;
4497 nsresult nsres;
4499 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pfMatches);
4501 if(!This->dom_element) {
4502 FIXME("No dom element\n");
4503 return E_UNEXPECTED;
4506 nsAString_InitDepend(&nsstr, v);
4507 nsres = nsIDOMElement_MozMatchesSelector(This->dom_element, &nsstr, &b);
4508 nsAString_Finish(&nsstr);
4509 if(NS_FAILED(nsres)) {
4510 WARN("MozMatchesSelector failed: %08x\n", nsres);
4511 return map_nsresult(nsres);
4514 *pfMatches = b;
4515 return S_OK;
4518 static HRESULT WINAPI HTMLElement6_put_onabort(IHTMLElement6 *iface, VARIANT v)
4520 HTMLElement *This = impl_from_IHTMLElement6(iface);
4522 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4524 return set_node_event(&This->node, EVENTID_ABORT, &v);
4527 static HRESULT WINAPI HTMLElement6_get_onabort(IHTMLElement6 *iface, VARIANT *p)
4529 HTMLElement *This = impl_from_IHTMLElement6(iface);
4531 TRACE("(%p)->(%p)\n", This, p);
4533 return get_node_event(&This->node, EVENTID_ABORT, p);
4536 static HRESULT WINAPI HTMLElement6_put_oncanplay(IHTMLElement6 *iface, VARIANT v)
4538 HTMLElement *This = impl_from_IHTMLElement6(iface);
4539 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4540 return E_NOTIMPL;
4543 static HRESULT WINAPI HTMLElement6_get_oncanplay(IHTMLElement6 *iface, VARIANT *p)
4545 HTMLElement *This = impl_from_IHTMLElement6(iface);
4546 FIXME("(%p)->(%p)\n", This, p);
4547 return E_NOTIMPL;
4550 static HRESULT WINAPI HTMLElement6_put_oncanplaythrough(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_oncanplaythrough(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_onchange(IHTMLElement6 *iface, VARIANT v)
4566 HTMLElement *This = impl_from_IHTMLElement6(iface);
4568 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4570 return set_node_event(&This->node, EVENTID_CHANGE, &v);
4573 static HRESULT WINAPI HTMLElement6_get_onchange(IHTMLElement6 *iface, VARIANT *p)
4575 HTMLElement *This = impl_from_IHTMLElement6(iface);
4577 TRACE("(%p)->(%p)\n", This, p);
4579 return get_node_event(&This->node, EVENTID_CHANGE, p);
4582 static HRESULT WINAPI HTMLElement6_put_ondurationchange(IHTMLElement6 *iface, VARIANT v)
4584 HTMLElement *This = impl_from_IHTMLElement6(iface);
4585 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4586 return E_NOTIMPL;
4589 static HRESULT WINAPI HTMLElement6_get_ondurationchange(IHTMLElement6 *iface, VARIANT *p)
4591 HTMLElement *This = impl_from_IHTMLElement6(iface);
4592 FIXME("(%p)->(%p)\n", This, p);
4593 return E_NOTIMPL;
4596 static HRESULT WINAPI HTMLElement6_put_onemptied(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_onemptied(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_onended(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_onended(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_onerror(IHTMLElement6 *iface, VARIANT v)
4626 HTMLElement *This = impl_from_IHTMLElement6(iface);
4628 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4630 return set_node_event(&This->node, EVENTID_ERROR, &v);
4633 static HRESULT WINAPI HTMLElement6_get_onerror(IHTMLElement6 *iface, VARIANT *p)
4635 HTMLElement *This = impl_from_IHTMLElement6(iface);
4637 TRACE("(%p)->(%p)\n", This, p);
4639 return get_node_event(&This->node, EVENTID_ERROR, p);
4642 static HRESULT WINAPI HTMLElement6_put_oninput(IHTMLElement6 *iface, VARIANT v)
4644 HTMLElement *This = impl_from_IHTMLElement6(iface);
4646 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4648 return set_node_event(&This->node, EVENTID_INPUT, &v);
4651 static HRESULT WINAPI HTMLElement6_get_oninput(IHTMLElement6 *iface, VARIANT *p)
4653 HTMLElement *This = impl_from_IHTMLElement6(iface);
4655 TRACE("(%p)->(%p)\n", This, p);
4657 return get_node_event(&This->node, EVENTID_INPUT, p);
4660 static HRESULT WINAPI HTMLElement6_put_onload(IHTMLElement6 *iface, VARIANT v)
4662 HTMLElement *This = impl_from_IHTMLElement6(iface);
4664 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4666 return set_node_event(&This->node, EVENTID_LOAD, &v);
4669 static HRESULT WINAPI HTMLElement6_get_onload(IHTMLElement6 *iface, VARIANT *p)
4671 HTMLElement *This = impl_from_IHTMLElement6(iface);
4673 TRACE("(%p)->(%p)\n", This, p);
4675 return get_node_event(&This->node, EVENTID_LOAD, p);
4678 static HRESULT WINAPI HTMLElement6_put_onloadeddata(IHTMLElement6 *iface, VARIANT v)
4680 HTMLElement *This = impl_from_IHTMLElement6(iface);
4681 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4682 return E_NOTIMPL;
4685 static HRESULT WINAPI HTMLElement6_get_onloadeddata(IHTMLElement6 *iface, VARIANT *p)
4687 HTMLElement *This = impl_from_IHTMLElement6(iface);
4688 FIXME("(%p)->(%p)\n", This, p);
4689 return E_NOTIMPL;
4692 static HRESULT WINAPI HTMLElement6_put_onloadedmetadata(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_onloadedmetadata(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_onloadstart(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_onloadstart(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_onpause(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_onpause(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_onplay(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_onplay(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_onplaying(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_onplaying(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_onprogress(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_onprogress(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_onratechange(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_onratechange(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_onreset(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_onreset(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_onseeked(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_onseeked(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_onseeking(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_onseeking(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_onselect(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_onselect(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_onstalled(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_onstalled(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_onsubmit(IHTMLElement6 *iface, VARIANT v)
4862 HTMLElement *This = impl_from_IHTMLElement6(iface);
4864 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4866 return set_node_event(&This->node, EVENTID_SUBMIT, &v);
4869 static HRESULT WINAPI HTMLElement6_get_onsubmit(IHTMLElement6 *iface, VARIANT *p)
4871 HTMLElement *This = impl_from_IHTMLElement6(iface);
4873 TRACE("(%p)->(%p)\n", This, p);
4875 return get_node_event(&This->node, EVENTID_SUBMIT, p);
4878 static HRESULT WINAPI HTMLElement6_put_onsuspend(IHTMLElement6 *iface, VARIANT v)
4880 HTMLElement *This = impl_from_IHTMLElement6(iface);
4881 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4882 return E_NOTIMPL;
4885 static HRESULT WINAPI HTMLElement6_get_onsuspend(IHTMLElement6 *iface, VARIANT *p)
4887 HTMLElement *This = impl_from_IHTMLElement6(iface);
4888 FIXME("(%p)->(%p)\n", This, p);
4889 return E_NOTIMPL;
4892 static HRESULT WINAPI HTMLElement6_put_ontimeupdate(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_ontimeupdate(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_onvolumechange(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_onvolumechange(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_onwaiting(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_onwaiting(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_hasAttributes(IHTMLElement6 *iface, VARIANT_BOOL *pfHasAttributes)
4936 HTMLElement *This = impl_from_IHTMLElement6(iface);
4937 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
4938 return E_NOTIMPL;
4941 static const IHTMLElement6Vtbl HTMLElement6Vtbl = {
4942 HTMLElement6_QueryInterface,
4943 HTMLElement6_AddRef,
4944 HTMLElement6_Release,
4945 HTMLElement6_GetTypeInfoCount,
4946 HTMLElement6_GetTypeInfo,
4947 HTMLElement6_GetIDsOfNames,
4948 HTMLElement6_Invoke,
4949 HTMLElement6_getAttributeNS,
4950 HTMLElement6_setAttributeNS,
4951 HTMLElement6_removeAttributeNS,
4952 HTMLElement6_getAttributeNodeNS,
4953 HTMLElement6_setAttributeNodeNS,
4954 HTMLElement6_hasAttributeNS,
4955 HTMLElement6_getAttribute,
4956 HTMLElement6_setAttribute,
4957 HTMLElement6_removeAttribute,
4958 HTMLElement6_getAttributeNode,
4959 HTMLElement6_setAttributeNode,
4960 HTMLElement6_removeAttributeNode,
4961 HTMLElement6_hasAttribute,
4962 HTMLElement6_getElementsByTagNameNS,
4963 HTMLElement6_get_tagName,
4964 HTMLElement6_get_nodeName,
4965 HTMLElement6_getElementsByClassName,
4966 HTMLElement6_msMatchesSelector,
4967 HTMLElement6_put_onabort,
4968 HTMLElement6_get_onabort,
4969 HTMLElement6_put_oncanplay,
4970 HTMLElement6_get_oncanplay,
4971 HTMLElement6_put_oncanplaythrough,
4972 HTMLElement6_get_oncanplaythrough,
4973 HTMLElement6_put_onchange,
4974 HTMLElement6_get_onchange,
4975 HTMLElement6_put_ondurationchange,
4976 HTMLElement6_get_ondurationchange,
4977 HTMLElement6_put_onemptied,
4978 HTMLElement6_get_onemptied,
4979 HTMLElement6_put_onended,
4980 HTMLElement6_get_onended,
4981 HTMLElement6_put_onerror,
4982 HTMLElement6_get_onerror,
4983 HTMLElement6_put_oninput,
4984 HTMLElement6_get_oninput,
4985 HTMLElement6_put_onload,
4986 HTMLElement6_get_onload,
4987 HTMLElement6_put_onloadeddata,
4988 HTMLElement6_get_onloadeddata,
4989 HTMLElement6_put_onloadedmetadata,
4990 HTMLElement6_get_onloadedmetadata,
4991 HTMLElement6_put_onloadstart,
4992 HTMLElement6_get_onloadstart,
4993 HTMLElement6_put_onpause,
4994 HTMLElement6_get_onpause,
4995 HTMLElement6_put_onplay,
4996 HTMLElement6_get_onplay,
4997 HTMLElement6_put_onplaying,
4998 HTMLElement6_get_onplaying,
4999 HTMLElement6_put_onprogress,
5000 HTMLElement6_get_onprogress,
5001 HTMLElement6_put_onratechange,
5002 HTMLElement6_get_onratechange,
5003 HTMLElement6_put_onreset,
5004 HTMLElement6_get_onreset,
5005 HTMLElement6_put_onseeked,
5006 HTMLElement6_get_onseeked,
5007 HTMLElement6_put_onseeking,
5008 HTMLElement6_get_onseeking,
5009 HTMLElement6_put_onselect,
5010 HTMLElement6_get_onselect,
5011 HTMLElement6_put_onstalled,
5012 HTMLElement6_get_onstalled,
5013 HTMLElement6_put_onsubmit,
5014 HTMLElement6_get_onsubmit,
5015 HTMLElement6_put_onsuspend,
5016 HTMLElement6_get_onsuspend,
5017 HTMLElement6_put_ontimeupdate,
5018 HTMLElement6_get_ontimeupdate,
5019 HTMLElement6_put_onvolumechange,
5020 HTMLElement6_get_onvolumechange,
5021 HTMLElement6_put_onwaiting,
5022 HTMLElement6_get_onwaiting,
5023 HTMLElement6_hasAttributes
5026 static inline HTMLElement *impl_from_IHTMLElement7(IHTMLElement7 *iface)
5028 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement7_iface);
5031 static HRESULT WINAPI HTMLElement7_QueryInterface(IHTMLElement7 *iface,
5032 REFIID riid, void **ppv)
5034 HTMLElement *This = impl_from_IHTMLElement7(iface);
5035 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5038 static ULONG WINAPI HTMLElement7_AddRef(IHTMLElement7 *iface)
5040 HTMLElement *This = impl_from_IHTMLElement7(iface);
5041 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5044 static ULONG WINAPI HTMLElement7_Release(IHTMLElement7 *iface)
5046 HTMLElement *This = impl_from_IHTMLElement7(iface);
5047 return IHTMLElement_Release(&This->IHTMLElement_iface);
5050 static HRESULT WINAPI HTMLElement7_GetTypeInfoCount(IHTMLElement7 *iface, UINT *pctinfo)
5052 HTMLElement *This = impl_from_IHTMLElement7(iface);
5053 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5056 static HRESULT WINAPI HTMLElement7_GetTypeInfo(IHTMLElement7 *iface, UINT iTInfo,
5057 LCID lcid, ITypeInfo **ppTInfo)
5059 HTMLElement *This = impl_from_IHTMLElement7(iface);
5060 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5063 static HRESULT WINAPI HTMLElement7_GetIDsOfNames(IHTMLElement7 *iface, REFIID riid,
5064 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5066 HTMLElement *This = impl_from_IHTMLElement7(iface);
5067 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5068 lcid, rgDispId);
5071 static HRESULT WINAPI HTMLElement7_Invoke(IHTMLElement7 *iface, DISPID dispIdMember, REFIID riid,
5072 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5074 HTMLElement *This = impl_from_IHTMLElement7(iface);
5075 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5076 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5079 static HRESULT WINAPI HTMLElement7_put_onmspointerdown(IHTMLElement7 *iface, VARIANT v)
5081 HTMLElement *This = impl_from_IHTMLElement7(iface);
5082 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5083 return E_NOTIMPL;
5086 static HRESULT WINAPI HTMLElement7_get_onmspointerdown(IHTMLElement7 *iface, VARIANT *p)
5088 HTMLElement *This = impl_from_IHTMLElement7(iface);
5089 FIXME("(%p)->(%p)\n", This, p);
5090 return E_NOTIMPL;
5093 static HRESULT WINAPI HTMLElement7_put_onmspointermove(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_onmspointermove(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_onmspointerup(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_onmspointerup(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_onmspointerover(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_onmspointerover(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_onmspointerout(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_onmspointerout(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_onmspointercancel(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_onmspointercancel(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_onmspointerhover(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_onmspointerhover(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_onmslostpointercapture(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_onmslostpointercapture(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_onmsgotpointercapture(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_onmsgotpointercapture(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_onmsgesturestart(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_onmsgesturestart(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_onmsgesturechange(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_onmsgesturechange(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_onmsgestureend(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_onmsgestureend(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_onmsgesturehold(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_onmsgesturehold(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_onmsgesturetap(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_onmsgesturetap(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_onmsgesturedoubletap(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_onmsgesturedoubletap(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_onmsinertiastart(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_onmsinertiastart(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_msSetPointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5305 HTMLElement *This = impl_from_IHTMLElement7(iface);
5306 FIXME("(%p)->(%d)\n", This, pointer_id);
5307 return E_NOTIMPL;
5310 static HRESULT WINAPI HTMLElement7_msReleasePointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5312 HTMLElement *This = impl_from_IHTMLElement7(iface);
5313 FIXME("(%p)->(%d)\n", This, pointer_id);
5314 return E_NOTIMPL;
5317 static HRESULT WINAPI HTMLElement7_put_onmstransitionstart(IHTMLElement7 *iface, VARIANT v)
5319 HTMLElement *This = impl_from_IHTMLElement7(iface);
5320 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5321 return E_NOTIMPL;
5324 static HRESULT WINAPI HTMLElement7_get_onmstransitionstart(IHTMLElement7 *iface, VARIANT *p)
5326 HTMLElement *This = impl_from_IHTMLElement7(iface);
5327 FIXME("(%p)->(%p)\n", This, p);
5328 return E_NOTIMPL;
5331 static HRESULT WINAPI HTMLElement7_put_onmstransitionend(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_onmstransitionend(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_onmsanimationstart(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_onmsanimationstart(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_onmsanimationend(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_onmsanimationend(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_onmsanimationiteration(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_onmsanimationiteration(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_oninvalid(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_oninvalid(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_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR v)
5403 HTMLElement *This = impl_from_IHTMLElement7(iface);
5404 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
5405 return E_NOTIMPL;
5408 static HRESULT WINAPI HTMLElement7_get_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR *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_spellcheck(IHTMLElement7 *iface, VARIANT v)
5417 HTMLElement *This = impl_from_IHTMLElement7(iface);
5419 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5421 if(!This->html_element) {
5422 FIXME("non-HTML element\n");
5423 return E_NOTIMPL;
5426 if(V_VT(&v) != VT_BOOL) {
5427 FIXME("unsupported argument %s\n", debugstr_variant(&v));
5428 return E_NOTIMPL;
5431 return map_nsresult(nsIDOMHTMLElement_SetSpellcheck(This->html_element, !!V_BOOL(&v)));
5434 static HRESULT WINAPI HTMLElement7_get_spellcheck(IHTMLElement7 *iface, VARIANT *p)
5436 HTMLElement *This = impl_from_IHTMLElement7(iface);
5437 cpp_bool spellcheck;
5438 nsresult nsres;
5440 TRACE("(%p)->(%p)\n", This, p);
5442 if(!This->html_element) {
5443 FIXME("non-HTML element\n");
5444 return E_NOTIMPL;
5447 nsres = nsIDOMHTMLElement_GetSpellcheck(This->html_element, &spellcheck);
5448 if(NS_FAILED(nsres))
5449 return map_nsresult(nsres);
5451 V_VT(p) = VT_BOOL;
5452 V_BOOL(p) = spellcheck ? VARIANT_TRUE : VARIANT_FALSE;
5453 return S_OK;
5456 static HRESULT WINAPI HTMLElement7_put_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT v)
5458 HTMLElement *This = impl_from_IHTMLElement7(iface);
5459 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5460 return E_NOTIMPL;
5463 static HRESULT WINAPI HTMLElement7_get_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT *p)
5465 HTMLElement *This = impl_from_IHTMLElement7(iface);
5466 FIXME("(%p)->(%p)\n", This, p);
5467 return E_NOTIMPL;
5470 static HRESULT WINAPI HTMLElement7_put_oncuechange(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_oncuechange(IHTMLElement7 *iface, VARIANT *p)
5479 HTMLElement *This = impl_from_IHTMLElement7(iface);
5480 FIXME("(%p)->(%p)\n", This, p);
5481 return E_NOTIMPL;
5484 static const IHTMLElement7Vtbl HTMLElement7Vtbl = {
5485 HTMLElement7_QueryInterface,
5486 HTMLElement7_AddRef,
5487 HTMLElement7_Release,
5488 HTMLElement7_GetTypeInfoCount,
5489 HTMLElement7_GetTypeInfo,
5490 HTMLElement7_GetIDsOfNames,
5491 HTMLElement7_Invoke,
5492 HTMLElement7_put_onmspointerdown,
5493 HTMLElement7_get_onmspointerdown,
5494 HTMLElement7_put_onmspointermove,
5495 HTMLElement7_get_onmspointermove,
5496 HTMLElement7_put_onmspointerup,
5497 HTMLElement7_get_onmspointerup,
5498 HTMLElement7_put_onmspointerover,
5499 HTMLElement7_get_onmspointerover,
5500 HTMLElement7_put_onmspointerout,
5501 HTMLElement7_get_onmspointerout,
5502 HTMLElement7_put_onmspointercancel,
5503 HTMLElement7_get_onmspointercancel,
5504 HTMLElement7_put_onmspointerhover,
5505 HTMLElement7_get_onmspointerhover,
5506 HTMLElement7_put_onmslostpointercapture,
5507 HTMLElement7_get_onmslostpointercapture,
5508 HTMLElement7_put_onmsgotpointercapture,
5509 HTMLElement7_get_onmsgotpointercapture,
5510 HTMLElement7_put_onmsgesturestart,
5511 HTMLElement7_get_onmsgesturestart,
5512 HTMLElement7_put_onmsgesturechange,
5513 HTMLElement7_get_onmsgesturechange,
5514 HTMLElement7_put_onmsgestureend,
5515 HTMLElement7_get_onmsgestureend,
5516 HTMLElement7_put_onmsgesturehold,
5517 HTMLElement7_get_onmsgesturehold,
5518 HTMLElement7_put_onmsgesturetap,
5519 HTMLElement7_get_onmsgesturetap,
5520 HTMLElement7_put_onmsgesturedoubletap,
5521 HTMLElement7_get_onmsgesturedoubletap,
5522 HTMLElement7_put_onmsinertiastart,
5523 HTMLElement7_get_onmsinertiastart,
5524 HTMLElement7_msSetPointerCapture,
5525 HTMLElement7_msReleasePointerCapture,
5526 HTMLElement7_put_onmstransitionstart,
5527 HTMLElement7_get_onmstransitionstart,
5528 HTMLElement7_put_onmstransitionend,
5529 HTMLElement7_get_onmstransitionend,
5530 HTMLElement7_put_onmsanimationstart,
5531 HTMLElement7_get_onmsanimationstart,
5532 HTMLElement7_put_onmsanimationend,
5533 HTMLElement7_get_onmsanimationend,
5534 HTMLElement7_put_onmsanimationiteration,
5535 HTMLElement7_get_onmsanimationiteration,
5536 HTMLElement7_put_oninvalid,
5537 HTMLElement7_get_oninvalid,
5538 HTMLElement7_put_xmsAcceleratorKey,
5539 HTMLElement7_get_xmsAcceleratorKey,
5540 HTMLElement7_put_spellcheck,
5541 HTMLElement7_get_spellcheck,
5542 HTMLElement7_put_onmsmanipulationstatechanged,
5543 HTMLElement7_get_onmsmanipulationstatechanged,
5544 HTMLElement7_put_oncuechange,
5545 HTMLElement7_get_oncuechange
5549 static inline HTMLElement *impl_from_IHTMLUniqueName(IHTMLUniqueName *iface)
5551 return CONTAINING_RECORD(iface, HTMLElement, IHTMLUniqueName_iface);
5554 static HRESULT WINAPI HTMLUniqueName_QueryInterface(IHTMLUniqueName *iface, REFIID riid, void **ppv)
5556 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5557 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5560 static ULONG WINAPI HTMLUniqueName_AddRef(IHTMLUniqueName *iface)
5562 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5563 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5566 static ULONG WINAPI HTMLUniqueName_Release(IHTMLUniqueName *iface)
5568 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5569 return IHTMLElement_Release(&This->IHTMLElement_iface);
5572 static HRESULT WINAPI HTMLUniqueName_GetTypeInfoCount(IHTMLUniqueName *iface, UINT *pctinfo)
5574 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5575 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5578 static HRESULT WINAPI HTMLUniqueName_GetTypeInfo(IHTMLUniqueName *iface, UINT iTInfo,
5579 LCID lcid, ITypeInfo **ppTInfo)
5581 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5582 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5585 static HRESULT WINAPI HTMLUniqueName_GetIDsOfNames(IHTMLUniqueName *iface, REFIID riid,
5586 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5588 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5589 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5590 lcid, rgDispId);
5593 static HRESULT WINAPI HTMLUniqueName_Invoke(IHTMLUniqueName *iface, DISPID dispIdMember, REFIID riid,
5594 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5596 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5597 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5598 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5601 HRESULT elem_unique_id(unsigned id, BSTR *p)
5603 WCHAR buf[32];
5605 swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
5606 *p = SysAllocString(buf);
5607 return *p ? S_OK : E_OUTOFMEMORY;
5610 static void ensure_unique_id(HTMLElement *elem)
5612 if(!elem->unique_id)
5613 elem->unique_id = ++elem->node.doc->unique_id;
5616 static HRESULT WINAPI HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName *iface, LONG *p)
5618 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5620 TRACE("(%p)->(%p)\n", This, p);
5622 ensure_unique_id(This);
5623 *p = This->unique_id;
5624 return S_OK;
5627 static HRESULT WINAPI HTMLUniqueName_get_uniqueID(IHTMLUniqueName *iface, BSTR *p)
5629 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5631 TRACE("(%p)->(%p)\n", This, p);
5633 ensure_unique_id(This);
5634 return elem_unique_id(This->unique_id, p);
5637 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl = {
5638 HTMLUniqueName_QueryInterface,
5639 HTMLUniqueName_AddRef,
5640 HTMLUniqueName_Release,
5641 HTMLUniqueName_GetTypeInfoCount,
5642 HTMLUniqueName_GetTypeInfo,
5643 HTMLUniqueName_GetIDsOfNames,
5644 HTMLUniqueName_Invoke,
5645 HTMLUniqueName_get_uniqueNumber,
5646 HTMLUniqueName_get_uniqueID
5649 static inline HTMLElement *impl_from_IElementSelector(IElementSelector *iface)
5651 return CONTAINING_RECORD(iface, HTMLElement, IElementSelector_iface);
5654 static HRESULT WINAPI ElementSelector_QueryInterface(IElementSelector *iface, REFIID riid, void **ppv)
5656 HTMLElement *This = impl_from_IElementSelector(iface);
5657 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5660 static ULONG WINAPI ElementSelector_AddRef(IElementSelector *iface)
5662 HTMLElement *This = impl_from_IElementSelector(iface);
5663 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5666 static ULONG WINAPI ElementSelector_Release(IElementSelector *iface)
5668 HTMLElement *This = impl_from_IElementSelector(iface);
5669 return IHTMLElement_Release(&This->IHTMLElement_iface);
5672 static HRESULT WINAPI ElementSelector_GetTypeInfoCount(IElementSelector *iface, UINT *pctinfo)
5674 HTMLElement *This = impl_from_IElementSelector(iface);
5675 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5678 static HRESULT WINAPI ElementSelector_GetTypeInfo(IElementSelector *iface, UINT iTInfo,
5679 LCID lcid, ITypeInfo **ppTInfo)
5681 HTMLElement *This = impl_from_IElementSelector(iface);
5682 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5685 static HRESULT WINAPI ElementSelector_GetIDsOfNames(IElementSelector *iface, REFIID riid,
5686 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5688 HTMLElement *This = impl_from_IElementSelector(iface);
5689 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
5692 static HRESULT WINAPI ElementSelector_Invoke(IElementSelector *iface, DISPID dispIdMember, REFIID riid,
5693 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5695 HTMLElement *This = impl_from_IElementSelector(iface);
5696 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
5697 pDispParams, pVarResult, pExcepInfo, puArgErr);
5700 static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BSTR v, IHTMLElement **pel)
5702 HTMLElement *This = impl_from_IElementSelector(iface);
5703 nsIDOMElement *nselem;
5704 HTMLElement *elem;
5705 nsAString nsstr;
5706 nsresult nsres;
5707 HRESULT hres;
5709 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5711 if(!This->dom_element) {
5712 FIXME("comment element\n");
5713 return E_NOTIMPL;
5716 nsAString_InitDepend(&nsstr, v);
5717 nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
5718 nsAString_Finish(&nsstr);
5719 if(NS_FAILED(nsres)) {
5720 ERR("QuerySelector failed: %08x\n", nsres);
5721 return E_FAIL;
5724 if(!nselem) {
5725 *pel = NULL;
5726 return S_OK;
5729 hres = get_element(nselem, &elem);
5730 nsIDOMElement_Release(nselem);
5731 if(FAILED(hres))
5732 return hres;
5734 *pel = &elem->IHTMLElement_iface;
5735 return S_OK;
5738 static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, BSTR v, IHTMLDOMChildrenCollection **pel)
5740 HTMLElement *This = impl_from_IElementSelector(iface);
5741 nsIDOMNodeList *node_list;
5742 nsAString nsstr;
5743 nsresult nsres;
5745 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5747 if(!This->dom_element) {
5748 FIXME("comment element\n");
5749 return E_NOTIMPL;
5752 nsAString_InitDepend(&nsstr, v);
5753 nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list);
5754 nsAString_Finish(&nsstr);
5755 if(NS_FAILED(nsres)) {
5756 ERR("QuerySelectorAll failed: %08x\n", nsres);
5757 return E_FAIL;
5760 *pel = create_child_collection(node_list);
5761 nsIDOMNodeList_Release(node_list);
5762 return *pel ? S_OK : E_OUTOFMEMORY;
5765 static const IElementSelectorVtbl ElementSelectorVtbl = {
5766 ElementSelector_QueryInterface,
5767 ElementSelector_AddRef,
5768 ElementSelector_Release,
5769 ElementSelector_GetTypeInfoCount,
5770 ElementSelector_GetTypeInfo,
5771 ElementSelector_GetIDsOfNames,
5772 ElementSelector_Invoke,
5773 ElementSelector_querySelector,
5774 ElementSelector_querySelectorAll
5777 static inline HTMLElement *impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo *iface)
5779 return CONTAINING_RECORD(iface, HTMLElement, IProvideMultipleClassInfo_iface);
5782 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo *iface,
5783 REFIID riid, void **ppv)
5785 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5786 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5789 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideMultipleClassInfo *iface)
5791 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5792 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5795 static ULONG WINAPI ProvideClassInfo_Release(IProvideMultipleClassInfo *iface)
5797 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5798 return IHTMLElement_Release(&This->IHTMLElement_iface);
5801 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *iface, ITypeInfo **ppTI)
5803 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5804 TRACE("(%p)->(%p)\n", This, ppTI);
5805 return get_class_typeinfo(This->node.vtbl->clsid, ppTI);
5808 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
5810 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5811 FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
5812 return E_NOTIMPL;
5815 static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo *iface, ULONG *pcti)
5817 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5818 FIXME("(%p)->(%p)\n", This, pcti);
5819 *pcti = 1;
5820 return S_OK;
5823 static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo *iface, ULONG iti,
5824 DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
5826 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5827 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
5828 return E_NOTIMPL;
5831 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = {
5832 ProvideClassInfo_QueryInterface,
5833 ProvideClassInfo_AddRef,
5834 ProvideClassInfo_Release,
5835 ProvideClassInfo_GetClassInfo,
5836 ProvideClassInfo2_GetGUID,
5837 ProvideMultipleClassInfo_GetMultiTypeInfoCount,
5838 ProvideMultipleClassInfo_GetInfoOfIndex
5841 static inline HTMLElement *impl_from_IElementTraversal(IElementTraversal *iface)
5843 return CONTAINING_RECORD(iface, HTMLElement, IElementTraversal_iface);
5846 static HRESULT WINAPI ElementTraversal_QueryInterface(IElementTraversal *iface, REFIID riid, void **ppv)
5848 HTMLElement *This = impl_from_IElementTraversal(iface);
5849 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5852 static ULONG WINAPI ElementTraversal_AddRef(IElementTraversal *iface)
5854 HTMLElement *This = impl_from_IElementTraversal(iface);
5856 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5859 static ULONG WINAPI ElementTraversal_Release(IElementTraversal *iface)
5861 HTMLElement *This = impl_from_IElementTraversal(iface);
5863 return IHTMLElement_Release(&This->IHTMLElement_iface);
5866 static HRESULT WINAPI ElementTraversal_GetTypeInfoCount(IElementTraversal *iface, UINT *pctinfo)
5868 HTMLElement *This = impl_from_IElementTraversal(iface);
5869 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5872 static HRESULT WINAPI ElementTraversal_GetTypeInfo(IElementTraversal *iface, UINT iTInfo,
5873 LCID lcid, ITypeInfo **ppTInfo)
5875 HTMLElement *This = impl_from_IElementTraversal(iface);
5876 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5879 static HRESULT WINAPI ElementTraversal_GetIDsOfNames(IElementTraversal *iface, REFIID riid,
5880 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5882 HTMLElement *This = impl_from_IElementTraversal(iface);
5883 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5884 lcid, rgDispId);
5887 static HRESULT WINAPI ElementTraversal_Invoke(IElementTraversal *iface, DISPID dispIdMember, REFIID riid,
5888 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5890 HTMLElement *This = impl_from_IElementTraversal(iface);
5891 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5892 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5895 static HRESULT WINAPI ElementTraversal_get_firstElementChild(IElementTraversal *iface, IHTMLElement **p)
5897 HTMLElement *This = impl_from_IElementTraversal(iface);
5898 nsIDOMElement *nselem = NULL;
5899 HTMLElement *elem;
5900 HRESULT hres;
5902 TRACE("(%p)->(%p)\n", This, p);
5904 if(!This->dom_element) {
5905 *p = NULL;
5906 return S_OK;
5909 nsIDOMElement_GetFirstElementChild(This->dom_element, &nselem);
5910 if(!nselem) {
5911 *p = NULL;
5912 return S_OK;
5915 hres = get_element(nselem, &elem);
5916 nsIDOMElement_Release(nselem);
5917 if(FAILED(hres))
5918 return hres;
5920 *p = &elem->IHTMLElement_iface;
5921 return S_OK;
5924 static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *iface, IHTMLElement **p)
5926 HTMLElement *This = impl_from_IElementTraversal(iface);
5927 FIXME("(%p)->(%p)\n", This, p);
5928 return E_NOTIMPL;
5931 static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
5933 HTMLElement *This = impl_from_IElementTraversal(iface);
5934 FIXME("(%p)->(%p)\n", This, p);
5935 return E_NOTIMPL;
5938 static HRESULT WINAPI ElementTraversal_get_nextElementSibling(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_childElementCount(IElementTraversal *iface, LONG *p)
5947 HTMLElement *This = impl_from_IElementTraversal(iface);
5948 FIXME("(%p)->(%p)\n", This, p);
5949 return E_NOTIMPL;
5952 static const IElementTraversalVtbl ElementTraversalVtbl = {
5953 ElementTraversal_QueryInterface,
5954 ElementTraversal_AddRef,
5955 ElementTraversal_Release,
5956 ElementTraversal_GetTypeInfoCount,
5957 ElementTraversal_GetTypeInfo,
5958 ElementTraversal_GetIDsOfNames,
5959 ElementTraversal_Invoke,
5960 ElementTraversal_get_firstElementChild,
5961 ElementTraversal_get_lastElementChild,
5962 ElementTraversal_get_previousElementSibling,
5963 ElementTraversal_get_nextElementSibling,
5964 ElementTraversal_get_childElementCount
5967 static inline HTMLElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
5969 return CONTAINING_RECORD(iface, HTMLElement, node);
5972 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
5974 HTMLElement *This = impl_from_HTMLDOMNode(iface);
5976 if(IsEqualGUID(&IID_IUnknown, riid)) {
5977 *ppv = &This->IHTMLElement_iface;
5978 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
5979 *ppv = &This->IHTMLElement_iface;
5980 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
5981 *ppv = &This->IHTMLElement_iface;
5982 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
5983 *ppv = &This->IHTMLElement2_iface;
5984 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
5985 *ppv = &This->IHTMLElement3_iface;
5986 }else if(IsEqualGUID(&IID_IHTMLElement4, riid)) {
5987 *ppv = &This->IHTMLElement4_iface;
5988 }else if(IsEqualGUID(&IID_IHTMLElement6, riid)) {
5989 *ppv = &This->IHTMLElement6_iface;
5990 }else if(IsEqualGUID(&IID_IHTMLElement7, riid)) {
5991 *ppv = &This->IHTMLElement7_iface;
5992 }else if(IsEqualGUID(&IID_IHTMLUniqueName, riid)) {
5993 *ppv = &This->IHTMLUniqueName_iface;
5994 }else if(IsEqualGUID(&IID_IElementSelector, riid)) {
5995 *ppv = &This->IElementSelector_iface;
5996 }else if(IsEqualGUID(&IID_IElementTraversal, riid)) {
5997 *ppv = &This->IElementTraversal_iface;
5998 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
5999 *ppv = &This->cp_container.IConnectionPointContainer_iface;
6000 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
6001 *ppv = &This->IProvideMultipleClassInfo_iface;
6002 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
6003 *ppv = &This->IProvideMultipleClassInfo_iface;
6004 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo, riid)) {
6005 *ppv = &This->IProvideMultipleClassInfo_iface;
6006 }else {
6007 return HTMLDOMNode_QI(&This->node, riid, ppv);
6010 IUnknown_AddRef((IUnknown*)*ppv);
6011 return S_OK;
6014 void HTMLElement_destructor(HTMLDOMNode *iface)
6016 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6018 ConnectionPointContainer_Destroy(&This->cp_container);
6020 if(This->style) {
6021 This->style->elem = NULL;
6022 IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
6024 if(This->runtime_style) {
6025 This->runtime_style->elem = NULL;
6026 IHTMLStyle_Release(&This->runtime_style->IHTMLStyle_iface);
6028 if(This->attrs) {
6029 HTMLDOMAttribute *attr;
6031 LIST_FOR_EACH_ENTRY(attr, &This->attrs->attrs, HTMLDOMAttribute, entry)
6032 attr->elem = NULL;
6034 This->attrs->elem = NULL;
6035 IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface);
6038 heap_free(This->filter);
6040 HTMLDOMNode_destructor(&This->node);
6043 HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
6045 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6046 HTMLElement *new_elem;
6047 HRESULT hres;
6049 hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
6050 if(FAILED(hres))
6051 return hres;
6053 if(This->filter) {
6054 new_elem->filter = heap_strdupW(This->filter);
6055 if(!new_elem->filter) {
6056 IHTMLElement_Release(&This->IHTMLElement_iface);
6057 return E_OUTOFMEMORY;
6061 *ret = &new_elem->node;
6062 return S_OK;
6065 HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
6067 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6069 switch(eid) {
6070 case EVENTID_KEYDOWN: {
6071 nsIDOMKeyEvent *key_event;
6072 nsresult nsres;
6074 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
6075 if(NS_SUCCEEDED(nsres)) {
6076 UINT32 code = 0;
6078 nsIDOMKeyEvent_GetKeyCode(key_event, &code);
6080 if(code == VK_F1 /* DOM_VK_F1 */) {
6081 DOMEvent *help_event;
6082 HRESULT hres;
6084 TRACE("F1 pressed\n");
6086 hres = create_document_event(This->node.doc, EVENTID_HELP, &help_event);
6087 if(SUCCEEDED(hres)) {
6088 dispatch_event(&This->node.event_target, help_event);
6089 IDOMEvent_Release(&help_event->IDOMEvent_iface);
6091 *prevent_default = TRUE;
6094 nsIDOMKeyEvent_Release(key_event);
6099 return S_OK;
6102 cp_static_data_t HTMLElementEvents2_data = { HTMLElementEvents2_tid, NULL /* FIXME */, TRUE };
6104 const cpc_entry_t HTMLElement_cpc[] = {
6105 HTMLELEMENT_CPC,
6106 {NULL}
6109 static const NodeImplVtbl HTMLElementImplVtbl = {
6110 &CLSID_HTMLUnknownElement,
6111 HTMLElement_QI,
6112 HTMLElement_destructor,
6113 HTMLElement_cpc,
6114 HTMLElement_clone,
6115 HTMLElement_handle_event,
6116 HTMLElement_get_attr_col
6119 static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
6121 return CONTAINING_RECORD(iface, HTMLElement, node.event_target.dispex);
6124 static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
6125 DWORD grfdex, DISPID *pid)
6127 HTMLElement *This = impl_from_DispatchEx(dispex);
6129 if(This->node.vtbl->get_dispid)
6130 return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
6132 return DISP_E_UNKNOWNNAME;
6135 static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
6136 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
6137 IServiceProvider *caller)
6139 HTMLElement *This = impl_from_DispatchEx(dispex);
6141 if(This->node.vtbl->invoke)
6142 return This->node.vtbl->invoke(&This->node, id, lcid, flags,
6143 params, res, ei, caller);
6145 ERR("(%p): element has no invoke method\n", This);
6146 return E_NOTIMPL;
6149 static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
6151 HTMLElement *This = impl_from_DispatchEx(dispex);
6152 nsIDOMMozNamedAttrMap *attrs;
6153 nsIDOMAttr *attr;
6154 nsAString nsstr;
6155 const PRUnichar *str;
6156 BSTR name;
6157 VARIANT value;
6158 unsigned i;
6159 UINT32 len;
6160 DISPID id;
6161 nsresult nsres;
6162 HRESULT hres;
6164 if(!This->dom_element)
6165 return S_FALSE;
6167 nsres = nsIDOMElement_GetAttributes(This->dom_element, &attrs);
6168 if(NS_FAILED(nsres))
6169 return E_FAIL;
6171 nsres = nsIDOMMozNamedAttrMap_GetLength(attrs, &len);
6172 if(NS_FAILED(nsres)) {
6173 nsIDOMMozNamedAttrMap_Release(attrs);
6174 return E_FAIL;
6177 nsAString_Init(&nsstr, NULL);
6178 for(i=0; i<len; i++) {
6179 nsres = nsIDOMMozNamedAttrMap_Item(attrs, i, &attr);
6180 if(NS_FAILED(nsres))
6181 continue;
6183 nsres = nsIDOMAttr_GetNodeName(attr, &nsstr);
6184 if(NS_FAILED(nsres)) {
6185 nsIDOMAttr_Release(attr);
6186 continue;
6189 nsAString_GetData(&nsstr, &str);
6190 name = SysAllocString(str);
6191 if(!name) {
6192 nsIDOMAttr_Release(attr);
6193 continue;
6196 hres = IDispatchEx_GetDispID(&dispex->IDispatchEx_iface, name, fdexNameCaseInsensitive, &id);
6197 if(hres != DISP_E_UNKNOWNNAME) {
6198 nsIDOMAttr_Release(attr);
6199 SysFreeString(name);
6200 continue;
6203 nsres = nsIDOMAttr_GetNodeValue(attr, &nsstr);
6204 nsIDOMAttr_Release(attr);
6205 if(NS_FAILED(nsres)) {
6206 SysFreeString(name);
6207 continue;
6210 nsAString_GetData(&nsstr, &str);
6211 V_VT(&value) = VT_BSTR;
6212 if(*str) {
6213 V_BSTR(&value) = SysAllocString(str);
6214 if(!V_BSTR(&value)) {
6215 SysFreeString(name);
6216 continue;
6218 } else
6219 V_BSTR(&value) = NULL;
6221 IHTMLElement_setAttribute(&This->IHTMLElement_iface, name, value, 0);
6222 SysFreeString(name);
6223 VariantClear(&value);
6225 nsAString_Finish(&nsstr);
6227 nsIDOMMozNamedAttrMap_Release(attrs);
6228 return S_OK;
6231 static nsISupports *HTMLElement_get_gecko_target(DispatchEx *dispex)
6233 HTMLElement *This = impl_from_DispatchEx(dispex);
6234 return (nsISupports*)This->node.nsnode;
6237 static void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
6239 HTMLElement *This = impl_from_DispatchEx(dispex);
6240 ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid);
6243 static HRESULT HTMLElement_handle_event_default(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *nsevent, BOOL *prevent_default)
6245 HTMLElement *This = impl_from_DispatchEx(dispex);
6247 if(!This->node.vtbl->handle_event)
6248 return S_OK;
6249 return This->node.vtbl->handle_event(&This->node, eid, nsevent, prevent_default);
6252 static EventTarget *HTMLElement_get_parent_event_target(DispatchEx *dispex)
6254 HTMLElement *This = impl_from_DispatchEx(dispex);
6255 HTMLDOMNode *node;
6256 nsIDOMNode *nsnode;
6257 nsresult nsres;
6258 HRESULT hres;
6260 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &nsnode);
6261 assert(nsres == NS_OK);
6262 if(!nsnode)
6263 return NULL;
6265 hres = get_node(nsnode, TRUE, &node);
6266 nsIDOMNode_Release(nsnode);
6267 if(FAILED(hres))
6268 return NULL;
6270 return &node->event_target;
6273 static ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx *dispex)
6275 HTMLElement *This = impl_from_DispatchEx(dispex);
6276 IConnectionPointContainer_AddRef(&This->cp_container.IConnectionPointContainer_iface);
6277 return &This->cp_container;
6280 static IHTMLEventObj *HTMLElement_set_current_event(DispatchEx *dispex, IHTMLEventObj *event)
6282 HTMLElement *This = impl_from_DispatchEx(dispex);
6283 return default_set_current_event(This->node.doc->window, event);
6286 void HTMLElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
6288 static const dispex_hook_t elem2_ie11_hooks[] = {
6289 {DISPID_IHTMLELEMENT2_DOSCROLL, NULL},
6290 {DISPID_UNKNOWN}
6293 HTMLDOMNode_init_dispex_info(info, mode);
6295 dispex_info_add_interface(info, IHTMLElement2_tid, mode >= COMPAT_MODE_IE11 ? elem2_ie11_hooks : NULL);
6297 if(mode >= COMPAT_MODE_IE8)
6298 dispex_info_add_interface(info, IElementSelector_tid, NULL);
6300 if(mode >= COMPAT_MODE_IE9) {
6301 dispex_info_add_interface(info, IHTMLElement6_tid, NULL);
6302 dispex_info_add_interface(info, IElementTraversal_tid, NULL);
6305 if(mode >= COMPAT_MODE_IE10)
6306 dispex_info_add_interface(info, IHTMLElement7_tid, NULL);
6309 static const tid_t HTMLElement_iface_tids[] = {
6310 HTMLELEMENT_TIDS,
6314 static event_target_vtbl_t HTMLElement_event_target_vtbl = {
6316 NULL,
6317 HTMLElement_get_dispid,
6318 HTMLElement_invoke,
6319 NULL,
6320 HTMLElement_populate_props
6322 HTMLElement_get_gecko_target,
6323 HTMLElement_bind_event,
6324 HTMLElement_get_parent_event_target,
6325 HTMLElement_handle_event_default,
6326 HTMLElement_get_cp_container,
6327 HTMLElement_set_current_event
6330 static dispex_static_data_t HTMLElement_dispex = {
6331 &HTMLElement_event_target_vtbl.dispex_vtbl,
6332 DispHTMLUnknownElement_tid,
6333 HTMLElement_iface_tids,
6334 HTMLElement_init_dispex_info
6337 void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMElement *nselem, dispex_static_data_t *dispex_data)
6339 This->IHTMLElement_iface.lpVtbl = &HTMLElementVtbl;
6340 This->IHTMLElement2_iface.lpVtbl = &HTMLElement2Vtbl;
6341 This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
6342 This->IHTMLElement4_iface.lpVtbl = &HTMLElement4Vtbl;
6343 This->IHTMLElement6_iface.lpVtbl = &HTMLElement6Vtbl;
6344 This->IHTMLElement7_iface.lpVtbl = &HTMLElement7Vtbl;
6345 This->IHTMLUniqueName_iface.lpVtbl = &HTMLUniqueNameVtbl;
6346 This->IElementSelector_iface.lpVtbl = &ElementSelectorVtbl;
6347 This->IElementTraversal_iface.lpVtbl = &ElementTraversalVtbl;
6348 This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
6350 if(dispex_data && !dispex_data->vtbl)
6351 dispex_data->vtbl = &HTMLElement_event_target_vtbl.dispex_vtbl;
6353 if(nselem) {
6354 nsIDOMHTMLElement *html_element;
6355 nsresult nsres;
6357 HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLElement_dispex);
6359 /* No AddRef, share reference with HTMLDOMNode */
6360 assert((nsIDOMNode*)nselem == This->node.nsnode);
6361 This->dom_element = nselem;
6363 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&html_element);
6364 if(NS_SUCCEEDED(nsres)) {
6365 This->html_element = html_element;
6366 /* share reference with HTMLDOMNode */
6367 assert((nsIDOMNode*)html_element == This->node.nsnode);
6368 nsIDOMHTMLElement_Release(html_element);
6372 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface, This->node.vtbl->cpc_entries);
6375 HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
6377 nsIDOMElement *nselem;
6378 nsAString tag_name_str;
6379 const PRUnichar *tag_name;
6380 const tag_desc_t *tag;
6381 HTMLElement *elem;
6382 nsresult nsres;
6383 HRESULT hres;
6385 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
6386 if(NS_FAILED(nsres)) {
6387 ERR("no nsIDOMElement iface\n");
6388 return E_FAIL;
6391 nsAString_Init(&tag_name_str, NULL);
6392 nsIDOMElement_GetTagName(nselem, &tag_name_str);
6394 nsAString_GetData(&tag_name_str, &tag_name);
6396 tag = get_tag_desc(tag_name);
6397 if(tag) {
6398 hres = tag->constructor(doc, nselem, &elem);
6399 }else {
6400 nsIDOMSVGElement *svg_element;
6402 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element);
6403 if(NS_SUCCEEDED(nsres)) {
6404 hres = create_svg_element(doc, svg_element, tag_name, &elem);
6405 nsIDOMSVGElement_Release(svg_element);
6406 }else if(use_generic) {
6407 hres = HTMLGenericElement_Create(doc, nselem, &elem);
6408 }else {
6409 elem = heap_alloc_zero(sizeof(HTMLElement));
6410 if(elem) {
6411 elem->node.vtbl = &HTMLElementImplVtbl;
6412 HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
6413 hres = S_OK;
6414 }else {
6415 hres = E_OUTOFMEMORY;
6420 TRACE("%s ret %p\n", debugstr_w(tag_name), elem);
6422 nsIDOMElement_Release(nselem);
6423 nsAString_Finish(&tag_name_str);
6424 if(FAILED(hres))
6425 return hres;
6427 *ret = elem;
6428 return S_OK;
6431 HRESULT get_element(nsIDOMElement *nselem, HTMLElement **ret)
6433 HTMLDOMNode *node;
6434 HRESULT hres;
6436 hres = get_node((nsIDOMNode*)nselem, TRUE, &node);
6437 if(FAILED(hres))
6438 return hres;
6440 *ret = impl_from_HTMLDOMNode(node);
6441 return S_OK;
6444 /* interface IHTMLFiltersCollection */
6445 static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
6447 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6449 TRACE("%p %s %p\n", This, debugstr_mshtml_guid(riid), ppv );
6451 if(IsEqualGUID(&IID_IUnknown, riid)) {
6452 *ppv = &This->IHTMLFiltersCollection_iface;
6453 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
6454 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
6455 *ppv = &This->IHTMLFiltersCollection_iface;
6456 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6457 return *ppv ? S_OK : E_NOINTERFACE;
6458 }else {
6459 *ppv = NULL;
6460 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6461 return E_NOINTERFACE;
6464 IUnknown_AddRef((IUnknown*)*ppv);
6465 return S_OK;
6468 static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
6470 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6471 LONG ref = InterlockedIncrement(&This->ref);
6473 TRACE("(%p) ref=%d\n", This, ref);
6475 return ref;
6478 static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
6480 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6481 LONG ref = InterlockedDecrement(&This->ref);
6483 TRACE("(%p) ref=%d\n", This, ref);
6485 if(!ref)
6487 heap_free(This);
6490 return ref;
6493 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
6495 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6496 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6499 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
6500 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
6502 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6503 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6506 static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
6507 REFIID riid, LPOLESTR *rgszNames, UINT cNames,
6508 LCID lcid, DISPID *rgDispId)
6510 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6511 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6512 lcid, rgDispId);
6515 static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
6516 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
6517 EXCEPINFO *pExcepInfo, UINT *puArgErr)
6519 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6520 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6521 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6524 static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
6526 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6528 if(!p)
6529 return E_POINTER;
6531 FIXME("(%p)->(%p) Always returning 0\n", This, p);
6532 *p = 0;
6534 return S_OK;
6537 static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
6539 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6540 FIXME("(%p)->(%p)\n", This, p);
6541 return E_NOTIMPL;
6544 static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
6546 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6547 FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
6548 return E_NOTIMPL;
6551 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
6552 HTMLFiltersCollection_QueryInterface,
6553 HTMLFiltersCollection_AddRef,
6554 HTMLFiltersCollection_Release,
6555 HTMLFiltersCollection_GetTypeInfoCount,
6556 HTMLFiltersCollection_GetTypeInfo,
6557 HTMLFiltersCollection_GetIDsOfNames,
6558 HTMLFiltersCollection_Invoke,
6559 HTMLFiltersCollection_get_length,
6560 HTMLFiltersCollection_get__newEnum,
6561 HTMLFiltersCollection_item
6564 static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
6566 WCHAR *ptr;
6567 int idx = 0;
6569 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
6570 idx = idx*10 + (*ptr-'0');
6571 if(*ptr)
6572 return DISP_E_UNKNOWNNAME;
6574 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
6575 TRACE("ret %x\n", *dispid);
6576 return S_OK;
6579 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
6580 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
6582 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
6584 V_VT(res) = VT_DISPATCH;
6585 V_DISPATCH(res) = NULL;
6587 FIXME("always returning NULL\n");
6589 return S_OK;
6592 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
6593 NULL,
6594 HTMLFiltersCollection_get_dispid,
6595 HTMLFiltersCollection_invoke,
6596 NULL
6599 static const tid_t HTMLFiltersCollection_iface_tids[] = {
6600 IHTMLFiltersCollection_tid,
6603 static dispex_static_data_t HTMLFiltersCollection_dispex = {
6604 &HTMLFiltersCollection_dispex_vtbl,
6605 IHTMLFiltersCollection_tid,
6606 HTMLFiltersCollection_iface_tids
6609 static IHTMLFiltersCollection *HTMLFiltersCollection_Create(void)
6611 HTMLFiltersCollection *ret = heap_alloc(sizeof(HTMLFiltersCollection));
6613 ret->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
6614 ret->ref = 1;
6616 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLFiltersCollection_iface,
6617 &HTMLFiltersCollection_dispex);
6619 return &ret->IHTMLFiltersCollection_iface;
6622 /* interface IHTMLAttributeCollection */
6623 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection *iface)
6625 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection_iface);
6628 static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection *iface, REFIID riid, void **ppv)
6630 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6632 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6634 if(IsEqualGUID(&IID_IUnknown, riid)) {
6635 *ppv = &This->IHTMLAttributeCollection_iface;
6636 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection, riid)) {
6637 *ppv = &This->IHTMLAttributeCollection_iface;
6638 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2, riid)) {
6639 *ppv = &This->IHTMLAttributeCollection2_iface;
6640 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3, riid)) {
6641 *ppv = &This->IHTMLAttributeCollection3_iface;
6642 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6643 return *ppv ? S_OK : E_NOINTERFACE;
6644 }else {
6645 *ppv = NULL;
6646 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6647 return E_NOINTERFACE;
6650 IUnknown_AddRef((IUnknown*)*ppv);
6651 return S_OK;
6654 static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface)
6656 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6657 LONG ref = InterlockedIncrement(&This->ref);
6659 TRACE("(%p) ref=%d\n", This, ref);
6661 return ref;
6664 static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface)
6666 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6667 LONG ref = InterlockedDecrement(&This->ref);
6669 TRACE("(%p) ref=%d\n", This, ref);
6671 if(!ref) {
6672 while(!list_empty(&This->attrs)) {
6673 HTMLDOMAttribute *attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry);
6675 list_remove(&attr->entry);
6676 attr->elem = NULL;
6677 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
6680 heap_free(This);
6683 return ref;
6686 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection *iface, UINT *pctinfo)
6688 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6689 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6692 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection *iface, UINT iTInfo,
6693 LCID lcid, ITypeInfo **ppTInfo)
6695 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6696 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6699 static HRESULT WINAPI HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection *iface, REFIID riid,
6700 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6702 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6703 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6704 lcid, rgDispId);
6707 static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *iface, DISPID dispIdMember,
6708 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6709 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6711 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6712 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6713 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6716 static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid)
6718 IDispatchEx *dispex = &This->elem->node.event_target.dispex.IDispatchEx_iface;
6719 DISPID id = DISPID_STARTENUM;
6720 LONG len = -1;
6721 HRESULT hres;
6723 FIXME("filter non-enumerable attributes out\n");
6725 while(1) {
6726 hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
6727 if(FAILED(hres))
6728 return hres;
6729 else if(hres == S_FALSE)
6730 break;
6732 len++;
6733 if(len == *idx)
6734 break;
6737 if(dispid) {
6738 *dispid = id;
6739 return *idx==len ? S_OK : DISP_E_UNKNOWNNAME;
6742 *idx = len+1;
6743 return S_OK;
6746 static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id)
6748 HRESULT hres;
6750 if(name[0]>='0' && name[0]<='9') {
6751 WCHAR *end_ptr;
6752 LONG idx;
6754 idx = wcstoul(name, &end_ptr, 10);
6755 if(!*end_ptr) {
6756 hres = get_attr_dispid_by_idx(This, &idx, id);
6757 if(SUCCEEDED(hres))
6758 return hres;
6762 if(!This->elem) {
6763 WARN("NULL elem\n");
6764 return E_UNEXPECTED;
6767 hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface,
6768 name, fdexNameCaseInsensitive, id);
6769 return hres;
6772 static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr)
6774 HTMLDOMAttribute *iter;
6775 LONG pos = 0;
6776 HRESULT hres;
6778 *attr = NULL;
6779 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
6780 if(iter->dispid == id) {
6781 *attr = iter;
6782 break;
6784 pos++;
6787 if(!*attr) {
6788 if(!This->elem) {
6789 WARN("NULL elem\n");
6790 return E_UNEXPECTED;
6793 hres = HTMLDOMAttribute_Create(NULL, This->elem, id, attr);
6794 if(FAILED(hres))
6795 return hres;
6798 IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface);
6799 if(list_pos)
6800 *list_pos = pos;
6801 return S_OK;
6804 static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p)
6806 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6807 HRESULT hres;
6809 TRACE("(%p)->(%p)\n", This, p);
6811 *p = -1;
6812 hres = get_attr_dispid_by_idx(This, p, NULL);
6813 return hres;
6816 static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p)
6818 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6819 FIXME("(%p)->(%p)\n", This, p);
6820 return E_NOTIMPL;
6823 static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem)
6825 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6826 HTMLDOMAttribute *attr;
6827 DISPID id;
6828 HRESULT hres;
6830 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(name), ppItem);
6832 switch(V_VT(name)) {
6833 case VT_I4:
6834 hres = get_attr_dispid_by_idx(This, &V_I4(name), &id);
6835 break;
6836 case VT_BSTR:
6837 hres = get_attr_dispid_by_name(This, V_BSTR(name), &id);
6838 break;
6839 default:
6840 FIXME("unsupported name %s\n", debugstr_variant(name));
6841 hres = E_NOTIMPL;
6843 if(hres == DISP_E_UNKNOWNNAME)
6844 return E_INVALIDARG;
6845 if(FAILED(hres))
6846 return hres;
6848 hres = get_domattr(This, id, NULL, &attr);
6849 if(FAILED(hres))
6850 return hres;
6852 *ppItem = (IDispatch*)&attr->IHTMLDOMAttribute_iface;
6853 return S_OK;
6856 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl = {
6857 HTMLAttributeCollection_QueryInterface,
6858 HTMLAttributeCollection_AddRef,
6859 HTMLAttributeCollection_Release,
6860 HTMLAttributeCollection_GetTypeInfoCount,
6861 HTMLAttributeCollection_GetTypeInfo,
6862 HTMLAttributeCollection_GetIDsOfNames,
6863 HTMLAttributeCollection_Invoke,
6864 HTMLAttributeCollection_get_length,
6865 HTMLAttributeCollection__newEnum,
6866 HTMLAttributeCollection_item
6869 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2 *iface)
6871 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection2_iface);
6874 static HRESULT WINAPI HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2 *iface, REFIID riid, void **ppv)
6876 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6877 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
6880 static ULONG WINAPI HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2 *iface)
6882 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6883 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
6886 static ULONG WINAPI HTMLAttributeCollection2_Release(IHTMLAttributeCollection2 *iface)
6888 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6889 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
6892 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2 *iface, UINT *pctinfo)
6894 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6895 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6898 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2 *iface, UINT iTInfo,
6899 LCID lcid, ITypeInfo **ppTInfo)
6901 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6902 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6905 static HRESULT WINAPI HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2 *iface, REFIID riid,
6906 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6908 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6909 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6910 lcid, rgDispId);
6913 static HRESULT WINAPI HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2 *iface, DISPID dispIdMember,
6914 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6915 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6917 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6918 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6919 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6922 static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2 *iface, BSTR bstrName,
6923 IHTMLDOMAttribute **newretNode)
6925 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6926 HTMLDOMAttribute *attr;
6927 DISPID id;
6928 HRESULT hres;
6930 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
6932 hres = get_attr_dispid_by_name(This, bstrName, &id);
6933 if(hres == DISP_E_UNKNOWNNAME) {
6934 *newretNode = NULL;
6935 return S_OK;
6936 } else if(FAILED(hres)) {
6937 return hres;
6940 hres = get_domattr(This, id, NULL, &attr);
6941 if(FAILED(hres))
6942 return hres;
6944 *newretNode = &attr->IHTMLDOMAttribute_iface;
6945 return S_OK;
6948 static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface,
6949 IHTMLDOMAttribute *ppNode, IHTMLDOMAttribute **newretNode)
6951 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6952 FIXME("(%p)->(%p %p)\n", This, ppNode, newretNode);
6953 return E_NOTIMPL;
6956 static HRESULT WINAPI HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2 *iface,
6957 BSTR bstrName, IHTMLDOMAttribute **newretNode)
6959 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6960 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
6961 return E_NOTIMPL;
6964 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl = {
6965 HTMLAttributeCollection2_QueryInterface,
6966 HTMLAttributeCollection2_AddRef,
6967 HTMLAttributeCollection2_Release,
6968 HTMLAttributeCollection2_GetTypeInfoCount,
6969 HTMLAttributeCollection2_GetTypeInfo,
6970 HTMLAttributeCollection2_GetIDsOfNames,
6971 HTMLAttributeCollection2_Invoke,
6972 HTMLAttributeCollection2_getNamedItem,
6973 HTMLAttributeCollection2_setNamedItem,
6974 HTMLAttributeCollection2_removeNamedItem
6977 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3 *iface)
6979 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection3_iface);
6982 static HRESULT WINAPI HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3 *iface, REFIID riid, void **ppv)
6984 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
6985 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
6988 static ULONG WINAPI HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3 *iface)
6990 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
6991 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
6994 static ULONG WINAPI HTMLAttributeCollection3_Release(IHTMLAttributeCollection3 *iface)
6996 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
6997 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
7000 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3 *iface, UINT *pctinfo)
7002 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7003 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7006 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3 *iface, UINT iTInfo,
7007 LCID lcid, ITypeInfo **ppTInfo)
7009 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7010 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7013 static HRESULT WINAPI HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3 *iface, REFIID riid,
7014 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7016 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7017 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7018 lcid, rgDispId);
7021 static HRESULT WINAPI HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3 *iface, DISPID dispIdMember,
7022 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7023 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7025 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7026 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7027 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7030 static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3 *iface, BSTR bstrName,
7031 IHTMLDOMAttribute **ppNodeOut)
7033 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7034 return IHTMLAttributeCollection2_getNamedItem(&This->IHTMLAttributeCollection2_iface, bstrName, ppNodeOut);
7037 static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
7038 IHTMLDOMAttribute *pNodeIn, IHTMLDOMAttribute **ppNodeOut)
7040 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7041 FIXME("(%p)->(%p %p)\n", This, pNodeIn, ppNodeOut);
7042 return E_NOTIMPL;
7045 static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3 *iface,
7046 BSTR bstrName, IHTMLDOMAttribute **ppNodeOut)
7048 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7049 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
7050 return E_NOTIMPL;
7053 static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut)
7055 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7056 HTMLDOMAttribute *attr;
7057 DISPID id;
7058 HRESULT hres;
7060 TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut);
7062 hres = get_attr_dispid_by_idx(This, &index, &id);
7063 if(hres == DISP_E_UNKNOWNNAME)
7064 return E_INVALIDARG;
7065 if(FAILED(hres))
7066 return hres;
7068 hres = get_domattr(This, id, NULL, &attr);
7069 if(FAILED(hres))
7070 return hres;
7072 *ppNodeOut = &attr->IHTMLDOMAttribute_iface;
7073 return S_OK;
7076 static HRESULT WINAPI HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3 *iface, LONG *p)
7078 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7079 return IHTMLAttributeCollection_get_length(&This->IHTMLAttributeCollection_iface, p);
7082 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl = {
7083 HTMLAttributeCollection3_QueryInterface,
7084 HTMLAttributeCollection3_AddRef,
7085 HTMLAttributeCollection3_Release,
7086 HTMLAttributeCollection3_GetTypeInfoCount,
7087 HTMLAttributeCollection3_GetTypeInfo,
7088 HTMLAttributeCollection3_GetIDsOfNames,
7089 HTMLAttributeCollection3_Invoke,
7090 HTMLAttributeCollection3_getNamedItem,
7091 HTMLAttributeCollection3_setNamedItem,
7092 HTMLAttributeCollection3_removeNamedItem,
7093 HTMLAttributeCollection3_item,
7094 HTMLAttributeCollection3_get_length
7097 static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(DispatchEx *iface)
7099 return CONTAINING_RECORD(iface, HTMLAttributeCollection, dispex);
7102 static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
7104 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7105 HTMLDOMAttribute *attr;
7106 LONG pos;
7107 HRESULT hres;
7109 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
7111 hres = get_attr_dispid_by_name(This, name, dispid);
7112 if(FAILED(hres))
7113 return hres;
7115 hres = get_domattr(This, *dispid, &pos, &attr);
7116 if(FAILED(hres))
7117 return hres;
7118 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
7120 *dispid = MSHTML_DISPID_CUSTOM_MIN+pos;
7121 return S_OK;
7124 static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
7125 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
7127 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7129 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
7131 switch(flags) {
7132 case DISPATCH_PROPERTYGET: {
7133 HTMLDOMAttribute *iter;
7134 DWORD pos;
7136 pos = id-MSHTML_DISPID_CUSTOM_MIN;
7138 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
7139 if(!pos) {
7140 IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
7141 V_VT(res) = VT_DISPATCH;
7142 V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
7143 return S_OK;
7145 pos--;
7148 WARN("invalid arg\n");
7149 return E_INVALIDARG;
7152 default:
7153 FIXME("unimplemented flags %x\n", flags);
7154 return E_NOTIMPL;
7158 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = {
7159 NULL,
7160 HTMLAttributeCollection_get_dispid,
7161 HTMLAttributeCollection_invoke,
7162 NULL
7165 static const tid_t HTMLAttributeCollection_iface_tids[] = {
7166 IHTMLAttributeCollection_tid,
7167 IHTMLAttributeCollection2_tid,
7168 IHTMLAttributeCollection3_tid,
7172 static dispex_static_data_t HTMLAttributeCollection_dispex = {
7173 &HTMLAttributeCollection_dispex_vtbl,
7174 DispHTMLAttributeCollection_tid,
7175 HTMLAttributeCollection_iface_tids
7178 HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
7180 HTMLElement *This = impl_from_HTMLDOMNode(iface);
7182 if(This->attrs) {
7183 IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface);
7184 *ac = This->attrs;
7185 return S_OK;
7188 This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection));
7189 if(!This->attrs)
7190 return E_OUTOFMEMORY;
7192 This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl;
7193 This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl;
7194 This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl;
7195 This->attrs->ref = 2;
7197 This->attrs->elem = This;
7198 list_init(&This->attrs->attrs);
7199 init_dispex_with_compat_mode(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface,
7200 &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
7202 *ac = This->attrs;
7203 return S_OK;