wined3d: Use context->ops->prepare_upload_bo() in wined3d_device_context_map() if...
[wine.git] / dlls / mshtml / htmlelem.c
blob8187cbf867ee731ac68ce262ca95aa7145a61e7d
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 static VARIANT_BOOL element_has_attribute(HTMLElement *element, const WCHAR *name)
207 nsAString name_str;
208 cpp_bool r;
209 nsresult nsres;
211 if(!element->dom_element) {
212 WARN("no DOM element\n");
213 return VARIANT_FALSE;
216 nsAString_InitDepend(&name_str, name);
217 nsres = nsIDOMElement_HasAttribute(element->dom_element, &name_str, &r);
218 return variant_bool(NS_SUCCEEDED(nsres) && r);
221 static HRESULT element_remove_attribute(HTMLElement *element, const WCHAR *name)
223 nsAString name_str;
224 nsresult nsres;
226 if(!element->dom_element) {
227 WARN("no DOM element\n");
228 return S_OK;
231 nsAString_InitDepend(&name_str, name);
232 nsres = nsIDOMElement_RemoveAttribute(element->dom_element, &name_str);
233 nsAString_Finish(&name_str);
234 return map_nsresult(nsres);
237 HRESULT get_readystate_string(READYSTATE readystate, BSTR *p)
239 static const LPCWSTR readystate_strs[] = {
240 L"uninitialized",
241 L"loading",
242 L"loaded",
243 L"interactive",
244 L"complete"
247 assert(readystate <= READYSTATE_COMPLETE);
248 *p = SysAllocString(readystate_strs[readystate]);
249 return *p ? S_OK : E_OUTOFMEMORY;
252 typedef struct
254 DispatchEx dispex;
255 IHTMLFiltersCollection IHTMLFiltersCollection_iface;
257 LONG ref;
258 } HTMLFiltersCollection;
260 static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface)
262 return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface);
265 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret);
267 static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface)
269 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement_iface);
272 HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **ret)
274 nsAString tag_str;
275 nsresult nsres;
277 if(!doc->nsdoc) {
278 WARN("NULL nsdoc\n");
279 return E_UNEXPECTED;
282 nsAString_InitDepend(&tag_str, tag);
283 nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
284 nsAString_Finish(&tag_str);
285 if(NS_FAILED(nsres)) {
286 ERR("CreateElement failed: %08x\n", nsres);
287 return E_FAIL;
290 return S_OK;
293 HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **ret)
295 nsIDOMElement *nselem;
296 HRESULT hres;
298 /* Use owner doc if called on document fragment */
299 if(!doc->nsdoc)
300 doc = doc->node.doc;
302 hres = create_nselem(doc, tag, &nselem);
303 if(FAILED(hres))
304 return hres;
306 hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, TRUE, ret);
307 nsIDOMElement_Release(nselem);
308 return hres;
311 typedef struct {
312 DispatchEx dispex;
313 IHTMLRect IHTMLRect_iface;
315 LONG ref;
317 nsIDOMClientRect *nsrect;
318 } HTMLRect;
320 static inline HTMLRect *impl_from_IHTMLRect(IHTMLRect *iface)
322 return CONTAINING_RECORD(iface, HTMLRect, IHTMLRect_iface);
325 static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, void **ppv)
327 HTMLRect *This = impl_from_IHTMLRect(iface);
329 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
331 if(IsEqualGUID(&IID_IUnknown, riid)) {
332 *ppv = &This->IHTMLRect_iface;
333 }else if(IsEqualGUID(&IID_IHTMLRect, riid)) {
334 *ppv = &This->IHTMLRect_iface;
335 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
336 return *ppv ? S_OK : E_NOINTERFACE;
337 }else {
338 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
339 *ppv = NULL;
340 return E_NOINTERFACE;
343 IUnknown_AddRef((IUnknown*)*ppv);
344 return S_OK;
347 static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
349 HTMLRect *This = impl_from_IHTMLRect(iface);
350 LONG ref = InterlockedIncrement(&This->ref);
352 TRACE("(%p) ref=%d\n", This, ref);
354 return ref;
357 static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
359 HTMLRect *This = impl_from_IHTMLRect(iface);
360 LONG ref = InterlockedDecrement(&This->ref);
362 TRACE("(%p) ref=%d\n", This, ref);
364 if(!ref) {
365 if(This->nsrect)
366 nsIDOMClientRect_Release(This->nsrect);
367 release_dispex(&This->dispex);
368 heap_free(This);
371 return ref;
374 static HRESULT WINAPI HTMLRect_GetTypeInfoCount(IHTMLRect *iface, UINT *pctinfo)
376 HTMLRect *This = impl_from_IHTMLRect(iface);
377 FIXME("(%p)->(%p)\n", This, pctinfo);
378 return E_NOTIMPL;
381 static HRESULT WINAPI HTMLRect_GetTypeInfo(IHTMLRect *iface, UINT iTInfo,
382 LCID lcid, ITypeInfo **ppTInfo)
384 HTMLRect *This = impl_from_IHTMLRect(iface);
386 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
389 static HRESULT WINAPI HTMLRect_GetIDsOfNames(IHTMLRect *iface, REFIID riid,
390 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
392 HTMLRect *This = impl_from_IHTMLRect(iface);
394 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
395 lcid, rgDispId);
398 static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
399 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
400 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
402 HTMLRect *This = impl_from_IHTMLRect(iface);
404 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
405 pDispParams, pVarResult, pExcepInfo, puArgErr);
408 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
410 HTMLRect *This = impl_from_IHTMLRect(iface);
411 FIXME("(%p)->(%d)\n", This, v);
412 return E_NOTIMPL;
415 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
417 HTMLRect *This = impl_from_IHTMLRect(iface);
418 float left;
419 nsresult nsres;
421 TRACE("(%p)->(%p)\n", This, p);
423 nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
424 if(NS_FAILED(nsres)) {
425 ERR("GetLeft failed: %08x\n", nsres);
426 return E_FAIL;
429 *p = floor(left+0.5);
430 return S_OK;
433 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
435 HTMLRect *This = impl_from_IHTMLRect(iface);
436 FIXME("(%p)->(%d)\n", This, v);
437 return E_NOTIMPL;
440 static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
442 HTMLRect *This = impl_from_IHTMLRect(iface);
443 float top;
444 nsresult nsres;
446 TRACE("(%p)->(%p)\n", This, p);
448 nsres = nsIDOMClientRect_GetTop(This->nsrect, &top);
449 if(NS_FAILED(nsres)) {
450 ERR("GetTop failed: %08x\n", nsres);
451 return E_FAIL;
454 *p = floor(top+0.5);
455 return S_OK;
458 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
460 HTMLRect *This = impl_from_IHTMLRect(iface);
461 FIXME("(%p)->(%d)\n", This, v);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
467 HTMLRect *This = impl_from_IHTMLRect(iface);
468 float right;
469 nsresult nsres;
471 TRACE("(%p)->(%p)\n", This, p);
473 nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
474 if(NS_FAILED(nsres)) {
475 ERR("GetRight failed: %08x\n", nsres);
476 return E_FAIL;
479 *p = floor(right+0.5);
480 return S_OK;
483 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
485 HTMLRect *This = impl_from_IHTMLRect(iface);
486 FIXME("(%p)->(%d)\n", This, v);
487 return E_NOTIMPL;
490 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
492 HTMLRect *This = impl_from_IHTMLRect(iface);
493 float bottom;
494 nsresult nsres;
496 TRACE("(%p)->(%p)\n", This, p);
498 nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
499 if(NS_FAILED(nsres)) {
500 ERR("GetBottom failed: %08x\n", nsres);
501 return E_FAIL;
504 *p = floor(bottom+0.5);
505 return S_OK;
508 static const IHTMLRectVtbl HTMLRectVtbl = {
509 HTMLRect_QueryInterface,
510 HTMLRect_AddRef,
511 HTMLRect_Release,
512 HTMLRect_GetTypeInfoCount,
513 HTMLRect_GetTypeInfo,
514 HTMLRect_GetIDsOfNames,
515 HTMLRect_Invoke,
516 HTMLRect_put_left,
517 HTMLRect_get_left,
518 HTMLRect_put_top,
519 HTMLRect_get_top,
520 HTMLRect_put_right,
521 HTMLRect_get_right,
522 HTMLRect_put_bottom,
523 HTMLRect_get_bottom
526 static const tid_t HTMLRect_iface_tids[] = {
527 IHTMLRect_tid,
530 static dispex_static_data_t HTMLRect_dispex = {
531 NULL,
532 IHTMLRect_tid,
533 HTMLRect_iface_tids
536 static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_mode, IHTMLRect **ret)
538 HTMLRect *rect;
540 rect = heap_alloc_zero(sizeof(HTMLRect));
541 if(!rect)
542 return E_OUTOFMEMORY;
544 rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl;
545 rect->ref = 1;
547 init_dispatch(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex, compat_mode);
549 nsIDOMClientRect_AddRef(nsrect);
550 rect->nsrect = nsrect;
552 *ret = &rect->IHTMLRect_iface;
553 return S_OK;
556 typedef struct {
557 DispatchEx dispex;
558 IHTMLRectCollection IHTMLRectCollection_iface;
560 LONG ref;
562 nsIDOMClientRectList *rect_list;
563 } HTMLRectCollection;
565 static inline HTMLRectCollection *impl_from_IHTMLRectCollection(IHTMLRectCollection *iface)
567 return CONTAINING_RECORD(iface, HTMLRectCollection, IHTMLRectCollection_iface);
570 static HRESULT WINAPI HTMLRectCollection_QueryInterface(IHTMLRectCollection *iface, REFIID riid, void **ppv)
572 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
574 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
576 if(IsEqualGUID(&IID_IUnknown, riid)) {
577 *ppv = &This->IHTMLRectCollection_iface;
578 }else if(IsEqualGUID(&IID_IHTMLRectCollection, riid)) {
579 *ppv = &This->IHTMLRectCollection_iface;
580 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
581 return *ppv ? S_OK : E_NOINTERFACE;
582 }else {
583 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
584 *ppv = NULL;
585 return E_NOINTERFACE;
588 IUnknown_AddRef((IUnknown*)*ppv);
589 return S_OK;
592 static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface)
594 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
595 LONG ref = InterlockedIncrement(&This->ref);
597 TRACE("(%p) ref=%d\n", This, ref);
599 return ref;
602 static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface)
604 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
605 LONG ref = InterlockedDecrement(&This->ref);
607 TRACE("(%p) ref=%d\n", This, ref);
609 if(!ref) {
610 if(This->rect_list)
611 nsIDOMClientRectList_Release(This->rect_list);
612 release_dispex(&This->dispex);
613 heap_free(This);
616 return ref;
619 static HRESULT WINAPI HTMLRectCollection_GetTypeInfoCount(IHTMLRectCollection *iface, UINT *pctinfo)
621 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
622 FIXME("(%p)->(%p)\n", This, pctinfo);
623 return E_NOTIMPL;
626 static HRESULT WINAPI HTMLRectCollection_GetTypeInfo(IHTMLRectCollection *iface, UINT iTInfo,
627 LCID lcid, ITypeInfo **ppTInfo)
629 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
630 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
633 static HRESULT WINAPI HTMLRectCollection_GetIDsOfNames(IHTMLRectCollection *iface, REFIID riid,
634 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
636 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
637 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
638 lcid, rgDispId);
641 static HRESULT WINAPI HTMLRectCollection_Invoke(IHTMLRectCollection *iface, DISPID dispIdMember,
642 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
643 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
645 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
646 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
647 pDispParams, pVarResult, pExcepInfo, puArgErr);
650 static HRESULT WINAPI HTMLRectCollection_get_length(IHTMLRectCollection *iface, LONG *p)
652 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
653 UINT32 length;
654 nsresult nsres;
656 TRACE("(%p)->(%p)\n", This, p);
658 nsres = nsIDOMClientRectList_GetLength(This->rect_list, &length);
659 assert(nsres == NS_OK);
660 *p = length;
661 return S_OK;
664 static HRESULT WINAPI HTMLRectCollection_get__newEnum(IHTMLRectCollection *iface, IUnknown **p)
666 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
667 FIXME("(%p)->(%p)\n", This, p);
668 return E_NOTIMPL;
671 static HRESULT WINAPI HTMLRectCollection_item(IHTMLRectCollection *iface, VARIANT *index, VARIANT *result)
673 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
674 nsIDOMClientRect *nsrect;
675 IHTMLRect *rect;
676 nsresult nsres;
677 HRESULT hres;
679 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(index), result);
681 if(V_VT(index) != VT_I4 || V_I4(index) < 0) {
682 FIXME("Unsupported for %s index\n", debugstr_variant(index));
683 return E_NOTIMPL;
686 nsres = nsIDOMClientRectList_Item(This->rect_list, V_I4(index), &nsrect);
687 if(NS_FAILED(nsres))
688 return map_nsresult(nsres);
689 if(!nsrect) {
690 V_VT(result) = VT_NULL;
691 return S_OK;
694 hres = create_html_rect(nsrect, dispex_compat_mode(&This->dispex), &rect);
695 nsIDOMClientRect_Release(nsrect);
696 if(FAILED(hres))
697 return hres;
699 V_VT(result) = VT_DISPATCH;
700 V_DISPATCH(result) = (IDispatch *)rect;
701 return S_OK;
704 static const IHTMLRectCollectionVtbl HTMLRectCollectionVtbl = {
705 HTMLRectCollection_QueryInterface,
706 HTMLRectCollection_AddRef,
707 HTMLRectCollection_Release,
708 HTMLRectCollection_GetTypeInfoCount,
709 HTMLRectCollection_GetTypeInfo,
710 HTMLRectCollection_GetIDsOfNames,
711 HTMLRectCollection_Invoke,
712 HTMLRectCollection_get_length,
713 HTMLRectCollection_get__newEnum,
714 HTMLRectCollection_item
717 static inline HTMLRectCollection *HTMLRectCollection_from_DispatchEx(DispatchEx *iface)
719 return CONTAINING_RECORD(iface, HTMLRectCollection, dispex);
722 static HRESULT HTMLRectCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
724 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
725 UINT32 len = 0;
726 DWORD idx = 0;
727 WCHAR *ptr;
729 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
730 idx = idx*10 + (*ptr-'0');
731 if(*ptr)
732 return DISP_E_UNKNOWNNAME;
734 nsIDOMClientRectList_GetLength(This->rect_list, &len);
735 if(idx >= len)
736 return DISP_E_UNKNOWNNAME;
738 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
739 TRACE("ret %x\n", *dispid);
740 return S_OK;
743 static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
744 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
746 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
748 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
750 switch(flags) {
751 case DISPATCH_PROPERTYGET: {
752 nsIDOMClientRect *rect;
753 IHTMLRect *html_rect;
754 nsresult nsres;
755 HRESULT hres;
757 nsres = nsIDOMClientRectList_Item(This->rect_list, id - MSHTML_DISPID_CUSTOM_MIN, &rect);
758 if(NS_FAILED(nsres) || !rect) {
759 WARN("Unknown item\n");
760 return DISP_E_UNKNOWNNAME;
763 hres = create_html_rect(rect, dispex_compat_mode(&This->dispex), &html_rect);
764 nsIDOMClientRect_Release(rect);
765 if(FAILED(hres))
766 return hres;
768 V_VT(res) = VT_DISPATCH;
769 V_DISPATCH(res) = (IDispatch*)html_rect;
770 break;
773 default:
774 FIXME("unimplemented flags %x\n", flags);
775 return E_NOTIMPL;
778 return S_OK;
781 static const dispex_static_data_vtbl_t HTMLRectCollection_dispex_vtbl = {
782 NULL,
783 HTMLRectCollection_get_dispid,
784 HTMLRectCollection_invoke,
785 NULL
787 static const tid_t HTMLRectCollection_iface_tids[] = {
788 IHTMLRectCollection_tid,
791 static dispex_static_data_t HTMLRectCollection_dispex = {
792 &HTMLRectCollection_dispex_vtbl,
793 IHTMLRectCollection_tid,
794 HTMLRectCollection_iface_tids
797 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
798 REFIID riid, void **ppv)
800 HTMLElement *This = impl_from_IHTMLElement(iface);
802 return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
805 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
807 HTMLElement *This = impl_from_IHTMLElement(iface);
809 return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
812 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
814 HTMLElement *This = impl_from_IHTMLElement(iface);
816 return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
819 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
821 HTMLElement *This = impl_from_IHTMLElement(iface);
822 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
825 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
826 LCID lcid, ITypeInfo **ppTInfo)
828 HTMLElement *This = impl_from_IHTMLElement(iface);
829 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
832 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
833 LPOLESTR *rgszNames, UINT cNames,
834 LCID lcid, DISPID *rgDispId)
836 HTMLElement *This = impl_from_IHTMLElement(iface);
837 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
838 lcid, rgDispId);
841 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
842 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
843 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
845 HTMLElement *This = impl_from_IHTMLElement(iface);
846 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
847 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
850 static HRESULT set_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *v)
852 DISPID propput_dispid = DISPID_PROPERTYPUT;
853 DISPPARAMS dp = {v, &propput_dispid, 1, 1};
854 EXCEPINFO ei;
856 if(dispid == DISPID_IHTMLELEMENT_STYLE) {
857 TRACE("Ignoring call on style attribute\n");
858 return S_OK;
861 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid,
862 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
865 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
866 VARIANT AttributeValue, LONG lFlags)
868 HTMLElement *This = impl_from_IHTMLElement(iface);
869 DISPID dispid;
870 HRESULT hres;
872 TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
874 if(This->dom_element && dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8) {
875 nsAString name_str, value_str;
876 nsresult nsres;
878 hres = variant_to_nsstr(&AttributeValue, FALSE, &value_str);
879 if(FAILED(hres))
880 return hres;
882 nsAString_InitDepend(&name_str, strAttributeName);
883 nsres = nsIDOMElement_SetAttribute(This->dom_element, &name_str, &value_str);
884 nsAString_Finish(&name_str);
885 nsAString_Finish(&value_str);
886 if(NS_FAILED(nsres))
887 WARN("SetAttribute failed: %08x\n", nsres);
888 return map_nsresult(nsres);
891 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
892 (lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive) | fdexNameEnsure, &dispid);
893 if(FAILED(hres))
894 return hres;
896 return set_elem_attr_value_by_dispid(This, dispid, &AttributeValue);
899 HRESULT get_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *ret)
901 DISPPARAMS dispParams = {NULL, NULL, 0, 0};
902 EXCEPINFO excep;
904 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid, LOCALE_SYSTEM_DEFAULT,
905 DISPATCH_PROPERTYGET, &dispParams, ret, &excep, NULL);
908 HRESULT attr_value_to_string(VARIANT *v)
910 HRESULT hres;
912 switch(V_VT(v)) {
913 case VT_BSTR:
914 break;
915 case VT_NULL:
916 V_BSTR(v) = SysAllocString(L"null");
917 if(!V_BSTR(v))
918 return E_OUTOFMEMORY;
919 V_VT(v) = VT_BSTR;
920 break;
921 case VT_DISPATCH:
922 IDispatch_Release(V_DISPATCH(v));
923 V_VT(v) = VT_BSTR;
924 V_BSTR(v) = SysAllocString(NULL);
925 break;
926 default:
927 hres = VariantChangeType(v, v, 0, VT_BSTR);
928 if(FAILED(hres))
929 return hres;
932 return S_OK;
935 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
936 LONG lFlags, VARIANT *AttributeValue)
938 HTMLElement *This = impl_from_IHTMLElement(iface);
939 DISPID dispid;
940 HRESULT hres;
942 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
944 if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
945 FIXME("Unsupported flags %x\n", lFlags);
947 if(This->dom_element && dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8) {
948 nsAString name_str, value_str;
949 nsresult nsres;
951 nsAString_InitDepend(&name_str, strAttributeName);
952 nsAString_InitDepend(&value_str, NULL);
953 nsres = nsIDOMElement_GetAttribute(This->dom_element, &name_str, &value_str);
954 nsAString_Finish(&name_str);
955 return return_nsstr_variant(nsres, &value_str, 0, AttributeValue);
958 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
959 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
960 if(hres == DISP_E_UNKNOWNNAME) {
961 V_VT(AttributeValue) = VT_NULL;
962 return S_OK;
965 if(FAILED(hres)) {
966 V_VT(AttributeValue) = VT_NULL;
967 return hres;
970 hres = get_elem_attr_value_by_dispid(This, dispid, AttributeValue);
971 if(SUCCEEDED(hres) && (lFlags & ATTRFLAG_ASSTRING))
972 hres = attr_value_to_string(AttributeValue);
973 return hres;
976 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
977 LONG lFlags, VARIANT_BOOL *pfSuccess)
979 HTMLElement *This = impl_from_IHTMLElement(iface);
980 DISPID id;
981 HRESULT hres;
983 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
985 if(dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8)
986 return element_remove_attribute(This, strAttributeName);
988 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
989 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &id);
990 if(hres == DISP_E_UNKNOWNNAME) {
991 *pfSuccess = VARIANT_FALSE;
992 return S_OK;
994 if(FAILED(hres))
995 return hres;
997 if(id == DISPID_IHTMLELEMENT_STYLE) {
998 IHTMLStyle *style;
1000 TRACE("Special case: style\n");
1002 hres = IHTMLElement_get_style(&This->IHTMLElement_iface, &style);
1003 if(FAILED(hres))
1004 return hres;
1006 hres = IHTMLStyle_put_cssText(style, NULL);
1007 IHTMLStyle_Release(style);
1008 if(FAILED(hres))
1009 return hres;
1011 *pfSuccess = VARIANT_TRUE;
1012 return S_OK;
1015 return remove_attribute(&This->node.event_target.dispex, id, pfSuccess);
1018 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
1020 HTMLElement *This = impl_from_IHTMLElement(iface);
1021 nsAString classname_str;
1022 nsresult nsres;
1024 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1026 if(!This->dom_element) {
1027 FIXME("comment element\n");
1028 return E_NOTIMPL;
1031 nsAString_InitDepend(&classname_str, v);
1032 nsres = nsIDOMElement_SetClassName(This->dom_element, &classname_str);
1033 nsAString_Finish(&classname_str);
1034 if(NS_FAILED(nsres))
1035 ERR("SetClassName failed: %08x\n", nsres);
1037 return S_OK;
1040 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
1042 HTMLElement *This = impl_from_IHTMLElement(iface);
1043 nsAString class_str;
1044 nsresult nsres;
1046 TRACE("(%p)->(%p)\n", This, p);
1048 if(!This->dom_element) {
1049 FIXME("comment element\n");
1050 return E_NOTIMPL;
1053 nsAString_Init(&class_str, NULL);
1054 nsres = nsIDOMElement_GetClassName(This->dom_element, &class_str);
1055 return return_nsstr(nsres, &class_str, p);
1058 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
1060 HTMLElement *This = impl_from_IHTMLElement(iface);
1061 nsAString id_str;
1062 nsresult nsres;
1064 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1066 if(!This->dom_element) {
1067 FIXME("comment element\n");
1068 return S_OK;
1071 nsAString_InitDepend(&id_str, v);
1072 nsres = nsIDOMElement_SetId(This->dom_element, &id_str);
1073 nsAString_Finish(&id_str);
1074 if(NS_FAILED(nsres))
1075 ERR("SetId failed: %08x\n", nsres);
1077 return S_OK;
1080 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
1082 HTMLElement *This = impl_from_IHTMLElement(iface);
1083 nsAString id_str;
1084 nsresult nsres;
1086 TRACE("(%p)->(%p)\n", This, p);
1088 if(!This->dom_element) {
1089 *p = NULL;
1090 return S_OK;
1093 nsAString_Init(&id_str, NULL);
1094 nsres = nsIDOMElement_GetId(This->dom_element, &id_str);
1095 return return_nsstr(nsres, &id_str, p);
1098 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
1100 HTMLElement *This = impl_from_IHTMLElement(iface);
1101 nsAString tag_str;
1102 nsresult nsres;
1104 TRACE("(%p)->(%p)\n", This, p);
1106 if(!This->dom_element) {
1107 TRACE("comment element\n");
1108 *p = SysAllocString(L"!");
1109 return *p ? S_OK : E_OUTOFMEMORY;
1112 nsAString_Init(&tag_str, NULL);
1113 nsres = nsIDOMElement_GetTagName(This->dom_element, &tag_str);
1114 return return_nsstr(nsres, &tag_str, p);
1117 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
1119 HTMLElement *This = impl_from_IHTMLElement(iface);
1120 IHTMLDOMNode *node;
1121 HRESULT hres;
1123 TRACE("(%p)->(%p)\n", This, p);
1125 hres = IHTMLDOMNode_get_parentNode(&This->node.IHTMLDOMNode_iface, &node);
1126 if(FAILED(hres))
1127 return hres;
1129 if(!node) {
1130 *p = NULL;
1131 return S_OK;
1134 hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
1135 IHTMLDOMNode_Release(node);
1136 if(FAILED(hres))
1137 *p = NULL;
1139 return S_OK;
1142 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
1144 HTMLElement *This = impl_from_IHTMLElement(iface);
1146 TRACE("(%p)->(%p)\n", This, p);
1148 if(!This->style) {
1149 HRESULT hres;
1151 hres = HTMLStyle_Create(This, &This->style);
1152 if(FAILED(hres))
1153 return hres;
1156 *p = &This->style->IHTMLStyle_iface;
1157 IHTMLStyle_AddRef(*p);
1158 return S_OK;
1161 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
1163 HTMLElement *This = impl_from_IHTMLElement(iface);
1165 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1167 return set_node_event(&This->node, EVENTID_HELP, &v);
1170 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
1172 HTMLElement *This = impl_from_IHTMLElement(iface);
1174 TRACE("(%p)->(%p)\n", This, p);
1176 return get_node_event(&This->node, EVENTID_HELP, p);
1179 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
1181 HTMLElement *This = impl_from_IHTMLElement(iface);
1183 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1185 return set_node_event(&This->node, EVENTID_CLICK, &v);
1188 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
1190 HTMLElement *This = impl_from_IHTMLElement(iface);
1192 TRACE("(%p)->(%p)\n", This, p);
1194 return get_node_event(&This->node, EVENTID_CLICK, p);
1197 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
1199 HTMLElement *This = impl_from_IHTMLElement(iface);
1201 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1203 return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
1206 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
1208 HTMLElement *This = impl_from_IHTMLElement(iface);
1210 TRACE("(%p)->(%p)\n", This, p);
1212 return get_node_event(&This->node, EVENTID_DBLCLICK, p);
1215 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
1217 HTMLElement *This = impl_from_IHTMLElement(iface);
1219 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1221 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
1224 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
1226 HTMLElement *This = impl_from_IHTMLElement(iface);
1228 TRACE("(%p)->(%p)\n", This, p);
1230 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
1233 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
1235 HTMLElement *This = impl_from_IHTMLElement(iface);
1237 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1239 return set_node_event(&This->node, EVENTID_KEYUP, &v);
1242 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
1244 HTMLElement *This = impl_from_IHTMLElement(iface);
1246 TRACE("(%p)->(%p)\n", This, p);
1248 return get_node_event(&This->node, EVENTID_KEYUP, p);
1251 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
1253 HTMLElement *This = impl_from_IHTMLElement(iface);
1255 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1257 return set_node_event(&This->node, EVENTID_KEYPRESS, &v);
1260 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
1262 HTMLElement *This = impl_from_IHTMLElement(iface);
1264 TRACE("(%p)->(%p)\n", This, p);
1266 return get_node_event(&This->node, EVENTID_KEYPRESS, p);
1269 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
1271 HTMLElement *This = impl_from_IHTMLElement(iface);
1273 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1275 return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
1278 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
1280 HTMLElement *This = impl_from_IHTMLElement(iface);
1282 TRACE("(%p)->(%p)\n", This, p);
1284 return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
1287 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
1289 HTMLElement *This = impl_from_IHTMLElement(iface);
1291 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1293 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
1296 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
1298 HTMLElement *This = impl_from_IHTMLElement(iface);
1300 TRACE("(%p)->(%p)\n", This, p);
1302 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
1305 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
1307 HTMLElement *This = impl_from_IHTMLElement(iface);
1309 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1311 return set_node_event(&This->node, EVENTID_MOUSEMOVE, &v);
1314 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
1316 HTMLElement *This = impl_from_IHTMLElement(iface);
1318 TRACE("(%p)->(%p)\n", This, p);
1320 return get_node_event(&This->node, EVENTID_MOUSEMOVE, p);
1323 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
1325 HTMLElement *This = impl_from_IHTMLElement(iface);
1327 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1329 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
1332 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
1334 HTMLElement *This = impl_from_IHTMLElement(iface);
1336 TRACE("(%p)->(%p)\n", This, p);
1338 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
1341 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
1343 HTMLElement *This = impl_from_IHTMLElement(iface);
1345 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1347 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
1350 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
1352 HTMLElement *This = impl_from_IHTMLElement(iface);
1354 TRACE("(%p)->(%p)\n", This, p);
1356 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
1359 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
1361 HTMLElement *This = impl_from_IHTMLElement(iface);
1363 TRACE("(%p)->(%p)\n", This, p);
1365 if(!p)
1366 return E_POINTER;
1368 if(This->node.vtbl->get_document)
1369 return This->node.vtbl->get_document(&This->node, p);
1371 *p = (IDispatch*)&This->node.doc->basedoc.IHTMLDocument2_iface;
1372 IDispatch_AddRef(*p);
1373 return S_OK;
1376 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
1378 HTMLElement *This = impl_from_IHTMLElement(iface);
1379 nsAString title_str;
1380 nsresult nsres;
1382 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1384 if(!This->dom_element) {
1385 VARIANT *var;
1386 HRESULT hres;
1388 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", TRUE, &var);
1389 if(FAILED(hres))
1390 return hres;
1392 VariantClear(var);
1393 V_VT(var) = VT_BSTR;
1394 V_BSTR(var) = v ? SysAllocString(v) : NULL;
1395 return S_OK;
1398 if(!This->html_element)
1399 return elem_string_attr_setter(This, L"title", v);
1401 nsAString_InitDepend(&title_str, v);
1402 nsres = nsIDOMHTMLElement_SetTitle(This->html_element, &title_str);
1403 nsAString_Finish(&title_str);
1404 if(NS_FAILED(nsres))
1405 ERR("SetTitle failed: %08x\n", nsres);
1407 return S_OK;
1410 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
1412 HTMLElement *This = impl_from_IHTMLElement(iface);
1413 nsAString title_str;
1414 nsresult nsres;
1416 TRACE("(%p)->(%p)\n", This, p);
1418 if(!This->dom_element) {
1419 VARIANT *var;
1420 HRESULT hres;
1422 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", FALSE, &var);
1423 if(hres == DISP_E_UNKNOWNNAME) {
1424 *p = NULL;
1425 }else if(V_VT(var) != VT_BSTR) {
1426 FIXME("title = %s\n", debugstr_variant(var));
1427 return E_FAIL;
1428 }else {
1429 *p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
1432 return S_OK;
1435 if(!This->html_element)
1436 return elem_string_attr_getter(This, L"title", FALSE, p);
1438 nsAString_Init(&title_str, NULL);
1439 nsres = nsIDOMHTMLElement_GetTitle(This->html_element, &title_str);
1440 return return_nsstr(nsres, &title_str, p);
1443 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
1445 HTMLElement *This = impl_from_IHTMLElement(iface);
1447 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1449 return elem_string_attr_setter(This, L"language", v);
1452 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
1454 HTMLElement *This = impl_from_IHTMLElement(iface);
1456 TRACE("(%p)->(%p)\n", This, p);
1458 return elem_string_attr_getter(This, L"language", TRUE, p);
1461 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
1463 HTMLElement *This = impl_from_IHTMLElement(iface);
1465 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1467 return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
1470 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
1472 HTMLElement *This = impl_from_IHTMLElement(iface);
1474 TRACE("(%p)->(%p)\n", This, p);
1476 return get_node_event(&This->node, EVENTID_SELECTSTART, p);
1479 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
1481 HTMLElement *This = impl_from_IHTMLElement(iface);
1482 cpp_bool start = TRUE;
1483 nsresult nsres;
1485 TRACE("(%p)->(%s)\n", This, debugstr_variant(&varargStart));
1487 switch(V_VT(&varargStart)) {
1488 case VT_EMPTY:
1489 case VT_ERROR:
1490 break;
1491 case VT_BOOL:
1492 start = V_BOOL(&varargStart) != VARIANT_FALSE;
1493 break;
1494 default:
1495 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart));
1498 if(!This->html_element) {
1499 FIXME("non-HTML elements\n");
1500 return E_NOTIMPL;
1503 nsres = nsIDOMHTMLElement_ScrollIntoView(This->html_element, start, 1);
1504 assert(nsres == NS_OK);
1506 return S_OK;
1509 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
1510 VARIANT_BOOL *pfResult)
1512 HTMLElement *This = impl_from_IHTMLElement(iface);
1513 cpp_bool result = FALSE;
1515 TRACE("(%p)->(%p %p)\n", This, pChild, pfResult);
1517 if(pChild) {
1518 HTMLElement *child;
1519 nsresult nsres;
1521 child = unsafe_impl_from_IHTMLElement(pChild);
1522 if(!child) {
1523 ERR("not our element\n");
1524 return E_FAIL;
1527 nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result);
1528 assert(nsres == NS_OK);
1531 *pfResult = variant_bool(result);
1532 return S_OK;
1535 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, LONG *p)
1537 HTMLElement *This = impl_from_IHTMLElement(iface);
1539 TRACE("(%p)->(%p)\n", This, p);
1541 return get_elem_source_index(This, p);
1544 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
1546 HTMLElement *This = impl_from_IHTMLElement(iface);
1547 FIXME("(%p)->(%p)\n", This, p);
1548 return E_NOTIMPL;
1551 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
1553 HTMLElement *This = impl_from_IHTMLElement(iface);
1554 nsAString nsstr;
1555 nsresult nsres;
1557 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1559 if(!This->html_element) {
1560 FIXME("non-HTML element\n");
1561 return E_NOTIMPL;
1564 nsAString_InitDepend(&nsstr, v);
1565 nsres = nsIDOMHTMLElement_SetLang(This->html_element, &nsstr);
1566 nsAString_Finish(&nsstr);
1567 if(NS_FAILED(nsres)) {
1568 ERR("SetLang failed: %08x\n", nsres);
1569 return E_FAIL;
1572 return S_OK;
1575 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
1577 HTMLElement *This = impl_from_IHTMLElement(iface);
1578 nsAString nsstr;
1579 nsresult nsres;
1581 TRACE("(%p)->(%p)\n", This, p);
1583 if(!This->html_element) {
1584 FIXME("non-HTML element\n");
1585 return E_NOTIMPL;
1588 nsAString_Init(&nsstr, NULL);
1589 nsres = nsIDOMHTMLElement_GetLang(This->html_element, &nsstr);
1590 return return_nsstr(nsres, &nsstr, p);
1593 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
1595 HTMLElement *This = impl_from_IHTMLElement(iface);
1596 nsresult nsres;
1598 TRACE("(%p)->(%p)\n", This, p);
1600 if(!This->html_element) {
1601 FIXME("non-HTML element\n");
1602 return E_NOTIMPL;
1605 nsres = nsIDOMHTMLElement_GetOffsetLeft(This->html_element, p);
1606 if(NS_FAILED(nsres)) {
1607 ERR("GetOffsetLeft failed: %08x\n", nsres);
1608 return E_FAIL;
1611 return S_OK;
1614 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
1616 HTMLElement *This = impl_from_IHTMLElement(iface);
1617 nsresult nsres;
1619 TRACE("(%p)->(%p)\n", This, p);
1621 if(!This->html_element) {
1622 FIXME("non-HTML element\n");
1623 return E_NOTIMPL;
1626 nsres = nsIDOMHTMLElement_GetOffsetTop(This->html_element, p);
1627 if(NS_FAILED(nsres)) {
1628 ERR("GetOffsetTop failed: %08x\n", nsres);
1629 return E_FAIL;
1632 return S_OK;
1635 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
1637 HTMLElement *This = impl_from_IHTMLElement(iface);
1638 nsresult nsres;
1640 TRACE("(%p)->(%p)\n", This, p);
1642 if(!This->html_element) {
1643 FIXME("non-HTML element\n");
1644 return E_NOTIMPL;
1647 nsres = nsIDOMHTMLElement_GetOffsetWidth(This->html_element, p);
1648 if(NS_FAILED(nsres)) {
1649 ERR("GetOffsetWidth failed: %08x\n", nsres);
1650 return E_FAIL;
1653 return S_OK;
1656 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
1658 HTMLElement *This = impl_from_IHTMLElement(iface);
1659 nsresult nsres;
1661 TRACE("(%p)->(%p)\n", This, p);
1663 if(!This->html_element) {
1664 FIXME("non-HTML element\n");
1665 return E_NOTIMPL;
1668 nsres = nsIDOMHTMLElement_GetOffsetHeight(This->html_element, p);
1669 if(NS_FAILED(nsres)) {
1670 ERR("GetOffsetHeight failed: %08x\n", nsres);
1671 return E_FAIL;
1674 return S_OK;
1677 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
1679 HTMLElement *This = impl_from_IHTMLElement(iface);
1680 nsIDOMElement *nsparent;
1681 HTMLElement *parent;
1682 nsresult nsres;
1683 HRESULT hres;
1685 TRACE("(%p)->(%p)\n", This, p);
1687 if(!This->html_element) {
1688 FIXME("non-HTML element\n");
1689 return E_NOTIMPL;
1692 nsres = nsIDOMHTMLElement_GetOffsetParent(This->html_element, &nsparent);
1693 if(NS_FAILED(nsres)) {
1694 ERR("GetOffsetParent failed: %08x\n", nsres);
1695 return E_FAIL;
1698 if(!nsparent) {
1699 *p = NULL;
1700 return S_OK;
1703 hres = get_element(nsparent, &parent);
1704 nsIDOMElement_Release(nsparent);
1705 if(FAILED(hres))
1706 return hres;
1708 *p = &parent->IHTMLElement_iface;
1709 return S_OK;
1712 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
1714 HTMLElement *This = impl_from_IHTMLElement(iface);
1715 nsAString html_str;
1716 nsresult nsres;
1718 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1720 if(!This->html_element) {
1721 FIXME("non-HTML element\n");
1722 return E_NOTIMPL;
1725 nsAString_InitDepend(&html_str, v);
1726 nsres = nsIDOMHTMLElement_SetInnerHTML(This->html_element, &html_str);
1727 nsAString_Finish(&html_str);
1728 if(NS_FAILED(nsres)) {
1729 FIXME("SetInnerHtml failed %08x\n", nsres);
1730 return E_FAIL;
1733 return S_OK;
1736 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
1738 HTMLElement *This = impl_from_IHTMLElement(iface);
1739 nsAString html_str;
1740 nsresult nsres;
1742 TRACE("(%p)->(%p)\n", This, p);
1744 if(!This->html_element) {
1745 FIXME("non-HTML element\n");
1746 return E_NOTIMPL;
1749 nsAString_Init(&html_str, NULL);
1750 nsres = nsIDOMHTMLElement_GetInnerHTML(This->html_element, &html_str);
1751 return return_nsstr(nsres, &html_str, p);
1754 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
1756 HTMLElement *This = impl_from_IHTMLElement(iface);
1757 nsIDOMNode *nschild, *tmp;
1758 nsIDOMText *text_node;
1759 nsAString text_str;
1760 nsresult nsres;
1762 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1764 while(1) {
1765 nsres = nsIDOMElement_GetLastChild(This->dom_element, &nschild);
1766 if(NS_FAILED(nsres)) {
1767 ERR("GetLastChild failed: %08x\n", nsres);
1768 return E_FAIL;
1770 if(!nschild)
1771 break;
1773 nsres = nsIDOMElement_RemoveChild(This->dom_element, nschild, &tmp);
1774 nsIDOMNode_Release(nschild);
1775 if(NS_FAILED(nsres)) {
1776 ERR("RemoveChild failed: %08x\n", nsres);
1777 return E_FAIL;
1779 nsIDOMNode_Release(tmp);
1782 nsAString_InitDepend(&text_str, v);
1783 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
1784 nsAString_Finish(&text_str);
1785 if(NS_FAILED(nsres)) {
1786 ERR("CreateTextNode failed: %08x\n", nsres);
1787 return E_FAIL;
1790 nsres = nsIDOMElement_AppendChild(This->dom_element, (nsIDOMNode*)text_node, &tmp);
1791 if(NS_FAILED(nsres)) {
1792 ERR("AppendChild failed: %08x\n", nsres);
1793 return E_FAIL;
1796 nsIDOMNode_Release(tmp);
1797 return S_OK;
1800 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
1802 HTMLElement *This = impl_from_IHTMLElement(iface);
1804 TRACE("(%p)->(%p)\n", This, p);
1806 return get_node_text(&This->node, p);
1809 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
1811 HTMLElement *This = impl_from_IHTMLElement(iface);
1813 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1815 return replace_node_by_html(This->node.doc->nsdoc, This->node.nsnode, v);
1818 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
1820 HTMLElement *This = impl_from_IHTMLElement(iface);
1821 nsAString html_str;
1822 HRESULT hres;
1824 WARN("(%p)->(%p) semi-stub\n", This, p);
1826 nsAString_Init(&html_str, NULL);
1827 hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
1828 if(SUCCEEDED(hres)) {
1829 const PRUnichar *html;
1831 nsAString_GetData(&html_str, &html);
1832 *p = SysAllocString(html);
1833 if(!*p)
1834 hres = E_OUTOFMEMORY;
1837 nsAString_Finish(&html_str);
1839 TRACE("ret %s\n", debugstr_w(*p));
1840 return hres;
1843 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
1845 HTMLElement *This = impl_from_IHTMLElement(iface);
1846 nsIDOMText *text_node;
1847 nsIDOMRange *range;
1848 nsAString nsstr;
1849 nsresult nsres;
1851 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1853 if(This->node.vtbl->is_settable && !This->node.vtbl->is_settable(&This->node, DISPID_IHTMLELEMENT_OUTERTEXT)) {
1854 WARN("Called on element that does not support setting the property.\n");
1855 return 0x800a0258; /* undocumented error code */
1858 if(!This->node.doc->nsdoc) {
1859 FIXME("NULL nsdoc\n");
1860 return E_FAIL;
1863 nsAString_InitDepend(&nsstr, v);
1864 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node);
1865 nsAString_Finish(&nsstr);
1866 if(NS_FAILED(nsres)) {
1867 ERR("CreateTextNode failed\n");
1868 return E_FAIL;
1871 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
1872 if(NS_SUCCEEDED(nsres)) {
1873 nsres = nsIDOMRange_SelectNode(range, This->node.nsnode);
1874 if(NS_SUCCEEDED(nsres))
1875 nsres = nsIDOMRange_DeleteContents(range);
1876 if(NS_SUCCEEDED(nsres))
1877 nsres = nsIDOMRange_InsertNode(range, (nsIDOMNode*)text_node);
1878 if(NS_SUCCEEDED(nsres))
1879 nsres = nsIDOMRange_SelectNodeContents(range, This->node.nsnode);
1880 if(NS_SUCCEEDED(nsres))
1881 nsres = nsIDOMRange_DeleteContents(range);
1882 nsIDOMRange_Release(range);
1884 nsIDOMText_Release(text_node);
1885 if(NS_FAILED(nsres)) {
1886 ERR("failed to set text: %08x\n", nsres);
1887 return E_FAIL;
1890 return S_OK;
1893 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
1895 HTMLElement *This = impl_from_IHTMLElement(iface);
1897 TRACE("(%p)->(%p)\n", This, p);
1899 /* getter is the same as innerText */
1900 return IHTMLElement_get_innerText(&This->IHTMLElement_iface, p);
1903 static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDOMNode *nsnode, HTMLDOMNode **ret_node)
1905 nsIDOMNode *ret_nsnode;
1906 nsresult nsres;
1907 HRESULT hres = S_OK;
1909 if (!wcsicmp(where, L"beforebegin")) {
1910 nsIDOMNode *parent;
1912 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1913 if(NS_FAILED(nsres))
1914 return E_FAIL;
1916 if(!parent)
1917 return E_INVALIDARG;
1919 nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &ret_nsnode);
1920 nsIDOMNode_Release(parent);
1921 }else if(!wcsicmp(where, L"afterbegin")) {
1922 nsIDOMNode *first_child;
1924 nsres = nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
1925 if(NS_FAILED(nsres))
1926 return E_FAIL;
1928 nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &ret_nsnode);
1929 if(NS_FAILED(nsres))
1930 return E_FAIL;
1932 if (first_child)
1933 nsIDOMNode_Release(first_child);
1934 }else if (!wcsicmp(where, L"beforeend")) {
1935 nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &ret_nsnode);
1936 }else if (!wcsicmp(where, L"afterend")) {
1937 nsIDOMNode *next_sibling, *parent;
1939 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1940 if(NS_FAILED(nsres))
1941 return E_FAIL;
1942 if(!parent)
1943 return E_INVALIDARG;
1945 nsres = nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
1946 if(NS_SUCCEEDED(nsres)) {
1947 if(next_sibling) {
1948 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &ret_nsnode);
1949 nsIDOMNode_Release(next_sibling);
1950 }else {
1951 nsres = nsIDOMNode_AppendChild(parent, nsnode, &ret_nsnode);
1955 nsIDOMNode_Release(parent);
1956 }else {
1957 ERR("invalid where: %s\n", debugstr_w(where));
1958 return E_INVALIDARG;
1961 if (NS_FAILED(nsres))
1962 return E_FAIL;
1964 if(ret_node)
1965 hres = get_node(ret_nsnode, TRUE, ret_node);
1966 nsIDOMNode_Release(ret_nsnode);
1967 return hres;
1970 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
1971 BSTR html)
1973 HTMLElement *This = impl_from_IHTMLElement(iface);
1974 nsIDOMRange *range;
1975 nsIDOMNode *nsnode;
1976 nsAString ns_html;
1977 nsresult nsres;
1978 HRESULT hr;
1980 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
1982 if(!This->node.doc->nsdoc) {
1983 WARN("NULL nsdoc\n");
1984 return E_UNEXPECTED;
1987 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
1988 if(NS_FAILED(nsres))
1990 ERR("CreateRange failed: %08x\n", nsres);
1991 return E_FAIL;
1994 nsIDOMRange_SetStartBefore(range, This->node.nsnode);
1996 nsAString_InitDepend(&ns_html, html);
1997 nsres = nsIDOMRange_CreateContextualFragment(range, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
1998 nsAString_Finish(&ns_html);
1999 nsIDOMRange_Release(range);
2001 if(NS_FAILED(nsres) || !nsnode)
2003 ERR("CreateTextNode failed: %08x\n", nsres);
2004 return E_FAIL;
2007 hr = insert_adjacent_node(This, where, nsnode, NULL);
2008 nsIDOMNode_Release(nsnode);
2009 return hr;
2012 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
2013 BSTR text)
2015 HTMLElement *This = impl_from_IHTMLElement(iface);
2016 nsIDOMNode *nsnode;
2017 nsAString ns_text;
2018 nsresult nsres;
2019 HRESULT hr;
2021 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
2023 if(!This->node.doc->nsdoc) {
2024 WARN("NULL nsdoc\n");
2025 return E_UNEXPECTED;
2029 nsAString_InitDepend(&ns_text, text);
2030 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
2031 nsAString_Finish(&ns_text);
2033 if(NS_FAILED(nsres) || !nsnode)
2035 ERR("CreateTextNode failed: %08x\n", nsres);
2036 return E_FAIL;
2039 hr = insert_adjacent_node(This, where, nsnode, NULL);
2040 nsIDOMNode_Release(nsnode);
2042 return hr;
2045 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
2047 HTMLElement *This = impl_from_IHTMLElement(iface);
2048 FIXME("(%p)->(%p)\n", This, p);
2049 return E_NOTIMPL;
2052 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
2054 HTMLElement *This = impl_from_IHTMLElement(iface);
2056 TRACE("(%p)->(%p)\n", This, p);
2058 *p = variant_bool(This->node.vtbl->is_text_edit && This->node.vtbl->is_text_edit(&This->node));
2059 return S_OK;
2062 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
2064 HTMLElement *This = impl_from_IHTMLElement(iface);
2065 nsresult nsres;
2067 TRACE("(%p)\n", This);
2069 if(!This->html_element) {
2070 FIXME("non-HTML element\n");
2071 return E_NOTIMPL;
2074 nsres = nsIDOMHTMLElement_Click(This->html_element);
2075 if(NS_FAILED(nsres)) {
2076 ERR("Click failed: %08x\n", nsres);
2077 return E_FAIL;
2080 return S_OK;
2083 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, IHTMLFiltersCollection **p)
2085 HTMLElement *This = impl_from_IHTMLElement(iface);
2087 TRACE("(%p)->(%p)\n", This, p);
2089 if(!p)
2090 return E_POINTER;
2092 return create_filters_collection(dispex_compat_mode(&This->node.event_target.dispex), p);
2095 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
2097 HTMLElement *This = impl_from_IHTMLElement(iface);
2099 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2101 return set_node_event(&This->node, EVENTID_DRAGSTART, &v);
2104 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
2106 HTMLElement *This = impl_from_IHTMLElement(iface);
2108 TRACE("(%p)->(%p)\n", This, p);
2110 return get_node_event(&This->node, EVENTID_DRAGSTART, p);
2113 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
2115 HTMLElement *This = impl_from_IHTMLElement(iface);
2116 FIXME("(%p)->(%p)\n", This, String);
2117 return E_NOTIMPL;
2120 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
2122 HTMLElement *This = impl_from_IHTMLElement(iface);
2123 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2124 return E_NOTIMPL;
2127 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
2129 HTMLElement *This = impl_from_IHTMLElement(iface);
2130 FIXME("(%p)->(%p)\n", This, p);
2131 return E_NOTIMPL;
2134 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
2136 HTMLElement *This = impl_from_IHTMLElement(iface);
2137 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2138 return E_NOTIMPL;
2141 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
2143 HTMLElement *This = impl_from_IHTMLElement(iface);
2144 FIXME("(%p)->(%p)\n", This, p);
2145 return E_NOTIMPL;
2148 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
2150 HTMLElement *This = impl_from_IHTMLElement(iface);
2151 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2152 return E_NOTIMPL;
2155 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
2157 HTMLElement *This = impl_from_IHTMLElement(iface);
2158 FIXME("(%p)->(%p)\n", This, p);
2159 return E_NOTIMPL;
2162 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
2164 HTMLElement *This = impl_from_IHTMLElement(iface);
2165 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2166 return E_NOTIMPL;
2169 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
2171 HTMLElement *This = impl_from_IHTMLElement(iface);
2172 FIXME("(%p)->(%p)\n", This, p);
2173 return E_NOTIMPL;
2176 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
2178 HTMLElement *This = impl_from_IHTMLElement(iface);
2179 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2180 return E_NOTIMPL;
2183 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
2185 HTMLElement *This = impl_from_IHTMLElement(iface);
2186 FIXME("(%p)->(%p)\n", This, p);
2187 return E_NOTIMPL;
2190 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
2192 HTMLElement *This = impl_from_IHTMLElement(iface);
2193 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2194 return E_NOTIMPL;
2197 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
2199 HTMLElement *This = impl_from_IHTMLElement(iface);
2200 FIXME("(%p)->(%p)\n", This, p);
2201 return E_NOTIMPL;
2204 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
2206 HTMLElement *This = impl_from_IHTMLElement(iface);
2208 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_variant(&v));
2210 return set_node_event(&This->node, EVENTID_DATAAVAILABLE, &v);
2213 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
2215 HTMLElement *This = impl_from_IHTMLElement(iface);
2217 TRACE("(%p)->(%p)\n", This, p);
2219 return get_node_event(&This->node, EVENTID_DATAAVAILABLE, p);
2222 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
2224 HTMLElement *This = impl_from_IHTMLElement(iface);
2225 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2226 return E_NOTIMPL;
2229 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
2231 HTMLElement *This = impl_from_IHTMLElement(iface);
2232 FIXME("(%p)->(%p)\n", This, p);
2233 return E_NOTIMPL;
2236 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
2238 HTMLElement *This = impl_from_IHTMLElement(iface);
2239 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2240 return E_NOTIMPL;
2243 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
2245 HTMLElement *This = impl_from_IHTMLElement(iface);
2246 FIXME("(%p)->(%p)\n", This, p);
2247 return E_NOTIMPL;
2250 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
2252 HTMLElement *This = impl_from_IHTMLElement(iface);
2253 nsIDOMNodeList *nsnode_list;
2254 nsresult nsres;
2256 TRACE("(%p)->(%p)\n", This, p);
2258 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
2259 if(NS_FAILED(nsres)) {
2260 ERR("GetChildNodes failed: %08x\n", nsres);
2261 return E_FAIL;
2264 *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode);
2266 nsIDOMNodeList_Release(nsnode_list);
2267 return S_OK;
2270 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
2272 HTMLElement *This = impl_from_IHTMLElement(iface);
2274 TRACE("(%p)->(%p)\n", This, p);
2276 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
2277 return S_OK;
2280 static const IHTMLElementVtbl HTMLElementVtbl = {
2281 HTMLElement_QueryInterface,
2282 HTMLElement_AddRef,
2283 HTMLElement_Release,
2284 HTMLElement_GetTypeInfoCount,
2285 HTMLElement_GetTypeInfo,
2286 HTMLElement_GetIDsOfNames,
2287 HTMLElement_Invoke,
2288 HTMLElement_setAttribute,
2289 HTMLElement_getAttribute,
2290 HTMLElement_removeAttribute,
2291 HTMLElement_put_className,
2292 HTMLElement_get_className,
2293 HTMLElement_put_id,
2294 HTMLElement_get_id,
2295 HTMLElement_get_tagName,
2296 HTMLElement_get_parentElement,
2297 HTMLElement_get_style,
2298 HTMLElement_put_onhelp,
2299 HTMLElement_get_onhelp,
2300 HTMLElement_put_onclick,
2301 HTMLElement_get_onclick,
2302 HTMLElement_put_ondblclick,
2303 HTMLElement_get_ondblclick,
2304 HTMLElement_put_onkeydown,
2305 HTMLElement_get_onkeydown,
2306 HTMLElement_put_onkeyup,
2307 HTMLElement_get_onkeyup,
2308 HTMLElement_put_onkeypress,
2309 HTMLElement_get_onkeypress,
2310 HTMLElement_put_onmouseout,
2311 HTMLElement_get_onmouseout,
2312 HTMLElement_put_onmouseover,
2313 HTMLElement_get_onmouseover,
2314 HTMLElement_put_onmousemove,
2315 HTMLElement_get_onmousemove,
2316 HTMLElement_put_onmousedown,
2317 HTMLElement_get_onmousedown,
2318 HTMLElement_put_onmouseup,
2319 HTMLElement_get_onmouseup,
2320 HTMLElement_get_document,
2321 HTMLElement_put_title,
2322 HTMLElement_get_title,
2323 HTMLElement_put_language,
2324 HTMLElement_get_language,
2325 HTMLElement_put_onselectstart,
2326 HTMLElement_get_onselectstart,
2327 HTMLElement_scrollIntoView,
2328 HTMLElement_contains,
2329 HTMLElement_get_sourceIndex,
2330 HTMLElement_get_recordNumber,
2331 HTMLElement_put_lang,
2332 HTMLElement_get_lang,
2333 HTMLElement_get_offsetLeft,
2334 HTMLElement_get_offsetTop,
2335 HTMLElement_get_offsetWidth,
2336 HTMLElement_get_offsetHeight,
2337 HTMLElement_get_offsetParent,
2338 HTMLElement_put_innerHTML,
2339 HTMLElement_get_innerHTML,
2340 HTMLElement_put_innerText,
2341 HTMLElement_get_innerText,
2342 HTMLElement_put_outerHTML,
2343 HTMLElement_get_outerHTML,
2344 HTMLElement_put_outerText,
2345 HTMLElement_get_outerText,
2346 HTMLElement_insertAdjacentHTML,
2347 HTMLElement_insertAdjacentText,
2348 HTMLElement_get_parentTextEdit,
2349 HTMLElement_get_isTextEdit,
2350 HTMLElement_click,
2351 HTMLElement_get_filters,
2352 HTMLElement_put_ondragstart,
2353 HTMLElement_get_ondragstart,
2354 HTMLElement_toString,
2355 HTMLElement_put_onbeforeupdate,
2356 HTMLElement_get_onbeforeupdate,
2357 HTMLElement_put_onafterupdate,
2358 HTMLElement_get_onafterupdate,
2359 HTMLElement_put_onerrorupdate,
2360 HTMLElement_get_onerrorupdate,
2361 HTMLElement_put_onrowexit,
2362 HTMLElement_get_onrowexit,
2363 HTMLElement_put_onrowenter,
2364 HTMLElement_get_onrowenter,
2365 HTMLElement_put_ondatasetchanged,
2366 HTMLElement_get_ondatasetchanged,
2367 HTMLElement_put_ondataavailable,
2368 HTMLElement_get_ondataavailable,
2369 HTMLElement_put_ondatasetcomplete,
2370 HTMLElement_get_ondatasetcomplete,
2371 HTMLElement_put_onfilterchange,
2372 HTMLElement_get_onfilterchange,
2373 HTMLElement_get_children,
2374 HTMLElement_get_all
2377 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement *iface)
2379 return iface->lpVtbl == &HTMLElementVtbl ? impl_from_IHTMLElement(iface) : NULL;
2382 static inline HTMLElement *impl_from_IHTMLElement2(IHTMLElement2 *iface)
2384 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement2_iface);
2387 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
2388 REFIID riid, void **ppv)
2390 HTMLElement *This = impl_from_IHTMLElement2(iface);
2391 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
2394 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
2396 HTMLElement *This = impl_from_IHTMLElement2(iface);
2397 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
2400 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
2402 HTMLElement *This = impl_from_IHTMLElement2(iface);
2403 return IHTMLElement_Release(&This->IHTMLElement_iface);
2406 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
2408 HTMLElement *This = impl_from_IHTMLElement2(iface);
2409 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
2412 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
2413 LCID lcid, ITypeInfo **ppTInfo)
2415 HTMLElement *This = impl_from_IHTMLElement2(iface);
2416 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2419 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
2420 LPOLESTR *rgszNames, UINT cNames,
2421 LCID lcid, DISPID *rgDispId)
2423 HTMLElement *This = impl_from_IHTMLElement2(iface);
2424 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2425 lcid, rgDispId);
2428 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
2429 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2430 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2432 HTMLElement *This = impl_from_IHTMLElement2(iface);
2433 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
2434 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2437 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
2439 HTMLElement *This = impl_from_IHTMLElement2(iface);
2440 FIXME("(%p)->(%p)\n", This, p);
2441 return E_NOTIMPL;
2444 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
2446 HTMLElement *This = impl_from_IHTMLElement2(iface);
2447 FIXME("(%p)->(%x)\n", This, containerCapture);
2448 return E_NOTIMPL;
2451 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
2453 HTMLElement *This = impl_from_IHTMLElement2(iface);
2454 FIXME("(%p)\n", This);
2455 return E_NOTIMPL;
2458 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
2460 HTMLElement *This = impl_from_IHTMLElement2(iface);
2461 FIXME("(%p)->()\n", This);
2462 return E_NOTIMPL;
2465 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
2467 HTMLElement *This = impl_from_IHTMLElement2(iface);
2468 FIXME("(%p)->(%p)\n", This, p);
2469 return E_NOTIMPL;
2472 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
2473 LONG x, LONG y, BSTR *component)
2475 HTMLElement *This = impl_from_IHTMLElement2(iface);
2476 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
2477 return E_NOTIMPL;
2480 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
2482 HTMLElement *This = impl_from_IHTMLElement2(iface);
2484 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
2486 if(!This->node.doc->content_ready
2487 || !This->node.doc->basedoc.doc_obj->in_place_active)
2488 return E_PENDING;
2490 WARN("stub\n");
2491 return S_OK;
2494 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
2496 HTMLElement *This = impl_from_IHTMLElement2(iface);
2498 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2500 return set_node_event(&This->node, EVENTID_SCROLL, &v);
2503 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
2505 HTMLElement *This = impl_from_IHTMLElement2(iface);
2507 TRACE("(%p)->(%p)\n", This, p);
2509 return get_node_event(&This->node, EVENTID_SCROLL, p);
2512 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
2514 HTMLElement *This = impl_from_IHTMLElement2(iface);
2516 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2518 return set_node_event(&This->node, EVENTID_DRAG, &v);
2521 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
2523 HTMLElement *This = impl_from_IHTMLElement2(iface);
2525 TRACE("(%p)->(%p)\n", This, p);
2527 return get_node_event(&This->node, EVENTID_DRAG, p);
2530 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
2532 HTMLElement *This = impl_from_IHTMLElement2(iface);
2533 FIXME("(%p)->()\n", This);
2534 return E_NOTIMPL;
2537 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
2539 HTMLElement *This = impl_from_IHTMLElement2(iface);
2540 FIXME("(%p)->(%p)\n", This, p);
2541 return E_NOTIMPL;
2544 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
2546 HTMLElement *This = impl_from_IHTMLElement2(iface);
2547 FIXME("(%p)->()\n", This);
2548 return E_NOTIMPL;
2551 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
2553 HTMLElement *This = impl_from_IHTMLElement2(iface);
2554 FIXME("(%p)->(%p)\n", This, p);
2555 return E_NOTIMPL;
2558 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
2560 HTMLElement *This = impl_from_IHTMLElement2(iface);
2561 FIXME("(%p)->()\n", This);
2562 return E_NOTIMPL;
2565 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
2567 HTMLElement *This = impl_from_IHTMLElement2(iface);
2568 FIXME("(%p)->(%p)\n", This, p);
2569 return E_NOTIMPL;
2572 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
2574 HTMLElement *This = impl_from_IHTMLElement2(iface);
2575 FIXME("(%p)->()\n", This);
2576 return E_NOTIMPL;
2579 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
2581 HTMLElement *This = impl_from_IHTMLElement2(iface);
2582 FIXME("(%p)->(%p)\n", This, p);
2583 return E_NOTIMPL;
2586 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
2588 HTMLElement *This = impl_from_IHTMLElement2(iface);
2589 FIXME("(%p)->()\n", This);
2590 return E_NOTIMPL;
2593 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
2595 HTMLElement *This = impl_from_IHTMLElement2(iface);
2596 FIXME("(%p)->(%p)\n", This, p);
2597 return E_NOTIMPL;
2600 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
2602 HTMLElement *This = impl_from_IHTMLElement2(iface);
2603 FIXME("(%p)->()\n", This);
2604 return E_NOTIMPL;
2607 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
2609 HTMLElement *This = impl_from_IHTMLElement2(iface);
2610 FIXME("(%p)->(%p)\n", This, p);
2611 return E_NOTIMPL;
2614 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
2616 HTMLElement *This = impl_from_IHTMLElement2(iface);
2617 FIXME("(%p)->()\n", This);
2618 return E_NOTIMPL;
2621 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
2623 HTMLElement *This = impl_from_IHTMLElement2(iface);
2624 FIXME("(%p)->(%p)\n", This, p);
2625 return E_NOTIMPL;
2628 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
2630 HTMLElement *This = impl_from_IHTMLElement2(iface);
2631 FIXME("(%p)->()\n", This);
2632 return E_NOTIMPL;
2635 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
2637 HTMLElement *This = impl_from_IHTMLElement2(iface);
2638 FIXME("(%p)->(%p)\n", This, p);
2639 return E_NOTIMPL;
2642 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
2644 HTMLElement *This = impl_from_IHTMLElement2(iface);
2645 FIXME("(%p)->()\n", This);
2646 return E_NOTIMPL;
2649 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
2651 HTMLElement *This = impl_from_IHTMLElement2(iface);
2652 FIXME("(%p)->(%p)\n", This, p);
2653 return E_NOTIMPL;
2656 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
2658 HTMLElement *This = impl_from_IHTMLElement2(iface);
2659 FIXME("(%p)->()\n", This);
2660 return E_NOTIMPL;
2663 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
2665 HTMLElement *This = impl_from_IHTMLElement2(iface);
2666 FIXME("(%p)->(%p)\n", This, p);
2667 return E_NOTIMPL;
2670 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
2672 HTMLElement *This = impl_from_IHTMLElement2(iface);
2674 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2676 return set_node_event(&This->node, EVENTID_PASTE, &v);
2679 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
2681 HTMLElement *This = impl_from_IHTMLElement2(iface);
2683 TRACE("(%p)->(%p)\n", This, p);
2685 return get_node_event(&This->node, EVENTID_PASTE, p);
2688 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
2690 HTMLElement *This = impl_from_IHTMLElement2(iface);
2692 TRACE("(%p)->(%p)\n", This, p);
2694 return HTMLCurrentStyle_Create(This, p);
2697 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
2699 HTMLElement *This = impl_from_IHTMLElement2(iface);
2700 FIXME("(%p)->()\n", This);
2701 return E_NOTIMPL;
2704 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
2706 HTMLElement *This = impl_from_IHTMLElement2(iface);
2707 FIXME("(%p)->(%p)\n", This, p);
2708 return E_NOTIMPL;
2711 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
2713 HTMLElement *This = impl_from_IHTMLElement2(iface);
2714 nsIDOMClientRectList *rect_list;
2715 HTMLRectCollection *rects;
2716 nsresult nsres;
2718 TRACE("(%p)->(%p)\n", This, pRectCol);
2720 if(!This->dom_element) {
2721 FIXME("comment element\n");
2722 return E_NOTIMPL;
2725 nsres = nsIDOMElement_GetClientRects(This->dom_element, &rect_list);
2726 if(NS_FAILED(nsres)) {
2727 WARN("GetClientRects failed: %08x\n", nsres);
2728 return map_nsresult(nsres);
2731 rects = heap_alloc_zero(sizeof(*rects));
2732 if(!rects) {
2733 nsIDOMClientRectList_Release(rect_list);
2734 return E_OUTOFMEMORY;
2737 rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl;
2738 rects->ref = 1;
2739 rects->rect_list = rect_list;
2740 init_dispatch(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface,
2741 &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
2743 *pRectCol = &rects->IHTMLRectCollection_iface;
2744 return S_OK;
2747 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
2749 HTMLElement *This = impl_from_IHTMLElement2(iface);
2750 nsIDOMClientRect *nsrect;
2751 nsresult nsres;
2752 HRESULT hres;
2754 TRACE("(%p)->(%p)\n", This, pRect);
2756 if(!This->dom_element) {
2757 FIXME("comment element\n");
2758 return E_NOTIMPL;
2761 nsres = nsIDOMElement_GetBoundingClientRect(This->dom_element, &nsrect);
2762 if(NS_FAILED(nsres) || !nsrect) {
2763 ERR("GetBoindingClientRect failed: %08x\n", nsres);
2764 return E_FAIL;
2767 hres = create_html_rect(nsrect, dispex_compat_mode(&This->node.event_target.dispex), pRect);
2769 nsIDOMClientRect_Release(nsrect);
2770 return hres;
2773 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
2774 BSTR expression, BSTR language)
2776 HTMLElement *This = impl_from_IHTMLElement2(iface);
2777 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
2778 debugstr_w(language));
2779 return E_NOTIMPL;
2782 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
2783 VARIANT *expression)
2785 HTMLElement *This = impl_from_IHTMLElement2(iface);
2786 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
2787 return E_NOTIMPL;
2790 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
2791 VARIANT_BOOL *pfSuccess)
2793 HTMLElement *This = impl_from_IHTMLElement2(iface);
2794 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
2795 return E_NOTIMPL;
2798 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
2800 HTMLElement *This = impl_from_IHTMLElement2(iface);
2801 nsresult nsres;
2803 TRACE("(%p)->(%d)\n", This, v);
2805 if(!This->html_element) {
2806 FIXME("non-HTML element\n");
2807 return E_NOTIMPL;
2810 nsres = nsIDOMHTMLElement_SetTabIndex(This->html_element, v);
2811 if(NS_FAILED(nsres))
2812 ERR("GetTabIndex failed: %08x\n", nsres);
2814 return S_OK;
2817 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
2819 HTMLElement *This = impl_from_IHTMLElement2(iface);
2820 LONG index;
2821 nsresult nsres;
2823 TRACE("(%p)->(%p)\n", This, p);
2825 if(!This->html_element) {
2826 FIXME("non-HTML element\n");
2827 return E_NOTIMPL;
2830 nsres = nsIDOMHTMLElement_GetTabIndex(This->html_element, &index);
2831 if(NS_FAILED(nsres)) {
2832 ERR("GetTabIndex failed: %08x\n", nsres);
2833 return E_FAIL;
2836 *p = index;
2837 return S_OK;
2840 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
2842 HTMLElement *This = impl_from_IHTMLElement2(iface);
2843 nsresult nsres;
2845 TRACE("(%p)\n", This);
2847 if(!This->html_element) {
2848 FIXME("non-HTML element\n");
2849 return E_NOTIMPL;
2852 nsres = nsIDOMHTMLElement_Focus(This->html_element);
2853 if(NS_FAILED(nsres))
2854 ERR("Focus failed: %08x\n", nsres);
2856 return S_OK;
2859 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
2861 HTMLElement *This = impl_from_IHTMLElement2(iface);
2862 nsAString nsstr;
2863 nsresult nsres;
2865 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2867 if(!This->html_element) {
2868 FIXME("non-HTML element\n");
2869 return E_NOTIMPL;
2872 nsAString_InitDepend(&nsstr, v);
2873 nsres = nsIDOMHTMLElement_SetAccessKey(This->html_element, &nsstr);
2874 nsAString_Finish(&nsstr);
2875 return map_nsresult(nsres);
2878 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
2880 HTMLElement *This = impl_from_IHTMLElement2(iface);
2881 nsAString nsstr;
2882 nsresult nsres;
2884 TRACE("(%p)->(%p)\n", This, p);
2886 if(!This->html_element) {
2887 FIXME("non-HTML element\n");
2888 return E_NOTIMPL;
2891 nsAString_InitDepend(&nsstr, NULL);
2892 nsres = nsIDOMHTMLElement_GetAccessKey(This->html_element, &nsstr);
2893 return return_nsstr(nsres, &nsstr, p);
2896 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
2898 HTMLElement *This = impl_from_IHTMLElement2(iface);
2900 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2902 return set_node_event(&This->node, EVENTID_BLUR, &v);
2905 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
2907 HTMLElement *This = impl_from_IHTMLElement2(iface);
2909 TRACE("(%p)->(%p)\n", This, p);
2911 return get_node_event(&This->node, EVENTID_BLUR, p);
2914 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
2916 HTMLElement *This = impl_from_IHTMLElement2(iface);
2918 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2920 return set_node_event(&This->node, EVENTID_FOCUS, &v);
2923 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
2925 HTMLElement *This = impl_from_IHTMLElement2(iface);
2927 TRACE("(%p)->(%p)\n", This, p);
2929 return get_node_event(&This->node, EVENTID_FOCUS, p);
2932 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
2934 HTMLElement *This = impl_from_IHTMLElement2(iface);
2936 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2938 return set_node_event(&This->node, EVENTID_RESIZE, &v);
2941 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
2943 HTMLElement *This = impl_from_IHTMLElement2(iface);
2945 TRACE("(%p)->(%p)\n", This, p);
2947 return get_node_event(&This->node, EVENTID_RESIZE, p);
2950 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
2952 HTMLElement *This = impl_from_IHTMLElement2(iface);
2953 nsresult nsres;
2955 TRACE("(%p)\n", This);
2957 if(!This->html_element) {
2958 FIXME("non-HTML element\n");
2959 return E_NOTIMPL;
2962 nsres = nsIDOMHTMLElement_Blur(This->html_element);
2963 if(NS_FAILED(nsres)) {
2964 ERR("Blur failed: %08x\n", nsres);
2965 return E_FAIL;
2968 return S_OK;
2971 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2973 HTMLElement *This = impl_from_IHTMLElement2(iface);
2974 FIXME("(%p)->(%p)\n", This, pUnk);
2975 return E_NOTIMPL;
2978 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
2980 HTMLElement *This = impl_from_IHTMLElement2(iface);
2981 FIXME("(%p)->(%p)\n", This, pUnk);
2982 return E_NOTIMPL;
2985 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
2987 HTMLElement *This = impl_from_IHTMLElement2(iface);
2988 nsresult nsres;
2990 TRACE("(%p)->(%p)\n", This, p);
2992 if(!This->dom_element) {
2993 FIXME("Unimplemented for comment element\n");
2994 return E_NOTIMPL;
2997 nsres = nsIDOMElement_GetClientHeight(This->dom_element, p);
2998 assert(nsres == NS_OK);
2999 return S_OK;
3002 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
3004 HTMLElement *This = impl_from_IHTMLElement2(iface);
3005 nsresult nsres;
3007 TRACE("(%p)->(%p)\n", This, p);
3009 if(!This->dom_element) {
3010 FIXME("comment element\n");
3011 return E_NOTIMPL;
3014 nsres = nsIDOMElement_GetClientWidth(This->dom_element, p);
3015 assert(nsres == NS_OK);
3016 return S_OK;
3019 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
3021 HTMLElement *This = impl_from_IHTMLElement2(iface);
3022 nsresult nsres;
3024 TRACE("(%p)->(%p)\n", This, p);
3026 if(!This->dom_element) {
3027 FIXME("comment element\n");
3028 return E_NOTIMPL;
3031 nsres = nsIDOMElement_GetClientTop(This->dom_element, p);
3032 assert(nsres == NS_OK);
3034 TRACE("*p = %d\n", *p);
3035 return S_OK;
3038 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
3040 HTMLElement *This = impl_from_IHTMLElement2(iface);
3041 nsresult nsres;
3043 TRACE("(%p)->(%p)\n", This, p);
3045 if(!This->dom_element) {
3046 FIXME("comment element\n");
3047 return E_NOTIMPL;
3050 nsres = nsIDOMElement_GetClientLeft(This->dom_element, p);
3051 assert(nsres == NS_OK);
3053 TRACE("*p = %d\n", *p);
3054 return S_OK;
3057 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
3058 IDispatch *pDisp, VARIANT_BOOL *pfResult)
3060 HTMLElement *This = impl_from_IHTMLElement2(iface);
3062 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
3064 return attach_event(&This->node.event_target, event, pDisp, pfResult);
3067 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
3069 HTMLElement *This = impl_from_IHTMLElement2(iface);
3071 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
3073 return detach_event(&This->node.event_target, event, pDisp);
3076 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
3078 HTMLElement *This = impl_from_IHTMLElement2(iface);
3079 BSTR str;
3081 TRACE("(%p)->(%p)\n", This, p);
3083 if(This->node.vtbl->get_readystate) {
3084 HRESULT hres;
3086 hres = This->node.vtbl->get_readystate(&This->node, &str);
3087 if(FAILED(hres))
3088 return hres;
3089 }else {
3090 str = SysAllocString(L"complete");
3091 if(!str)
3092 return E_OUTOFMEMORY;
3095 V_VT(p) = VT_BSTR;
3096 V_BSTR(p) = str;
3097 return S_OK;
3100 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
3102 HTMLElement *This = impl_from_IHTMLElement2(iface);
3104 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3106 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
3109 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
3111 HTMLElement *This = impl_from_IHTMLElement2(iface);
3113 TRACE("(%p)->(%p)\n", This, p);
3115 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
3118 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
3120 HTMLElement *This = impl_from_IHTMLElement2(iface);
3121 FIXME("(%p)->()\n", This);
3122 return E_NOTIMPL;
3125 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
3127 HTMLElement *This = impl_from_IHTMLElement2(iface);
3128 FIXME("(%p)->(%p)\n", This, p);
3129 return E_NOTIMPL;
3132 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
3134 HTMLElement *This = impl_from_IHTMLElement2(iface);
3135 FIXME("(%p)->()\n", This);
3136 return E_NOTIMPL;
3139 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
3141 HTMLElement *This = impl_from_IHTMLElement2(iface);
3142 FIXME("(%p)->(%p)\n", This, p);
3143 return E_NOTIMPL;
3146 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
3148 HTMLElement *This = impl_from_IHTMLElement2(iface);
3149 FIXME("(%p)->()\n", This);
3150 return E_NOTIMPL;
3153 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
3155 HTMLElement *This = impl_from_IHTMLElement2(iface);
3156 FIXME("(%p)->(%p)\n", This, p);
3157 return E_NOTIMPL;
3160 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
3162 HTMLElement *This = impl_from_IHTMLElement2(iface);
3163 nsAString nsstr;
3164 nsresult nsres;
3166 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3168 if(!This->html_element) {
3169 FIXME("non-HTML element\n");
3170 return S_OK;
3173 nsAString_InitDepend(&nsstr, v);
3174 nsres = nsIDOMHTMLElement_SetDir(This->html_element, &nsstr);
3175 nsAString_Finish(&nsstr);
3176 if(NS_FAILED(nsres)) {
3177 ERR("SetDir failed: %08x\n", nsres);
3178 return E_FAIL;
3181 return S_OK;
3184 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
3186 HTMLElement *This = impl_from_IHTMLElement2(iface);
3187 nsAString dir_str;
3188 nsresult nsres;
3190 TRACE("(%p)->(%p)\n", This, p);
3192 if(!This->html_element) {
3193 if(This->dom_element)
3194 FIXME("non-HTML element\n");
3195 *p = NULL;
3196 return S_OK;
3199 nsAString_Init(&dir_str, NULL);
3200 nsres = nsIDOMHTMLElement_GetDir(This->html_element, &dir_str);
3201 return return_nsstr(nsres, &dir_str, p);
3204 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
3206 HTMLElement *This = impl_from_IHTMLElement2(iface);
3207 FIXME("(%p)->(%p)\n", This, range);
3208 return E_NOTIMPL;
3211 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
3213 HTMLElement *This = impl_from_IHTMLElement2(iface);
3214 nsresult nsres;
3216 TRACE("(%p)->(%p)\n", This, p);
3218 if(!This->dom_element) {
3219 FIXME("comment element\n");
3220 return E_NOTIMPL;
3223 nsres = nsIDOMElement_GetScrollHeight(This->dom_element, p);
3224 assert(nsres == NS_OK);
3225 TRACE("*p = %d\n", *p);
3226 return S_OK;
3229 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
3231 HTMLElement *This = impl_from_IHTMLElement2(iface);
3232 nsresult nsres;
3234 TRACE("(%p)->(%p)\n", This, p);
3236 if(!This->dom_element) {
3237 FIXME("comment element\n");
3238 return E_NOTIMPL;
3241 nsres = nsIDOMElement_GetScrollWidth(This->dom_element, p);
3242 assert(nsres == NS_OK);
3244 TRACE("*p = %d\n", *p);
3245 return S_OK;
3248 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
3250 HTMLElement *This = impl_from_IHTMLElement2(iface);
3252 TRACE("(%p)->(%d)\n", This, v);
3254 if(!This->dom_element) {
3255 FIXME("comment element\n");
3256 return E_NOTIMPL;
3259 nsIDOMElement_SetScrollTop(This->dom_element, v);
3260 return S_OK;
3263 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
3265 HTMLElement *This = impl_from_IHTMLElement2(iface);
3266 nsresult nsres;
3268 TRACE("(%p)->(%p)\n", This, p);
3270 if(!This->dom_element) {
3271 FIXME("comment element\n");
3272 return E_NOTIMPL;
3275 nsres = nsIDOMElement_GetScrollTop(This->dom_element, p);
3276 assert(nsres == NS_OK);
3278 TRACE("*p = %d\n", *p);
3279 return S_OK;
3282 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
3284 HTMLElement *This = impl_from_IHTMLElement2(iface);
3286 TRACE("(%p)->(%d)\n", This, v);
3288 if(!This->dom_element) {
3289 FIXME("comment element\n");
3290 return E_NOTIMPL;
3293 nsIDOMElement_SetScrollLeft(This->dom_element, v);
3294 return S_OK;
3297 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
3299 HTMLElement *This = impl_from_IHTMLElement2(iface);
3300 nsresult nsres;
3302 TRACE("(%p)->(%p)\n", This, p);
3304 if(!p)
3305 return E_INVALIDARG;
3307 if(!This->dom_element) {
3308 FIXME("comment element\n");
3309 return E_NOTIMPL;
3312 nsres = nsIDOMElement_GetScrollLeft(This->dom_element, p);
3313 assert(nsres == NS_OK);
3314 TRACE("*p = %d\n", *p);
3315 return S_OK;
3318 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
3320 HTMLElement *This = impl_from_IHTMLElement2(iface);
3321 FIXME("(%p)\n", This);
3322 return E_NOTIMPL;
3325 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
3327 HTMLElement *This = impl_from_IHTMLElement2(iface);
3328 FIXME("(%p)->(%p)\n", This, mergeThis);
3329 return E_NOTIMPL;
3332 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
3334 HTMLElement *This = impl_from_IHTMLElement2(iface);
3336 TRACE("(%p)->()\n", This);
3338 return set_node_event(&This->node, EVENTID_CONTEXTMENU, &v);
3341 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
3343 HTMLElement *This = impl_from_IHTMLElement2(iface);
3345 TRACE("(%p)->(%p)\n", This, p);
3347 return get_node_event(&This->node, EVENTID_CONTEXTMENU, p);
3350 static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, BSTR where,
3351 IHTMLElement *insertedElement, IHTMLElement **inserted)
3353 HTMLElement *This = impl_from_IHTMLElement2(iface);
3354 HTMLDOMNode *ret_node;
3355 HTMLElement *elem;
3356 HRESULT hres;
3358 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
3360 elem = unsafe_impl_from_IHTMLElement(insertedElement);
3361 if(!elem)
3362 return E_INVALIDARG;
3364 hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node);
3365 if(FAILED(hres))
3366 return hres;
3368 hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted);
3369 IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface);
3370 return hres;
3373 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
3374 BSTR where, IHTMLElement **applied)
3376 HTMLElement *This = impl_from_IHTMLElement2(iface);
3377 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
3378 return E_NOTIMPL;
3381 static HRESULT WINAPI HTMLElement2_getAdjacentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
3383 HTMLElement *This = impl_from_IHTMLElement2(iface);
3384 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
3385 return E_NOTIMPL;
3388 static HRESULT WINAPI HTMLElement2_replaceAdjacentText(IHTMLElement2 *iface, BSTR where,
3389 BSTR newText, BSTR *oldText)
3391 HTMLElement *This = impl_from_IHTMLElement2(iface);
3392 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
3393 return E_NOTIMPL;
3396 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
3398 HTMLElement *This = impl_from_IHTMLElement2(iface);
3399 FIXME("(%p)->(%p)\n", This, p);
3400 return E_NOTIMPL;
3403 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
3404 VARIANT *pvarFactory, LONG *pCookie)
3406 HTMLElement *This = impl_from_IHTMLElement2(iface);
3407 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
3408 return E_NOTIMPL;
3411 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
3412 VARIANT_BOOL *pfResult)
3414 HTMLElement *This = impl_from_IHTMLElement2(iface);
3415 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
3416 return E_NOTIMPL;
3419 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
3421 HTMLElement *This = impl_from_IHTMLElement2(iface);
3423 FIXME("(%p)->(%p): hack\n", This, p);
3425 /* We can't implement correct behavior on top of Gecko (although we could
3426 try a bit harder). Making runtimeStyle behave like regular style is
3427 enough for most use cases. */
3428 if(!This->runtime_style) {
3429 HRESULT hres;
3431 hres = HTMLStyle_Create(This, &This->runtime_style);
3432 if(FAILED(hres))
3433 return hres;
3436 *p = &This->runtime_style->IHTMLStyle_iface;
3437 IHTMLStyle_AddRef(*p);
3438 return S_OK;
3441 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
3443 HTMLElement *This = impl_from_IHTMLElement2(iface);
3444 FIXME("(%p)->(%p)\n", This, p);
3445 return E_NOTIMPL;
3448 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
3450 HTMLElement *This = impl_from_IHTMLElement2(iface);
3451 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3452 return E_NOTIMPL;
3455 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
3457 HTMLElement *This = impl_from_IHTMLElement2(iface);
3458 FIXME("(%p)->(%p)\n", This, p);
3459 return E_NOTIMPL;
3462 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
3464 HTMLElement *This = impl_from_IHTMLElement2(iface);
3465 FIXME("(%p)->()\n", This);
3466 return E_NOTIMPL;
3469 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
3471 HTMLElement *This = impl_from_IHTMLElement2(iface);
3472 FIXME("(%p)->(%p)\n", This, p);
3473 return E_NOTIMPL;
3476 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
3478 HTMLElement *This = impl_from_IHTMLElement2(iface);
3479 FIXME("(%p)->(%p)\n", This, p);
3480 return E_NOTIMPL;
3483 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
3484 IHTMLElementCollection **pelColl)
3486 HTMLElement *This = impl_from_IHTMLElement2(iface);
3487 nsIDOMHTMLCollection *nscol;
3488 nsAString tag_str;
3489 nsresult nsres;
3491 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
3493 if(!This->dom_element) {
3494 *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode);
3495 return S_OK;
3498 nsAString_InitDepend(&tag_str, v);
3499 nsres = nsIDOMElement_GetElementsByTagName(This->dom_element, &tag_str, &nscol);
3500 nsAString_Finish(&tag_str);
3501 if(NS_FAILED(nsres)) {
3502 ERR("GetElementByTagName failed: %08x\n", nsres);
3503 return E_FAIL;
3506 *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
3507 nsIDOMHTMLCollection_Release(nscol);
3508 return S_OK;
3511 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
3512 HTMLElement2_QueryInterface,
3513 HTMLElement2_AddRef,
3514 HTMLElement2_Release,
3515 HTMLElement2_GetTypeInfoCount,
3516 HTMLElement2_GetTypeInfo,
3517 HTMLElement2_GetIDsOfNames,
3518 HTMLElement2_Invoke,
3519 HTMLElement2_get_scopeName,
3520 HTMLElement2_setCapture,
3521 HTMLElement2_releaseCapture,
3522 HTMLElement2_put_onlosecapture,
3523 HTMLElement2_get_onlosecapture,
3524 HTMLElement2_componentFromPoint,
3525 HTMLElement2_doScroll,
3526 HTMLElement2_put_onscroll,
3527 HTMLElement2_get_onscroll,
3528 HTMLElement2_put_ondrag,
3529 HTMLElement2_get_ondrag,
3530 HTMLElement2_put_ondragend,
3531 HTMLElement2_get_ondragend,
3532 HTMLElement2_put_ondragenter,
3533 HTMLElement2_get_ondragenter,
3534 HTMLElement2_put_ondragover,
3535 HTMLElement2_get_ondragover,
3536 HTMLElement2_put_ondragleave,
3537 HTMLElement2_get_ondragleave,
3538 HTMLElement2_put_ondrop,
3539 HTMLElement2_get_ondrop,
3540 HTMLElement2_put_onbeforecut,
3541 HTMLElement2_get_onbeforecut,
3542 HTMLElement2_put_oncut,
3543 HTMLElement2_get_oncut,
3544 HTMLElement2_put_onbeforecopy,
3545 HTMLElement2_get_onbeforecopy,
3546 HTMLElement2_put_oncopy,
3547 HTMLElement2_get_oncopy,
3548 HTMLElement2_put_onbeforepaste,
3549 HTMLElement2_get_onbeforepaste,
3550 HTMLElement2_put_onpaste,
3551 HTMLElement2_get_onpaste,
3552 HTMLElement2_get_currentStyle,
3553 HTMLElement2_put_onpropertychange,
3554 HTMLElement2_get_onpropertychange,
3555 HTMLElement2_getClientRects,
3556 HTMLElement2_getBoundingClientRect,
3557 HTMLElement2_setExpression,
3558 HTMLElement2_getExpression,
3559 HTMLElement2_removeExpression,
3560 HTMLElement2_put_tabIndex,
3561 HTMLElement2_get_tabIndex,
3562 HTMLElement2_focus,
3563 HTMLElement2_put_accessKey,
3564 HTMLElement2_get_accessKey,
3565 HTMLElement2_put_onblur,
3566 HTMLElement2_get_onblur,
3567 HTMLElement2_put_onfocus,
3568 HTMLElement2_get_onfocus,
3569 HTMLElement2_put_onresize,
3570 HTMLElement2_get_onresize,
3571 HTMLElement2_blur,
3572 HTMLElement2_addFilter,
3573 HTMLElement2_removeFilter,
3574 HTMLElement2_get_clientHeight,
3575 HTMLElement2_get_clientWidth,
3576 HTMLElement2_get_clientTop,
3577 HTMLElement2_get_clientLeft,
3578 HTMLElement2_attachEvent,
3579 HTMLElement2_detachEvent,
3580 HTMLElement2_get_readyState,
3581 HTMLElement2_put_onreadystatechange,
3582 HTMLElement2_get_onreadystatechange,
3583 HTMLElement2_put_onrowsdelete,
3584 HTMLElement2_get_onrowsdelete,
3585 HTMLElement2_put_onrowsinserted,
3586 HTMLElement2_get_onrowsinserted,
3587 HTMLElement2_put_oncellchange,
3588 HTMLElement2_get_oncellchange,
3589 HTMLElement2_put_dir,
3590 HTMLElement2_get_dir,
3591 HTMLElement2_createControlRange,
3592 HTMLElement2_get_scrollHeight,
3593 HTMLElement2_get_scrollWidth,
3594 HTMLElement2_put_scrollTop,
3595 HTMLElement2_get_scrollTop,
3596 HTMLElement2_put_scrollLeft,
3597 HTMLElement2_get_scrollLeft,
3598 HTMLElement2_clearAttributes,
3599 HTMLElement2_mergeAttributes,
3600 HTMLElement2_put_oncontextmenu,
3601 HTMLElement2_get_oncontextmenu,
3602 HTMLElement2_insertAdjacentElement,
3603 HTMLElement2_applyElement,
3604 HTMLElement2_getAdjacentText,
3605 HTMLElement2_replaceAdjacentText,
3606 HTMLElement2_get_canHandleChildren,
3607 HTMLElement2_addBehavior,
3608 HTMLElement2_removeBehavior,
3609 HTMLElement2_get_runtimeStyle,
3610 HTMLElement2_get_behaviorUrns,
3611 HTMLElement2_put_tagUrn,
3612 HTMLElement2_get_tagUrn,
3613 HTMLElement2_put_onbeforeeditfocus,
3614 HTMLElement2_get_onbeforeeditfocus,
3615 HTMLElement2_get_readyStateValue,
3616 HTMLElement2_getElementsByTagName,
3619 static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
3621 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
3624 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
3625 REFIID riid, void **ppv)
3627 HTMLElement *This = impl_from_IHTMLElement3(iface);
3628 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
3631 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
3633 HTMLElement *This = impl_from_IHTMLElement3(iface);
3634 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
3637 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
3639 HTMLElement *This = impl_from_IHTMLElement3(iface);
3640 return IHTMLElement_Release(&This->IHTMLElement_iface);
3643 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
3645 HTMLElement *This = impl_from_IHTMLElement3(iface);
3646 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
3649 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
3650 LCID lcid, ITypeInfo **ppTInfo)
3652 HTMLElement *This = impl_from_IHTMLElement3(iface);
3653 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
3656 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
3657 LPOLESTR *rgszNames, UINT cNames,
3658 LCID lcid, DISPID *rgDispId)
3660 HTMLElement *This = impl_from_IHTMLElement3(iface);
3661 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
3662 lcid, rgDispId);
3665 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
3666 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3667 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3669 HTMLElement *This = impl_from_IHTMLElement3(iface);
3670 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
3671 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3674 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
3676 HTMLElement *This = impl_from_IHTMLElement3(iface);
3677 FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
3678 return E_NOTIMPL;
3681 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
3683 HTMLElement *This = impl_from_IHTMLElement3(iface);
3684 FIXME("(%p)->(%p)\n", This, p);
3685 return E_NOTIMPL;
3688 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
3690 HTMLElement *This = impl_from_IHTMLElement3(iface);
3691 FIXME("(%p)->(%p)\n", This, p);
3692 return E_NOTIMPL;
3695 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
3697 HTMLElement *This = impl_from_IHTMLElement3(iface);
3698 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3699 return E_NOTIMPL;
3702 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
3704 HTMLElement *This = impl_from_IHTMLElement3(iface);
3705 FIXME("(%p)->(%p)\n", This, p);
3706 return E_NOTIMPL;
3709 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
3711 HTMLElement *This = impl_from_IHTMLElement3(iface);
3712 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3713 return E_NOTIMPL;
3716 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
3718 HTMLElement *This = impl_from_IHTMLElement3(iface);
3719 FIXME("(%p)->(%p)\n", This, p);
3720 return E_NOTIMPL;
3723 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
3725 HTMLElement *This = impl_from_IHTMLElement3(iface);
3726 FIXME("(%p)->(%x)\n", This, v);
3727 return E_NOTIMPL;
3730 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
3732 HTMLElement *This = impl_from_IHTMLElement3(iface);
3733 FIXME("(%p)->(%p)\n", This, p);
3734 return E_NOTIMPL;
3737 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
3739 HTMLElement *This = impl_from_IHTMLElement3(iface);
3740 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3741 return E_NOTIMPL;
3744 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
3746 HTMLElement *This = impl_from_IHTMLElement3(iface);
3747 FIXME("(%p)->(%p)\n", This, p);
3748 return E_NOTIMPL;
3751 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
3753 HTMLElement *This = impl_from_IHTMLElement3(iface);
3754 FIXME("(%p)\n", This);
3755 return E_NOTIMPL;
3758 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
3760 HTMLElement *This = impl_from_IHTMLElement3(iface);
3761 nsresult nsres;
3762 nsAString str;
3764 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3766 if(!This->html_element) {
3767 FIXME("non-HTML element\n");
3768 return E_NOTIMPL;
3771 nsAString_InitDepend(&str, v);
3772 nsres = nsIDOMHTMLElement_SetContentEditable(This->html_element, &str);
3773 nsAString_Finish(&str);
3775 if (NS_FAILED(nsres)){
3776 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v));
3777 return E_FAIL;
3780 return S_OK;
3783 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
3785 HTMLElement *This = impl_from_IHTMLElement3(iface);
3786 nsresult nsres;
3787 nsAString str;
3789 TRACE("(%p)->(%p)\n", This, p);
3791 if(!This->html_element) {
3792 FIXME("non-HTML element\n");
3793 return E_NOTIMPL;
3796 nsAString_Init(&str, NULL);
3797 nsres = nsIDOMHTMLElement_GetContentEditable(This->html_element, &str);
3798 return return_nsstr(nsres, &str, p);
3801 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
3803 HTMLElement *This = impl_from_IHTMLElement3(iface);
3804 FIXME("(%p)->(%p)\n", This, p);
3805 return E_NOTIMPL;
3808 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
3810 HTMLElement *This = impl_from_IHTMLElement3(iface);
3811 FIXME("(%p)->(%x)\n", This, v);
3812 return E_NOTIMPL;
3815 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
3817 HTMLElement *This = impl_from_IHTMLElement3(iface);
3818 FIXME("(%p)->(%p)\n", This, p);
3819 return E_NOTIMPL;
3822 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
3824 HTMLElement *This = impl_from_IHTMLElement3(iface);
3826 TRACE("(%p)->(%x)\n", This, v);
3828 if(This->node.vtbl->put_disabled)
3829 return This->node.vtbl->put_disabled(&This->node, v);
3831 if(!v) return element_remove_attribute(This, L"disabled");
3832 return elem_string_attr_setter(This, L"disabled", L"");
3835 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3837 HTMLElement *This = impl_from_IHTMLElement3(iface);
3839 TRACE("(%p)->(%p)\n", This, p);
3841 if(This->node.vtbl->get_disabled)
3842 return This->node.vtbl->get_disabled(&This->node, p);
3844 *p = variant_bool(element_has_attribute(This, L"disabled"));
3845 return S_OK;
3848 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
3850 HTMLElement *This = impl_from_IHTMLElement3(iface);
3851 FIXME("(%p)->(%p)\n", This, p);
3852 return E_NOTIMPL;
3855 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
3857 HTMLElement *This = impl_from_IHTMLElement3(iface);
3858 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3859 return E_NOTIMPL;
3862 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
3864 HTMLElement *This = impl_from_IHTMLElement3(iface);
3865 FIXME("(%p)->(%p)\n", This, p);
3866 return E_NOTIMPL;
3869 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
3871 HTMLElement *This = impl_from_IHTMLElement3(iface);
3872 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3873 return E_NOTIMPL;
3876 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
3878 HTMLElement *This = impl_from_IHTMLElement3(iface);
3879 FIXME("(%p)->(%p)\n", This, p);
3880 return E_NOTIMPL;
3883 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
3884 VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
3886 HTMLElement *This = impl_from_IHTMLElement3(iface);
3888 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
3889 pfCancelled);
3891 return fire_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
3894 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
3896 HTMLElement *This = impl_from_IHTMLElement3(iface);
3897 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3898 return E_NOTIMPL;
3901 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
3903 HTMLElement *This = impl_from_IHTMLElement3(iface);
3904 FIXME("(%p)->(%p)\n", This, p);
3905 return E_NOTIMPL;
3908 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
3910 HTMLElement *This = impl_from_IHTMLElement3(iface);
3911 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3912 return E_NOTIMPL;
3915 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
3917 HTMLElement *This = impl_from_IHTMLElement3(iface);
3918 FIXME("(%p)->(%p)\n", This, p);
3919 return E_NOTIMPL;
3922 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
3924 HTMLElement *This = impl_from_IHTMLElement3(iface);
3925 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3926 return E_NOTIMPL;
3929 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
3931 HTMLElement *This = impl_from_IHTMLElement3(iface);
3932 FIXME("(%p)->(%p)\n", This, p);
3933 return E_NOTIMPL;
3936 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
3938 HTMLElement *This = impl_from_IHTMLElement3(iface);
3939 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3940 return E_NOTIMPL;
3943 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
3945 HTMLElement *This = impl_from_IHTMLElement3(iface);
3946 FIXME("(%p)->(%p)\n", This, p);
3947 return E_NOTIMPL;
3950 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
3952 HTMLElement *This = impl_from_IHTMLElement3(iface);
3953 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3954 return E_NOTIMPL;
3957 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
3959 HTMLElement *This = impl_from_IHTMLElement3(iface);
3960 FIXME("(%p)->(%p)\n", This, p);
3961 return E_NOTIMPL;
3964 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
3966 HTMLElement *This = impl_from_IHTMLElement3(iface);
3967 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3968 return E_NOTIMPL;
3971 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
3973 HTMLElement *This = impl_from_IHTMLElement3(iface);
3974 FIXME("(%p)->(%p)\n", This, p);
3975 return E_NOTIMPL;
3978 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
3980 HTMLElement *This = impl_from_IHTMLElement3(iface);
3981 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3982 return E_NOTIMPL;
3985 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
3987 HTMLElement *This = impl_from_IHTMLElement3(iface);
3988 FIXME("(%p)->(%p)\n", This, p);
3989 return E_NOTIMPL;
3992 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
3994 HTMLElement *This = impl_from_IHTMLElement3(iface);
3995 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3996 return E_NOTIMPL;
3999 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
4001 HTMLElement *This = impl_from_IHTMLElement3(iface);
4002 FIXME("(%p)->(%p)\n", This, p);
4003 return E_NOTIMPL;
4006 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
4008 HTMLElement *This = impl_from_IHTMLElement3(iface);
4009 FIXME("(%p)->(%p)\n", This, pfRet);
4010 return E_NOTIMPL;
4013 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
4015 HTMLElement *This = impl_from_IHTMLElement3(iface);
4016 FIXME("(%p)->(%p)\n", This, p);
4017 return E_NOTIMPL;
4020 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
4021 HTMLElement3_QueryInterface,
4022 HTMLElement3_AddRef,
4023 HTMLElement3_Release,
4024 HTMLElement3_GetTypeInfoCount,
4025 HTMLElement3_GetTypeInfo,
4026 HTMLElement3_GetIDsOfNames,
4027 HTMLElement3_Invoke,
4028 HTMLElement3_mergeAttributes,
4029 HTMLElement3_get_isMultiLine,
4030 HTMLElement3_get_canHaveHTML,
4031 HTMLElement3_put_onlayoutcomplete,
4032 HTMLElement3_get_onlayoutcomplete,
4033 HTMLElement3_put_onpage,
4034 HTMLElement3_get_onpage,
4035 HTMLElement3_put_inflateBlock,
4036 HTMLElement3_get_inflateBlock,
4037 HTMLElement3_put_onbeforedeactivate,
4038 HTMLElement3_get_onbeforedeactivate,
4039 HTMLElement3_setActive,
4040 HTMLElement3_put_contentEditable,
4041 HTMLElement3_get_contentEditable,
4042 HTMLElement3_get_isContentEditable,
4043 HTMLElement3_put_hideFocus,
4044 HTMLElement3_get_hideFocus,
4045 HTMLElement3_put_disabled,
4046 HTMLElement3_get_disabled,
4047 HTMLElement3_get_isDisabled,
4048 HTMLElement3_put_onmove,
4049 HTMLElement3_get_onmove,
4050 HTMLElement3_put_oncontrolselect,
4051 HTMLElement3_get_oncontrolselect,
4052 HTMLElement3_fireEvent,
4053 HTMLElement3_put_onresizestart,
4054 HTMLElement3_get_onresizestart,
4055 HTMLElement3_put_onresizeend,
4056 HTMLElement3_get_onresizeend,
4057 HTMLElement3_put_onmovestart,
4058 HTMLElement3_get_onmovestart,
4059 HTMLElement3_put_onmoveend,
4060 HTMLElement3_get_onmoveend,
4061 HTMLElement3_put_onmousecenter,
4062 HTMLElement3_get_onmousecenter,
4063 HTMLElement3_put_onmouseleave,
4064 HTMLElement3_get_onmouseleave,
4065 HTMLElement3_put_onactivate,
4066 HTMLElement3_get_onactivate,
4067 HTMLElement3_put_ondeactivate,
4068 HTMLElement3_get_ondeactivate,
4069 HTMLElement3_dragDrop,
4070 HTMLElement3_get_glyphMode
4073 static inline HTMLElement *impl_from_IHTMLElement4(IHTMLElement4 *iface)
4075 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement4_iface);
4078 static HRESULT WINAPI HTMLElement4_QueryInterface(IHTMLElement4 *iface,
4079 REFIID riid, void **ppv)
4081 HTMLElement *This = impl_from_IHTMLElement4(iface);
4082 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4085 static ULONG WINAPI HTMLElement4_AddRef(IHTMLElement4 *iface)
4087 HTMLElement *This = impl_from_IHTMLElement4(iface);
4088 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4091 static ULONG WINAPI HTMLElement4_Release(IHTMLElement4 *iface)
4093 HTMLElement *This = impl_from_IHTMLElement4(iface);
4094 return IHTMLElement_Release(&This->IHTMLElement_iface);
4097 static HRESULT WINAPI HTMLElement4_GetTypeInfoCount(IHTMLElement4 *iface, UINT *pctinfo)
4099 HTMLElement *This = impl_from_IHTMLElement4(iface);
4100 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4103 static HRESULT WINAPI HTMLElement4_GetTypeInfo(IHTMLElement4 *iface, UINT iTInfo,
4104 LCID lcid, ITypeInfo **ppTInfo)
4106 HTMLElement *This = impl_from_IHTMLElement4(iface);
4107 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4110 static HRESULT WINAPI HTMLElement4_GetIDsOfNames(IHTMLElement4 *iface, REFIID riid,
4111 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4113 HTMLElement *This = impl_from_IHTMLElement4(iface);
4114 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4115 lcid, rgDispId);
4118 static HRESULT WINAPI HTMLElement4_Invoke(IHTMLElement4 *iface, DISPID dispIdMember, REFIID riid,
4119 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4121 HTMLElement *This = impl_from_IHTMLElement4(iface);
4122 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4123 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4126 static HRESULT WINAPI HTMLElement4_put_onmousewheel(IHTMLElement4 *iface, VARIANT v)
4128 HTMLElement *This = impl_from_IHTMLElement4(iface);
4130 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4132 return set_node_event(&This->node, EVENTID_MOUSEWHEEL, &v);
4135 static HRESULT WINAPI HTMLElement4_get_onmousewheel(IHTMLElement4 *iface, VARIANT *p)
4137 HTMLElement *This = impl_from_IHTMLElement4(iface);
4139 TRACE("(%p)->(%p)\n", This, p);
4141 return get_node_event(&This->node, EVENTID_MOUSEWHEEL, p);
4144 static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
4146 HTMLElement *This = impl_from_IHTMLElement4(iface);
4147 FIXME("(%p)\n", This);
4148 return E_NOTIMPL;
4151 static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute)
4153 HTMLElement *This = impl_from_IHTMLElement4(iface);
4154 HTMLAttributeCollection *attrs;
4155 HRESULT hres;
4157 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute);
4159 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4160 if(FAILED(hres))
4161 return hres;
4163 hres = IHTMLAttributeCollection2_getNamedItem(&attrs->IHTMLAttributeCollection2_iface, bstrname, ppAttribute);
4164 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4165 return hres;
4168 static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4169 IHTMLDOMAttribute **ppretAttribute)
4171 HTMLElement *This = impl_from_IHTMLElement4(iface);
4172 HTMLDOMAttribute *attr, *iter, *replace = NULL;
4173 HTMLAttributeCollection *attrs;
4174 DISPID dispid;
4175 HRESULT hres;
4177 TRACE("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4179 attr = unsafe_impl_from_IHTMLDOMAttribute(pattr);
4180 if(!attr)
4181 return E_INVALIDARG;
4183 if(attr->elem) {
4184 WARN("Tried to set already attached attribute.\n");
4185 return E_INVALIDARG;
4188 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface,
4189 attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid);
4190 if(FAILED(hres))
4191 return hres;
4193 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4194 if(FAILED(hres))
4195 return hres;
4197 LIST_FOR_EACH_ENTRY(iter, &attrs->attrs, HTMLDOMAttribute, entry) {
4198 if(iter->dispid == dispid) {
4199 replace = iter;
4200 break;
4204 if(replace) {
4205 hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value);
4206 if(FAILED(hres)) {
4207 WARN("could not get attr value: %08x\n", hres);
4208 V_VT(&replace->value) = VT_EMPTY;
4210 if(!replace->name) {
4211 replace->name = attr->name;
4212 attr->name = NULL;
4214 list_add_head(&replace->entry, &attr->entry);
4215 list_remove(&replace->entry);
4216 replace->elem = NULL;
4217 }else {
4218 list_add_tail(&attrs->attrs, &attr->entry);
4221 IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface);
4222 attr->elem = This;
4223 attr->dispid = dispid;
4225 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4227 hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value);
4228 if(FAILED(hres))
4229 WARN("Could not set attribute value: %08x\n", hres);
4230 VariantClear(&attr->value);
4232 *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL;
4233 return S_OK;
4236 static HRESULT WINAPI HTMLElement4_removeAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4237 IHTMLDOMAttribute **ppretAttribute)
4239 HTMLElement *This = impl_from_IHTMLElement4(iface);
4240 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4241 return E_NOTIMPL;
4244 static HRESULT WINAPI HTMLElement4_put_onbeforeactivate(IHTMLElement4 *iface, VARIANT v)
4246 HTMLElement *This = impl_from_IHTMLElement4(iface);
4248 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4250 return set_node_event(&This->node, EVENTID_BEFOREACTIVATE, &v);
4253 static HRESULT WINAPI HTMLElement4_get_onbeforeactivate(IHTMLElement4 *iface, VARIANT *p)
4255 HTMLElement *This = impl_from_IHTMLElement4(iface);
4257 TRACE("(%p)->(%p)\n", This, p);
4259 return get_node_event(&This->node, EVENTID_BEFOREACTIVATE, p);
4262 static HRESULT WINAPI HTMLElement4_put_onfocusin(IHTMLElement4 *iface, VARIANT v)
4264 HTMLElement *This = impl_from_IHTMLElement4(iface);
4266 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4268 return set_node_event(&This->node, EVENTID_FOCUSIN, &v);
4271 static HRESULT WINAPI HTMLElement4_get_onfocusin(IHTMLElement4 *iface, VARIANT *p)
4273 HTMLElement *This = impl_from_IHTMLElement4(iface);
4275 TRACE("(%p)->(%p)\n", This, p);
4277 return get_node_event(&This->node, EVENTID_FOCUSIN, p);
4280 static HRESULT WINAPI HTMLElement4_put_onfocusout(IHTMLElement4 *iface, VARIANT v)
4282 HTMLElement *This = impl_from_IHTMLElement4(iface);
4284 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4286 return set_node_event(&This->node, EVENTID_FOCUSOUT, &v);
4289 static HRESULT WINAPI HTMLElement4_get_onfocusout(IHTMLElement4 *iface, VARIANT *p)
4291 HTMLElement *This = impl_from_IHTMLElement4(iface);
4293 TRACE("(%p)->(%p)\n", This, p);
4295 return get_node_event(&This->node, EVENTID_FOCUSOUT, p);
4298 static const IHTMLElement4Vtbl HTMLElement4Vtbl = {
4299 HTMLElement4_QueryInterface,
4300 HTMLElement4_AddRef,
4301 HTMLElement4_Release,
4302 HTMLElement4_GetTypeInfoCount,
4303 HTMLElement4_GetTypeInfo,
4304 HTMLElement4_GetIDsOfNames,
4305 HTMLElement4_Invoke,
4306 HTMLElement4_put_onmousewheel,
4307 HTMLElement4_get_onmousewheel,
4308 HTMLElement4_normalize,
4309 HTMLElement4_getAttributeNode,
4310 HTMLElement4_setAttributeNode,
4311 HTMLElement4_removeAttributeNode,
4312 HTMLElement4_put_onbeforeactivate,
4313 HTMLElement4_get_onbeforeactivate,
4314 HTMLElement4_put_onfocusin,
4315 HTMLElement4_get_onfocusin,
4316 HTMLElement4_put_onfocusout,
4317 HTMLElement4_get_onfocusout
4320 static inline HTMLElement *impl_from_IHTMLElement6(IHTMLElement6 *iface)
4322 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement6_iface);
4325 static HRESULT WINAPI HTMLElement6_QueryInterface(IHTMLElement6 *iface,
4326 REFIID riid, void **ppv)
4328 HTMLElement *This = impl_from_IHTMLElement6(iface);
4329 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4332 static ULONG WINAPI HTMLElement6_AddRef(IHTMLElement6 *iface)
4334 HTMLElement *This = impl_from_IHTMLElement6(iface);
4335 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4338 static ULONG WINAPI HTMLElement6_Release(IHTMLElement6 *iface)
4340 HTMLElement *This = impl_from_IHTMLElement6(iface);
4341 return IHTMLElement_Release(&This->IHTMLElement_iface);
4344 static HRESULT WINAPI HTMLElement6_GetTypeInfoCount(IHTMLElement6 *iface, UINT *pctinfo)
4346 HTMLElement *This = impl_from_IHTMLElement6(iface);
4347 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4350 static HRESULT WINAPI HTMLElement6_GetTypeInfo(IHTMLElement6 *iface, UINT iTInfo,
4351 LCID lcid, ITypeInfo **ppTInfo)
4353 HTMLElement *This = impl_from_IHTMLElement6(iface);
4354 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4357 static HRESULT WINAPI HTMLElement6_GetIDsOfNames(IHTMLElement6 *iface, REFIID riid,
4358 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4360 HTMLElement *This = impl_from_IHTMLElement6(iface);
4361 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4362 lcid, rgDispId);
4365 static HRESULT WINAPI HTMLElement6_Invoke(IHTMLElement6 *iface, DISPID dispIdMember, REFIID riid,
4366 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4368 HTMLElement *This = impl_from_IHTMLElement6(iface);
4369 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4370 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4373 static HRESULT WINAPI HTMLElement6_getAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *AttributeValue)
4375 HTMLElement *This = impl_from_IHTMLElement6(iface);
4376 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
4377 return E_NOTIMPL;
4380 static HRESULT WINAPI HTMLElement6_setAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4382 HTMLElement *This = impl_from_IHTMLElement6(iface);
4383 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), debugstr_variant(pvarAttributeValue));
4384 return E_NOTIMPL;
4387 static HRESULT WINAPI HTMLElement6_removeAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName)
4389 HTMLElement *This = impl_from_IHTMLElement6(iface);
4390 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName));
4391 return E_NOTIMPL;
4394 static HRESULT WINAPI HTMLElement6_getAttributeNodeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, IHTMLDOMAttribute2 **ppretAttribute)
4396 HTMLElement *This = impl_from_IHTMLElement6(iface);
4397 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), ppretAttribute);
4398 return E_NOTIMPL;
4401 static HRESULT WINAPI HTMLElement6_setAttributeNodeNS(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4403 HTMLElement *This = impl_from_IHTMLElement6(iface);
4404 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4405 return E_NOTIMPL;
4408 static HRESULT WINAPI HTMLElement6_hasAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, VARIANT_BOOL *pfHasAttribute)
4410 HTMLElement *This = impl_from_IHTMLElement6(iface);
4411 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), pfHasAttribute);
4412 return E_NOTIMPL;
4415 static HRESULT WINAPI HTMLElement6_getAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *AttributeValue)
4417 HTMLElement *This = impl_from_IHTMLElement6(iface);
4419 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), AttributeValue);
4421 return IHTMLElement_getAttribute(&This->IHTMLElement_iface, strAttributeName, 0, AttributeValue);
4424 static HRESULT WINAPI HTMLElement6_setAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4426 HTMLElement *This = impl_from_IHTMLElement6(iface);
4428 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), pvarAttributeValue);
4430 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, strAttributeName, *pvarAttributeValue, 0);
4433 static HRESULT WINAPI HTMLElement6_removeAttribute(IHTMLElement6 *iface, BSTR strAttributeName)
4435 HTMLElement *This = impl_from_IHTMLElement6(iface);
4436 VARIANT_BOOL success;
4438 WARN("(%p)->(%s) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName));
4440 return IHTMLElement_removeAttribute(&This->IHTMLElement_iface, strAttributeName, 0, &success);
4443 static HRESULT WINAPI HTMLElement6_getAttributeNode(IHTMLElement6 *iface, BSTR strAttributeName, IHTMLDOMAttribute2 **ppretAttribute)
4445 HTMLElement *This = impl_from_IHTMLElement6(iface);
4446 IHTMLDOMAttribute *attr;
4447 HRESULT hres;
4449 WARN("(%p)->(%s %p) forwarding to IHTMLElement4\n", This, debugstr_w(strAttributeName), ppretAttribute);
4451 hres = IHTMLElement4_getAttributeNode(&This->IHTMLElement4_iface, strAttributeName, &attr);
4452 if(FAILED(hres))
4453 return hres;
4455 if(attr) {
4456 hres = IHTMLDOMAttribute_QueryInterface(attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4457 IHTMLDOMAttribute_Release(attr);
4458 }else {
4459 *ppretAttribute = NULL;
4461 return hres;
4464 static HRESULT WINAPI HTMLElement6_setAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4466 HTMLElement *This = impl_from_IHTMLElement6(iface);
4467 IHTMLDOMAttribute *attr, *ret_attr;
4468 HRESULT hres;
4470 WARN("(%p)->(%p %p) forwarding to IHTMLElement4\n", This, pattr, ppretAttribute);
4472 hres = IHTMLDOMAttribute2_QueryInterface(pattr, &IID_IHTMLDOMAttribute, (void**)&attr);
4473 if(FAILED(hres))
4474 return hres;
4476 hres = IHTMLElement4_setAttributeNode(&This->IHTMLElement4_iface, attr, &ret_attr);
4477 if(FAILED(hres))
4478 return hres;
4480 if(ret_attr) {
4481 hres = IHTMLDOMAttribute_QueryInterface(ret_attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4482 IHTMLDOMAttribute_Release(ret_attr);
4483 }else {
4484 *ppretAttribute = NULL;
4486 return hres;
4489 static HRESULT WINAPI HTMLElement6_removeAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4491 HTMLElement *This = impl_from_IHTMLElement6(iface);
4492 FIXME("(%p)->()\n", This);
4493 return E_NOTIMPL;
4496 static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *p)
4498 HTMLElement *This = impl_from_IHTMLElement6(iface);
4500 TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), p);
4502 *p = element_has_attribute(This, name);
4503 return S_OK;
4506 static HRESULT WINAPI HTMLElement6_getElementsByTagNameNS(IHTMLElement6 *iface, VARIANT *varNS, BSTR bstrLocalName, IHTMLElementCollection **pelColl)
4508 HTMLElement *This = impl_from_IHTMLElement6(iface);
4509 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(varNS), debugstr_w(bstrLocalName), pelColl);
4510 return E_NOTIMPL;
4513 static HRESULT WINAPI HTMLElement6_get_tagName(IHTMLElement6 *iface, BSTR *p)
4515 HTMLElement *This = impl_from_IHTMLElement6(iface);
4517 TRACE("(%p)->(%p)\n", This, p);
4519 return IHTMLElement_get_tagName(&This->IHTMLElement_iface, p);
4522 static HRESULT WINAPI HTMLElement6_get_nodeName(IHTMLElement6 *iface, BSTR *p)
4524 HTMLElement *This = impl_from_IHTMLElement6(iface);
4526 TRACE("(%p)->(%p)\n", This, p);
4528 return IHTMLDOMNode_get_nodeName(&This->node.IHTMLDOMNode_iface, p);
4531 static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, BSTR v, IHTMLElementCollection **pel)
4533 HTMLElement *This = impl_from_IHTMLElement6(iface);
4534 nsIDOMHTMLCollection *nscol = NULL;
4535 nsAString nsstr;
4536 nsresult nsres;
4538 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
4540 if(This->dom_element) {
4541 nsAString_InitDepend(&nsstr, v);
4542 nsres = nsIDOMElement_GetElementsByClassName(This->dom_element, &nsstr, &nscol);
4543 nsAString_Finish(&nsstr);
4544 if(NS_FAILED(nsres)) {
4545 ERR("GetElementsByClassName failed: %08x\n", nsres);
4546 return E_FAIL;
4550 *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
4551 nsIDOMHTMLCollection_Release(nscol);
4552 return S_OK;
4555 static HRESULT WINAPI HTMLElement6_msMatchesSelector(IHTMLElement6 *iface, BSTR v, VARIANT_BOOL *pfMatches)
4557 HTMLElement *This = impl_from_IHTMLElement6(iface);
4558 nsAString nsstr;
4559 cpp_bool b;
4560 nsresult nsres;
4562 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pfMatches);
4564 if(!This->dom_element) {
4565 FIXME("No dom element\n");
4566 return E_UNEXPECTED;
4569 nsAString_InitDepend(&nsstr, v);
4570 nsres = nsIDOMElement_MozMatchesSelector(This->dom_element, &nsstr, &b);
4571 nsAString_Finish(&nsstr);
4572 if(NS_FAILED(nsres)) {
4573 WARN("MozMatchesSelector failed: %08x\n", nsres);
4574 return map_nsresult(nsres);
4577 *pfMatches = b;
4578 return S_OK;
4581 static HRESULT WINAPI HTMLElement6_put_onabort(IHTMLElement6 *iface, VARIANT v)
4583 HTMLElement *This = impl_from_IHTMLElement6(iface);
4585 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4587 return set_node_event(&This->node, EVENTID_ABORT, &v);
4590 static HRESULT WINAPI HTMLElement6_get_onabort(IHTMLElement6 *iface, VARIANT *p)
4592 HTMLElement *This = impl_from_IHTMLElement6(iface);
4594 TRACE("(%p)->(%p)\n", This, p);
4596 return get_node_event(&This->node, EVENTID_ABORT, p);
4599 static HRESULT WINAPI HTMLElement6_put_oncanplay(IHTMLElement6 *iface, VARIANT v)
4601 HTMLElement *This = impl_from_IHTMLElement6(iface);
4602 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4603 return E_NOTIMPL;
4606 static HRESULT WINAPI HTMLElement6_get_oncanplay(IHTMLElement6 *iface, VARIANT *p)
4608 HTMLElement *This = impl_from_IHTMLElement6(iface);
4609 FIXME("(%p)->(%p)\n", This, p);
4610 return E_NOTIMPL;
4613 static HRESULT WINAPI HTMLElement6_put_oncanplaythrough(IHTMLElement6 *iface, VARIANT v)
4615 HTMLElement *This = impl_from_IHTMLElement6(iface);
4616 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4617 return E_NOTIMPL;
4620 static HRESULT WINAPI HTMLElement6_get_oncanplaythrough(IHTMLElement6 *iface, VARIANT *p)
4622 HTMLElement *This = impl_from_IHTMLElement6(iface);
4623 FIXME("(%p)->(%p)\n", This, p);
4624 return E_NOTIMPL;
4627 static HRESULT WINAPI HTMLElement6_put_onchange(IHTMLElement6 *iface, VARIANT v)
4629 HTMLElement *This = impl_from_IHTMLElement6(iface);
4631 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4633 return set_node_event(&This->node, EVENTID_CHANGE, &v);
4636 static HRESULT WINAPI HTMLElement6_get_onchange(IHTMLElement6 *iface, VARIANT *p)
4638 HTMLElement *This = impl_from_IHTMLElement6(iface);
4640 TRACE("(%p)->(%p)\n", This, p);
4642 return get_node_event(&This->node, EVENTID_CHANGE, p);
4645 static HRESULT WINAPI HTMLElement6_put_ondurationchange(IHTMLElement6 *iface, VARIANT v)
4647 HTMLElement *This = impl_from_IHTMLElement6(iface);
4648 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4649 return E_NOTIMPL;
4652 static HRESULT WINAPI HTMLElement6_get_ondurationchange(IHTMLElement6 *iface, VARIANT *p)
4654 HTMLElement *This = impl_from_IHTMLElement6(iface);
4655 FIXME("(%p)->(%p)\n", This, p);
4656 return E_NOTIMPL;
4659 static HRESULT WINAPI HTMLElement6_put_onemptied(IHTMLElement6 *iface, VARIANT v)
4661 HTMLElement *This = impl_from_IHTMLElement6(iface);
4662 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4663 return E_NOTIMPL;
4666 static HRESULT WINAPI HTMLElement6_get_onemptied(IHTMLElement6 *iface, VARIANT *p)
4668 HTMLElement *This = impl_from_IHTMLElement6(iface);
4669 FIXME("(%p)->(%p)\n", This, p);
4670 return E_NOTIMPL;
4673 static HRESULT WINAPI HTMLElement6_put_onended(IHTMLElement6 *iface, VARIANT v)
4675 HTMLElement *This = impl_from_IHTMLElement6(iface);
4676 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4677 return E_NOTIMPL;
4680 static HRESULT WINAPI HTMLElement6_get_onended(IHTMLElement6 *iface, VARIANT *p)
4682 HTMLElement *This = impl_from_IHTMLElement6(iface);
4683 FIXME("(%p)->(%p)\n", This, p);
4684 return E_NOTIMPL;
4687 static HRESULT WINAPI HTMLElement6_put_onerror(IHTMLElement6 *iface, VARIANT v)
4689 HTMLElement *This = impl_from_IHTMLElement6(iface);
4691 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4693 return set_node_event(&This->node, EVENTID_ERROR, &v);
4696 static HRESULT WINAPI HTMLElement6_get_onerror(IHTMLElement6 *iface, VARIANT *p)
4698 HTMLElement *This = impl_from_IHTMLElement6(iface);
4700 TRACE("(%p)->(%p)\n", This, p);
4702 return get_node_event(&This->node, EVENTID_ERROR, p);
4705 static HRESULT WINAPI HTMLElement6_put_oninput(IHTMLElement6 *iface, VARIANT v)
4707 HTMLElement *This = impl_from_IHTMLElement6(iface);
4709 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4711 return set_node_event(&This->node, EVENTID_INPUT, &v);
4714 static HRESULT WINAPI HTMLElement6_get_oninput(IHTMLElement6 *iface, VARIANT *p)
4716 HTMLElement *This = impl_from_IHTMLElement6(iface);
4718 TRACE("(%p)->(%p)\n", This, p);
4720 return get_node_event(&This->node, EVENTID_INPUT, p);
4723 static HRESULT WINAPI HTMLElement6_put_onload(IHTMLElement6 *iface, VARIANT v)
4725 HTMLElement *This = impl_from_IHTMLElement6(iface);
4727 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4729 return set_node_event(&This->node, EVENTID_LOAD, &v);
4732 static HRESULT WINAPI HTMLElement6_get_onload(IHTMLElement6 *iface, VARIANT *p)
4734 HTMLElement *This = impl_from_IHTMLElement6(iface);
4736 TRACE("(%p)->(%p)\n", This, p);
4738 return get_node_event(&This->node, EVENTID_LOAD, p);
4741 static HRESULT WINAPI HTMLElement6_put_onloadeddata(IHTMLElement6 *iface, VARIANT v)
4743 HTMLElement *This = impl_from_IHTMLElement6(iface);
4744 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4745 return E_NOTIMPL;
4748 static HRESULT WINAPI HTMLElement6_get_onloadeddata(IHTMLElement6 *iface, VARIANT *p)
4750 HTMLElement *This = impl_from_IHTMLElement6(iface);
4751 FIXME("(%p)->(%p)\n", This, p);
4752 return E_NOTIMPL;
4755 static HRESULT WINAPI HTMLElement6_put_onloadedmetadata(IHTMLElement6 *iface, VARIANT v)
4757 HTMLElement *This = impl_from_IHTMLElement6(iface);
4758 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4759 return E_NOTIMPL;
4762 static HRESULT WINAPI HTMLElement6_get_onloadedmetadata(IHTMLElement6 *iface, VARIANT *p)
4764 HTMLElement *This = impl_from_IHTMLElement6(iface);
4765 FIXME("(%p)->(%p)\n", This, p);
4766 return E_NOTIMPL;
4769 static HRESULT WINAPI HTMLElement6_put_onloadstart(IHTMLElement6 *iface, VARIANT v)
4771 HTMLElement *This = impl_from_IHTMLElement6(iface);
4772 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4773 return E_NOTIMPL;
4776 static HRESULT WINAPI HTMLElement6_get_onloadstart(IHTMLElement6 *iface, VARIANT *p)
4778 HTMLElement *This = impl_from_IHTMLElement6(iface);
4779 FIXME("(%p)->(%p)\n", This, p);
4780 return E_NOTIMPL;
4783 static HRESULT WINAPI HTMLElement6_put_onpause(IHTMLElement6 *iface, VARIANT v)
4785 HTMLElement *This = impl_from_IHTMLElement6(iface);
4786 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4787 return E_NOTIMPL;
4790 static HRESULT WINAPI HTMLElement6_get_onpause(IHTMLElement6 *iface, VARIANT *p)
4792 HTMLElement *This = impl_from_IHTMLElement6(iface);
4793 FIXME("(%p)->(%p)\n", This, p);
4794 return E_NOTIMPL;
4797 static HRESULT WINAPI HTMLElement6_put_onplay(IHTMLElement6 *iface, VARIANT v)
4799 HTMLElement *This = impl_from_IHTMLElement6(iface);
4800 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4801 return E_NOTIMPL;
4804 static HRESULT WINAPI HTMLElement6_get_onplay(IHTMLElement6 *iface, VARIANT *p)
4806 HTMLElement *This = impl_from_IHTMLElement6(iface);
4807 FIXME("(%p)->(%p)\n", This, p);
4808 return E_NOTIMPL;
4811 static HRESULT WINAPI HTMLElement6_put_onplaying(IHTMLElement6 *iface, VARIANT v)
4813 HTMLElement *This = impl_from_IHTMLElement6(iface);
4814 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4815 return E_NOTIMPL;
4818 static HRESULT WINAPI HTMLElement6_get_onplaying(IHTMLElement6 *iface, VARIANT *p)
4820 HTMLElement *This = impl_from_IHTMLElement6(iface);
4821 FIXME("(%p)->(%p)\n", This, p);
4822 return E_NOTIMPL;
4825 static HRESULT WINAPI HTMLElement6_put_onprogress(IHTMLElement6 *iface, VARIANT v)
4827 HTMLElement *This = impl_from_IHTMLElement6(iface);
4828 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4829 return E_NOTIMPL;
4832 static HRESULT WINAPI HTMLElement6_get_onprogress(IHTMLElement6 *iface, VARIANT *p)
4834 HTMLElement *This = impl_from_IHTMLElement6(iface);
4835 FIXME("(%p)->(%p)\n", This, p);
4836 return E_NOTIMPL;
4839 static HRESULT WINAPI HTMLElement6_put_onratechange(IHTMLElement6 *iface, VARIANT v)
4841 HTMLElement *This = impl_from_IHTMLElement6(iface);
4842 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4843 return E_NOTIMPL;
4846 static HRESULT WINAPI HTMLElement6_get_onratechange(IHTMLElement6 *iface, VARIANT *p)
4848 HTMLElement *This = impl_from_IHTMLElement6(iface);
4849 FIXME("(%p)->(%p)\n", This, p);
4850 return E_NOTIMPL;
4853 static HRESULT WINAPI HTMLElement6_put_onreset(IHTMLElement6 *iface, VARIANT v)
4855 HTMLElement *This = impl_from_IHTMLElement6(iface);
4856 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4857 return E_NOTIMPL;
4860 static HRESULT WINAPI HTMLElement6_get_onreset(IHTMLElement6 *iface, VARIANT *p)
4862 HTMLElement *This = impl_from_IHTMLElement6(iface);
4863 FIXME("(%p)->(%p)\n", This, p);
4864 return E_NOTIMPL;
4867 static HRESULT WINAPI HTMLElement6_put_onseeked(IHTMLElement6 *iface, VARIANT v)
4869 HTMLElement *This = impl_from_IHTMLElement6(iface);
4870 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4871 return E_NOTIMPL;
4874 static HRESULT WINAPI HTMLElement6_get_onseeked(IHTMLElement6 *iface, VARIANT *p)
4876 HTMLElement *This = impl_from_IHTMLElement6(iface);
4877 FIXME("(%p)->(%p)\n", This, p);
4878 return E_NOTIMPL;
4881 static HRESULT WINAPI HTMLElement6_put_onseeking(IHTMLElement6 *iface, VARIANT v)
4883 HTMLElement *This = impl_from_IHTMLElement6(iface);
4884 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4885 return E_NOTIMPL;
4888 static HRESULT WINAPI HTMLElement6_get_onseeking(IHTMLElement6 *iface, VARIANT *p)
4890 HTMLElement *This = impl_from_IHTMLElement6(iface);
4891 FIXME("(%p)->(%p)\n", This, p);
4892 return E_NOTIMPL;
4895 static HRESULT WINAPI HTMLElement6_put_onselect(IHTMLElement6 *iface, VARIANT v)
4897 HTMLElement *This = impl_from_IHTMLElement6(iface);
4898 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4899 return E_NOTIMPL;
4902 static HRESULT WINAPI HTMLElement6_get_onselect(IHTMLElement6 *iface, VARIANT *p)
4904 HTMLElement *This = impl_from_IHTMLElement6(iface);
4905 FIXME("(%p)->(%p)\n", This, p);
4906 return E_NOTIMPL;
4909 static HRESULT WINAPI HTMLElement6_put_onstalled(IHTMLElement6 *iface, VARIANT v)
4911 HTMLElement *This = impl_from_IHTMLElement6(iface);
4912 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4913 return E_NOTIMPL;
4916 static HRESULT WINAPI HTMLElement6_get_onstalled(IHTMLElement6 *iface, VARIANT *p)
4918 HTMLElement *This = impl_from_IHTMLElement6(iface);
4919 FIXME("(%p)->(%p)\n", This, p);
4920 return E_NOTIMPL;
4923 static HRESULT WINAPI HTMLElement6_put_onsubmit(IHTMLElement6 *iface, VARIANT v)
4925 HTMLElement *This = impl_from_IHTMLElement6(iface);
4927 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4929 return set_node_event(&This->node, EVENTID_SUBMIT, &v);
4932 static HRESULT WINAPI HTMLElement6_get_onsubmit(IHTMLElement6 *iface, VARIANT *p)
4934 HTMLElement *This = impl_from_IHTMLElement6(iface);
4936 TRACE("(%p)->(%p)\n", This, p);
4938 return get_node_event(&This->node, EVENTID_SUBMIT, p);
4941 static HRESULT WINAPI HTMLElement6_put_onsuspend(IHTMLElement6 *iface, VARIANT v)
4943 HTMLElement *This = impl_from_IHTMLElement6(iface);
4944 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4945 return E_NOTIMPL;
4948 static HRESULT WINAPI HTMLElement6_get_onsuspend(IHTMLElement6 *iface, VARIANT *p)
4950 HTMLElement *This = impl_from_IHTMLElement6(iface);
4951 FIXME("(%p)->(%p)\n", This, p);
4952 return E_NOTIMPL;
4955 static HRESULT WINAPI HTMLElement6_put_ontimeupdate(IHTMLElement6 *iface, VARIANT v)
4957 HTMLElement *This = impl_from_IHTMLElement6(iface);
4958 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4959 return E_NOTIMPL;
4962 static HRESULT WINAPI HTMLElement6_get_ontimeupdate(IHTMLElement6 *iface, VARIANT *p)
4964 HTMLElement *This = impl_from_IHTMLElement6(iface);
4965 FIXME("(%p)->(%p)\n", This, p);
4966 return E_NOTIMPL;
4969 static HRESULT WINAPI HTMLElement6_put_onvolumechange(IHTMLElement6 *iface, VARIANT v)
4971 HTMLElement *This = impl_from_IHTMLElement6(iface);
4972 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4973 return E_NOTIMPL;
4976 static HRESULT WINAPI HTMLElement6_get_onvolumechange(IHTMLElement6 *iface, VARIANT *p)
4978 HTMLElement *This = impl_from_IHTMLElement6(iface);
4979 FIXME("(%p)->(%p)\n", This, p);
4980 return E_NOTIMPL;
4983 static HRESULT WINAPI HTMLElement6_put_onwaiting(IHTMLElement6 *iface, VARIANT v)
4985 HTMLElement *This = impl_from_IHTMLElement6(iface);
4986 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4987 return E_NOTIMPL;
4990 static HRESULT WINAPI HTMLElement6_get_onwaiting(IHTMLElement6 *iface, VARIANT *p)
4992 HTMLElement *This = impl_from_IHTMLElement6(iface);
4993 FIXME("(%p)->(%p)\n", This, p);
4994 return E_NOTIMPL;
4997 static HRESULT WINAPI HTMLElement6_hasAttributes(IHTMLElement6 *iface, VARIANT_BOOL *pfHasAttributes)
4999 HTMLElement *This = impl_from_IHTMLElement6(iface);
5000 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
5001 return E_NOTIMPL;
5004 static const IHTMLElement6Vtbl HTMLElement6Vtbl = {
5005 HTMLElement6_QueryInterface,
5006 HTMLElement6_AddRef,
5007 HTMLElement6_Release,
5008 HTMLElement6_GetTypeInfoCount,
5009 HTMLElement6_GetTypeInfo,
5010 HTMLElement6_GetIDsOfNames,
5011 HTMLElement6_Invoke,
5012 HTMLElement6_getAttributeNS,
5013 HTMLElement6_setAttributeNS,
5014 HTMLElement6_removeAttributeNS,
5015 HTMLElement6_getAttributeNodeNS,
5016 HTMLElement6_setAttributeNodeNS,
5017 HTMLElement6_hasAttributeNS,
5018 HTMLElement6_getAttribute,
5019 HTMLElement6_setAttribute,
5020 HTMLElement6_removeAttribute,
5021 HTMLElement6_getAttributeNode,
5022 HTMLElement6_setAttributeNode,
5023 HTMLElement6_removeAttributeNode,
5024 HTMLElement6_hasAttribute,
5025 HTMLElement6_getElementsByTagNameNS,
5026 HTMLElement6_get_tagName,
5027 HTMLElement6_get_nodeName,
5028 HTMLElement6_getElementsByClassName,
5029 HTMLElement6_msMatchesSelector,
5030 HTMLElement6_put_onabort,
5031 HTMLElement6_get_onabort,
5032 HTMLElement6_put_oncanplay,
5033 HTMLElement6_get_oncanplay,
5034 HTMLElement6_put_oncanplaythrough,
5035 HTMLElement6_get_oncanplaythrough,
5036 HTMLElement6_put_onchange,
5037 HTMLElement6_get_onchange,
5038 HTMLElement6_put_ondurationchange,
5039 HTMLElement6_get_ondurationchange,
5040 HTMLElement6_put_onemptied,
5041 HTMLElement6_get_onemptied,
5042 HTMLElement6_put_onended,
5043 HTMLElement6_get_onended,
5044 HTMLElement6_put_onerror,
5045 HTMLElement6_get_onerror,
5046 HTMLElement6_put_oninput,
5047 HTMLElement6_get_oninput,
5048 HTMLElement6_put_onload,
5049 HTMLElement6_get_onload,
5050 HTMLElement6_put_onloadeddata,
5051 HTMLElement6_get_onloadeddata,
5052 HTMLElement6_put_onloadedmetadata,
5053 HTMLElement6_get_onloadedmetadata,
5054 HTMLElement6_put_onloadstart,
5055 HTMLElement6_get_onloadstart,
5056 HTMLElement6_put_onpause,
5057 HTMLElement6_get_onpause,
5058 HTMLElement6_put_onplay,
5059 HTMLElement6_get_onplay,
5060 HTMLElement6_put_onplaying,
5061 HTMLElement6_get_onplaying,
5062 HTMLElement6_put_onprogress,
5063 HTMLElement6_get_onprogress,
5064 HTMLElement6_put_onratechange,
5065 HTMLElement6_get_onratechange,
5066 HTMLElement6_put_onreset,
5067 HTMLElement6_get_onreset,
5068 HTMLElement6_put_onseeked,
5069 HTMLElement6_get_onseeked,
5070 HTMLElement6_put_onseeking,
5071 HTMLElement6_get_onseeking,
5072 HTMLElement6_put_onselect,
5073 HTMLElement6_get_onselect,
5074 HTMLElement6_put_onstalled,
5075 HTMLElement6_get_onstalled,
5076 HTMLElement6_put_onsubmit,
5077 HTMLElement6_get_onsubmit,
5078 HTMLElement6_put_onsuspend,
5079 HTMLElement6_get_onsuspend,
5080 HTMLElement6_put_ontimeupdate,
5081 HTMLElement6_get_ontimeupdate,
5082 HTMLElement6_put_onvolumechange,
5083 HTMLElement6_get_onvolumechange,
5084 HTMLElement6_put_onwaiting,
5085 HTMLElement6_get_onwaiting,
5086 HTMLElement6_hasAttributes
5089 static inline HTMLElement *impl_from_IHTMLElement7(IHTMLElement7 *iface)
5091 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement7_iface);
5094 static HRESULT WINAPI HTMLElement7_QueryInterface(IHTMLElement7 *iface,
5095 REFIID riid, void **ppv)
5097 HTMLElement *This = impl_from_IHTMLElement7(iface);
5098 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5101 static ULONG WINAPI HTMLElement7_AddRef(IHTMLElement7 *iface)
5103 HTMLElement *This = impl_from_IHTMLElement7(iface);
5104 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5107 static ULONG WINAPI HTMLElement7_Release(IHTMLElement7 *iface)
5109 HTMLElement *This = impl_from_IHTMLElement7(iface);
5110 return IHTMLElement_Release(&This->IHTMLElement_iface);
5113 static HRESULT WINAPI HTMLElement7_GetTypeInfoCount(IHTMLElement7 *iface, UINT *pctinfo)
5115 HTMLElement *This = impl_from_IHTMLElement7(iface);
5116 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5119 static HRESULT WINAPI HTMLElement7_GetTypeInfo(IHTMLElement7 *iface, UINT iTInfo,
5120 LCID lcid, ITypeInfo **ppTInfo)
5122 HTMLElement *This = impl_from_IHTMLElement7(iface);
5123 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5126 static HRESULT WINAPI HTMLElement7_GetIDsOfNames(IHTMLElement7 *iface, REFIID riid,
5127 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5129 HTMLElement *This = impl_from_IHTMLElement7(iface);
5130 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5131 lcid, rgDispId);
5134 static HRESULT WINAPI HTMLElement7_Invoke(IHTMLElement7 *iface, DISPID dispIdMember, REFIID riid,
5135 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5137 HTMLElement *This = impl_from_IHTMLElement7(iface);
5138 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5139 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5142 static HRESULT WINAPI HTMLElement7_put_onmspointerdown(IHTMLElement7 *iface, VARIANT v)
5144 HTMLElement *This = impl_from_IHTMLElement7(iface);
5145 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5146 return E_NOTIMPL;
5149 static HRESULT WINAPI HTMLElement7_get_onmspointerdown(IHTMLElement7 *iface, VARIANT *p)
5151 HTMLElement *This = impl_from_IHTMLElement7(iface);
5152 FIXME("(%p)->(%p)\n", This, p);
5153 return E_NOTIMPL;
5156 static HRESULT WINAPI HTMLElement7_put_onmspointermove(IHTMLElement7 *iface, VARIANT v)
5158 HTMLElement *This = impl_from_IHTMLElement7(iface);
5159 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5160 return E_NOTIMPL;
5163 static HRESULT WINAPI HTMLElement7_get_onmspointermove(IHTMLElement7 *iface, VARIANT *p)
5165 HTMLElement *This = impl_from_IHTMLElement7(iface);
5166 FIXME("(%p)->(%p)\n", This, p);
5167 return E_NOTIMPL;
5170 static HRESULT WINAPI HTMLElement7_put_onmspointerup(IHTMLElement7 *iface, VARIANT v)
5172 HTMLElement *This = impl_from_IHTMLElement7(iface);
5173 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5174 return E_NOTIMPL;
5177 static HRESULT WINAPI HTMLElement7_get_onmspointerup(IHTMLElement7 *iface, VARIANT *p)
5179 HTMLElement *This = impl_from_IHTMLElement7(iface);
5180 FIXME("(%p)->(%p)\n", This, p);
5181 return E_NOTIMPL;
5184 static HRESULT WINAPI HTMLElement7_put_onmspointerover(IHTMLElement7 *iface, VARIANT v)
5186 HTMLElement *This = impl_from_IHTMLElement7(iface);
5187 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5188 return E_NOTIMPL;
5191 static HRESULT WINAPI HTMLElement7_get_onmspointerover(IHTMLElement7 *iface, VARIANT *p)
5193 HTMLElement *This = impl_from_IHTMLElement7(iface);
5194 FIXME("(%p)->(%p)\n", This, p);
5195 return E_NOTIMPL;
5198 static HRESULT WINAPI HTMLElement7_put_onmspointerout(IHTMLElement7 *iface, VARIANT v)
5200 HTMLElement *This = impl_from_IHTMLElement7(iface);
5201 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5202 return E_NOTIMPL;
5205 static HRESULT WINAPI HTMLElement7_get_onmspointerout(IHTMLElement7 *iface, VARIANT *p)
5207 HTMLElement *This = impl_from_IHTMLElement7(iface);
5208 FIXME("(%p)->(%p)\n", This, p);
5209 return E_NOTIMPL;
5212 static HRESULT WINAPI HTMLElement7_put_onmspointercancel(IHTMLElement7 *iface, VARIANT v)
5214 HTMLElement *This = impl_from_IHTMLElement7(iface);
5215 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5216 return E_NOTIMPL;
5219 static HRESULT WINAPI HTMLElement7_get_onmspointercancel(IHTMLElement7 *iface, VARIANT *p)
5221 HTMLElement *This = impl_from_IHTMLElement7(iface);
5222 FIXME("(%p)->(%p)\n", This, p);
5223 return E_NOTIMPL;
5226 static HRESULT WINAPI HTMLElement7_put_onmspointerhover(IHTMLElement7 *iface, VARIANT v)
5228 HTMLElement *This = impl_from_IHTMLElement7(iface);
5229 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5230 return E_NOTIMPL;
5233 static HRESULT WINAPI HTMLElement7_get_onmspointerhover(IHTMLElement7 *iface, VARIANT *p)
5235 HTMLElement *This = impl_from_IHTMLElement7(iface);
5236 FIXME("(%p)->(%p)\n", This, p);
5237 return E_NOTIMPL;
5240 static HRESULT WINAPI HTMLElement7_put_onmslostpointercapture(IHTMLElement7 *iface, VARIANT v)
5242 HTMLElement *This = impl_from_IHTMLElement7(iface);
5243 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5244 return E_NOTIMPL;
5247 static HRESULT WINAPI HTMLElement7_get_onmslostpointercapture(IHTMLElement7 *iface, VARIANT *p)
5249 HTMLElement *This = impl_from_IHTMLElement7(iface);
5250 FIXME("(%p)->(%p)\n", This, p);
5251 return E_NOTIMPL;
5254 static HRESULT WINAPI HTMLElement7_put_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT v)
5256 HTMLElement *This = impl_from_IHTMLElement7(iface);
5257 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5258 return E_NOTIMPL;
5261 static HRESULT WINAPI HTMLElement7_get_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT *p)
5263 HTMLElement *This = impl_from_IHTMLElement7(iface);
5264 FIXME("(%p)->(%p)\n", This, p);
5265 return E_NOTIMPL;
5268 static HRESULT WINAPI HTMLElement7_put_onmsgesturestart(IHTMLElement7 *iface, VARIANT v)
5270 HTMLElement *This = impl_from_IHTMLElement7(iface);
5271 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5272 return E_NOTIMPL;
5275 static HRESULT WINAPI HTMLElement7_get_onmsgesturestart(IHTMLElement7 *iface, VARIANT *p)
5277 HTMLElement *This = impl_from_IHTMLElement7(iface);
5278 FIXME("(%p)->(%p)\n", This, p);
5279 return E_NOTIMPL;
5282 static HRESULT WINAPI HTMLElement7_put_onmsgesturechange(IHTMLElement7 *iface, VARIANT v)
5284 HTMLElement *This = impl_from_IHTMLElement7(iface);
5285 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5286 return E_NOTIMPL;
5289 static HRESULT WINAPI HTMLElement7_get_onmsgesturechange(IHTMLElement7 *iface, VARIANT *p)
5291 HTMLElement *This = impl_from_IHTMLElement7(iface);
5292 FIXME("(%p)->(%p)\n", This, p);
5293 return E_NOTIMPL;
5296 static HRESULT WINAPI HTMLElement7_put_onmsgestureend(IHTMLElement7 *iface, VARIANT v)
5298 HTMLElement *This = impl_from_IHTMLElement7(iface);
5299 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5300 return E_NOTIMPL;
5303 static HRESULT WINAPI HTMLElement7_get_onmsgestureend(IHTMLElement7 *iface, VARIANT *p)
5305 HTMLElement *This = impl_from_IHTMLElement7(iface);
5306 FIXME("(%p)->(%p)\n", This, p);
5307 return E_NOTIMPL;
5310 static HRESULT WINAPI HTMLElement7_put_onmsgesturehold(IHTMLElement7 *iface, VARIANT v)
5312 HTMLElement *This = impl_from_IHTMLElement7(iface);
5313 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5314 return E_NOTIMPL;
5317 static HRESULT WINAPI HTMLElement7_get_onmsgesturehold(IHTMLElement7 *iface, VARIANT *p)
5319 HTMLElement *This = impl_from_IHTMLElement7(iface);
5320 FIXME("(%p)->(%p)\n", This, p);
5321 return E_NOTIMPL;
5324 static HRESULT WINAPI HTMLElement7_put_onmsgesturetap(IHTMLElement7 *iface, VARIANT v)
5326 HTMLElement *This = impl_from_IHTMLElement7(iface);
5327 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5328 return E_NOTIMPL;
5331 static HRESULT WINAPI HTMLElement7_get_onmsgesturetap(IHTMLElement7 *iface, VARIANT *p)
5333 HTMLElement *This = impl_from_IHTMLElement7(iface);
5334 FIXME("(%p)->(%p)\n", This, p);
5335 return E_NOTIMPL;
5338 static HRESULT WINAPI HTMLElement7_put_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT v)
5340 HTMLElement *This = impl_from_IHTMLElement7(iface);
5341 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5342 return E_NOTIMPL;
5345 static HRESULT WINAPI HTMLElement7_get_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT *p)
5347 HTMLElement *This = impl_from_IHTMLElement7(iface);
5348 FIXME("(%p)->(%p)\n", This, p);
5349 return E_NOTIMPL;
5352 static HRESULT WINAPI HTMLElement7_put_onmsinertiastart(IHTMLElement7 *iface, VARIANT v)
5354 HTMLElement *This = impl_from_IHTMLElement7(iface);
5355 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5356 return E_NOTIMPL;
5359 static HRESULT WINAPI HTMLElement7_get_onmsinertiastart(IHTMLElement7 *iface, VARIANT *p)
5361 HTMLElement *This = impl_from_IHTMLElement7(iface);
5362 FIXME("(%p)->(%p)\n", This, p);
5363 return E_NOTIMPL;
5366 static HRESULT WINAPI HTMLElement7_msSetPointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5368 HTMLElement *This = impl_from_IHTMLElement7(iface);
5369 FIXME("(%p)->(%d)\n", This, pointer_id);
5370 return E_NOTIMPL;
5373 static HRESULT WINAPI HTMLElement7_msReleasePointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5375 HTMLElement *This = impl_from_IHTMLElement7(iface);
5376 FIXME("(%p)->(%d)\n", This, pointer_id);
5377 return E_NOTIMPL;
5380 static HRESULT WINAPI HTMLElement7_put_onmstransitionstart(IHTMLElement7 *iface, VARIANT v)
5382 HTMLElement *This = impl_from_IHTMLElement7(iface);
5383 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5384 return E_NOTIMPL;
5387 static HRESULT WINAPI HTMLElement7_get_onmstransitionstart(IHTMLElement7 *iface, VARIANT *p)
5389 HTMLElement *This = impl_from_IHTMLElement7(iface);
5390 FIXME("(%p)->(%p)\n", This, p);
5391 return E_NOTIMPL;
5394 static HRESULT WINAPI HTMLElement7_put_onmstransitionend(IHTMLElement7 *iface, VARIANT v)
5396 HTMLElement *This = impl_from_IHTMLElement7(iface);
5397 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5398 return E_NOTIMPL;
5401 static HRESULT WINAPI HTMLElement7_get_onmstransitionend(IHTMLElement7 *iface, VARIANT *p)
5403 HTMLElement *This = impl_from_IHTMLElement7(iface);
5404 FIXME("(%p)->(%p)\n", This, p);
5405 return E_NOTIMPL;
5408 static HRESULT WINAPI HTMLElement7_put_onmsanimationstart(IHTMLElement7 *iface, VARIANT v)
5410 HTMLElement *This = impl_from_IHTMLElement7(iface);
5411 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5412 return E_NOTIMPL;
5415 static HRESULT WINAPI HTMLElement7_get_onmsanimationstart(IHTMLElement7 *iface, VARIANT *p)
5417 HTMLElement *This = impl_from_IHTMLElement7(iface);
5418 FIXME("(%p)->(%p)\n", This, p);
5419 return E_NOTIMPL;
5422 static HRESULT WINAPI HTMLElement7_put_onmsanimationend(IHTMLElement7 *iface, VARIANT v)
5424 HTMLElement *This = impl_from_IHTMLElement7(iface);
5425 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5426 return E_NOTIMPL;
5429 static HRESULT WINAPI HTMLElement7_get_onmsanimationend(IHTMLElement7 *iface, VARIANT *p)
5431 HTMLElement *This = impl_from_IHTMLElement7(iface);
5432 FIXME("(%p)->(%p)\n", This, p);
5433 return E_NOTIMPL;
5436 static HRESULT WINAPI HTMLElement7_put_onmsanimationiteration(IHTMLElement7 *iface, VARIANT v)
5438 HTMLElement *This = impl_from_IHTMLElement7(iface);
5439 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5440 return E_NOTIMPL;
5443 static HRESULT WINAPI HTMLElement7_get_onmsanimationiteration(IHTMLElement7 *iface, VARIANT *p)
5445 HTMLElement *This = impl_from_IHTMLElement7(iface);
5446 FIXME("(%p)->(%p)\n", This, p);
5447 return E_NOTIMPL;
5450 static HRESULT WINAPI HTMLElement7_put_oninvalid(IHTMLElement7 *iface, VARIANT v)
5452 HTMLElement *This = impl_from_IHTMLElement7(iface);
5453 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5454 return E_NOTIMPL;
5457 static HRESULT WINAPI HTMLElement7_get_oninvalid(IHTMLElement7 *iface, VARIANT *p)
5459 HTMLElement *This = impl_from_IHTMLElement7(iface);
5460 FIXME("(%p)->(%p)\n", This, p);
5461 return E_NOTIMPL;
5464 static HRESULT WINAPI HTMLElement7_put_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR v)
5466 HTMLElement *This = impl_from_IHTMLElement7(iface);
5467 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
5468 return E_NOTIMPL;
5471 static HRESULT WINAPI HTMLElement7_get_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR *p)
5473 HTMLElement *This = impl_from_IHTMLElement7(iface);
5474 FIXME("(%p)->(%p)\n", This, p);
5475 return E_NOTIMPL;
5478 static HRESULT WINAPI HTMLElement7_put_spellcheck(IHTMLElement7 *iface, VARIANT v)
5480 HTMLElement *This = impl_from_IHTMLElement7(iface);
5482 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5484 if(!This->html_element) {
5485 FIXME("non-HTML element\n");
5486 return E_NOTIMPL;
5489 if(V_VT(&v) != VT_BOOL) {
5490 FIXME("unsupported argument %s\n", debugstr_variant(&v));
5491 return E_NOTIMPL;
5494 return map_nsresult(nsIDOMHTMLElement_SetSpellcheck(This->html_element, !!V_BOOL(&v)));
5497 static HRESULT WINAPI HTMLElement7_get_spellcheck(IHTMLElement7 *iface, VARIANT *p)
5499 HTMLElement *This = impl_from_IHTMLElement7(iface);
5500 cpp_bool spellcheck;
5501 nsresult nsres;
5503 TRACE("(%p)->(%p)\n", This, p);
5505 if(!This->html_element) {
5506 FIXME("non-HTML element\n");
5507 return E_NOTIMPL;
5510 nsres = nsIDOMHTMLElement_GetSpellcheck(This->html_element, &spellcheck);
5511 if(NS_FAILED(nsres))
5512 return map_nsresult(nsres);
5514 V_VT(p) = VT_BOOL;
5515 V_BOOL(p) = spellcheck ? VARIANT_TRUE : VARIANT_FALSE;
5516 return S_OK;
5519 static HRESULT WINAPI HTMLElement7_put_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT v)
5521 HTMLElement *This = impl_from_IHTMLElement7(iface);
5522 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5523 return E_NOTIMPL;
5526 static HRESULT WINAPI HTMLElement7_get_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT *p)
5528 HTMLElement *This = impl_from_IHTMLElement7(iface);
5529 FIXME("(%p)->(%p)\n", This, p);
5530 return E_NOTIMPL;
5533 static HRESULT WINAPI HTMLElement7_put_oncuechange(IHTMLElement7 *iface, VARIANT v)
5535 HTMLElement *This = impl_from_IHTMLElement7(iface);
5536 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5537 return E_NOTIMPL;
5540 static HRESULT WINAPI HTMLElement7_get_oncuechange(IHTMLElement7 *iface, VARIANT *p)
5542 HTMLElement *This = impl_from_IHTMLElement7(iface);
5543 FIXME("(%p)->(%p)\n", This, p);
5544 return E_NOTIMPL;
5547 static const IHTMLElement7Vtbl HTMLElement7Vtbl = {
5548 HTMLElement7_QueryInterface,
5549 HTMLElement7_AddRef,
5550 HTMLElement7_Release,
5551 HTMLElement7_GetTypeInfoCount,
5552 HTMLElement7_GetTypeInfo,
5553 HTMLElement7_GetIDsOfNames,
5554 HTMLElement7_Invoke,
5555 HTMLElement7_put_onmspointerdown,
5556 HTMLElement7_get_onmspointerdown,
5557 HTMLElement7_put_onmspointermove,
5558 HTMLElement7_get_onmspointermove,
5559 HTMLElement7_put_onmspointerup,
5560 HTMLElement7_get_onmspointerup,
5561 HTMLElement7_put_onmspointerover,
5562 HTMLElement7_get_onmspointerover,
5563 HTMLElement7_put_onmspointerout,
5564 HTMLElement7_get_onmspointerout,
5565 HTMLElement7_put_onmspointercancel,
5566 HTMLElement7_get_onmspointercancel,
5567 HTMLElement7_put_onmspointerhover,
5568 HTMLElement7_get_onmspointerhover,
5569 HTMLElement7_put_onmslostpointercapture,
5570 HTMLElement7_get_onmslostpointercapture,
5571 HTMLElement7_put_onmsgotpointercapture,
5572 HTMLElement7_get_onmsgotpointercapture,
5573 HTMLElement7_put_onmsgesturestart,
5574 HTMLElement7_get_onmsgesturestart,
5575 HTMLElement7_put_onmsgesturechange,
5576 HTMLElement7_get_onmsgesturechange,
5577 HTMLElement7_put_onmsgestureend,
5578 HTMLElement7_get_onmsgestureend,
5579 HTMLElement7_put_onmsgesturehold,
5580 HTMLElement7_get_onmsgesturehold,
5581 HTMLElement7_put_onmsgesturetap,
5582 HTMLElement7_get_onmsgesturetap,
5583 HTMLElement7_put_onmsgesturedoubletap,
5584 HTMLElement7_get_onmsgesturedoubletap,
5585 HTMLElement7_put_onmsinertiastart,
5586 HTMLElement7_get_onmsinertiastart,
5587 HTMLElement7_msSetPointerCapture,
5588 HTMLElement7_msReleasePointerCapture,
5589 HTMLElement7_put_onmstransitionstart,
5590 HTMLElement7_get_onmstransitionstart,
5591 HTMLElement7_put_onmstransitionend,
5592 HTMLElement7_get_onmstransitionend,
5593 HTMLElement7_put_onmsanimationstart,
5594 HTMLElement7_get_onmsanimationstart,
5595 HTMLElement7_put_onmsanimationend,
5596 HTMLElement7_get_onmsanimationend,
5597 HTMLElement7_put_onmsanimationiteration,
5598 HTMLElement7_get_onmsanimationiteration,
5599 HTMLElement7_put_oninvalid,
5600 HTMLElement7_get_oninvalid,
5601 HTMLElement7_put_xmsAcceleratorKey,
5602 HTMLElement7_get_xmsAcceleratorKey,
5603 HTMLElement7_put_spellcheck,
5604 HTMLElement7_get_spellcheck,
5605 HTMLElement7_put_onmsmanipulationstatechanged,
5606 HTMLElement7_get_onmsmanipulationstatechanged,
5607 HTMLElement7_put_oncuechange,
5608 HTMLElement7_get_oncuechange
5612 static inline HTMLElement *impl_from_IHTMLUniqueName(IHTMLUniqueName *iface)
5614 return CONTAINING_RECORD(iface, HTMLElement, IHTMLUniqueName_iface);
5617 static HRESULT WINAPI HTMLUniqueName_QueryInterface(IHTMLUniqueName *iface, REFIID riid, void **ppv)
5619 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5620 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5623 static ULONG WINAPI HTMLUniqueName_AddRef(IHTMLUniqueName *iface)
5625 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5626 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5629 static ULONG WINAPI HTMLUniqueName_Release(IHTMLUniqueName *iface)
5631 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5632 return IHTMLElement_Release(&This->IHTMLElement_iface);
5635 static HRESULT WINAPI HTMLUniqueName_GetTypeInfoCount(IHTMLUniqueName *iface, UINT *pctinfo)
5637 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5638 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5641 static HRESULT WINAPI HTMLUniqueName_GetTypeInfo(IHTMLUniqueName *iface, UINT iTInfo,
5642 LCID lcid, ITypeInfo **ppTInfo)
5644 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5645 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5648 static HRESULT WINAPI HTMLUniqueName_GetIDsOfNames(IHTMLUniqueName *iface, REFIID riid,
5649 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5651 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5652 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5653 lcid, rgDispId);
5656 static HRESULT WINAPI HTMLUniqueName_Invoke(IHTMLUniqueName *iface, DISPID dispIdMember, REFIID riid,
5657 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5659 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5660 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5661 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5664 HRESULT elem_unique_id(unsigned id, BSTR *p)
5666 WCHAR buf[32];
5668 swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
5669 *p = SysAllocString(buf);
5670 return *p ? S_OK : E_OUTOFMEMORY;
5673 static void ensure_unique_id(HTMLElement *elem)
5675 if(!elem->unique_id)
5676 elem->unique_id = ++elem->node.doc->unique_id;
5679 static HRESULT WINAPI HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName *iface, LONG *p)
5681 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5683 TRACE("(%p)->(%p)\n", This, p);
5685 ensure_unique_id(This);
5686 *p = This->unique_id;
5687 return S_OK;
5690 static HRESULT WINAPI HTMLUniqueName_get_uniqueID(IHTMLUniqueName *iface, BSTR *p)
5692 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5694 TRACE("(%p)->(%p)\n", This, p);
5696 ensure_unique_id(This);
5697 return elem_unique_id(This->unique_id, p);
5700 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl = {
5701 HTMLUniqueName_QueryInterface,
5702 HTMLUniqueName_AddRef,
5703 HTMLUniqueName_Release,
5704 HTMLUniqueName_GetTypeInfoCount,
5705 HTMLUniqueName_GetTypeInfo,
5706 HTMLUniqueName_GetIDsOfNames,
5707 HTMLUniqueName_Invoke,
5708 HTMLUniqueName_get_uniqueNumber,
5709 HTMLUniqueName_get_uniqueID
5712 static inline HTMLElement *impl_from_IElementSelector(IElementSelector *iface)
5714 return CONTAINING_RECORD(iface, HTMLElement, IElementSelector_iface);
5717 static HRESULT WINAPI ElementSelector_QueryInterface(IElementSelector *iface, REFIID riid, void **ppv)
5719 HTMLElement *This = impl_from_IElementSelector(iface);
5720 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5723 static ULONG WINAPI ElementSelector_AddRef(IElementSelector *iface)
5725 HTMLElement *This = impl_from_IElementSelector(iface);
5726 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5729 static ULONG WINAPI ElementSelector_Release(IElementSelector *iface)
5731 HTMLElement *This = impl_from_IElementSelector(iface);
5732 return IHTMLElement_Release(&This->IHTMLElement_iface);
5735 static HRESULT WINAPI ElementSelector_GetTypeInfoCount(IElementSelector *iface, UINT *pctinfo)
5737 HTMLElement *This = impl_from_IElementSelector(iface);
5738 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5741 static HRESULT WINAPI ElementSelector_GetTypeInfo(IElementSelector *iface, UINT iTInfo,
5742 LCID lcid, ITypeInfo **ppTInfo)
5744 HTMLElement *This = impl_from_IElementSelector(iface);
5745 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5748 static HRESULT WINAPI ElementSelector_GetIDsOfNames(IElementSelector *iface, REFIID riid,
5749 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5751 HTMLElement *This = impl_from_IElementSelector(iface);
5752 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
5755 static HRESULT WINAPI ElementSelector_Invoke(IElementSelector *iface, DISPID dispIdMember, REFIID riid,
5756 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5758 HTMLElement *This = impl_from_IElementSelector(iface);
5759 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
5760 pDispParams, pVarResult, pExcepInfo, puArgErr);
5763 static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BSTR v, IHTMLElement **pel)
5765 HTMLElement *This = impl_from_IElementSelector(iface);
5766 nsIDOMElement *nselem;
5767 HTMLElement *elem;
5768 nsAString nsstr;
5769 nsresult nsres;
5770 HRESULT hres;
5772 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5774 if(!This->dom_element) {
5775 FIXME("comment element\n");
5776 return E_NOTIMPL;
5779 nsAString_InitDepend(&nsstr, v);
5780 nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
5781 nsAString_Finish(&nsstr);
5782 if(NS_FAILED(nsres)) {
5783 ERR("QuerySelector failed: %08x\n", nsres);
5784 return E_FAIL;
5787 if(!nselem) {
5788 *pel = NULL;
5789 return S_OK;
5792 hres = get_element(nselem, &elem);
5793 nsIDOMElement_Release(nselem);
5794 if(FAILED(hres))
5795 return hres;
5797 *pel = &elem->IHTMLElement_iface;
5798 return S_OK;
5801 static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, BSTR v, IHTMLDOMChildrenCollection **pel)
5803 HTMLElement *This = impl_from_IElementSelector(iface);
5804 nsIDOMNodeList *node_list;
5805 nsAString nsstr;
5806 HRESULT hres;
5808 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
5810 if(!This->dom_element) {
5811 FIXME("comment element\n");
5812 return E_NOTIMPL;
5815 nsAString_InitDepend(&nsstr, v);
5816 hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
5817 nsAString_Finish(&nsstr);
5818 if(FAILED(hres)) {
5819 ERR("QuerySelectorAll failed: %08x\n", hres);
5820 return hres;
5823 hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
5824 nsIDOMNodeList_Release(node_list);
5825 return hres;
5828 static const IElementSelectorVtbl ElementSelectorVtbl = {
5829 ElementSelector_QueryInterface,
5830 ElementSelector_AddRef,
5831 ElementSelector_Release,
5832 ElementSelector_GetTypeInfoCount,
5833 ElementSelector_GetTypeInfo,
5834 ElementSelector_GetIDsOfNames,
5835 ElementSelector_Invoke,
5836 ElementSelector_querySelector,
5837 ElementSelector_querySelectorAll
5840 static inline HTMLElement *impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo *iface)
5842 return CONTAINING_RECORD(iface, HTMLElement, IProvideMultipleClassInfo_iface);
5845 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo *iface,
5846 REFIID riid, void **ppv)
5848 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5849 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5852 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideMultipleClassInfo *iface)
5854 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5855 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5858 static ULONG WINAPI ProvideClassInfo_Release(IProvideMultipleClassInfo *iface)
5860 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5861 return IHTMLElement_Release(&This->IHTMLElement_iface);
5864 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *iface, ITypeInfo **ppTI)
5866 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5867 TRACE("(%p)->(%p)\n", This, ppTI);
5868 return get_class_typeinfo(This->node.vtbl->clsid, ppTI);
5871 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
5873 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5874 FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
5875 return E_NOTIMPL;
5878 static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo *iface, ULONG *pcti)
5880 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5881 FIXME("(%p)->(%p)\n", This, pcti);
5882 *pcti = 1;
5883 return S_OK;
5886 static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo *iface, ULONG iti,
5887 DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
5889 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
5890 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
5891 return E_NOTIMPL;
5894 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = {
5895 ProvideClassInfo_QueryInterface,
5896 ProvideClassInfo_AddRef,
5897 ProvideClassInfo_Release,
5898 ProvideClassInfo_GetClassInfo,
5899 ProvideClassInfo2_GetGUID,
5900 ProvideMultipleClassInfo_GetMultiTypeInfoCount,
5901 ProvideMultipleClassInfo_GetInfoOfIndex
5904 static inline HTMLElement *impl_from_IElementTraversal(IElementTraversal *iface)
5906 return CONTAINING_RECORD(iface, HTMLElement, IElementTraversal_iface);
5909 static HRESULT WINAPI ElementTraversal_QueryInterface(IElementTraversal *iface, REFIID riid, void **ppv)
5911 HTMLElement *This = impl_from_IElementTraversal(iface);
5912 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5915 static ULONG WINAPI ElementTraversal_AddRef(IElementTraversal *iface)
5917 HTMLElement *This = impl_from_IElementTraversal(iface);
5919 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5922 static ULONG WINAPI ElementTraversal_Release(IElementTraversal *iface)
5924 HTMLElement *This = impl_from_IElementTraversal(iface);
5926 return IHTMLElement_Release(&This->IHTMLElement_iface);
5929 static HRESULT WINAPI ElementTraversal_GetTypeInfoCount(IElementTraversal *iface, UINT *pctinfo)
5931 HTMLElement *This = impl_from_IElementTraversal(iface);
5932 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5935 static HRESULT WINAPI ElementTraversal_GetTypeInfo(IElementTraversal *iface, UINT iTInfo,
5936 LCID lcid, ITypeInfo **ppTInfo)
5938 HTMLElement *This = impl_from_IElementTraversal(iface);
5939 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5942 static HRESULT WINAPI ElementTraversal_GetIDsOfNames(IElementTraversal *iface, REFIID riid,
5943 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5945 HTMLElement *This = impl_from_IElementTraversal(iface);
5946 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5947 lcid, rgDispId);
5950 static HRESULT WINAPI ElementTraversal_Invoke(IElementTraversal *iface, DISPID dispIdMember, REFIID riid,
5951 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5953 HTMLElement *This = impl_from_IElementTraversal(iface);
5954 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5955 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5958 static HRESULT WINAPI ElementTraversal_get_firstElementChild(IElementTraversal *iface, IHTMLElement **p)
5960 HTMLElement *This = impl_from_IElementTraversal(iface);
5961 nsIDOMElement *nselem = NULL;
5962 HTMLElement *elem;
5963 HRESULT hres;
5965 TRACE("(%p)->(%p)\n", This, p);
5967 if(!This->dom_element) {
5968 *p = NULL;
5969 return S_OK;
5972 nsIDOMElement_GetFirstElementChild(This->dom_element, &nselem);
5973 if(!nselem) {
5974 *p = NULL;
5975 return S_OK;
5978 hres = get_element(nselem, &elem);
5979 nsIDOMElement_Release(nselem);
5980 if(FAILED(hres))
5981 return hres;
5983 *p = &elem->IHTMLElement_iface;
5984 return S_OK;
5987 static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *iface, IHTMLElement **p)
5989 HTMLElement *This = impl_from_IElementTraversal(iface);
5990 FIXME("(%p)->(%p)\n", This, p);
5991 return E_NOTIMPL;
5994 static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
5996 HTMLElement *This = impl_from_IElementTraversal(iface);
5997 FIXME("(%p)->(%p)\n", This, p);
5998 return E_NOTIMPL;
6001 static HRESULT WINAPI ElementTraversal_get_nextElementSibling(IElementTraversal *iface, IHTMLElement **p)
6003 HTMLElement *This = impl_from_IElementTraversal(iface);
6004 FIXME("(%p)->(%p)\n", This, p);
6005 return E_NOTIMPL;
6008 static HRESULT WINAPI ElementTraversal_get_childElementCount(IElementTraversal *iface, LONG *p)
6010 HTMLElement *This = impl_from_IElementTraversal(iface);
6011 FIXME("(%p)->(%p)\n", This, p);
6012 return E_NOTIMPL;
6015 static const IElementTraversalVtbl ElementTraversalVtbl = {
6016 ElementTraversal_QueryInterface,
6017 ElementTraversal_AddRef,
6018 ElementTraversal_Release,
6019 ElementTraversal_GetTypeInfoCount,
6020 ElementTraversal_GetTypeInfo,
6021 ElementTraversal_GetIDsOfNames,
6022 ElementTraversal_Invoke,
6023 ElementTraversal_get_firstElementChild,
6024 ElementTraversal_get_lastElementChild,
6025 ElementTraversal_get_previousElementSibling,
6026 ElementTraversal_get_nextElementSibling,
6027 ElementTraversal_get_childElementCount
6030 static inline HTMLElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
6032 return CONTAINING_RECORD(iface, HTMLElement, node);
6035 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
6037 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6039 if(IsEqualGUID(&IID_IUnknown, riid)) {
6040 *ppv = &This->IHTMLElement_iface;
6041 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
6042 *ppv = &This->IHTMLElement_iface;
6043 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
6044 *ppv = &This->IHTMLElement_iface;
6045 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
6046 *ppv = &This->IHTMLElement2_iface;
6047 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
6048 *ppv = &This->IHTMLElement3_iface;
6049 }else if(IsEqualGUID(&IID_IHTMLElement4, riid)) {
6050 *ppv = &This->IHTMLElement4_iface;
6051 }else if(IsEqualGUID(&IID_IHTMLElement6, riid)) {
6052 *ppv = &This->IHTMLElement6_iface;
6053 }else if(IsEqualGUID(&IID_IHTMLElement7, riid)) {
6054 *ppv = &This->IHTMLElement7_iface;
6055 }else if(IsEqualGUID(&IID_IHTMLUniqueName, riid)) {
6056 *ppv = &This->IHTMLUniqueName_iface;
6057 }else if(IsEqualGUID(&IID_IElementSelector, riid)) {
6058 *ppv = &This->IElementSelector_iface;
6059 }else if(IsEqualGUID(&IID_IElementTraversal, riid)) {
6060 *ppv = &This->IElementTraversal_iface;
6061 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
6062 *ppv = &This->cp_container.IConnectionPointContainer_iface;
6063 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
6064 *ppv = &This->IProvideMultipleClassInfo_iface;
6065 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
6066 *ppv = &This->IProvideMultipleClassInfo_iface;
6067 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo, riid)) {
6068 *ppv = &This->IProvideMultipleClassInfo_iface;
6069 }else {
6070 return HTMLDOMNode_QI(&This->node, riid, ppv);
6073 IUnknown_AddRef((IUnknown*)*ppv);
6074 return S_OK;
6077 void HTMLElement_destructor(HTMLDOMNode *iface)
6079 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6081 ConnectionPointContainer_Destroy(&This->cp_container);
6083 if(This->style) {
6084 This->style->elem = NULL;
6085 IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
6087 if(This->runtime_style) {
6088 This->runtime_style->elem = NULL;
6089 IHTMLStyle_Release(&This->runtime_style->IHTMLStyle_iface);
6091 if(This->attrs) {
6092 HTMLDOMAttribute *attr;
6094 LIST_FOR_EACH_ENTRY(attr, &This->attrs->attrs, HTMLDOMAttribute, entry)
6095 attr->elem = NULL;
6097 This->attrs->elem = NULL;
6098 IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface);
6101 heap_free(This->filter);
6103 HTMLDOMNode_destructor(&This->node);
6106 HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
6108 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6109 HTMLElement *new_elem;
6110 HRESULT hres;
6112 hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
6113 if(FAILED(hres))
6114 return hres;
6116 if(This->filter) {
6117 new_elem->filter = heap_strdupW(This->filter);
6118 if(!new_elem->filter) {
6119 IHTMLElement_Release(&This->IHTMLElement_iface);
6120 return E_OUTOFMEMORY;
6124 *ret = &new_elem->node;
6125 return S_OK;
6128 HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
6130 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6132 switch(eid) {
6133 case EVENTID_KEYDOWN: {
6134 nsIDOMKeyEvent *key_event;
6135 nsresult nsres;
6137 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
6138 if(NS_SUCCEEDED(nsres)) {
6139 UINT32 code = 0;
6141 nsIDOMKeyEvent_GetKeyCode(key_event, &code);
6143 if(code == VK_F1 /* DOM_VK_F1 */) {
6144 DOMEvent *help_event;
6145 HRESULT hres;
6147 TRACE("F1 pressed\n");
6149 hres = create_document_event(This->node.doc, EVENTID_HELP, &help_event);
6150 if(SUCCEEDED(hres)) {
6151 dispatch_event(&This->node.event_target, help_event);
6152 IDOMEvent_Release(&help_event->IDOMEvent_iface);
6154 *prevent_default = TRUE;
6157 nsIDOMKeyEvent_Release(key_event);
6162 return S_OK;
6165 cp_static_data_t HTMLElementEvents2_data = { HTMLElementEvents2_tid, NULL /* FIXME */, TRUE };
6167 const cpc_entry_t HTMLElement_cpc[] = {
6168 HTMLELEMENT_CPC,
6169 {NULL}
6172 static const NodeImplVtbl HTMLElementImplVtbl = {
6173 &CLSID_HTMLUnknownElement,
6174 HTMLElement_QI,
6175 HTMLElement_destructor,
6176 HTMLElement_cpc,
6177 HTMLElement_clone,
6178 HTMLElement_handle_event,
6179 HTMLElement_get_attr_col
6182 static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
6184 return CONTAINING_RECORD(iface, HTMLElement, node.event_target.dispex);
6187 static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
6188 DWORD grfdex, DISPID *pid)
6190 HTMLElement *This = impl_from_DispatchEx(dispex);
6192 if(This->node.vtbl->get_dispid)
6193 return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
6195 return DISP_E_UNKNOWNNAME;
6198 static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
6199 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
6200 IServiceProvider *caller)
6202 HTMLElement *This = impl_from_DispatchEx(dispex);
6204 if(This->node.vtbl->invoke)
6205 return This->node.vtbl->invoke(&This->node, id, lcid, flags,
6206 params, res, ei, caller);
6208 ERR("(%p): element has no invoke method\n", This);
6209 return E_NOTIMPL;
6212 static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
6214 HTMLElement *This = impl_from_DispatchEx(dispex);
6215 nsIDOMMozNamedAttrMap *attrs;
6216 nsIDOMAttr *attr;
6217 nsAString nsstr;
6218 const PRUnichar *str;
6219 BSTR name;
6220 VARIANT value;
6221 unsigned i;
6222 UINT32 len;
6223 DISPID id;
6224 nsresult nsres;
6225 HRESULT hres;
6227 if(!This->dom_element)
6228 return S_FALSE;
6230 nsres = nsIDOMElement_GetAttributes(This->dom_element, &attrs);
6231 if(NS_FAILED(nsres))
6232 return E_FAIL;
6234 nsres = nsIDOMMozNamedAttrMap_GetLength(attrs, &len);
6235 if(NS_FAILED(nsres)) {
6236 nsIDOMMozNamedAttrMap_Release(attrs);
6237 return E_FAIL;
6240 nsAString_Init(&nsstr, NULL);
6241 for(i=0; i<len; i++) {
6242 nsres = nsIDOMMozNamedAttrMap_Item(attrs, i, &attr);
6243 if(NS_FAILED(nsres))
6244 continue;
6246 nsres = nsIDOMAttr_GetNodeName(attr, &nsstr);
6247 if(NS_FAILED(nsres)) {
6248 nsIDOMAttr_Release(attr);
6249 continue;
6252 nsAString_GetData(&nsstr, &str);
6253 name = SysAllocString(str);
6254 if(!name) {
6255 nsIDOMAttr_Release(attr);
6256 continue;
6259 hres = IDispatchEx_GetDispID(&dispex->IDispatchEx_iface, name, fdexNameCaseInsensitive, &id);
6260 if(hres != DISP_E_UNKNOWNNAME) {
6261 nsIDOMAttr_Release(attr);
6262 SysFreeString(name);
6263 continue;
6266 nsres = nsIDOMAttr_GetNodeValue(attr, &nsstr);
6267 nsIDOMAttr_Release(attr);
6268 if(NS_FAILED(nsres)) {
6269 SysFreeString(name);
6270 continue;
6273 nsAString_GetData(&nsstr, &str);
6274 V_VT(&value) = VT_BSTR;
6275 if(*str) {
6276 V_BSTR(&value) = SysAllocString(str);
6277 if(!V_BSTR(&value)) {
6278 SysFreeString(name);
6279 continue;
6281 } else
6282 V_BSTR(&value) = NULL;
6284 IHTMLElement_setAttribute(&This->IHTMLElement_iface, name, value, 0);
6285 SysFreeString(name);
6286 VariantClear(&value);
6288 nsAString_Finish(&nsstr);
6290 nsIDOMMozNamedAttrMap_Release(attrs);
6291 return S_OK;
6294 static nsISupports *HTMLElement_get_gecko_target(DispatchEx *dispex)
6296 HTMLElement *This = impl_from_DispatchEx(dispex);
6297 return (nsISupports*)This->node.nsnode;
6300 static void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
6302 HTMLElement *This = impl_from_DispatchEx(dispex);
6303 ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid);
6306 static HRESULT HTMLElement_handle_event_default(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *nsevent, BOOL *prevent_default)
6308 HTMLElement *This = impl_from_DispatchEx(dispex);
6310 if(!This->node.vtbl->handle_event)
6311 return S_OK;
6312 return This->node.vtbl->handle_event(&This->node, eid, nsevent, prevent_default);
6315 static EventTarget *HTMLElement_get_parent_event_target(DispatchEx *dispex)
6317 HTMLElement *This = impl_from_DispatchEx(dispex);
6318 HTMLDOMNode *node;
6319 nsIDOMNode *nsnode;
6320 nsresult nsres;
6321 HRESULT hres;
6323 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &nsnode);
6324 assert(nsres == NS_OK);
6325 if(!nsnode)
6326 return NULL;
6328 hres = get_node(nsnode, TRUE, &node);
6329 nsIDOMNode_Release(nsnode);
6330 if(FAILED(hres))
6331 return NULL;
6333 return &node->event_target;
6336 static ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx *dispex)
6338 HTMLElement *This = impl_from_DispatchEx(dispex);
6339 IConnectionPointContainer_AddRef(&This->cp_container.IConnectionPointContainer_iface);
6340 return &This->cp_container;
6343 static IHTMLEventObj *HTMLElement_set_current_event(DispatchEx *dispex, IHTMLEventObj *event)
6345 HTMLElement *This = impl_from_DispatchEx(dispex);
6346 return default_set_current_event(This->node.doc->window, event);
6349 void HTMLElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
6351 static const dispex_hook_t elem2_ie11_hooks[] = {
6352 {DISPID_IHTMLELEMENT2_DOSCROLL, NULL},
6353 {DISPID_IHTMLELEMENT2_READYSTATE, NULL},
6354 {DISPID_UNKNOWN}
6357 HTMLDOMNode_init_dispex_info(info, mode);
6359 dispex_info_add_interface(info, IHTMLElement2_tid, mode >= COMPAT_MODE_IE11 ? elem2_ie11_hooks : NULL);
6361 if(mode >= COMPAT_MODE_IE8)
6362 dispex_info_add_interface(info, IElementSelector_tid, NULL);
6364 if(mode >= COMPAT_MODE_IE9) {
6365 dispex_info_add_interface(info, IHTMLElement6_tid, NULL);
6366 dispex_info_add_interface(info, IElementTraversal_tid, NULL);
6369 if(mode >= COMPAT_MODE_IE10)
6370 dispex_info_add_interface(info, IHTMLElement7_tid, NULL);
6373 static const tid_t HTMLElement_iface_tids[] = {
6374 HTMLELEMENT_TIDS,
6378 static event_target_vtbl_t HTMLElement_event_target_vtbl = {
6380 NULL,
6381 HTMLElement_get_dispid,
6382 HTMLElement_invoke,
6383 NULL,
6384 HTMLElement_populate_props
6386 HTMLElement_get_gecko_target,
6387 HTMLElement_bind_event,
6388 HTMLElement_get_parent_event_target,
6389 HTMLElement_handle_event_default,
6390 HTMLElement_get_cp_container,
6391 HTMLElement_set_current_event
6394 static dispex_static_data_t HTMLElement_dispex = {
6395 &HTMLElement_event_target_vtbl.dispex_vtbl,
6396 DispHTMLUnknownElement_tid,
6397 HTMLElement_iface_tids,
6398 HTMLElement_init_dispex_info
6401 void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMElement *nselem, dispex_static_data_t *dispex_data)
6403 This->IHTMLElement_iface.lpVtbl = &HTMLElementVtbl;
6404 This->IHTMLElement2_iface.lpVtbl = &HTMLElement2Vtbl;
6405 This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
6406 This->IHTMLElement4_iface.lpVtbl = &HTMLElement4Vtbl;
6407 This->IHTMLElement6_iface.lpVtbl = &HTMLElement6Vtbl;
6408 This->IHTMLElement7_iface.lpVtbl = &HTMLElement7Vtbl;
6409 This->IHTMLUniqueName_iface.lpVtbl = &HTMLUniqueNameVtbl;
6410 This->IElementSelector_iface.lpVtbl = &ElementSelectorVtbl;
6411 This->IElementTraversal_iface.lpVtbl = &ElementTraversalVtbl;
6412 This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
6414 if(dispex_data && !dispex_data->vtbl)
6415 dispex_data->vtbl = &HTMLElement_event_target_vtbl.dispex_vtbl;
6417 if(nselem) {
6418 nsIDOMHTMLElement *html_element;
6419 nsresult nsres;
6421 HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLElement_dispex);
6423 /* No AddRef, share reference with HTMLDOMNode */
6424 assert((nsIDOMNode*)nselem == This->node.nsnode);
6425 This->dom_element = nselem;
6427 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&html_element);
6428 if(NS_SUCCEEDED(nsres)) {
6429 This->html_element = html_element;
6430 /* share reference with HTMLDOMNode */
6431 assert((nsIDOMNode*)html_element == This->node.nsnode);
6432 nsIDOMHTMLElement_Release(html_element);
6436 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface, This->node.vtbl->cpc_entries);
6439 HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
6441 nsIDOMElement *nselem;
6442 nsAString tag_name_str;
6443 const PRUnichar *tag_name;
6444 const tag_desc_t *tag;
6445 HTMLElement *elem;
6446 nsresult nsres;
6447 HRESULT hres;
6449 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
6450 if(NS_FAILED(nsres)) {
6451 ERR("no nsIDOMElement iface\n");
6452 return E_FAIL;
6455 nsAString_Init(&tag_name_str, NULL);
6456 nsIDOMElement_GetTagName(nselem, &tag_name_str);
6458 nsAString_GetData(&tag_name_str, &tag_name);
6460 tag = get_tag_desc(tag_name);
6461 if(tag) {
6462 hres = tag->constructor(doc, nselem, &elem);
6463 }else {
6464 nsIDOMSVGElement *svg_element;
6466 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element);
6467 if(NS_SUCCEEDED(nsres)) {
6468 hres = create_svg_element(doc, svg_element, tag_name, &elem);
6469 nsIDOMSVGElement_Release(svg_element);
6470 }else if(use_generic) {
6471 hres = HTMLGenericElement_Create(doc, nselem, &elem);
6472 }else {
6473 elem = heap_alloc_zero(sizeof(HTMLElement));
6474 if(elem) {
6475 elem->node.vtbl = &HTMLElementImplVtbl;
6476 HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
6477 hres = S_OK;
6478 }else {
6479 hres = E_OUTOFMEMORY;
6484 TRACE("%s ret %p\n", debugstr_w(tag_name), elem);
6486 nsIDOMElement_Release(nselem);
6487 nsAString_Finish(&tag_name_str);
6488 if(FAILED(hres))
6489 return hres;
6491 *ret = elem;
6492 return S_OK;
6495 HRESULT get_element(nsIDOMElement *nselem, HTMLElement **ret)
6497 HTMLDOMNode *node;
6498 HRESULT hres;
6500 hres = get_node((nsIDOMNode*)nselem, TRUE, &node);
6501 if(FAILED(hres))
6502 return hres;
6504 *ret = impl_from_HTMLDOMNode(node);
6505 return S_OK;
6508 /* interface IHTMLFiltersCollection */
6509 static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
6511 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6513 TRACE("%p %s %p\n", This, debugstr_mshtml_guid(riid), ppv );
6515 if(IsEqualGUID(&IID_IUnknown, riid)) {
6516 *ppv = &This->IHTMLFiltersCollection_iface;
6517 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
6518 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
6519 *ppv = &This->IHTMLFiltersCollection_iface;
6520 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6521 return *ppv ? S_OK : E_NOINTERFACE;
6522 }else {
6523 *ppv = NULL;
6524 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6525 return E_NOINTERFACE;
6528 IUnknown_AddRef((IUnknown*)*ppv);
6529 return S_OK;
6532 static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
6534 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6535 LONG ref = InterlockedIncrement(&This->ref);
6537 TRACE("(%p) ref=%d\n", This, ref);
6539 return ref;
6542 static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
6544 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6545 LONG ref = InterlockedDecrement(&This->ref);
6547 TRACE("(%p) ref=%d\n", This, ref);
6549 if(!ref)
6551 heap_free(This);
6554 return ref;
6557 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
6559 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6560 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6563 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
6564 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
6566 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6567 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6570 static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
6571 REFIID riid, LPOLESTR *rgszNames, UINT cNames,
6572 LCID lcid, DISPID *rgDispId)
6574 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6575 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6576 lcid, rgDispId);
6579 static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
6580 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
6581 EXCEPINFO *pExcepInfo, UINT *puArgErr)
6583 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6584 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6585 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6588 static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
6590 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6592 if(!p)
6593 return E_POINTER;
6595 FIXME("(%p)->(%p) Always returning 0\n", This, p);
6596 *p = 0;
6598 return S_OK;
6601 static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
6603 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6604 FIXME("(%p)->(%p)\n", This, p);
6605 return E_NOTIMPL;
6608 static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
6610 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
6611 FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
6612 return E_NOTIMPL;
6615 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
6616 HTMLFiltersCollection_QueryInterface,
6617 HTMLFiltersCollection_AddRef,
6618 HTMLFiltersCollection_Release,
6619 HTMLFiltersCollection_GetTypeInfoCount,
6620 HTMLFiltersCollection_GetTypeInfo,
6621 HTMLFiltersCollection_GetIDsOfNames,
6622 HTMLFiltersCollection_Invoke,
6623 HTMLFiltersCollection_get_length,
6624 HTMLFiltersCollection_get__newEnum,
6625 HTMLFiltersCollection_item
6628 static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
6630 WCHAR *ptr;
6631 int idx = 0;
6633 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
6634 idx = idx*10 + (*ptr-'0');
6635 if(*ptr)
6636 return DISP_E_UNKNOWNNAME;
6638 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
6639 TRACE("ret %x\n", *dispid);
6640 return S_OK;
6643 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
6644 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
6646 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
6648 V_VT(res) = VT_DISPATCH;
6649 V_DISPATCH(res) = NULL;
6651 FIXME("always returning NULL\n");
6653 return S_OK;
6656 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
6657 NULL,
6658 HTMLFiltersCollection_get_dispid,
6659 HTMLFiltersCollection_invoke,
6660 NULL
6663 static const tid_t HTMLFiltersCollection_iface_tids[] = {
6664 IHTMLFiltersCollection_tid,
6667 static dispex_static_data_t HTMLFiltersCollection_dispex = {
6668 &HTMLFiltersCollection_dispex_vtbl,
6669 IHTMLFiltersCollection_tid,
6670 HTMLFiltersCollection_iface_tids
6673 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret)
6675 HTMLFiltersCollection *collection;
6677 if(!(collection = heap_alloc(sizeof(HTMLFiltersCollection))))
6678 return E_OUTOFMEMORY;
6680 collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
6681 collection->ref = 1;
6683 init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface,
6684 &HTMLFiltersCollection_dispex, compat_mode);
6686 *ret = &collection->IHTMLFiltersCollection_iface;
6687 return S_OK;
6690 /* interface IHTMLAttributeCollection */
6691 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection *iface)
6693 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection_iface);
6696 static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection *iface, REFIID riid, void **ppv)
6698 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6700 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6702 if(IsEqualGUID(&IID_IUnknown, riid)) {
6703 *ppv = &This->IHTMLAttributeCollection_iface;
6704 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection, riid)) {
6705 *ppv = &This->IHTMLAttributeCollection_iface;
6706 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2, riid)) {
6707 *ppv = &This->IHTMLAttributeCollection2_iface;
6708 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3, riid)) {
6709 *ppv = &This->IHTMLAttributeCollection3_iface;
6710 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
6711 return *ppv ? S_OK : E_NOINTERFACE;
6712 }else {
6713 *ppv = NULL;
6714 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
6715 return E_NOINTERFACE;
6718 IUnknown_AddRef((IUnknown*)*ppv);
6719 return S_OK;
6722 static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface)
6724 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6725 LONG ref = InterlockedIncrement(&This->ref);
6727 TRACE("(%p) ref=%d\n", This, ref);
6729 return ref;
6732 static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface)
6734 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6735 LONG ref = InterlockedDecrement(&This->ref);
6737 TRACE("(%p) ref=%d\n", This, ref);
6739 if(!ref) {
6740 while(!list_empty(&This->attrs)) {
6741 HTMLDOMAttribute *attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry);
6743 list_remove(&attr->entry);
6744 attr->elem = NULL;
6745 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
6748 heap_free(This);
6751 return ref;
6754 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection *iface, UINT *pctinfo)
6756 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6757 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6760 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection *iface, UINT iTInfo,
6761 LCID lcid, ITypeInfo **ppTInfo)
6763 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6764 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6767 static HRESULT WINAPI HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection *iface, REFIID riid,
6768 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6770 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6771 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6772 lcid, rgDispId);
6775 static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *iface, DISPID dispIdMember,
6776 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6777 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6779 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6780 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6781 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6784 static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid)
6786 IDispatchEx *dispex = &This->elem->node.event_target.dispex.IDispatchEx_iface;
6787 DISPID id = DISPID_STARTENUM;
6788 LONG len = -1;
6789 HRESULT hres;
6791 FIXME("filter non-enumerable attributes out\n");
6793 while(1) {
6794 hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
6795 if(FAILED(hres))
6796 return hres;
6797 else if(hres == S_FALSE)
6798 break;
6800 len++;
6801 if(len == *idx)
6802 break;
6805 if(dispid) {
6806 *dispid = id;
6807 return *idx==len ? S_OK : DISP_E_UNKNOWNNAME;
6810 *idx = len+1;
6811 return S_OK;
6814 static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id)
6816 HRESULT hres;
6818 if(name[0]>='0' && name[0]<='9') {
6819 WCHAR *end_ptr;
6820 LONG idx;
6822 idx = wcstoul(name, &end_ptr, 10);
6823 if(!*end_ptr) {
6824 hres = get_attr_dispid_by_idx(This, &idx, id);
6825 if(SUCCEEDED(hres))
6826 return hres;
6830 if(!This->elem) {
6831 WARN("NULL elem\n");
6832 return E_UNEXPECTED;
6835 hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface,
6836 name, fdexNameCaseInsensitive, id);
6837 return hres;
6840 static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr)
6842 HTMLDOMAttribute *iter;
6843 LONG pos = 0;
6844 HRESULT hres;
6846 *attr = NULL;
6847 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
6848 if(iter->dispid == id) {
6849 *attr = iter;
6850 break;
6852 pos++;
6855 if(!*attr) {
6856 if(!This->elem) {
6857 WARN("NULL elem\n");
6858 return E_UNEXPECTED;
6861 hres = HTMLDOMAttribute_Create(NULL, This->elem, id, attr);
6862 if(FAILED(hres))
6863 return hres;
6866 IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface);
6867 if(list_pos)
6868 *list_pos = pos;
6869 return S_OK;
6872 static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p)
6874 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6875 HRESULT hres;
6877 TRACE("(%p)->(%p)\n", This, p);
6879 *p = -1;
6880 hres = get_attr_dispid_by_idx(This, p, NULL);
6881 return hres;
6884 static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p)
6886 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6887 FIXME("(%p)->(%p)\n", This, p);
6888 return E_NOTIMPL;
6891 static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem)
6893 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
6894 HTMLDOMAttribute *attr;
6895 DISPID id;
6896 HRESULT hres;
6898 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(name), ppItem);
6900 switch(V_VT(name)) {
6901 case VT_I4:
6902 hres = get_attr_dispid_by_idx(This, &V_I4(name), &id);
6903 break;
6904 case VT_BSTR:
6905 hres = get_attr_dispid_by_name(This, V_BSTR(name), &id);
6906 break;
6907 default:
6908 FIXME("unsupported name %s\n", debugstr_variant(name));
6909 hres = E_NOTIMPL;
6911 if(hres == DISP_E_UNKNOWNNAME)
6912 return E_INVALIDARG;
6913 if(FAILED(hres))
6914 return hres;
6916 hres = get_domattr(This, id, NULL, &attr);
6917 if(FAILED(hres))
6918 return hres;
6920 *ppItem = (IDispatch*)&attr->IHTMLDOMAttribute_iface;
6921 return S_OK;
6924 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl = {
6925 HTMLAttributeCollection_QueryInterface,
6926 HTMLAttributeCollection_AddRef,
6927 HTMLAttributeCollection_Release,
6928 HTMLAttributeCollection_GetTypeInfoCount,
6929 HTMLAttributeCollection_GetTypeInfo,
6930 HTMLAttributeCollection_GetIDsOfNames,
6931 HTMLAttributeCollection_Invoke,
6932 HTMLAttributeCollection_get_length,
6933 HTMLAttributeCollection__newEnum,
6934 HTMLAttributeCollection_item
6937 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2 *iface)
6939 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection2_iface);
6942 static HRESULT WINAPI HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2 *iface, REFIID riid, void **ppv)
6944 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6945 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
6948 static ULONG WINAPI HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2 *iface)
6950 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6951 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
6954 static ULONG WINAPI HTMLAttributeCollection2_Release(IHTMLAttributeCollection2 *iface)
6956 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6957 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
6960 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2 *iface, UINT *pctinfo)
6962 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6963 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
6966 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2 *iface, UINT iTInfo,
6967 LCID lcid, ITypeInfo **ppTInfo)
6969 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6970 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6973 static HRESULT WINAPI HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2 *iface, REFIID riid,
6974 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6976 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6977 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6978 lcid, rgDispId);
6981 static HRESULT WINAPI HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2 *iface, DISPID dispIdMember,
6982 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6983 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6985 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6986 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6987 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6990 static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2 *iface, BSTR bstrName,
6991 IHTMLDOMAttribute **newretNode)
6993 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
6994 HTMLDOMAttribute *attr;
6995 DISPID id;
6996 HRESULT hres;
6998 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
7000 hres = get_attr_dispid_by_name(This, bstrName, &id);
7001 if(hres == DISP_E_UNKNOWNNAME) {
7002 *newretNode = NULL;
7003 return S_OK;
7004 } else if(FAILED(hres)) {
7005 return hres;
7008 hres = get_domattr(This, id, NULL, &attr);
7009 if(FAILED(hres))
7010 return hres;
7012 *newretNode = &attr->IHTMLDOMAttribute_iface;
7013 return S_OK;
7016 static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface,
7017 IHTMLDOMAttribute *ppNode, IHTMLDOMAttribute **newretNode)
7019 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7020 FIXME("(%p)->(%p %p)\n", This, ppNode, newretNode);
7021 return E_NOTIMPL;
7024 static HRESULT WINAPI HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2 *iface,
7025 BSTR bstrName, IHTMLDOMAttribute **newretNode)
7027 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7028 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
7029 return E_NOTIMPL;
7032 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl = {
7033 HTMLAttributeCollection2_QueryInterface,
7034 HTMLAttributeCollection2_AddRef,
7035 HTMLAttributeCollection2_Release,
7036 HTMLAttributeCollection2_GetTypeInfoCount,
7037 HTMLAttributeCollection2_GetTypeInfo,
7038 HTMLAttributeCollection2_GetIDsOfNames,
7039 HTMLAttributeCollection2_Invoke,
7040 HTMLAttributeCollection2_getNamedItem,
7041 HTMLAttributeCollection2_setNamedItem,
7042 HTMLAttributeCollection2_removeNamedItem
7045 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3 *iface)
7047 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection3_iface);
7050 static HRESULT WINAPI HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3 *iface, REFIID riid, void **ppv)
7052 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7053 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
7056 static ULONG WINAPI HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3 *iface)
7058 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7059 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
7062 static ULONG WINAPI HTMLAttributeCollection3_Release(IHTMLAttributeCollection3 *iface)
7064 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7065 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
7068 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3 *iface, UINT *pctinfo)
7070 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7071 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7074 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3 *iface, UINT iTInfo,
7075 LCID lcid, ITypeInfo **ppTInfo)
7077 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7078 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7081 static HRESULT WINAPI HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3 *iface, REFIID riid,
7082 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7084 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7085 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7086 lcid, rgDispId);
7089 static HRESULT WINAPI HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3 *iface, DISPID dispIdMember,
7090 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7091 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7093 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7094 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7095 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7098 static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3 *iface, BSTR bstrName,
7099 IHTMLDOMAttribute **ppNodeOut)
7101 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7102 return IHTMLAttributeCollection2_getNamedItem(&This->IHTMLAttributeCollection2_iface, bstrName, ppNodeOut);
7105 static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
7106 IHTMLDOMAttribute *pNodeIn, IHTMLDOMAttribute **ppNodeOut)
7108 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7109 FIXME("(%p)->(%p %p)\n", This, pNodeIn, ppNodeOut);
7110 return E_NOTIMPL;
7113 static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3 *iface,
7114 BSTR bstrName, IHTMLDOMAttribute **ppNodeOut)
7116 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7117 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
7118 return E_NOTIMPL;
7121 static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut)
7123 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7124 HTMLDOMAttribute *attr;
7125 DISPID id;
7126 HRESULT hres;
7128 TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut);
7130 hres = get_attr_dispid_by_idx(This, &index, &id);
7131 if(hres == DISP_E_UNKNOWNNAME)
7132 return E_INVALIDARG;
7133 if(FAILED(hres))
7134 return hres;
7136 hres = get_domattr(This, id, NULL, &attr);
7137 if(FAILED(hres))
7138 return hres;
7140 *ppNodeOut = &attr->IHTMLDOMAttribute_iface;
7141 return S_OK;
7144 static HRESULT WINAPI HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3 *iface, LONG *p)
7146 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7147 return IHTMLAttributeCollection_get_length(&This->IHTMLAttributeCollection_iface, p);
7150 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl = {
7151 HTMLAttributeCollection3_QueryInterface,
7152 HTMLAttributeCollection3_AddRef,
7153 HTMLAttributeCollection3_Release,
7154 HTMLAttributeCollection3_GetTypeInfoCount,
7155 HTMLAttributeCollection3_GetTypeInfo,
7156 HTMLAttributeCollection3_GetIDsOfNames,
7157 HTMLAttributeCollection3_Invoke,
7158 HTMLAttributeCollection3_getNamedItem,
7159 HTMLAttributeCollection3_setNamedItem,
7160 HTMLAttributeCollection3_removeNamedItem,
7161 HTMLAttributeCollection3_item,
7162 HTMLAttributeCollection3_get_length
7165 static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(DispatchEx *iface)
7167 return CONTAINING_RECORD(iface, HTMLAttributeCollection, dispex);
7170 static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
7172 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7173 HTMLDOMAttribute *attr;
7174 LONG pos;
7175 HRESULT hres;
7177 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
7179 hres = get_attr_dispid_by_name(This, name, dispid);
7180 if(FAILED(hres))
7181 return hres;
7183 hres = get_domattr(This, *dispid, &pos, &attr);
7184 if(FAILED(hres))
7185 return hres;
7186 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
7188 *dispid = MSHTML_DISPID_CUSTOM_MIN+pos;
7189 return S_OK;
7192 static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
7193 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
7195 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7197 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
7199 switch(flags) {
7200 case DISPATCH_PROPERTYGET: {
7201 HTMLDOMAttribute *iter;
7202 DWORD pos;
7204 pos = id-MSHTML_DISPID_CUSTOM_MIN;
7206 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
7207 if(!pos) {
7208 IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
7209 V_VT(res) = VT_DISPATCH;
7210 V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
7211 return S_OK;
7213 pos--;
7216 WARN("invalid arg\n");
7217 return E_INVALIDARG;
7220 default:
7221 FIXME("unimplemented flags %x\n", flags);
7222 return E_NOTIMPL;
7226 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = {
7227 NULL,
7228 HTMLAttributeCollection_get_dispid,
7229 HTMLAttributeCollection_invoke,
7230 NULL
7233 static const tid_t HTMLAttributeCollection_iface_tids[] = {
7234 IHTMLAttributeCollection_tid,
7235 IHTMLAttributeCollection2_tid,
7236 IHTMLAttributeCollection3_tid,
7240 static dispex_static_data_t HTMLAttributeCollection_dispex = {
7241 &HTMLAttributeCollection_dispex_vtbl,
7242 DispHTMLAttributeCollection_tid,
7243 HTMLAttributeCollection_iface_tids
7246 HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
7248 HTMLElement *This = impl_from_HTMLDOMNode(iface);
7250 if(This->attrs) {
7251 IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface);
7252 *ac = This->attrs;
7253 return S_OK;
7256 This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection));
7257 if(!This->attrs)
7258 return E_OUTOFMEMORY;
7260 This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl;
7261 This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl;
7262 This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl;
7263 This->attrs->ref = 2;
7265 This->attrs->elem = This;
7266 list_init(&This->attrs->attrs);
7267 init_dispatch(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface,
7268 &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
7270 *ac = This->attrs;
7271 return S_OK;