mf/tests: Add some WMA decoder GetInputAvailableType tests.
[wine.git] / dlls / mshtml / htmlelem.c
blob2a73c6a2d331e91fc6d9eb707a8784fb97b06aff
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 <math.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "winreg.h"
28 #include "ole2.h"
29 #include "shlwapi.h"
30 #include "mshtmdid.h"
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
35 #include "htmlevent.h"
36 #include "htmlstyle.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 #define ATTRFLAG_CASESENSITIVE 0x0001
41 #define ATTRFLAG_ASSTRING 0x0002
42 #define ATTRFLAG_EXPANDURL 0x0004
44 typedef struct {
45 const WCHAR *name;
46 HRESULT (*constructor)(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
47 } tag_desc_t;
49 static HRESULT HTMLElement_Ctor(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
51 static const tag_desc_t tag_descs[] = {
52 {L"A", HTMLAnchorElement_Create},
53 {L"ABBR", HTMLElement_Ctor},
54 {L"ACRONYM", HTMLElement_Ctor},
55 {L"ADDRESS", HTMLElement_Ctor},
56 {L"APPLET", HTMLElement_Ctor},
57 {L"AREA", HTMLAreaElement_Create},
58 {L"ARTICLE", HTMLElement_Ctor},
59 {L"ASIDE", HTMLElement_Ctor},
60 {L"AUDIO", HTMLElement_Ctor},
61 {L"B", HTMLElement_Ctor},
62 {L"BASE", HTMLElement_Ctor},
63 {L"BASEFONT", HTMLElement_Ctor},
64 {L"BDO", HTMLElement_Ctor},
65 {L"BIG", HTMLElement_Ctor},
66 {L"BLOCKQUOTE", HTMLElement_Ctor},
67 {L"BODY", HTMLBodyElement_Create},
68 {L"BR", HTMLElement_Ctor},
69 {L"BUTTON", HTMLButtonElement_Create},
70 {L"CANVAS", HTMLElement_Ctor},
71 {L"CAPTION", HTMLElement_Ctor},
72 {L"CENTER", HTMLElement_Ctor},
73 {L"CITE", HTMLElement_Ctor},
74 {L"CODE", HTMLElement_Ctor},
75 {L"COL", HTMLElement_Ctor},
76 {L"COLGROUP", HTMLElement_Ctor},
77 {L"DATALIST", HTMLElement_Ctor},
78 {L"DD", HTMLElement_Ctor},
79 {L"DEL", HTMLElement_Ctor},
80 {L"DFN", HTMLElement_Ctor},
81 {L"DIR", HTMLElement_Ctor},
82 {L"DIV", HTMLElement_Ctor},
83 {L"DL", HTMLElement_Ctor},
84 {L"DT", HTMLElement_Ctor},
85 {L"EM", HTMLElement_Ctor},
86 {L"EMBED", HTMLEmbedElement_Create},
87 {L"FIELDSET", HTMLElement_Ctor},
88 {L"FIGCAPTION", HTMLElement_Ctor},
89 {L"FIGURE", HTMLElement_Ctor},
90 {L"FONT", HTMLElement_Ctor},
91 {L"FOOTER", HTMLElement_Ctor},
92 {L"FORM", HTMLFormElement_Create},
93 {L"FRAME", HTMLFrameElement_Create},
94 {L"FRAMESET", HTMLElement_Ctor},
95 {L"H1", HTMLElement_Ctor},
96 {L"H2", HTMLElement_Ctor},
97 {L"H3", HTMLElement_Ctor},
98 {L"H4", HTMLElement_Ctor},
99 {L"H5", HTMLElement_Ctor},
100 {L"H6", HTMLElement_Ctor},
101 {L"HEAD", HTMLHeadElement_Create},
102 {L"HEADER", HTMLElement_Ctor},
103 {L"HR", HTMLElement_Ctor},
104 {L"HTML", HTMLHtmlElement_Create},
105 {L"I", HTMLElement_Ctor},
106 {L"IFRAME", HTMLIFrame_Create},
107 {L"IMG", HTMLImgElement_Create},
108 {L"INPUT", HTMLInputElement_Create},
109 {L"INS", HTMLElement_Ctor},
110 {L"KBD", HTMLElement_Ctor},
111 {L"LABEL", HTMLLabelElement_Create},
112 {L"LEGEND", HTMLElement_Ctor},
113 {L"LI", HTMLElement_Ctor},
114 {L"LINK", HTMLLinkElement_Create},
115 {L"MAP", HTMLElement_Ctor},
116 {L"MARK", HTMLElement_Ctor},
117 {L"META", HTMLMetaElement_Create},
118 {L"NAV", HTMLElement_Ctor},
119 {L"NOFRAMES", HTMLElement_Ctor},
120 {L"NOSCRIPT", HTMLElement_Ctor},
121 {L"OBJECT", HTMLObjectElement_Create},
122 {L"OL", HTMLElement_Ctor},
123 {L"OPTGROUP", HTMLElement_Ctor},
124 {L"OPTION", HTMLOptionElement_Create},
125 {L"P", HTMLElement_Ctor},
126 {L"PARAM", HTMLElement_Ctor},
127 {L"PRE", HTMLElement_Ctor},
128 {L"PROGRESS", HTMLElement_Ctor},
129 {L"Q", HTMLElement_Ctor},
130 {L"RP", HTMLElement_Ctor},
131 {L"RT", HTMLElement_Ctor},
132 {L"RUBY", HTMLElement_Ctor},
133 {L"S", HTMLElement_Ctor},
134 {L"SAMP", HTMLElement_Ctor},
135 {L"SCRIPT", HTMLScriptElement_Create},
136 {L"SECTION", HTMLElement_Ctor},
137 {L"SELECT", HTMLSelectElement_Create},
138 {L"SMALL", HTMLElement_Ctor},
139 {L"SOURCE", HTMLElement_Ctor},
140 {L"SPAN", HTMLElement_Ctor},
141 {L"STRIKE", HTMLElement_Ctor},
142 {L"STRONG", HTMLElement_Ctor},
143 {L"STYLE", HTMLStyleElement_Create},
144 {L"SUB", HTMLElement_Ctor},
145 {L"SUP", HTMLElement_Ctor},
146 {L"TABLE", HTMLTable_Create},
147 {L"TBODY", HTMLElement_Ctor},
148 {L"TD", HTMLTableCell_Create},
149 {L"TEXTAREA", HTMLTextAreaElement_Create},
150 {L"TFOOT", HTMLElement_Ctor},
151 {L"TH", HTMLElement_Ctor},
152 {L"THEAD", HTMLElement_Ctor},
153 {L"TITLE", HTMLTitleElement_Create},
154 {L"TR", HTMLTableRow_Create},
155 {L"TRACK", HTMLElement_Ctor},
156 {L"TT", HTMLElement_Ctor},
157 {L"U", HTMLElement_Ctor},
158 {L"UL", HTMLElement_Ctor},
159 {L"VAR", HTMLElement_Ctor},
160 {L"VIDEO", HTMLElement_Ctor},
161 {L"WBR", HTMLElement_Ctor}
164 static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
166 DWORD min=0, max=ARRAY_SIZE(tag_descs)-1, i;
167 int r;
169 while(min <= max) {
170 i = (min+max)/2;
171 r = wcscmp(tag_name, tag_descs[i].name);
172 if(!r)
173 return tag_descs+i;
175 if(r < 0)
176 max = i-1;
177 else
178 min = i+1;
181 return NULL;
184 HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
186 nsIDOMDocumentFragment *nsfragment;
187 nsIDOMNode *nsparent;
188 nsIDOMRange *range;
189 nsAString html_str;
190 nsresult nsres;
191 HRESULT hres = S_OK;
193 nsres = nsIDOMHTMLDocument_CreateRange(nsdoc, &range);
194 if(NS_FAILED(nsres)) {
195 ERR("CreateRange failed: %08x\n", nsres);
196 return E_FAIL;
199 nsAString_InitDepend(&html_str, html);
200 nsIDOMRange_CreateContextualFragment(range, &html_str, &nsfragment);
201 nsIDOMRange_Release(range);
202 nsAString_Finish(&html_str);
203 if(NS_FAILED(nsres)) {
204 ERR("CreateContextualFragment failed: %08x\n", nsres);
205 return E_FAIL;
208 nsres = nsIDOMNode_GetParentNode(nsnode, &nsparent);
209 if(NS_SUCCEEDED(nsres) && nsparent) {
210 nsIDOMNode *nstmp;
212 nsres = nsIDOMNode_ReplaceChild(nsparent, (nsIDOMNode*)nsfragment, nsnode, &nstmp);
213 nsIDOMNode_Release(nsparent);
214 if(NS_FAILED(nsres)) {
215 ERR("ReplaceChild failed: %08x\n", nsres);
216 hres = E_FAIL;
217 }else if(nstmp) {
218 nsIDOMNode_Release(nstmp);
220 }else {
221 ERR("GetParentNode failed: %08x\n", nsres);
222 hres = E_FAIL;
225 nsIDOMDocumentFragment_Release(nsfragment);
226 return hres;
229 nsresult get_elem_attr_value(nsIDOMElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
231 nsAString name_str;
232 nsresult nsres;
234 nsAString_InitDepend(&name_str, name);
235 nsAString_Init(val_str, NULL);
236 nsres = nsIDOMElement_GetAttribute(nselem, &name_str, val_str);
237 nsAString_Finish(&name_str);
238 if(NS_FAILED(nsres)) {
239 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name), nsres);
240 nsAString_Finish(val_str);
241 return nsres;
244 nsAString_GetData(val_str, val);
245 return NS_OK;
248 HRESULT elem_string_attr_getter(HTMLElement *elem, const WCHAR *name, BOOL use_null, BSTR *p)
250 const PRUnichar *val;
251 nsAString val_str;
252 nsresult nsres;
253 HRESULT hres = S_OK;
255 nsres = get_elem_attr_value(elem->dom_element, name, &val_str, &val);
256 if(NS_FAILED(nsres))
257 return E_FAIL;
259 TRACE("%s: returning %s\n", debugstr_w(name), debugstr_w(val));
261 if(*val || !use_null) {
262 *p = SysAllocString(val);
263 if(!*p)
264 hres = E_OUTOFMEMORY;
265 }else {
266 *p = NULL;
268 nsAString_Finish(&val_str);
269 return hres;
272 HRESULT elem_string_attr_setter(HTMLElement *elem, const WCHAR *name, const WCHAR *value)
274 nsAString name_str, val_str;
275 nsresult nsres;
277 nsAString_InitDepend(&name_str, name);
278 nsAString_InitDepend(&val_str, value);
279 nsres = nsIDOMElement_SetAttribute(elem->dom_element, &name_str, &val_str);
280 nsAString_Finish(&name_str);
281 nsAString_Finish(&val_str);
283 if(NS_FAILED(nsres)) {
284 WARN("SetAttribute failed: %08x\n", nsres);
285 return E_FAIL;
288 return S_OK;
291 static VARIANT_BOOL element_has_attribute(HTMLElement *element, const WCHAR *name)
293 nsAString name_str;
294 cpp_bool r;
295 nsresult nsres;
297 if(!element->dom_element) {
298 WARN("no DOM element\n");
299 return VARIANT_FALSE;
302 nsAString_InitDepend(&name_str, name);
303 nsres = nsIDOMElement_HasAttribute(element->dom_element, &name_str, &r);
304 return variant_bool(NS_SUCCEEDED(nsres) && r);
307 static HRESULT element_remove_attribute(HTMLElement *element, const WCHAR *name)
309 nsAString name_str;
310 nsresult nsres;
312 if(!element->dom_element) {
313 WARN("no DOM element\n");
314 return S_OK;
317 nsAString_InitDepend(&name_str, name);
318 nsres = nsIDOMElement_RemoveAttribute(element->dom_element, &name_str);
319 nsAString_Finish(&name_str);
320 return map_nsresult(nsres);
323 HRESULT get_readystate_string(READYSTATE readystate, BSTR *p)
325 static const LPCWSTR readystate_strs[] = {
326 L"uninitialized",
327 L"loading",
328 L"loaded",
329 L"interactive",
330 L"complete"
333 assert(readystate <= READYSTATE_COMPLETE);
334 *p = SysAllocString(readystate_strs[readystate]);
335 return *p ? S_OK : E_OUTOFMEMORY;
338 typedef struct
340 DispatchEx dispex;
341 IHTMLFiltersCollection IHTMLFiltersCollection_iface;
343 LONG ref;
344 } HTMLFiltersCollection;
346 static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection *iface)
348 return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface);
351 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret);
353 static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface)
355 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement_iface);
358 static HRESULT copy_nselem_attrs(nsIDOMElement *nselem_with_attrs, nsIDOMElement *nselem)
360 nsIDOMMozNamedAttrMap *attrs;
361 nsAString name_str, val_str;
362 nsresult nsres, nsres2;
363 nsIDOMAttr *attr;
364 UINT32 i, length;
366 nsres = nsIDOMElement_GetAttributes(nselem_with_attrs, &attrs);
367 if(NS_FAILED(nsres))
368 return E_FAIL;
370 nsres = nsIDOMMozNamedAttrMap_GetLength(attrs, &length);
371 if(NS_FAILED(nsres)) {
372 nsIDOMMozNamedAttrMap_Release(attrs);
373 return E_FAIL;
376 nsAString_Init(&name_str, NULL);
377 nsAString_Init(&val_str, NULL);
378 for(i = 0; i < length; i++) {
379 nsres = nsIDOMMozNamedAttrMap_Item(attrs, i, &attr);
380 if(NS_FAILED(nsres))
381 continue;
383 nsres = nsIDOMAttr_GetNodeName(attr, &name_str);
384 nsres2 = nsIDOMAttr_GetNodeValue(attr, &val_str);
385 nsIDOMAttr_Release(attr);
386 if(NS_FAILED(nsres) || NS_FAILED(nsres2))
387 continue;
389 nsIDOMElement_SetAttribute(nselem, &name_str, &val_str);
391 nsAString_Finish(&name_str);
392 nsAString_Finish(&val_str);
394 nsIDOMMozNamedAttrMap_Release(attrs);
395 return S_OK;
398 static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **ret)
400 static const WCHAR prefix[4] = L"<FOO";
401 nsIDOMDocumentFragment *nsfragment;
402 WCHAR *p = wcschr(tag + 1, '>');
403 UINT32 i, name_len, size;
404 nsIDOMElement *nselem;
405 nsIDOMRange *nsrange;
406 nsIDOMNode *nsnode;
407 nsresult nsres;
408 nsAString str;
409 HRESULT hres;
411 if(!p || p[1] || wcschr(tag + 1, '<'))
412 return E_FAIL;
413 if(!doc->nsdoc) {
414 WARN("NULL nsdoc\n");
415 return E_UNEXPECTED;
418 /* Ignore the starting token and > or /> end token */
419 name_len = p - tag - 1 - (p[-1] == '/');
421 /* Get the tag name using HTML whitespace rules */
422 for(i = 1; i <= name_len; i++) {
423 if((tag[i] >= 0x09 && tag[i] <= 0x0d) || tag[i] == ' ') {
424 name_len = i - 1;
425 break;
428 if(!name_len)
429 return E_FAIL;
430 size = (p + 2 - (tag + 1 + name_len)) * sizeof(WCHAR);
432 /* Parse the input via a contextual fragment, using a dummy unknown tag */
433 nsres = nsIDOMHTMLDocument_CreateRange(doc->nsdoc, &nsrange);
434 if(NS_FAILED(nsres))
435 return map_nsresult(nsres);
437 if(!(p = heap_alloc(sizeof(prefix) + size))) {
438 nsIDOMRange_Release(nsrange);
439 return E_OUTOFMEMORY;
441 memcpy(p, prefix, sizeof(prefix));
442 memcpy(p + ARRAY_SIZE(prefix), tag + 1 + name_len, size);
444 nsAString_InitDepend(&str, p);
445 nsIDOMRange_CreateContextualFragment(nsrange, &str, &nsfragment);
446 nsIDOMRange_Release(nsrange);
447 nsAString_Finish(&str);
448 heap_free(p);
449 if(NS_FAILED(nsres))
450 return map_nsresult(nsres);
452 /* Grab the parsed element and copy its attributes into the proper element */
453 nsres = nsIDOMDocumentFragment_GetFirstChild(nsfragment, &nsnode);
454 nsIDOMDocumentFragment_Release(nsfragment);
455 if(NS_FAILED(nsres) || !nsnode)
456 return E_FAIL;
458 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
459 nsIDOMNode_Release(nsnode);
460 if(NS_FAILED(nsres))
461 return E_FAIL;
463 if(!(p = heap_alloc((name_len + 1) * sizeof(WCHAR))))
464 hres = E_OUTOFMEMORY;
465 else {
466 memcpy(p, tag + 1, name_len * sizeof(WCHAR));
467 p[name_len] = '\0';
469 nsAString_InitDepend(&str, p);
470 nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &str, ret);
471 nsAString_Finish(&str);
472 heap_free(p);
474 if(NS_FAILED(nsres))
475 hres = map_nsresult(nsres);
476 else {
477 hres = copy_nselem_attrs(nselem, *ret);
478 if(FAILED(hres))
479 nsIDOMElement_Release(*ret);
482 nsIDOMElement_Release(nselem);
483 return hres;
486 HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **ret)
488 nsAString tag_str;
489 nsresult nsres;
491 if(!doc->nsdoc) {
492 WARN("NULL nsdoc\n");
493 return E_UNEXPECTED;
496 nsAString_InitDepend(&tag_str, tag);
497 nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
498 nsAString_Finish(&tag_str);
499 if(NS_FAILED(nsres)) {
500 ERR("CreateElement failed: %08x\n", nsres);
501 return E_FAIL;
504 return S_OK;
507 HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **ret)
509 nsIDOMElement *nselem;
510 HRESULT hres;
512 /* Use owner doc if called on document fragment */
513 if(!doc->nsdoc)
514 doc = doc->node.doc;
516 /* IE8 and below allow creating elements with attributes, such as <div class="a"> */
517 if(tag[0] == '<' && dispex_compat_mode(&doc->node.event_target.dispex) <= COMPAT_MODE_IE8)
518 hres = create_nselem_parse(doc, tag, &nselem);
519 else
520 hres = create_nselem(doc, tag, &nselem);
521 if(FAILED(hres))
522 return hres;
524 hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, TRUE, ret);
525 nsIDOMElement_Release(nselem);
526 return hres;
529 typedef struct {
530 DispatchEx dispex;
531 IHTMLRect IHTMLRect_iface;
533 LONG ref;
535 nsIDOMClientRect *nsrect;
536 } HTMLRect;
538 static inline HTMLRect *impl_from_IHTMLRect(IHTMLRect *iface)
540 return CONTAINING_RECORD(iface, HTMLRect, IHTMLRect_iface);
543 static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, void **ppv)
545 HTMLRect *This = impl_from_IHTMLRect(iface);
547 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
549 if(IsEqualGUID(&IID_IUnknown, riid)) {
550 *ppv = &This->IHTMLRect_iface;
551 }else if(IsEqualGUID(&IID_IHTMLRect, riid)) {
552 *ppv = &This->IHTMLRect_iface;
553 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
554 return *ppv ? S_OK : E_NOINTERFACE;
555 }else {
556 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
557 *ppv = NULL;
558 return E_NOINTERFACE;
561 IUnknown_AddRef((IUnknown*)*ppv);
562 return S_OK;
565 static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
567 HTMLRect *This = impl_from_IHTMLRect(iface);
568 LONG ref = InterlockedIncrement(&This->ref);
570 TRACE("(%p) ref=%d\n", This, ref);
572 return ref;
575 static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
577 HTMLRect *This = impl_from_IHTMLRect(iface);
578 LONG ref = InterlockedDecrement(&This->ref);
580 TRACE("(%p) ref=%d\n", This, ref);
582 if(!ref) {
583 if(This->nsrect)
584 nsIDOMClientRect_Release(This->nsrect);
585 release_dispex(&This->dispex);
586 heap_free(This);
589 return ref;
592 static HRESULT WINAPI HTMLRect_GetTypeInfoCount(IHTMLRect *iface, UINT *pctinfo)
594 HTMLRect *This = impl_from_IHTMLRect(iface);
595 FIXME("(%p)->(%p)\n", This, pctinfo);
596 return E_NOTIMPL;
599 static HRESULT WINAPI HTMLRect_GetTypeInfo(IHTMLRect *iface, UINT iTInfo,
600 LCID lcid, ITypeInfo **ppTInfo)
602 HTMLRect *This = impl_from_IHTMLRect(iface);
604 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
607 static HRESULT WINAPI HTMLRect_GetIDsOfNames(IHTMLRect *iface, REFIID riid,
608 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
610 HTMLRect *This = impl_from_IHTMLRect(iface);
612 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
613 lcid, rgDispId);
616 static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
617 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
618 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
620 HTMLRect *This = impl_from_IHTMLRect(iface);
622 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
623 pDispParams, pVarResult, pExcepInfo, puArgErr);
626 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
628 HTMLRect *This = impl_from_IHTMLRect(iface);
629 FIXME("(%p)->(%d)\n", This, v);
630 return E_NOTIMPL;
633 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
635 HTMLRect *This = impl_from_IHTMLRect(iface);
636 float left;
637 nsresult nsres;
639 TRACE("(%p)->(%p)\n", This, p);
641 nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
642 if(NS_FAILED(nsres)) {
643 ERR("GetLeft failed: %08x\n", nsres);
644 return E_FAIL;
647 *p = floor(left+0.5);
648 return S_OK;
651 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
653 HTMLRect *This = impl_from_IHTMLRect(iface);
654 FIXME("(%p)->(%d)\n", This, v);
655 return E_NOTIMPL;
658 static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
660 HTMLRect *This = impl_from_IHTMLRect(iface);
661 float top;
662 nsresult nsres;
664 TRACE("(%p)->(%p)\n", This, p);
666 nsres = nsIDOMClientRect_GetTop(This->nsrect, &top);
667 if(NS_FAILED(nsres)) {
668 ERR("GetTop failed: %08x\n", nsres);
669 return E_FAIL;
672 *p = floor(top+0.5);
673 return S_OK;
676 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
678 HTMLRect *This = impl_from_IHTMLRect(iface);
679 FIXME("(%p)->(%d)\n", This, v);
680 return E_NOTIMPL;
683 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
685 HTMLRect *This = impl_from_IHTMLRect(iface);
686 float right;
687 nsresult nsres;
689 TRACE("(%p)->(%p)\n", This, p);
691 nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
692 if(NS_FAILED(nsres)) {
693 ERR("GetRight failed: %08x\n", nsres);
694 return E_FAIL;
697 *p = floor(right+0.5);
698 return S_OK;
701 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
703 HTMLRect *This = impl_from_IHTMLRect(iface);
704 FIXME("(%p)->(%d)\n", This, v);
705 return E_NOTIMPL;
708 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
710 HTMLRect *This = impl_from_IHTMLRect(iface);
711 float bottom;
712 nsresult nsres;
714 TRACE("(%p)->(%p)\n", This, p);
716 nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
717 if(NS_FAILED(nsres)) {
718 ERR("GetBottom failed: %08x\n", nsres);
719 return E_FAIL;
722 *p = floor(bottom+0.5);
723 return S_OK;
726 static const IHTMLRectVtbl HTMLRectVtbl = {
727 HTMLRect_QueryInterface,
728 HTMLRect_AddRef,
729 HTMLRect_Release,
730 HTMLRect_GetTypeInfoCount,
731 HTMLRect_GetTypeInfo,
732 HTMLRect_GetIDsOfNames,
733 HTMLRect_Invoke,
734 HTMLRect_put_left,
735 HTMLRect_get_left,
736 HTMLRect_put_top,
737 HTMLRect_get_top,
738 HTMLRect_put_right,
739 HTMLRect_get_right,
740 HTMLRect_put_bottom,
741 HTMLRect_get_bottom
744 static const tid_t HTMLRect_iface_tids[] = {
745 IHTMLRect_tid,
748 static dispex_static_data_t HTMLRect_dispex = {
749 L"ClientRect",
750 NULL,
751 IHTMLRect_tid,
752 HTMLRect_iface_tids
755 static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_mode, IHTMLRect **ret)
757 HTMLRect *rect;
759 rect = heap_alloc_zero(sizeof(HTMLRect));
760 if(!rect)
761 return E_OUTOFMEMORY;
763 rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl;
764 rect->ref = 1;
766 init_dispatch(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex, compat_mode);
768 nsIDOMClientRect_AddRef(nsrect);
769 rect->nsrect = nsrect;
771 *ret = &rect->IHTMLRect_iface;
772 return S_OK;
775 typedef struct {
776 DispatchEx dispex;
777 IHTMLRectCollection IHTMLRectCollection_iface;
779 LONG ref;
781 nsIDOMClientRectList *rect_list;
782 } HTMLRectCollection;
784 static inline HTMLRectCollection *impl_from_IHTMLRectCollection(IHTMLRectCollection *iface)
786 return CONTAINING_RECORD(iface, HTMLRectCollection, IHTMLRectCollection_iface);
789 static HRESULT WINAPI HTMLRectCollection_QueryInterface(IHTMLRectCollection *iface, REFIID riid, void **ppv)
791 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
793 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
795 if(IsEqualGUID(&IID_IUnknown, riid)) {
796 *ppv = &This->IHTMLRectCollection_iface;
797 }else if(IsEqualGUID(&IID_IHTMLRectCollection, riid)) {
798 *ppv = &This->IHTMLRectCollection_iface;
799 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
800 return *ppv ? S_OK : E_NOINTERFACE;
801 }else {
802 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
803 *ppv = NULL;
804 return E_NOINTERFACE;
807 IUnknown_AddRef((IUnknown*)*ppv);
808 return S_OK;
811 static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface)
813 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
814 LONG ref = InterlockedIncrement(&This->ref);
816 TRACE("(%p) ref=%d\n", This, ref);
818 return ref;
821 static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface)
823 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
824 LONG ref = InterlockedDecrement(&This->ref);
826 TRACE("(%p) ref=%d\n", This, ref);
828 if(!ref) {
829 if(This->rect_list)
830 nsIDOMClientRectList_Release(This->rect_list);
831 release_dispex(&This->dispex);
832 heap_free(This);
835 return ref;
838 static HRESULT WINAPI HTMLRectCollection_GetTypeInfoCount(IHTMLRectCollection *iface, UINT *pctinfo)
840 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
841 FIXME("(%p)->(%p)\n", This, pctinfo);
842 return E_NOTIMPL;
845 static HRESULT WINAPI HTMLRectCollection_GetTypeInfo(IHTMLRectCollection *iface, UINT iTInfo,
846 LCID lcid, ITypeInfo **ppTInfo)
848 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
849 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
852 static HRESULT WINAPI HTMLRectCollection_GetIDsOfNames(IHTMLRectCollection *iface, REFIID riid,
853 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
855 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
856 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
857 lcid, rgDispId);
860 static HRESULT WINAPI HTMLRectCollection_Invoke(IHTMLRectCollection *iface, DISPID dispIdMember,
861 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
862 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
864 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
865 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
866 pDispParams, pVarResult, pExcepInfo, puArgErr);
869 static HRESULT WINAPI HTMLRectCollection_get_length(IHTMLRectCollection *iface, LONG *p)
871 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
872 UINT32 length;
873 nsresult nsres;
875 TRACE("(%p)->(%p)\n", This, p);
877 nsres = nsIDOMClientRectList_GetLength(This->rect_list, &length);
878 assert(nsres == NS_OK);
879 *p = length;
880 return S_OK;
883 static HRESULT WINAPI HTMLRectCollection_get__newEnum(IHTMLRectCollection *iface, IUnknown **p)
885 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
886 FIXME("(%p)->(%p)\n", This, p);
887 return E_NOTIMPL;
890 static HRESULT WINAPI HTMLRectCollection_item(IHTMLRectCollection *iface, VARIANT *index, VARIANT *result)
892 HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
893 nsIDOMClientRect *nsrect;
894 IHTMLRect *rect;
895 nsresult nsres;
896 HRESULT hres;
898 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(index), result);
900 if(V_VT(index) != VT_I4 || V_I4(index) < 0) {
901 FIXME("Unsupported for %s index\n", debugstr_variant(index));
902 return E_NOTIMPL;
905 nsres = nsIDOMClientRectList_Item(This->rect_list, V_I4(index), &nsrect);
906 if(NS_FAILED(nsres))
907 return map_nsresult(nsres);
908 if(!nsrect) {
909 V_VT(result) = VT_NULL;
910 return S_OK;
913 hres = create_html_rect(nsrect, dispex_compat_mode(&This->dispex), &rect);
914 nsIDOMClientRect_Release(nsrect);
915 if(FAILED(hres))
916 return hres;
918 V_VT(result) = VT_DISPATCH;
919 V_DISPATCH(result) = (IDispatch *)rect;
920 return S_OK;
923 static const IHTMLRectCollectionVtbl HTMLRectCollectionVtbl = {
924 HTMLRectCollection_QueryInterface,
925 HTMLRectCollection_AddRef,
926 HTMLRectCollection_Release,
927 HTMLRectCollection_GetTypeInfoCount,
928 HTMLRectCollection_GetTypeInfo,
929 HTMLRectCollection_GetIDsOfNames,
930 HTMLRectCollection_Invoke,
931 HTMLRectCollection_get_length,
932 HTMLRectCollection_get__newEnum,
933 HTMLRectCollection_item
936 static inline HTMLRectCollection *HTMLRectCollection_from_DispatchEx(DispatchEx *iface)
938 return CONTAINING_RECORD(iface, HTMLRectCollection, dispex);
941 static HRESULT HTMLRectCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
943 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
944 UINT32 len = 0;
945 DWORD idx = 0;
946 WCHAR *ptr;
948 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
949 idx = idx*10 + (*ptr-'0');
950 if(*ptr)
951 return DISP_E_UNKNOWNNAME;
953 nsIDOMClientRectList_GetLength(This->rect_list, &len);
954 if(idx >= len)
955 return DISP_E_UNKNOWNNAME;
957 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
958 TRACE("ret %x\n", *dispid);
959 return S_OK;
962 static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
963 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
965 HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
967 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
969 switch(flags) {
970 case DISPATCH_PROPERTYGET: {
971 nsIDOMClientRect *rect;
972 IHTMLRect *html_rect;
973 nsresult nsres;
974 HRESULT hres;
976 nsres = nsIDOMClientRectList_Item(This->rect_list, id - MSHTML_DISPID_CUSTOM_MIN, &rect);
977 if(NS_FAILED(nsres) || !rect) {
978 WARN("Unknown item\n");
979 return DISP_E_UNKNOWNNAME;
982 hres = create_html_rect(rect, dispex_compat_mode(&This->dispex), &html_rect);
983 nsIDOMClientRect_Release(rect);
984 if(FAILED(hres))
985 return hres;
987 V_VT(res) = VT_DISPATCH;
988 V_DISPATCH(res) = (IDispatch*)html_rect;
989 break;
992 default:
993 FIXME("unimplemented flags %x\n", flags);
994 return E_NOTIMPL;
997 return S_OK;
1000 static const dispex_static_data_vtbl_t HTMLRectCollection_dispex_vtbl = {
1001 NULL,
1002 HTMLRectCollection_get_dispid,
1003 HTMLRectCollection_invoke,
1004 NULL
1006 static const tid_t HTMLRectCollection_iface_tids[] = {
1007 IHTMLRectCollection_tid,
1010 static dispex_static_data_t HTMLRectCollection_dispex = {
1011 L"ClientRectList",
1012 &HTMLRectCollection_dispex_vtbl,
1013 IHTMLRectCollection_tid,
1014 HTMLRectCollection_iface_tids
1017 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
1018 REFIID riid, void **ppv)
1020 HTMLElement *This = impl_from_IHTMLElement(iface);
1022 return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv);
1025 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
1027 HTMLElement *This = impl_from_IHTMLElement(iface);
1029 return IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface);
1032 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
1034 HTMLElement *This = impl_from_IHTMLElement(iface);
1036 return IHTMLDOMNode_Release(&This->node.IHTMLDOMNode_iface);
1039 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
1041 HTMLElement *This = impl_from_IHTMLElement(iface);
1042 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
1045 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
1046 LCID lcid, ITypeInfo **ppTInfo)
1048 HTMLElement *This = impl_from_IHTMLElement(iface);
1049 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1052 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
1053 LPOLESTR *rgszNames, UINT cNames,
1054 LCID lcid, DISPID *rgDispId)
1056 HTMLElement *This = impl_from_IHTMLElement(iface);
1057 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1058 lcid, rgDispId);
1061 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
1062 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1063 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1065 HTMLElement *This = impl_from_IHTMLElement(iface);
1066 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
1067 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1070 static inline WCHAR *translate_attr_name(WCHAR *attr_name, compat_mode_t compat_mode)
1072 static WCHAR classNameW[] = L"className";
1073 WCHAR *ret = attr_name;
1075 if(compat_mode >= COMPAT_MODE_IE8 && !wcsicmp(attr_name, L"class"))
1076 ret = classNameW;
1077 return ret;
1080 static HRESULT set_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *v)
1082 DISPID propput_dispid = DISPID_PROPERTYPUT;
1083 DISPPARAMS dp = {v, &propput_dispid, 1, 1};
1084 EXCEPINFO ei;
1086 if(dispid == DISPID_IHTMLELEMENT_STYLE) {
1087 TRACE("Ignoring call on style attribute\n");
1088 return S_OK;
1091 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid,
1092 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
1095 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
1096 VARIANT AttributeValue, LONG lFlags)
1098 HTMLElement *This = impl_from_IHTMLElement(iface);
1099 compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex);
1100 nsAString name_str, value_str;
1101 VARIANT val = AttributeValue;
1102 BOOL needs_free = FALSE;
1103 nsresult nsres;
1104 DISPID dispid;
1105 HRESULT hres;
1107 TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
1109 if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
1110 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
1111 (lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive) | fdexNameEnsure, &dispid);
1112 if(FAILED(hres))
1113 return hres;
1115 if(compat_mode >= COMPAT_MODE_IE8 && get_dispid_type(dispid) == DISPEXPROP_BUILTIN) {
1116 if(V_VT(&val) != VT_BSTR && V_VT(&val) != VT_NULL) {
1117 LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
1119 V_VT(&val) = VT_EMPTY;
1120 hres = VariantChangeTypeEx(&val, &AttributeValue, lcid, 0, VT_BSTR);
1121 if(FAILED(hres))
1122 return hres;
1124 if(V_BSTR(&val))
1125 needs_free = TRUE;
1126 else
1127 V_VT(&val) = VT_NULL;
1131 /* className and style are special cases */
1132 if(compat_mode != COMPAT_MODE_IE8 || !This->dom_element ||
1133 (dispid != DISPID_IHTMLELEMENT_CLASSNAME && dispid != DISPID_IHTMLELEMENT_STYLE)) {
1134 hres = set_elem_attr_value_by_dispid(This, dispid, &val);
1135 goto done;
1139 hres = variant_to_nsstr(&val, FALSE, &value_str);
1140 if(FAILED(hres))
1141 goto done;
1143 nsAString_InitDepend(&name_str, strAttributeName);
1144 nsres = nsIDOMElement_SetAttribute(This->dom_element, &name_str, &value_str);
1145 nsAString_Finish(&name_str);
1146 nsAString_Finish(&value_str);
1147 if(NS_FAILED(nsres))
1148 WARN("SetAttribute failed: %08x\n", nsres);
1149 hres = map_nsresult(nsres);
1151 done:
1152 if(needs_free)
1153 SysFreeString(V_BSTR(&val));
1154 return hres;
1157 HRESULT get_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *ret)
1159 DISPPARAMS dispParams = {NULL, NULL, 0, 0};
1160 EXCEPINFO excep;
1162 return IDispatchEx_InvokeEx(&elem->node.event_target.dispex.IDispatchEx_iface, dispid, LOCALE_SYSTEM_DEFAULT,
1163 DISPATCH_PROPERTYGET, &dispParams, ret, &excep, NULL);
1166 HRESULT attr_value_to_string(VARIANT *v)
1168 HRESULT hres;
1170 switch(V_VT(v)) {
1171 case VT_BSTR:
1172 break;
1173 case VT_NULL:
1174 V_BSTR(v) = SysAllocString(L"null");
1175 if(!V_BSTR(v))
1176 return E_OUTOFMEMORY;
1177 V_VT(v) = VT_BSTR;
1178 break;
1179 case VT_DISPATCH:
1180 IDispatch_Release(V_DISPATCH(v));
1181 V_VT(v) = VT_BSTR;
1182 V_BSTR(v) = SysAllocString(NULL);
1183 break;
1184 default:
1185 hres = VariantChangeType(v, v, 0, VT_BSTR);
1186 if(FAILED(hres))
1187 return hres;
1190 return S_OK;
1193 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
1194 LONG lFlags, VARIANT *AttributeValue)
1196 HTMLElement *This = impl_from_IHTMLElement(iface);
1197 compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex);
1198 nsAString name_str, value_str;
1199 nsresult nsres;
1200 DISPID dispid;
1201 HRESULT hres;
1203 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
1205 if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
1206 FIXME("Unsupported flags %x\n", lFlags);
1208 if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
1209 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
1210 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
1211 if(FAILED(hres)) {
1212 V_VT(AttributeValue) = VT_NULL;
1213 return (hres == DISP_E_UNKNOWNNAME) ? S_OK : hres;
1216 /* className and style are special cases */
1217 if(compat_mode != COMPAT_MODE_IE8 || !This->dom_element ||
1218 (dispid != DISPID_IHTMLELEMENT_CLASSNAME && dispid != DISPID_IHTMLELEMENT_STYLE)) {
1219 hres = get_elem_attr_value_by_dispid(This, dispid, AttributeValue);
1220 if(FAILED(hres))
1221 return hres;
1223 if(compat_mode >= COMPAT_MODE_IE8 && V_VT(AttributeValue) != VT_BSTR && V_VT(AttributeValue) != VT_NULL) {
1224 LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
1226 hres = VariantChangeTypeEx(AttributeValue, AttributeValue, lcid, 0, VT_BSTR);
1227 if(FAILED(hres)) {
1228 VariantClear(AttributeValue);
1229 return hres;
1231 if(!V_BSTR(AttributeValue))
1232 V_VT(AttributeValue) = VT_NULL;
1233 }else if(lFlags & ATTRFLAG_ASSTRING)
1234 hres = attr_value_to_string(AttributeValue);
1235 return hres;
1239 nsAString_InitDepend(&name_str, strAttributeName);
1240 nsAString_InitDepend(&value_str, NULL);
1241 nsres = nsIDOMElement_GetAttribute(This->dom_element, &name_str, &value_str);
1242 nsAString_Finish(&name_str);
1243 return return_nsstr_variant(nsres, &value_str, 0, AttributeValue);
1246 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
1247 LONG lFlags, VARIANT_BOOL *pfSuccess)
1249 HTMLElement *This = impl_from_IHTMLElement(iface);
1250 compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex);
1251 DISPID id;
1252 HRESULT hres;
1254 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
1256 if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
1257 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
1258 lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &id);
1259 if(hres == DISP_E_UNKNOWNNAME) {
1260 *pfSuccess = VARIANT_FALSE;
1261 return S_OK;
1263 if(FAILED(hres))
1264 return hres;
1266 if(id == DISPID_IHTMLELEMENT_STYLE) {
1267 IHTMLStyle *style;
1269 TRACE("Special case: style\n");
1271 hres = IHTMLElement_get_style(&This->IHTMLElement_iface, &style);
1272 if(FAILED(hres))
1273 return hres;
1275 hres = IHTMLStyle_put_cssText(style, NULL);
1276 IHTMLStyle_Release(style);
1277 if(FAILED(hres))
1278 return hres;
1280 if(compat_mode >= COMPAT_MODE_IE8)
1281 element_remove_attribute(This, strAttributeName);
1283 *pfSuccess = VARIANT_TRUE;
1284 return S_OK;
1287 if(compat_mode != COMPAT_MODE_IE8 || !This->dom_element || id != DISPID_IHTMLELEMENT_CLASSNAME)
1288 return remove_attribute(&This->node.event_target.dispex, id, pfSuccess);
1291 *pfSuccess = element_has_attribute(This, strAttributeName);
1292 if(*pfSuccess)
1293 return element_remove_attribute(This, strAttributeName);
1294 return S_OK;
1297 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
1299 HTMLElement *This = impl_from_IHTMLElement(iface);
1300 nsAString classname_str;
1301 nsresult nsres;
1303 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1305 if(!This->dom_element) {
1306 FIXME("comment element\n");
1307 return E_NOTIMPL;
1310 nsAString_InitDepend(&classname_str, v);
1311 nsres = nsIDOMElement_SetClassName(This->dom_element, &classname_str);
1312 nsAString_Finish(&classname_str);
1313 if(NS_FAILED(nsres))
1314 ERR("SetClassName failed: %08x\n", nsres);
1316 return S_OK;
1319 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
1321 HTMLElement *This = impl_from_IHTMLElement(iface);
1322 nsAString class_str;
1323 nsresult nsres;
1325 TRACE("(%p)->(%p)\n", This, p);
1327 if(!This->dom_element) {
1328 FIXME("comment element\n");
1329 return E_NOTIMPL;
1332 nsAString_Init(&class_str, NULL);
1333 nsres = nsIDOMElement_GetClassName(This->dom_element, &class_str);
1334 return return_nsstr(nsres, &class_str, p);
1337 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
1339 HTMLElement *This = impl_from_IHTMLElement(iface);
1340 nsAString id_str;
1341 nsresult nsres;
1343 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1345 if(!This->dom_element) {
1346 FIXME("comment element\n");
1347 return S_OK;
1350 nsAString_InitDepend(&id_str, v);
1351 nsres = nsIDOMElement_SetId(This->dom_element, &id_str);
1352 nsAString_Finish(&id_str);
1353 if(NS_FAILED(nsres))
1354 ERR("SetId failed: %08x\n", nsres);
1356 return S_OK;
1359 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
1361 HTMLElement *This = impl_from_IHTMLElement(iface);
1362 nsAString id_str;
1363 nsresult nsres;
1365 TRACE("(%p)->(%p)\n", This, p);
1367 if(!This->dom_element) {
1368 *p = NULL;
1369 return S_OK;
1372 nsAString_Init(&id_str, NULL);
1373 nsres = nsIDOMElement_GetId(This->dom_element, &id_str);
1374 return return_nsstr(nsres, &id_str, p);
1377 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
1379 HTMLElement *This = impl_from_IHTMLElement(iface);
1380 nsAString tag_str;
1381 nsresult nsres;
1383 TRACE("(%p)->(%p)\n", This, p);
1385 if(!This->dom_element) {
1386 TRACE("comment element\n");
1387 *p = SysAllocString(L"!");
1388 return *p ? S_OK : E_OUTOFMEMORY;
1391 nsAString_Init(&tag_str, NULL);
1392 nsres = nsIDOMElement_GetTagName(This->dom_element, &tag_str);
1393 return return_nsstr(nsres, &tag_str, p);
1396 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
1398 HTMLElement *This = impl_from_IHTMLElement(iface);
1399 IHTMLDOMNode *node;
1400 HRESULT hres;
1402 TRACE("(%p)->(%p)\n", This, p);
1404 hres = IHTMLDOMNode_get_parentNode(&This->node.IHTMLDOMNode_iface, &node);
1405 if(FAILED(hres))
1406 return hres;
1408 if(!node) {
1409 *p = NULL;
1410 return S_OK;
1413 hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
1414 IHTMLDOMNode_Release(node);
1415 if(FAILED(hres))
1416 *p = NULL;
1418 return S_OK;
1421 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
1423 HTMLElement *This = impl_from_IHTMLElement(iface);
1425 TRACE("(%p)->(%p)\n", This, p);
1427 if(!This->style) {
1428 HRESULT hres;
1430 hres = HTMLStyle_Create(This, &This->style);
1431 if(FAILED(hres))
1432 return hres;
1435 *p = &This->style->IHTMLStyle_iface;
1436 IHTMLStyle_AddRef(*p);
1437 return S_OK;
1440 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
1442 HTMLElement *This = impl_from_IHTMLElement(iface);
1444 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1446 return set_node_event(&This->node, EVENTID_HELP, &v);
1449 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
1451 HTMLElement *This = impl_from_IHTMLElement(iface);
1453 TRACE("(%p)->(%p)\n", This, p);
1455 return get_node_event(&This->node, EVENTID_HELP, p);
1458 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
1460 HTMLElement *This = impl_from_IHTMLElement(iface);
1462 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1464 return set_node_event(&This->node, EVENTID_CLICK, &v);
1467 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
1469 HTMLElement *This = impl_from_IHTMLElement(iface);
1471 TRACE("(%p)->(%p)\n", This, p);
1473 return get_node_event(&This->node, EVENTID_CLICK, p);
1476 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
1478 HTMLElement *This = impl_from_IHTMLElement(iface);
1480 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1482 return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
1485 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
1487 HTMLElement *This = impl_from_IHTMLElement(iface);
1489 TRACE("(%p)->(%p)\n", This, p);
1491 return get_node_event(&This->node, EVENTID_DBLCLICK, p);
1494 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
1496 HTMLElement *This = impl_from_IHTMLElement(iface);
1498 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1500 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
1503 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
1505 HTMLElement *This = impl_from_IHTMLElement(iface);
1507 TRACE("(%p)->(%p)\n", This, p);
1509 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
1512 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
1514 HTMLElement *This = impl_from_IHTMLElement(iface);
1516 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1518 return set_node_event(&This->node, EVENTID_KEYUP, &v);
1521 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
1523 HTMLElement *This = impl_from_IHTMLElement(iface);
1525 TRACE("(%p)->(%p)\n", This, p);
1527 return get_node_event(&This->node, EVENTID_KEYUP, p);
1530 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
1532 HTMLElement *This = impl_from_IHTMLElement(iface);
1534 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1536 return set_node_event(&This->node, EVENTID_KEYPRESS, &v);
1539 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
1541 HTMLElement *This = impl_from_IHTMLElement(iface);
1543 TRACE("(%p)->(%p)\n", This, p);
1545 return get_node_event(&This->node, EVENTID_KEYPRESS, p);
1548 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
1550 HTMLElement *This = impl_from_IHTMLElement(iface);
1552 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1554 return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
1557 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
1559 HTMLElement *This = impl_from_IHTMLElement(iface);
1561 TRACE("(%p)->(%p)\n", This, p);
1563 return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
1566 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
1568 HTMLElement *This = impl_from_IHTMLElement(iface);
1570 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1572 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
1575 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
1577 HTMLElement *This = impl_from_IHTMLElement(iface);
1579 TRACE("(%p)->(%p)\n", This, p);
1581 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
1584 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
1586 HTMLElement *This = impl_from_IHTMLElement(iface);
1588 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1590 return set_node_event(&This->node, EVENTID_MOUSEMOVE, &v);
1593 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
1595 HTMLElement *This = impl_from_IHTMLElement(iface);
1597 TRACE("(%p)->(%p)\n", This, p);
1599 return get_node_event(&This->node, EVENTID_MOUSEMOVE, p);
1602 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
1604 HTMLElement *This = impl_from_IHTMLElement(iface);
1606 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1608 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
1611 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
1613 HTMLElement *This = impl_from_IHTMLElement(iface);
1615 TRACE("(%p)->(%p)\n", This, p);
1617 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
1620 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
1622 HTMLElement *This = impl_from_IHTMLElement(iface);
1624 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1626 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
1629 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
1631 HTMLElement *This = impl_from_IHTMLElement(iface);
1633 TRACE("(%p)->(%p)\n", This, p);
1635 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
1638 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
1640 HTMLElement *This = impl_from_IHTMLElement(iface);
1642 TRACE("(%p)->(%p)\n", This, p);
1644 if(!p)
1645 return E_POINTER;
1647 if(This->node.vtbl->get_document)
1648 return This->node.vtbl->get_document(&This->node, p);
1650 *p = (IDispatch*)&This->node.doc->basedoc.IHTMLDocument2_iface;
1651 IDispatch_AddRef(*p);
1652 return S_OK;
1655 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
1657 HTMLElement *This = impl_from_IHTMLElement(iface);
1658 nsAString title_str;
1659 nsresult nsres;
1661 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1663 if(!This->dom_element) {
1664 VARIANT *var;
1665 HRESULT hres;
1667 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", TRUE, &var);
1668 if(FAILED(hres))
1669 return hres;
1671 VariantClear(var);
1672 V_VT(var) = VT_BSTR;
1673 V_BSTR(var) = v ? SysAllocString(v) : NULL;
1674 return S_OK;
1677 if(!This->html_element)
1678 return elem_string_attr_setter(This, L"title", v);
1680 nsAString_InitDepend(&title_str, v);
1681 nsres = nsIDOMHTMLElement_SetTitle(This->html_element, &title_str);
1682 nsAString_Finish(&title_str);
1683 if(NS_FAILED(nsres))
1684 ERR("SetTitle failed: %08x\n", nsres);
1686 return S_OK;
1689 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
1691 HTMLElement *This = impl_from_IHTMLElement(iface);
1692 nsAString title_str;
1693 nsresult nsres;
1695 TRACE("(%p)->(%p)\n", This, p);
1697 if(!This->dom_element) {
1698 VARIANT *var;
1699 HRESULT hres;
1701 hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", FALSE, &var);
1702 if(hres == DISP_E_UNKNOWNNAME) {
1703 *p = NULL;
1704 }else if(V_VT(var) != VT_BSTR) {
1705 FIXME("title = %s\n", debugstr_variant(var));
1706 return E_FAIL;
1707 }else {
1708 *p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
1711 return S_OK;
1714 if(!This->html_element)
1715 return elem_string_attr_getter(This, L"title", FALSE, p);
1717 nsAString_Init(&title_str, NULL);
1718 nsres = nsIDOMHTMLElement_GetTitle(This->html_element, &title_str);
1719 return return_nsstr(nsres, &title_str, p);
1722 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
1724 HTMLElement *This = impl_from_IHTMLElement(iface);
1726 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1728 return elem_string_attr_setter(This, L"language", v);
1731 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
1733 HTMLElement *This = impl_from_IHTMLElement(iface);
1735 TRACE("(%p)->(%p)\n", This, p);
1737 return elem_string_attr_getter(This, L"language", TRUE, p);
1740 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
1742 HTMLElement *This = impl_from_IHTMLElement(iface);
1744 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1746 return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
1749 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
1751 HTMLElement *This = impl_from_IHTMLElement(iface);
1753 TRACE("(%p)->(%p)\n", This, p);
1755 return get_node_event(&This->node, EVENTID_SELECTSTART, p);
1758 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
1760 HTMLElement *This = impl_from_IHTMLElement(iface);
1761 cpp_bool start = TRUE;
1762 nsresult nsres;
1764 TRACE("(%p)->(%s)\n", This, debugstr_variant(&varargStart));
1766 switch(V_VT(&varargStart)) {
1767 case VT_EMPTY:
1768 case VT_ERROR:
1769 break;
1770 case VT_BOOL:
1771 start = V_BOOL(&varargStart) != VARIANT_FALSE;
1772 break;
1773 default:
1774 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart));
1777 if(!This->html_element) {
1778 FIXME("non-HTML elements\n");
1779 return E_NOTIMPL;
1782 nsres = nsIDOMHTMLElement_ScrollIntoView(This->html_element, start, 1);
1783 assert(nsres == NS_OK);
1785 return S_OK;
1788 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
1789 VARIANT_BOOL *pfResult)
1791 HTMLElement *This = impl_from_IHTMLElement(iface);
1792 cpp_bool result = FALSE;
1794 TRACE("(%p)->(%p %p)\n", This, pChild, pfResult);
1796 if(pChild) {
1797 HTMLElement *child;
1798 nsresult nsres;
1800 child = unsafe_impl_from_IHTMLElement(pChild);
1801 if(!child) {
1802 ERR("not our element\n");
1803 return E_FAIL;
1806 nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result);
1807 assert(nsres == NS_OK);
1810 *pfResult = variant_bool(result);
1811 return S_OK;
1814 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, LONG *p)
1816 HTMLElement *This = impl_from_IHTMLElement(iface);
1818 TRACE("(%p)->(%p)\n", This, p);
1820 return get_elem_source_index(This, p);
1823 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
1825 HTMLElement *This = impl_from_IHTMLElement(iface);
1826 FIXME("(%p)->(%p)\n", This, p);
1827 return E_NOTIMPL;
1830 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
1832 HTMLElement *This = impl_from_IHTMLElement(iface);
1833 nsAString nsstr;
1834 nsresult nsres;
1836 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1838 if(!This->html_element) {
1839 FIXME("non-HTML element\n");
1840 return E_NOTIMPL;
1843 nsAString_InitDepend(&nsstr, v);
1844 nsres = nsIDOMHTMLElement_SetLang(This->html_element, &nsstr);
1845 nsAString_Finish(&nsstr);
1846 if(NS_FAILED(nsres)) {
1847 ERR("SetLang failed: %08x\n", nsres);
1848 return E_FAIL;
1851 return S_OK;
1854 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
1856 HTMLElement *This = impl_from_IHTMLElement(iface);
1857 nsAString nsstr;
1858 nsresult nsres;
1860 TRACE("(%p)->(%p)\n", This, p);
1862 if(!This->html_element) {
1863 FIXME("non-HTML element\n");
1864 return E_NOTIMPL;
1867 nsAString_Init(&nsstr, NULL);
1868 nsres = nsIDOMHTMLElement_GetLang(This->html_element, &nsstr);
1869 return return_nsstr(nsres, &nsstr, p);
1872 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
1874 HTMLElement *This = impl_from_IHTMLElement(iface);
1875 nsresult nsres;
1877 TRACE("(%p)->(%p)\n", This, p);
1879 if(!This->html_element) {
1880 FIXME("non-HTML element\n");
1881 return E_NOTIMPL;
1884 nsres = nsIDOMHTMLElement_GetOffsetLeft(This->html_element, p);
1885 if(NS_FAILED(nsres)) {
1886 ERR("GetOffsetLeft failed: %08x\n", nsres);
1887 return E_FAIL;
1890 return S_OK;
1893 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
1895 HTMLElement *This = impl_from_IHTMLElement(iface);
1896 nsresult nsres;
1898 TRACE("(%p)->(%p)\n", This, p);
1900 if(!This->html_element) {
1901 FIXME("non-HTML element\n");
1902 return E_NOTIMPL;
1905 nsres = nsIDOMHTMLElement_GetOffsetTop(This->html_element, p);
1906 if(NS_FAILED(nsres)) {
1907 ERR("GetOffsetTop failed: %08x\n", nsres);
1908 return E_FAIL;
1911 return S_OK;
1914 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
1916 HTMLElement *This = impl_from_IHTMLElement(iface);
1917 nsresult nsres;
1919 TRACE("(%p)->(%p)\n", This, p);
1921 if(!This->html_element) {
1922 FIXME("non-HTML element\n");
1923 return E_NOTIMPL;
1926 nsres = nsIDOMHTMLElement_GetOffsetWidth(This->html_element, p);
1927 if(NS_FAILED(nsres)) {
1928 ERR("GetOffsetWidth failed: %08x\n", nsres);
1929 return E_FAIL;
1932 return S_OK;
1935 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
1937 HTMLElement *This = impl_from_IHTMLElement(iface);
1938 nsresult nsres;
1940 TRACE("(%p)->(%p)\n", This, p);
1942 if(!This->html_element) {
1943 FIXME("non-HTML element\n");
1944 return E_NOTIMPL;
1947 nsres = nsIDOMHTMLElement_GetOffsetHeight(This->html_element, p);
1948 if(NS_FAILED(nsres)) {
1949 ERR("GetOffsetHeight failed: %08x\n", nsres);
1950 return E_FAIL;
1953 return S_OK;
1956 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
1958 HTMLElement *This = impl_from_IHTMLElement(iface);
1959 nsIDOMElement *nsparent;
1960 HTMLElement *parent;
1961 nsresult nsres;
1962 HRESULT hres;
1964 TRACE("(%p)->(%p)\n", This, p);
1966 if(!This->html_element) {
1967 FIXME("non-HTML element\n");
1968 return E_NOTIMPL;
1971 nsres = nsIDOMHTMLElement_GetOffsetParent(This->html_element, &nsparent);
1972 if(NS_FAILED(nsres)) {
1973 ERR("GetOffsetParent failed: %08x\n", nsres);
1974 return E_FAIL;
1977 if(!nsparent) {
1978 *p = NULL;
1979 return S_OK;
1982 hres = get_element(nsparent, &parent);
1983 nsIDOMElement_Release(nsparent);
1984 if(FAILED(hres))
1985 return hres;
1987 *p = &parent->IHTMLElement_iface;
1988 return S_OK;
1991 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
1993 HTMLElement *This = impl_from_IHTMLElement(iface);
1994 nsAString html_str;
1995 nsresult nsres;
1997 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1999 if(!This->html_element) {
2000 FIXME("non-HTML element\n");
2001 return E_NOTIMPL;
2004 nsAString_InitDepend(&html_str, v);
2005 nsres = nsIDOMHTMLElement_SetInnerHTML(This->html_element, &html_str);
2006 nsAString_Finish(&html_str);
2007 if(NS_FAILED(nsres)) {
2008 FIXME("SetInnerHtml failed %08x\n", nsres);
2009 return E_FAIL;
2012 return S_OK;
2015 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
2017 HTMLElement *This = impl_from_IHTMLElement(iface);
2018 nsAString html_str;
2019 nsresult nsres;
2021 TRACE("(%p)->(%p)\n", This, p);
2023 if(!This->html_element) {
2024 FIXME("non-HTML element\n");
2025 return E_NOTIMPL;
2028 nsAString_Init(&html_str, NULL);
2029 nsres = nsIDOMHTMLElement_GetInnerHTML(This->html_element, &html_str);
2030 return return_nsstr(nsres, &html_str, p);
2033 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
2035 HTMLElement *This = impl_from_IHTMLElement(iface);
2036 nsIDOMNode *nschild, *tmp;
2037 nsIDOMText *text_node;
2038 nsAString text_str;
2039 nsresult nsres;
2041 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2043 while(1) {
2044 nsres = nsIDOMElement_GetLastChild(This->dom_element, &nschild);
2045 if(NS_FAILED(nsres)) {
2046 ERR("GetLastChild failed: %08x\n", nsres);
2047 return E_FAIL;
2049 if(!nschild)
2050 break;
2052 nsres = nsIDOMElement_RemoveChild(This->dom_element, nschild, &tmp);
2053 nsIDOMNode_Release(nschild);
2054 if(NS_FAILED(nsres)) {
2055 ERR("RemoveChild failed: %08x\n", nsres);
2056 return E_FAIL;
2058 nsIDOMNode_Release(tmp);
2061 nsAString_InitDepend(&text_str, v);
2062 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
2063 nsAString_Finish(&text_str);
2064 if(NS_FAILED(nsres)) {
2065 ERR("CreateTextNode failed: %08x\n", nsres);
2066 return E_FAIL;
2069 nsres = nsIDOMElement_AppendChild(This->dom_element, (nsIDOMNode*)text_node, &tmp);
2070 if(NS_FAILED(nsres)) {
2071 ERR("AppendChild failed: %08x\n", nsres);
2072 return E_FAIL;
2075 nsIDOMNode_Release(tmp);
2076 return S_OK;
2079 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
2081 HTMLElement *This = impl_from_IHTMLElement(iface);
2083 TRACE("(%p)->(%p)\n", This, p);
2085 return get_node_text(&This->node, p);
2088 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
2090 HTMLElement *This = impl_from_IHTMLElement(iface);
2092 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2094 return replace_node_by_html(This->node.doc->nsdoc, This->node.nsnode, v);
2097 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
2099 HTMLElement *This = impl_from_IHTMLElement(iface);
2100 nsAString html_str;
2101 HRESULT hres;
2103 WARN("(%p)->(%p) semi-stub\n", This, p);
2105 nsAString_Init(&html_str, NULL);
2106 hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
2107 if(SUCCEEDED(hres)) {
2108 const PRUnichar *html;
2110 nsAString_GetData(&html_str, &html);
2111 *p = SysAllocString(html);
2112 if(!*p)
2113 hres = E_OUTOFMEMORY;
2116 nsAString_Finish(&html_str);
2118 TRACE("ret %s\n", debugstr_w(*p));
2119 return hres;
2122 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
2124 HTMLElement *This = impl_from_IHTMLElement(iface);
2125 nsIDOMText *text_node;
2126 nsIDOMRange *range;
2127 nsAString nsstr;
2128 nsresult nsres;
2130 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
2132 if(This->node.vtbl->is_settable && !This->node.vtbl->is_settable(&This->node, DISPID_IHTMLELEMENT_OUTERTEXT)) {
2133 WARN("Called on element that does not support setting the property.\n");
2134 return 0x800a0258; /* undocumented error code */
2137 if(!This->node.doc->nsdoc) {
2138 FIXME("NULL nsdoc\n");
2139 return E_FAIL;
2142 nsAString_InitDepend(&nsstr, v);
2143 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &nsstr, &text_node);
2144 nsAString_Finish(&nsstr);
2145 if(NS_FAILED(nsres)) {
2146 ERR("CreateTextNode failed\n");
2147 return E_FAIL;
2150 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
2151 if(NS_SUCCEEDED(nsres)) {
2152 nsres = nsIDOMRange_SelectNode(range, This->node.nsnode);
2153 if(NS_SUCCEEDED(nsres))
2154 nsres = nsIDOMRange_DeleteContents(range);
2155 if(NS_SUCCEEDED(nsres))
2156 nsres = nsIDOMRange_InsertNode(range, (nsIDOMNode*)text_node);
2157 if(NS_SUCCEEDED(nsres))
2158 nsres = nsIDOMRange_SelectNodeContents(range, This->node.nsnode);
2159 if(NS_SUCCEEDED(nsres))
2160 nsres = nsIDOMRange_DeleteContents(range);
2161 nsIDOMRange_Release(range);
2163 nsIDOMText_Release(text_node);
2164 if(NS_FAILED(nsres)) {
2165 ERR("failed to set text: %08x\n", nsres);
2166 return E_FAIL;
2169 return S_OK;
2172 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
2174 HTMLElement *This = impl_from_IHTMLElement(iface);
2176 TRACE("(%p)->(%p)\n", This, p);
2178 /* getter is the same as innerText */
2179 return IHTMLElement_get_innerText(&This->IHTMLElement_iface, p);
2182 static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDOMNode *nsnode, HTMLDOMNode **ret_node)
2184 nsIDOMNode *ret_nsnode;
2185 nsresult nsres;
2186 HRESULT hres = S_OK;
2188 if (!wcsicmp(where, L"beforebegin")) {
2189 nsIDOMNode *parent;
2191 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
2192 if(NS_FAILED(nsres))
2193 return E_FAIL;
2195 if(!parent)
2196 return E_INVALIDARG;
2198 nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &ret_nsnode);
2199 nsIDOMNode_Release(parent);
2200 }else if(!wcsicmp(where, L"afterbegin")) {
2201 nsIDOMNode *first_child;
2203 nsres = nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
2204 if(NS_FAILED(nsres))
2205 return E_FAIL;
2207 nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &ret_nsnode);
2208 if(NS_FAILED(nsres))
2209 return E_FAIL;
2211 if (first_child)
2212 nsIDOMNode_Release(first_child);
2213 }else if (!wcsicmp(where, L"beforeend")) {
2214 nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &ret_nsnode);
2215 }else if (!wcsicmp(where, L"afterend")) {
2216 nsIDOMNode *next_sibling, *parent;
2218 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
2219 if(NS_FAILED(nsres))
2220 return E_FAIL;
2221 if(!parent)
2222 return E_INVALIDARG;
2224 nsres = nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
2225 if(NS_SUCCEEDED(nsres)) {
2226 if(next_sibling) {
2227 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &ret_nsnode);
2228 nsIDOMNode_Release(next_sibling);
2229 }else {
2230 nsres = nsIDOMNode_AppendChild(parent, nsnode, &ret_nsnode);
2234 nsIDOMNode_Release(parent);
2235 }else {
2236 ERR("invalid where: %s\n", debugstr_w(where));
2237 return E_INVALIDARG;
2240 if (NS_FAILED(nsres))
2241 return E_FAIL;
2243 if(ret_node)
2244 hres = get_node(ret_nsnode, TRUE, ret_node);
2245 nsIDOMNode_Release(ret_nsnode);
2246 return hres;
2249 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
2250 BSTR html)
2252 HTMLElement *This = impl_from_IHTMLElement(iface);
2253 nsIDOMRange *range;
2254 nsIDOMNode *nsnode;
2255 nsAString ns_html;
2256 nsresult nsres;
2257 HRESULT hr;
2259 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
2261 if(!This->node.doc->nsdoc) {
2262 WARN("NULL nsdoc\n");
2263 return E_UNEXPECTED;
2266 nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
2267 if(NS_FAILED(nsres))
2269 ERR("CreateRange failed: %08x\n", nsres);
2270 return E_FAIL;
2273 nsIDOMRange_SetStartBefore(range, This->node.nsnode);
2275 nsAString_InitDepend(&ns_html, html);
2276 nsres = nsIDOMRange_CreateContextualFragment(range, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
2277 nsAString_Finish(&ns_html);
2278 nsIDOMRange_Release(range);
2280 if(NS_FAILED(nsres) || !nsnode)
2282 ERR("CreateTextNode failed: %08x\n", nsres);
2283 return E_FAIL;
2286 hr = insert_adjacent_node(This, where, nsnode, NULL);
2287 nsIDOMNode_Release(nsnode);
2288 return hr;
2291 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
2292 BSTR text)
2294 HTMLElement *This = impl_from_IHTMLElement(iface);
2295 nsIDOMNode *nsnode;
2296 nsAString ns_text;
2297 nsresult nsres;
2298 HRESULT hr;
2300 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
2302 if(!This->node.doc->nsdoc) {
2303 WARN("NULL nsdoc\n");
2304 return E_UNEXPECTED;
2308 nsAString_InitDepend(&ns_text, text);
2309 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
2310 nsAString_Finish(&ns_text);
2312 if(NS_FAILED(nsres) || !nsnode)
2314 ERR("CreateTextNode failed: %08x\n", nsres);
2315 return E_FAIL;
2318 hr = insert_adjacent_node(This, where, nsnode, NULL);
2319 nsIDOMNode_Release(nsnode);
2321 return hr;
2324 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
2326 HTMLElement *This = impl_from_IHTMLElement(iface);
2327 FIXME("(%p)->(%p)\n", This, p);
2328 return E_NOTIMPL;
2331 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
2333 HTMLElement *This = impl_from_IHTMLElement(iface);
2335 TRACE("(%p)->(%p)\n", This, p);
2337 *p = variant_bool(This->node.vtbl->is_text_edit && This->node.vtbl->is_text_edit(&This->node));
2338 return S_OK;
2341 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
2343 HTMLElement *This = impl_from_IHTMLElement(iface);
2344 nsresult nsres;
2346 TRACE("(%p)\n", This);
2348 if(!This->html_element) {
2349 FIXME("non-HTML element\n");
2350 return E_NOTIMPL;
2353 nsres = nsIDOMHTMLElement_Click(This->html_element);
2354 if(NS_FAILED(nsres)) {
2355 ERR("Click failed: %08x\n", nsres);
2356 return E_FAIL;
2359 return S_OK;
2362 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, IHTMLFiltersCollection **p)
2364 HTMLElement *This = impl_from_IHTMLElement(iface);
2366 TRACE("(%p)->(%p)\n", This, p);
2368 if(!p)
2369 return E_POINTER;
2371 return create_filters_collection(dispex_compat_mode(&This->node.event_target.dispex), p);
2374 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
2376 HTMLElement *This = impl_from_IHTMLElement(iface);
2378 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2380 return set_node_event(&This->node, EVENTID_DRAGSTART, &v);
2383 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
2385 HTMLElement *This = impl_from_IHTMLElement(iface);
2387 TRACE("(%p)->(%p)\n", This, p);
2389 return get_node_event(&This->node, EVENTID_DRAGSTART, p);
2392 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
2394 HTMLElement *This = impl_from_IHTMLElement(iface);
2395 HRESULT hres;
2396 VARIANT var;
2398 TRACE("(%p)->(%p)\n", This, String);
2400 if(!String)
2401 return E_INVALIDARG;
2403 hres = IDispatchEx_InvokeEx(&This->node.event_target.dispex.IDispatchEx_iface, DISPID_VALUE,
2404 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, NULL, &var, NULL, NULL);
2405 if(SUCCEEDED(hres)) {
2406 assert(V_VT(&var) == VT_BSTR);
2407 *String = V_BSTR(&var);
2409 return hres;
2412 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
2414 HTMLElement *This = impl_from_IHTMLElement(iface);
2415 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2416 return E_NOTIMPL;
2419 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
2421 HTMLElement *This = impl_from_IHTMLElement(iface);
2422 FIXME("(%p)->(%p)\n", This, p);
2423 return E_NOTIMPL;
2426 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
2428 HTMLElement *This = impl_from_IHTMLElement(iface);
2429 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2430 return E_NOTIMPL;
2433 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
2435 HTMLElement *This = impl_from_IHTMLElement(iface);
2436 FIXME("(%p)->(%p)\n", This, p);
2437 return E_NOTIMPL;
2440 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
2442 HTMLElement *This = impl_from_IHTMLElement(iface);
2443 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2444 return E_NOTIMPL;
2447 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
2449 HTMLElement *This = impl_from_IHTMLElement(iface);
2450 FIXME("(%p)->(%p)\n", This, p);
2451 return E_NOTIMPL;
2454 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
2456 HTMLElement *This = impl_from_IHTMLElement(iface);
2457 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2458 return E_NOTIMPL;
2461 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
2463 HTMLElement *This = impl_from_IHTMLElement(iface);
2464 FIXME("(%p)->(%p)\n", This, p);
2465 return E_NOTIMPL;
2468 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
2470 HTMLElement *This = impl_from_IHTMLElement(iface);
2471 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2472 return E_NOTIMPL;
2475 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
2477 HTMLElement *This = impl_from_IHTMLElement(iface);
2478 FIXME("(%p)->(%p)\n", This, p);
2479 return E_NOTIMPL;
2482 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
2484 HTMLElement *This = impl_from_IHTMLElement(iface);
2485 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2486 return E_NOTIMPL;
2489 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
2491 HTMLElement *This = impl_from_IHTMLElement(iface);
2492 FIXME("(%p)->(%p)\n", This, p);
2493 return E_NOTIMPL;
2496 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
2498 HTMLElement *This = impl_from_IHTMLElement(iface);
2500 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_variant(&v));
2502 return set_node_event(&This->node, EVENTID_DATAAVAILABLE, &v);
2505 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
2507 HTMLElement *This = impl_from_IHTMLElement(iface);
2509 TRACE("(%p)->(%p)\n", This, p);
2511 return get_node_event(&This->node, EVENTID_DATAAVAILABLE, p);
2514 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
2516 HTMLElement *This = impl_from_IHTMLElement(iface);
2517 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2518 return E_NOTIMPL;
2521 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
2523 HTMLElement *This = impl_from_IHTMLElement(iface);
2524 FIXME("(%p)->(%p)\n", This, p);
2525 return E_NOTIMPL;
2528 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
2530 HTMLElement *This = impl_from_IHTMLElement(iface);
2531 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2532 return E_NOTIMPL;
2535 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
2537 HTMLElement *This = impl_from_IHTMLElement(iface);
2538 FIXME("(%p)->(%p)\n", This, p);
2539 return E_NOTIMPL;
2542 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
2544 HTMLElement *This = impl_from_IHTMLElement(iface);
2545 nsIDOMNodeList *nsnode_list;
2546 nsresult nsres;
2548 TRACE("(%p)->(%p)\n", This, p);
2550 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
2551 if(NS_FAILED(nsres)) {
2552 ERR("GetChildNodes failed: %08x\n", nsres);
2553 return E_FAIL;
2556 *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode);
2558 nsIDOMNodeList_Release(nsnode_list);
2559 return S_OK;
2562 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
2564 HTMLElement *This = impl_from_IHTMLElement(iface);
2566 TRACE("(%p)->(%p)\n", This, p);
2568 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
2569 return S_OK;
2572 static const IHTMLElementVtbl HTMLElementVtbl = {
2573 HTMLElement_QueryInterface,
2574 HTMLElement_AddRef,
2575 HTMLElement_Release,
2576 HTMLElement_GetTypeInfoCount,
2577 HTMLElement_GetTypeInfo,
2578 HTMLElement_GetIDsOfNames,
2579 HTMLElement_Invoke,
2580 HTMLElement_setAttribute,
2581 HTMLElement_getAttribute,
2582 HTMLElement_removeAttribute,
2583 HTMLElement_put_className,
2584 HTMLElement_get_className,
2585 HTMLElement_put_id,
2586 HTMLElement_get_id,
2587 HTMLElement_get_tagName,
2588 HTMLElement_get_parentElement,
2589 HTMLElement_get_style,
2590 HTMLElement_put_onhelp,
2591 HTMLElement_get_onhelp,
2592 HTMLElement_put_onclick,
2593 HTMLElement_get_onclick,
2594 HTMLElement_put_ondblclick,
2595 HTMLElement_get_ondblclick,
2596 HTMLElement_put_onkeydown,
2597 HTMLElement_get_onkeydown,
2598 HTMLElement_put_onkeyup,
2599 HTMLElement_get_onkeyup,
2600 HTMLElement_put_onkeypress,
2601 HTMLElement_get_onkeypress,
2602 HTMLElement_put_onmouseout,
2603 HTMLElement_get_onmouseout,
2604 HTMLElement_put_onmouseover,
2605 HTMLElement_get_onmouseover,
2606 HTMLElement_put_onmousemove,
2607 HTMLElement_get_onmousemove,
2608 HTMLElement_put_onmousedown,
2609 HTMLElement_get_onmousedown,
2610 HTMLElement_put_onmouseup,
2611 HTMLElement_get_onmouseup,
2612 HTMLElement_get_document,
2613 HTMLElement_put_title,
2614 HTMLElement_get_title,
2615 HTMLElement_put_language,
2616 HTMLElement_get_language,
2617 HTMLElement_put_onselectstart,
2618 HTMLElement_get_onselectstart,
2619 HTMLElement_scrollIntoView,
2620 HTMLElement_contains,
2621 HTMLElement_get_sourceIndex,
2622 HTMLElement_get_recordNumber,
2623 HTMLElement_put_lang,
2624 HTMLElement_get_lang,
2625 HTMLElement_get_offsetLeft,
2626 HTMLElement_get_offsetTop,
2627 HTMLElement_get_offsetWidth,
2628 HTMLElement_get_offsetHeight,
2629 HTMLElement_get_offsetParent,
2630 HTMLElement_put_innerHTML,
2631 HTMLElement_get_innerHTML,
2632 HTMLElement_put_innerText,
2633 HTMLElement_get_innerText,
2634 HTMLElement_put_outerHTML,
2635 HTMLElement_get_outerHTML,
2636 HTMLElement_put_outerText,
2637 HTMLElement_get_outerText,
2638 HTMLElement_insertAdjacentHTML,
2639 HTMLElement_insertAdjacentText,
2640 HTMLElement_get_parentTextEdit,
2641 HTMLElement_get_isTextEdit,
2642 HTMLElement_click,
2643 HTMLElement_get_filters,
2644 HTMLElement_put_ondragstart,
2645 HTMLElement_get_ondragstart,
2646 HTMLElement_toString,
2647 HTMLElement_put_onbeforeupdate,
2648 HTMLElement_get_onbeforeupdate,
2649 HTMLElement_put_onafterupdate,
2650 HTMLElement_get_onafterupdate,
2651 HTMLElement_put_onerrorupdate,
2652 HTMLElement_get_onerrorupdate,
2653 HTMLElement_put_onrowexit,
2654 HTMLElement_get_onrowexit,
2655 HTMLElement_put_onrowenter,
2656 HTMLElement_get_onrowenter,
2657 HTMLElement_put_ondatasetchanged,
2658 HTMLElement_get_ondatasetchanged,
2659 HTMLElement_put_ondataavailable,
2660 HTMLElement_get_ondataavailable,
2661 HTMLElement_put_ondatasetcomplete,
2662 HTMLElement_get_ondatasetcomplete,
2663 HTMLElement_put_onfilterchange,
2664 HTMLElement_get_onfilterchange,
2665 HTMLElement_get_children,
2666 HTMLElement_get_all
2669 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement *iface)
2671 return iface->lpVtbl == &HTMLElementVtbl ? impl_from_IHTMLElement(iface) : NULL;
2674 static inline HTMLElement *impl_from_IHTMLElement2(IHTMLElement2 *iface)
2676 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement2_iface);
2679 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
2680 REFIID riid, void **ppv)
2682 HTMLElement *This = impl_from_IHTMLElement2(iface);
2683 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
2686 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
2688 HTMLElement *This = impl_from_IHTMLElement2(iface);
2689 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
2692 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
2694 HTMLElement *This = impl_from_IHTMLElement2(iface);
2695 return IHTMLElement_Release(&This->IHTMLElement_iface);
2698 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
2700 HTMLElement *This = impl_from_IHTMLElement2(iface);
2701 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
2704 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
2705 LCID lcid, ITypeInfo **ppTInfo)
2707 HTMLElement *This = impl_from_IHTMLElement2(iface);
2708 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2711 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
2712 LPOLESTR *rgszNames, UINT cNames,
2713 LCID lcid, DISPID *rgDispId)
2715 HTMLElement *This = impl_from_IHTMLElement2(iface);
2716 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2717 lcid, rgDispId);
2720 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
2721 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2722 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2724 HTMLElement *This = impl_from_IHTMLElement2(iface);
2725 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
2726 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2729 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
2731 HTMLElement *This = impl_from_IHTMLElement2(iface);
2732 FIXME("(%p)->(%p)\n", This, p);
2733 return E_NOTIMPL;
2736 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
2738 HTMLElement *This = impl_from_IHTMLElement2(iface);
2739 FIXME("(%p)->(%x)\n", This, containerCapture);
2740 return E_NOTIMPL;
2743 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
2745 HTMLElement *This = impl_from_IHTMLElement2(iface);
2746 FIXME("(%p)\n", This);
2747 return E_NOTIMPL;
2750 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
2752 HTMLElement *This = impl_from_IHTMLElement2(iface);
2753 FIXME("(%p)->()\n", This);
2754 return E_NOTIMPL;
2757 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
2759 HTMLElement *This = impl_from_IHTMLElement2(iface);
2760 FIXME("(%p)->(%p)\n", This, p);
2761 return E_NOTIMPL;
2764 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
2765 LONG x, LONG y, BSTR *component)
2767 HTMLElement *This = impl_from_IHTMLElement2(iface);
2768 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
2769 return E_NOTIMPL;
2772 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
2774 HTMLElement *This = impl_from_IHTMLElement2(iface);
2776 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
2778 if(!This->node.doc->content_ready
2779 || !This->node.doc->basedoc.doc_obj->in_place_active)
2780 return E_PENDING;
2782 WARN("stub\n");
2783 return S_OK;
2786 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
2788 HTMLElement *This = impl_from_IHTMLElement2(iface);
2790 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2792 return set_node_event(&This->node, EVENTID_SCROLL, &v);
2795 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
2797 HTMLElement *This = impl_from_IHTMLElement2(iface);
2799 TRACE("(%p)->(%p)\n", This, p);
2801 return get_node_event(&This->node, EVENTID_SCROLL, p);
2804 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
2806 HTMLElement *This = impl_from_IHTMLElement2(iface);
2808 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2810 return set_node_event(&This->node, EVENTID_DRAG, &v);
2813 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
2815 HTMLElement *This = impl_from_IHTMLElement2(iface);
2817 TRACE("(%p)->(%p)\n", This, p);
2819 return get_node_event(&This->node, EVENTID_DRAG, p);
2822 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
2824 HTMLElement *This = impl_from_IHTMLElement2(iface);
2825 FIXME("(%p)->()\n", This);
2826 return E_NOTIMPL;
2829 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
2831 HTMLElement *This = impl_from_IHTMLElement2(iface);
2832 FIXME("(%p)->(%p)\n", This, p);
2833 return E_NOTIMPL;
2836 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
2838 HTMLElement *This = impl_from_IHTMLElement2(iface);
2839 FIXME("(%p)->()\n", This);
2840 return E_NOTIMPL;
2843 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
2845 HTMLElement *This = impl_from_IHTMLElement2(iface);
2846 FIXME("(%p)->(%p)\n", This, p);
2847 return E_NOTIMPL;
2850 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
2852 HTMLElement *This = impl_from_IHTMLElement2(iface);
2853 FIXME("(%p)->()\n", This);
2854 return E_NOTIMPL;
2857 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
2859 HTMLElement *This = impl_from_IHTMLElement2(iface);
2860 FIXME("(%p)->(%p)\n", This, p);
2861 return E_NOTIMPL;
2864 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
2866 HTMLElement *This = impl_from_IHTMLElement2(iface);
2867 FIXME("(%p)->()\n", This);
2868 return E_NOTIMPL;
2871 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
2873 HTMLElement *This = impl_from_IHTMLElement2(iface);
2874 FIXME("(%p)->(%p)\n", This, p);
2875 return E_NOTIMPL;
2878 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
2880 HTMLElement *This = impl_from_IHTMLElement2(iface);
2881 FIXME("(%p)->()\n", This);
2882 return E_NOTIMPL;
2885 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
2887 HTMLElement *This = impl_from_IHTMLElement2(iface);
2888 FIXME("(%p)->(%p)\n", This, p);
2889 return E_NOTIMPL;
2892 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
2894 HTMLElement *This = impl_from_IHTMLElement2(iface);
2895 FIXME("(%p)->()\n", This);
2896 return E_NOTIMPL;
2899 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
2901 HTMLElement *This = impl_from_IHTMLElement2(iface);
2902 FIXME("(%p)->(%p)\n", This, p);
2903 return E_NOTIMPL;
2906 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
2908 HTMLElement *This = impl_from_IHTMLElement2(iface);
2909 FIXME("(%p)->()\n", This);
2910 return E_NOTIMPL;
2913 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
2915 HTMLElement *This = impl_from_IHTMLElement2(iface);
2916 FIXME("(%p)->(%p)\n", This, p);
2917 return E_NOTIMPL;
2920 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
2922 HTMLElement *This = impl_from_IHTMLElement2(iface);
2923 FIXME("(%p)->()\n", This);
2924 return E_NOTIMPL;
2927 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
2929 HTMLElement *This = impl_from_IHTMLElement2(iface);
2930 FIXME("(%p)->(%p)\n", This, p);
2931 return E_NOTIMPL;
2934 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
2936 HTMLElement *This = impl_from_IHTMLElement2(iface);
2937 FIXME("(%p)->()\n", This);
2938 return E_NOTIMPL;
2941 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
2943 HTMLElement *This = impl_from_IHTMLElement2(iface);
2944 FIXME("(%p)->(%p)\n", This, p);
2945 return E_NOTIMPL;
2948 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
2950 HTMLElement *This = impl_from_IHTMLElement2(iface);
2951 FIXME("(%p)->()\n", This);
2952 return E_NOTIMPL;
2955 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
2957 HTMLElement *This = impl_from_IHTMLElement2(iface);
2958 FIXME("(%p)->(%p)\n", This, p);
2959 return E_NOTIMPL;
2962 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
2964 HTMLElement *This = impl_from_IHTMLElement2(iface);
2966 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
2968 return set_node_event(&This->node, EVENTID_PASTE, &v);
2971 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
2973 HTMLElement *This = impl_from_IHTMLElement2(iface);
2975 TRACE("(%p)->(%p)\n", This, p);
2977 return get_node_event(&This->node, EVENTID_PASTE, p);
2980 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
2982 HTMLElement *This = impl_from_IHTMLElement2(iface);
2984 TRACE("(%p)->(%p)\n", This, p);
2986 return HTMLCurrentStyle_Create(This, p);
2989 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
2991 HTMLElement *This = impl_from_IHTMLElement2(iface);
2992 FIXME("(%p)->()\n", This);
2993 return E_NOTIMPL;
2996 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
2998 HTMLElement *This = impl_from_IHTMLElement2(iface);
2999 FIXME("(%p)->(%p)\n", This, p);
3000 return E_NOTIMPL;
3003 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
3005 HTMLElement *This = impl_from_IHTMLElement2(iface);
3006 nsIDOMClientRectList *rect_list;
3007 HTMLRectCollection *rects;
3008 nsresult nsres;
3010 TRACE("(%p)->(%p)\n", This, pRectCol);
3012 if(!This->dom_element) {
3013 FIXME("comment element\n");
3014 return E_NOTIMPL;
3017 nsres = nsIDOMElement_GetClientRects(This->dom_element, &rect_list);
3018 if(NS_FAILED(nsres)) {
3019 WARN("GetClientRects failed: %08x\n", nsres);
3020 return map_nsresult(nsres);
3023 rects = heap_alloc_zero(sizeof(*rects));
3024 if(!rects) {
3025 nsIDOMClientRectList_Release(rect_list);
3026 return E_OUTOFMEMORY;
3029 rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl;
3030 rects->ref = 1;
3031 rects->rect_list = rect_list;
3032 init_dispatch(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface,
3033 &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
3035 *pRectCol = &rects->IHTMLRectCollection_iface;
3036 return S_OK;
3039 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
3041 HTMLElement *This = impl_from_IHTMLElement2(iface);
3042 nsIDOMClientRect *nsrect;
3043 nsresult nsres;
3044 HRESULT hres;
3046 TRACE("(%p)->(%p)\n", This, pRect);
3048 if(!This->dom_element) {
3049 FIXME("comment element\n");
3050 return E_NOTIMPL;
3053 nsres = nsIDOMElement_GetBoundingClientRect(This->dom_element, &nsrect);
3054 if(NS_FAILED(nsres) || !nsrect) {
3055 ERR("GetBoindingClientRect failed: %08x\n", nsres);
3056 return E_FAIL;
3059 hres = create_html_rect(nsrect, dispex_compat_mode(&This->node.event_target.dispex), pRect);
3061 nsIDOMClientRect_Release(nsrect);
3062 return hres;
3065 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
3066 BSTR expression, BSTR language)
3068 HTMLElement *This = impl_from_IHTMLElement2(iface);
3069 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
3070 debugstr_w(language));
3071 return E_NOTIMPL;
3074 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
3075 VARIANT *expression)
3077 HTMLElement *This = impl_from_IHTMLElement2(iface);
3078 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
3079 return E_NOTIMPL;
3082 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
3083 VARIANT_BOOL *pfSuccess)
3085 HTMLElement *This = impl_from_IHTMLElement2(iface);
3086 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
3087 return E_NOTIMPL;
3090 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
3092 HTMLElement *This = impl_from_IHTMLElement2(iface);
3093 nsresult nsres;
3095 TRACE("(%p)->(%d)\n", This, v);
3097 if(!This->html_element) {
3098 FIXME("non-HTML element\n");
3099 return E_NOTIMPL;
3102 nsres = nsIDOMHTMLElement_SetTabIndex(This->html_element, v);
3103 if(NS_FAILED(nsres))
3104 ERR("GetTabIndex failed: %08x\n", nsres);
3106 return S_OK;
3109 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
3111 HTMLElement *This = impl_from_IHTMLElement2(iface);
3112 LONG index;
3113 nsresult nsres;
3115 TRACE("(%p)->(%p)\n", This, p);
3117 if(!This->html_element) {
3118 FIXME("non-HTML element\n");
3119 return E_NOTIMPL;
3122 nsres = nsIDOMHTMLElement_GetTabIndex(This->html_element, &index);
3123 if(NS_FAILED(nsres)) {
3124 ERR("GetTabIndex failed: %08x\n", nsres);
3125 return E_FAIL;
3128 *p = index;
3129 return S_OK;
3132 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
3134 HTMLElement *This = impl_from_IHTMLElement2(iface);
3135 nsresult nsres;
3137 TRACE("(%p)\n", This);
3139 if(!This->html_element) {
3140 FIXME("non-HTML element\n");
3141 return E_NOTIMPL;
3144 nsres = nsIDOMHTMLElement_Focus(This->html_element);
3145 if(NS_FAILED(nsres))
3146 ERR("Focus failed: %08x\n", nsres);
3148 return S_OK;
3151 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
3153 HTMLElement *This = impl_from_IHTMLElement2(iface);
3154 nsAString nsstr;
3155 nsresult nsres;
3157 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3159 if(!This->html_element) {
3160 FIXME("non-HTML element\n");
3161 return E_NOTIMPL;
3164 nsAString_InitDepend(&nsstr, v);
3165 nsres = nsIDOMHTMLElement_SetAccessKey(This->html_element, &nsstr);
3166 nsAString_Finish(&nsstr);
3167 return map_nsresult(nsres);
3170 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
3172 HTMLElement *This = impl_from_IHTMLElement2(iface);
3173 nsAString nsstr;
3174 nsresult nsres;
3176 TRACE("(%p)->(%p)\n", This, p);
3178 if(!This->html_element) {
3179 FIXME("non-HTML element\n");
3180 return E_NOTIMPL;
3183 nsAString_InitDepend(&nsstr, NULL);
3184 nsres = nsIDOMHTMLElement_GetAccessKey(This->html_element, &nsstr);
3185 return return_nsstr(nsres, &nsstr, p);
3188 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
3190 HTMLElement *This = impl_from_IHTMLElement2(iface);
3192 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3194 return set_node_event(&This->node, EVENTID_BLUR, &v);
3197 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
3199 HTMLElement *This = impl_from_IHTMLElement2(iface);
3201 TRACE("(%p)->(%p)\n", This, p);
3203 return get_node_event(&This->node, EVENTID_BLUR, p);
3206 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
3208 HTMLElement *This = impl_from_IHTMLElement2(iface);
3210 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3212 return set_node_event(&This->node, EVENTID_FOCUS, &v);
3215 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
3217 HTMLElement *This = impl_from_IHTMLElement2(iface);
3219 TRACE("(%p)->(%p)\n", This, p);
3221 return get_node_event(&This->node, EVENTID_FOCUS, p);
3224 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
3226 HTMLElement *This = impl_from_IHTMLElement2(iface);
3228 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3230 return set_node_event(&This->node, EVENTID_RESIZE, &v);
3233 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
3235 HTMLElement *This = impl_from_IHTMLElement2(iface);
3237 TRACE("(%p)->(%p)\n", This, p);
3239 return get_node_event(&This->node, EVENTID_RESIZE, p);
3242 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
3244 HTMLElement *This = impl_from_IHTMLElement2(iface);
3245 nsresult nsres;
3247 TRACE("(%p)\n", This);
3249 if(!This->html_element) {
3250 FIXME("non-HTML element\n");
3251 return E_NOTIMPL;
3254 nsres = nsIDOMHTMLElement_Blur(This->html_element);
3255 if(NS_FAILED(nsres)) {
3256 ERR("Blur failed: %08x\n", nsres);
3257 return E_FAIL;
3260 return S_OK;
3263 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
3265 HTMLElement *This = impl_from_IHTMLElement2(iface);
3266 FIXME("(%p)->(%p)\n", This, pUnk);
3267 return E_NOTIMPL;
3270 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
3272 HTMLElement *This = impl_from_IHTMLElement2(iface);
3273 FIXME("(%p)->(%p)\n", This, pUnk);
3274 return E_NOTIMPL;
3277 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
3279 HTMLElement *This = impl_from_IHTMLElement2(iface);
3280 nsresult nsres;
3282 TRACE("(%p)->(%p)\n", This, p);
3284 if(!This->dom_element) {
3285 FIXME("Unimplemented for comment element\n");
3286 return E_NOTIMPL;
3289 nsres = nsIDOMElement_GetClientHeight(This->dom_element, p);
3290 assert(nsres == NS_OK);
3291 return S_OK;
3294 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
3296 HTMLElement *This = impl_from_IHTMLElement2(iface);
3297 nsresult nsres;
3299 TRACE("(%p)->(%p)\n", This, p);
3301 if(!This->dom_element) {
3302 FIXME("comment element\n");
3303 return E_NOTIMPL;
3306 nsres = nsIDOMElement_GetClientWidth(This->dom_element, p);
3307 assert(nsres == NS_OK);
3308 return S_OK;
3311 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
3313 HTMLElement *This = impl_from_IHTMLElement2(iface);
3314 nsresult nsres;
3316 TRACE("(%p)->(%p)\n", This, p);
3318 if(!This->dom_element) {
3319 FIXME("comment element\n");
3320 return E_NOTIMPL;
3323 nsres = nsIDOMElement_GetClientTop(This->dom_element, p);
3324 assert(nsres == NS_OK);
3326 TRACE("*p = %d\n", *p);
3327 return S_OK;
3330 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
3332 HTMLElement *This = impl_from_IHTMLElement2(iface);
3333 nsresult nsres;
3335 TRACE("(%p)->(%p)\n", This, p);
3337 if(!This->dom_element) {
3338 FIXME("comment element\n");
3339 return E_NOTIMPL;
3342 nsres = nsIDOMElement_GetClientLeft(This->dom_element, p);
3343 assert(nsres == NS_OK);
3345 TRACE("*p = %d\n", *p);
3346 return S_OK;
3349 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
3350 IDispatch *pDisp, VARIANT_BOOL *pfResult)
3352 HTMLElement *This = impl_from_IHTMLElement2(iface);
3354 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
3356 return attach_event(&This->node.event_target, event, pDisp, pfResult);
3359 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
3361 HTMLElement *This = impl_from_IHTMLElement2(iface);
3363 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
3365 return detach_event(&This->node.event_target, event, pDisp);
3368 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
3370 HTMLElement *This = impl_from_IHTMLElement2(iface);
3371 BSTR str;
3373 TRACE("(%p)->(%p)\n", This, p);
3375 if(This->node.vtbl->get_readystate) {
3376 HRESULT hres;
3378 hres = This->node.vtbl->get_readystate(&This->node, &str);
3379 if(FAILED(hres))
3380 return hres;
3381 }else {
3382 str = SysAllocString(L"complete");
3383 if(!str)
3384 return E_OUTOFMEMORY;
3387 V_VT(p) = VT_BSTR;
3388 V_BSTR(p) = str;
3389 return S_OK;
3392 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
3394 HTMLElement *This = impl_from_IHTMLElement2(iface);
3396 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
3398 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
3401 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
3403 HTMLElement *This = impl_from_IHTMLElement2(iface);
3405 TRACE("(%p)->(%p)\n", This, p);
3407 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
3410 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
3412 HTMLElement *This = impl_from_IHTMLElement2(iface);
3413 FIXME("(%p)->()\n", This);
3414 return E_NOTIMPL;
3417 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
3419 HTMLElement *This = impl_from_IHTMLElement2(iface);
3420 FIXME("(%p)->(%p)\n", This, p);
3421 return E_NOTIMPL;
3424 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
3426 HTMLElement *This = impl_from_IHTMLElement2(iface);
3427 FIXME("(%p)->()\n", This);
3428 return E_NOTIMPL;
3431 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
3433 HTMLElement *This = impl_from_IHTMLElement2(iface);
3434 FIXME("(%p)->(%p)\n", This, p);
3435 return E_NOTIMPL;
3438 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
3440 HTMLElement *This = impl_from_IHTMLElement2(iface);
3441 FIXME("(%p)->()\n", This);
3442 return E_NOTIMPL;
3445 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
3447 HTMLElement *This = impl_from_IHTMLElement2(iface);
3448 FIXME("(%p)->(%p)\n", This, p);
3449 return E_NOTIMPL;
3452 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
3454 HTMLElement *This = impl_from_IHTMLElement2(iface);
3455 nsAString nsstr;
3456 nsresult nsres;
3458 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
3460 if(!This->html_element) {
3461 FIXME("non-HTML element\n");
3462 return S_OK;
3465 nsAString_InitDepend(&nsstr, v);
3466 nsres = nsIDOMHTMLElement_SetDir(This->html_element, &nsstr);
3467 nsAString_Finish(&nsstr);
3468 if(NS_FAILED(nsres)) {
3469 ERR("SetDir failed: %08x\n", nsres);
3470 return E_FAIL;
3473 return S_OK;
3476 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
3478 HTMLElement *This = impl_from_IHTMLElement2(iface);
3479 nsAString dir_str;
3480 nsresult nsres;
3482 TRACE("(%p)->(%p)\n", This, p);
3484 if(!This->html_element) {
3485 if(This->dom_element)
3486 FIXME("non-HTML element\n");
3487 *p = NULL;
3488 return S_OK;
3491 nsAString_Init(&dir_str, NULL);
3492 nsres = nsIDOMHTMLElement_GetDir(This->html_element, &dir_str);
3493 return return_nsstr(nsres, &dir_str, p);
3496 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
3498 HTMLElement *This = impl_from_IHTMLElement2(iface);
3499 FIXME("(%p)->(%p)\n", This, range);
3500 return E_NOTIMPL;
3503 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
3505 HTMLElement *This = impl_from_IHTMLElement2(iface);
3506 nsresult nsres;
3508 TRACE("(%p)->(%p)\n", This, p);
3510 if(!This->dom_element) {
3511 FIXME("comment element\n");
3512 return E_NOTIMPL;
3515 nsres = nsIDOMElement_GetScrollHeight(This->dom_element, p);
3516 assert(nsres == NS_OK);
3517 TRACE("*p = %d\n", *p);
3518 return S_OK;
3521 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
3523 HTMLElement *This = impl_from_IHTMLElement2(iface);
3524 nsresult nsres;
3526 TRACE("(%p)->(%p)\n", This, p);
3528 if(!This->dom_element) {
3529 FIXME("comment element\n");
3530 return E_NOTIMPL;
3533 nsres = nsIDOMElement_GetScrollWidth(This->dom_element, p);
3534 assert(nsres == NS_OK);
3536 TRACE("*p = %d\n", *p);
3537 return S_OK;
3540 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
3542 HTMLElement *This = impl_from_IHTMLElement2(iface);
3544 TRACE("(%p)->(%d)\n", This, v);
3546 if(!This->dom_element) {
3547 FIXME("comment element\n");
3548 return E_NOTIMPL;
3551 nsIDOMElement_SetScrollTop(This->dom_element, v);
3552 return S_OK;
3555 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
3557 HTMLElement *This = impl_from_IHTMLElement2(iface);
3558 nsresult nsres;
3560 TRACE("(%p)->(%p)\n", This, p);
3562 if(!This->dom_element) {
3563 FIXME("comment element\n");
3564 return E_NOTIMPL;
3567 nsres = nsIDOMElement_GetScrollTop(This->dom_element, p);
3568 assert(nsres == NS_OK);
3570 TRACE("*p = %d\n", *p);
3571 return S_OK;
3574 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
3576 HTMLElement *This = impl_from_IHTMLElement2(iface);
3578 TRACE("(%p)->(%d)\n", This, v);
3580 if(!This->dom_element) {
3581 FIXME("comment element\n");
3582 return E_NOTIMPL;
3585 nsIDOMElement_SetScrollLeft(This->dom_element, v);
3586 return S_OK;
3589 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
3591 HTMLElement *This = impl_from_IHTMLElement2(iface);
3592 nsresult nsres;
3594 TRACE("(%p)->(%p)\n", This, p);
3596 if(!p)
3597 return E_INVALIDARG;
3599 if(!This->dom_element) {
3600 FIXME("comment element\n");
3601 return E_NOTIMPL;
3604 nsres = nsIDOMElement_GetScrollLeft(This->dom_element, p);
3605 assert(nsres == NS_OK);
3606 TRACE("*p = %d\n", *p);
3607 return S_OK;
3610 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
3612 HTMLElement *This = impl_from_IHTMLElement2(iface);
3613 FIXME("(%p)\n", This);
3614 return E_NOTIMPL;
3617 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
3619 HTMLElement *This = impl_from_IHTMLElement2(iface);
3620 FIXME("(%p)->(%p)\n", This, mergeThis);
3621 return E_NOTIMPL;
3624 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
3626 HTMLElement *This = impl_from_IHTMLElement2(iface);
3628 TRACE("(%p)->()\n", This);
3630 return set_node_event(&This->node, EVENTID_CONTEXTMENU, &v);
3633 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
3635 HTMLElement *This = impl_from_IHTMLElement2(iface);
3637 TRACE("(%p)->(%p)\n", This, p);
3639 return get_node_event(&This->node, EVENTID_CONTEXTMENU, p);
3642 static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, BSTR where,
3643 IHTMLElement *insertedElement, IHTMLElement **inserted)
3645 HTMLElement *This = impl_from_IHTMLElement2(iface);
3646 HTMLDOMNode *ret_node;
3647 HTMLElement *elem;
3648 HRESULT hres;
3650 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
3652 elem = unsafe_impl_from_IHTMLElement(insertedElement);
3653 if(!elem)
3654 return E_INVALIDARG;
3656 hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node);
3657 if(FAILED(hres))
3658 return hres;
3660 hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted);
3661 IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface);
3662 return hres;
3665 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
3666 BSTR where, IHTMLElement **applied)
3668 HTMLElement *This = impl_from_IHTMLElement2(iface);
3669 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
3670 return E_NOTIMPL;
3673 static HRESULT WINAPI HTMLElement2_getAdjacentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
3675 HTMLElement *This = impl_from_IHTMLElement2(iface);
3676 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
3677 return E_NOTIMPL;
3680 static HRESULT WINAPI HTMLElement2_replaceAdjacentText(IHTMLElement2 *iface, BSTR where,
3681 BSTR newText, BSTR *oldText)
3683 HTMLElement *This = impl_from_IHTMLElement2(iface);
3684 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
3685 return E_NOTIMPL;
3688 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
3690 HTMLElement *This = impl_from_IHTMLElement2(iface);
3691 FIXME("(%p)->(%p)\n", This, p);
3692 return E_NOTIMPL;
3695 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
3696 VARIANT *pvarFactory, LONG *pCookie)
3698 HTMLElement *This = impl_from_IHTMLElement2(iface);
3699 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
3700 return E_NOTIMPL;
3703 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
3704 VARIANT_BOOL *pfResult)
3706 HTMLElement *This = impl_from_IHTMLElement2(iface);
3707 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
3708 return E_NOTIMPL;
3711 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
3713 HTMLElement *This = impl_from_IHTMLElement2(iface);
3715 FIXME("(%p)->(%p): hack\n", This, p);
3717 /* We can't implement correct behavior on top of Gecko (although we could
3718 try a bit harder). Making runtimeStyle behave like regular style is
3719 enough for most use cases. */
3720 if(!This->runtime_style) {
3721 HRESULT hres;
3723 hres = HTMLStyle_Create(This, &This->runtime_style);
3724 if(FAILED(hres))
3725 return hres;
3728 *p = &This->runtime_style->IHTMLStyle_iface;
3729 IHTMLStyle_AddRef(*p);
3730 return S_OK;
3733 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
3735 HTMLElement *This = impl_from_IHTMLElement2(iface);
3736 FIXME("(%p)->(%p)\n", This, p);
3737 return E_NOTIMPL;
3740 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
3742 HTMLElement *This = impl_from_IHTMLElement2(iface);
3743 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3744 return E_NOTIMPL;
3747 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
3749 HTMLElement *This = impl_from_IHTMLElement2(iface);
3750 FIXME("(%p)->(%p)\n", This, p);
3751 return E_NOTIMPL;
3754 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
3756 HTMLElement *This = impl_from_IHTMLElement2(iface);
3757 FIXME("(%p)->()\n", This);
3758 return E_NOTIMPL;
3761 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
3763 HTMLElement *This = impl_from_IHTMLElement2(iface);
3764 FIXME("(%p)->(%p)\n", This, p);
3765 return E_NOTIMPL;
3768 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
3770 HTMLElement *This = impl_from_IHTMLElement2(iface);
3771 FIXME("(%p)->(%p)\n", This, p);
3772 return E_NOTIMPL;
3775 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
3776 IHTMLElementCollection **pelColl)
3778 HTMLElement *This = impl_from_IHTMLElement2(iface);
3779 nsIDOMHTMLCollection *nscol;
3780 nsAString tag_str;
3781 nsresult nsres;
3783 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
3785 if(!This->dom_element) {
3786 *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode);
3787 return S_OK;
3790 nsAString_InitDepend(&tag_str, v);
3791 nsres = nsIDOMElement_GetElementsByTagName(This->dom_element, &tag_str, &nscol);
3792 nsAString_Finish(&tag_str);
3793 if(NS_FAILED(nsres)) {
3794 ERR("GetElementByTagName failed: %08x\n", nsres);
3795 return E_FAIL;
3798 *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
3799 nsIDOMHTMLCollection_Release(nscol);
3800 return S_OK;
3803 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
3804 HTMLElement2_QueryInterface,
3805 HTMLElement2_AddRef,
3806 HTMLElement2_Release,
3807 HTMLElement2_GetTypeInfoCount,
3808 HTMLElement2_GetTypeInfo,
3809 HTMLElement2_GetIDsOfNames,
3810 HTMLElement2_Invoke,
3811 HTMLElement2_get_scopeName,
3812 HTMLElement2_setCapture,
3813 HTMLElement2_releaseCapture,
3814 HTMLElement2_put_onlosecapture,
3815 HTMLElement2_get_onlosecapture,
3816 HTMLElement2_componentFromPoint,
3817 HTMLElement2_doScroll,
3818 HTMLElement2_put_onscroll,
3819 HTMLElement2_get_onscroll,
3820 HTMLElement2_put_ondrag,
3821 HTMLElement2_get_ondrag,
3822 HTMLElement2_put_ondragend,
3823 HTMLElement2_get_ondragend,
3824 HTMLElement2_put_ondragenter,
3825 HTMLElement2_get_ondragenter,
3826 HTMLElement2_put_ondragover,
3827 HTMLElement2_get_ondragover,
3828 HTMLElement2_put_ondragleave,
3829 HTMLElement2_get_ondragleave,
3830 HTMLElement2_put_ondrop,
3831 HTMLElement2_get_ondrop,
3832 HTMLElement2_put_onbeforecut,
3833 HTMLElement2_get_onbeforecut,
3834 HTMLElement2_put_oncut,
3835 HTMLElement2_get_oncut,
3836 HTMLElement2_put_onbeforecopy,
3837 HTMLElement2_get_onbeforecopy,
3838 HTMLElement2_put_oncopy,
3839 HTMLElement2_get_oncopy,
3840 HTMLElement2_put_onbeforepaste,
3841 HTMLElement2_get_onbeforepaste,
3842 HTMLElement2_put_onpaste,
3843 HTMLElement2_get_onpaste,
3844 HTMLElement2_get_currentStyle,
3845 HTMLElement2_put_onpropertychange,
3846 HTMLElement2_get_onpropertychange,
3847 HTMLElement2_getClientRects,
3848 HTMLElement2_getBoundingClientRect,
3849 HTMLElement2_setExpression,
3850 HTMLElement2_getExpression,
3851 HTMLElement2_removeExpression,
3852 HTMLElement2_put_tabIndex,
3853 HTMLElement2_get_tabIndex,
3854 HTMLElement2_focus,
3855 HTMLElement2_put_accessKey,
3856 HTMLElement2_get_accessKey,
3857 HTMLElement2_put_onblur,
3858 HTMLElement2_get_onblur,
3859 HTMLElement2_put_onfocus,
3860 HTMLElement2_get_onfocus,
3861 HTMLElement2_put_onresize,
3862 HTMLElement2_get_onresize,
3863 HTMLElement2_blur,
3864 HTMLElement2_addFilter,
3865 HTMLElement2_removeFilter,
3866 HTMLElement2_get_clientHeight,
3867 HTMLElement2_get_clientWidth,
3868 HTMLElement2_get_clientTop,
3869 HTMLElement2_get_clientLeft,
3870 HTMLElement2_attachEvent,
3871 HTMLElement2_detachEvent,
3872 HTMLElement2_get_readyState,
3873 HTMLElement2_put_onreadystatechange,
3874 HTMLElement2_get_onreadystatechange,
3875 HTMLElement2_put_onrowsdelete,
3876 HTMLElement2_get_onrowsdelete,
3877 HTMLElement2_put_onrowsinserted,
3878 HTMLElement2_get_onrowsinserted,
3879 HTMLElement2_put_oncellchange,
3880 HTMLElement2_get_oncellchange,
3881 HTMLElement2_put_dir,
3882 HTMLElement2_get_dir,
3883 HTMLElement2_createControlRange,
3884 HTMLElement2_get_scrollHeight,
3885 HTMLElement2_get_scrollWidth,
3886 HTMLElement2_put_scrollTop,
3887 HTMLElement2_get_scrollTop,
3888 HTMLElement2_put_scrollLeft,
3889 HTMLElement2_get_scrollLeft,
3890 HTMLElement2_clearAttributes,
3891 HTMLElement2_mergeAttributes,
3892 HTMLElement2_put_oncontextmenu,
3893 HTMLElement2_get_oncontextmenu,
3894 HTMLElement2_insertAdjacentElement,
3895 HTMLElement2_applyElement,
3896 HTMLElement2_getAdjacentText,
3897 HTMLElement2_replaceAdjacentText,
3898 HTMLElement2_get_canHandleChildren,
3899 HTMLElement2_addBehavior,
3900 HTMLElement2_removeBehavior,
3901 HTMLElement2_get_runtimeStyle,
3902 HTMLElement2_get_behaviorUrns,
3903 HTMLElement2_put_tagUrn,
3904 HTMLElement2_get_tagUrn,
3905 HTMLElement2_put_onbeforeeditfocus,
3906 HTMLElement2_get_onbeforeeditfocus,
3907 HTMLElement2_get_readyStateValue,
3908 HTMLElement2_getElementsByTagName,
3911 static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
3913 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
3916 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
3917 REFIID riid, void **ppv)
3919 HTMLElement *This = impl_from_IHTMLElement3(iface);
3920 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
3923 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
3925 HTMLElement *This = impl_from_IHTMLElement3(iface);
3926 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
3929 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
3931 HTMLElement *This = impl_from_IHTMLElement3(iface);
3932 return IHTMLElement_Release(&This->IHTMLElement_iface);
3935 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
3937 HTMLElement *This = impl_from_IHTMLElement3(iface);
3938 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
3941 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
3942 LCID lcid, ITypeInfo **ppTInfo)
3944 HTMLElement *This = impl_from_IHTMLElement3(iface);
3945 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
3948 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
3949 LPOLESTR *rgszNames, UINT cNames,
3950 LCID lcid, DISPID *rgDispId)
3952 HTMLElement *This = impl_from_IHTMLElement3(iface);
3953 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
3954 lcid, rgDispId);
3957 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
3958 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3959 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3961 HTMLElement *This = impl_from_IHTMLElement3(iface);
3962 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
3963 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3966 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
3968 HTMLElement *This = impl_from_IHTMLElement3(iface);
3969 FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
3970 return E_NOTIMPL;
3973 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
3975 HTMLElement *This = impl_from_IHTMLElement3(iface);
3976 FIXME("(%p)->(%p)\n", This, p);
3977 return E_NOTIMPL;
3980 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
3982 HTMLElement *This = impl_from_IHTMLElement3(iface);
3983 FIXME("(%p)->(%p)\n", This, p);
3984 return E_NOTIMPL;
3987 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
3989 HTMLElement *This = impl_from_IHTMLElement3(iface);
3990 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3991 return E_NOTIMPL;
3994 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
3996 HTMLElement *This = impl_from_IHTMLElement3(iface);
3997 FIXME("(%p)->(%p)\n", This, p);
3998 return E_NOTIMPL;
4001 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
4003 HTMLElement *This = impl_from_IHTMLElement3(iface);
4004 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4005 return E_NOTIMPL;
4008 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
4010 HTMLElement *This = impl_from_IHTMLElement3(iface);
4011 FIXME("(%p)->(%p)\n", This, p);
4012 return E_NOTIMPL;
4015 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
4017 HTMLElement *This = impl_from_IHTMLElement3(iface);
4018 FIXME("(%p)->(%x)\n", This, v);
4019 return E_NOTIMPL;
4022 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
4024 HTMLElement *This = impl_from_IHTMLElement3(iface);
4025 FIXME("(%p)->(%p)\n", This, p);
4026 return E_NOTIMPL;
4029 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
4031 HTMLElement *This = impl_from_IHTMLElement3(iface);
4032 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4033 return E_NOTIMPL;
4036 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
4038 HTMLElement *This = impl_from_IHTMLElement3(iface);
4039 FIXME("(%p)->(%p)\n", This, p);
4040 return E_NOTIMPL;
4043 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
4045 HTMLElement *This = impl_from_IHTMLElement3(iface);
4046 FIXME("(%p)\n", This);
4047 return E_NOTIMPL;
4050 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
4052 HTMLElement *This = impl_from_IHTMLElement3(iface);
4053 nsresult nsres;
4054 nsAString str;
4056 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
4058 if(!This->html_element) {
4059 FIXME("non-HTML element\n");
4060 return E_NOTIMPL;
4063 nsAString_InitDepend(&str, v);
4064 nsres = nsIDOMHTMLElement_SetContentEditable(This->html_element, &str);
4065 nsAString_Finish(&str);
4067 if (NS_FAILED(nsres)){
4068 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v));
4069 return E_FAIL;
4072 return S_OK;
4075 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
4077 HTMLElement *This = impl_from_IHTMLElement3(iface);
4078 nsresult nsres;
4079 nsAString str;
4081 TRACE("(%p)->(%p)\n", This, p);
4083 if(!This->html_element) {
4084 FIXME("non-HTML element\n");
4085 return E_NOTIMPL;
4088 nsAString_Init(&str, NULL);
4089 nsres = nsIDOMHTMLElement_GetContentEditable(This->html_element, &str);
4090 return return_nsstr(nsres, &str, p);
4093 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
4095 HTMLElement *This = impl_from_IHTMLElement3(iface);
4096 FIXME("(%p)->(%p)\n", This, p);
4097 return E_NOTIMPL;
4100 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
4102 HTMLElement *This = impl_from_IHTMLElement3(iface);
4103 FIXME("(%p)->(%x)\n", This, v);
4104 return E_NOTIMPL;
4107 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
4109 HTMLElement *This = impl_from_IHTMLElement3(iface);
4110 FIXME("(%p)->(%p)\n", This, p);
4111 return E_NOTIMPL;
4114 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
4116 HTMLElement *This = impl_from_IHTMLElement3(iface);
4118 TRACE("(%p)->(%x)\n", This, v);
4120 if(This->node.vtbl->put_disabled)
4121 return This->node.vtbl->put_disabled(&This->node, v);
4123 if(!v) return element_remove_attribute(This, L"disabled");
4124 return elem_string_attr_setter(This, L"disabled", L"");
4127 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
4129 HTMLElement *This = impl_from_IHTMLElement3(iface);
4131 TRACE("(%p)->(%p)\n", This, p);
4133 if(This->node.vtbl->get_disabled)
4134 return This->node.vtbl->get_disabled(&This->node, p);
4136 *p = variant_bool(element_has_attribute(This, L"disabled"));
4137 return S_OK;
4140 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
4142 HTMLElement *This = impl_from_IHTMLElement3(iface);
4143 FIXME("(%p)->(%p)\n", This, p);
4144 return E_NOTIMPL;
4147 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
4149 HTMLElement *This = impl_from_IHTMLElement3(iface);
4150 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4151 return E_NOTIMPL;
4154 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
4156 HTMLElement *This = impl_from_IHTMLElement3(iface);
4157 FIXME("(%p)->(%p)\n", This, p);
4158 return E_NOTIMPL;
4161 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
4163 HTMLElement *This = impl_from_IHTMLElement3(iface);
4164 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4165 return E_NOTIMPL;
4168 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
4170 HTMLElement *This = impl_from_IHTMLElement3(iface);
4171 FIXME("(%p)->(%p)\n", This, p);
4172 return E_NOTIMPL;
4175 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
4176 VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
4178 HTMLElement *This = impl_from_IHTMLElement3(iface);
4180 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
4181 pfCancelled);
4183 return fire_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
4186 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
4188 HTMLElement *This = impl_from_IHTMLElement3(iface);
4189 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4190 return E_NOTIMPL;
4193 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
4195 HTMLElement *This = impl_from_IHTMLElement3(iface);
4196 FIXME("(%p)->(%p)\n", This, p);
4197 return E_NOTIMPL;
4200 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
4202 HTMLElement *This = impl_from_IHTMLElement3(iface);
4203 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4204 return E_NOTIMPL;
4207 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
4209 HTMLElement *This = impl_from_IHTMLElement3(iface);
4210 FIXME("(%p)->(%p)\n", This, p);
4211 return E_NOTIMPL;
4214 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
4216 HTMLElement *This = impl_from_IHTMLElement3(iface);
4217 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4218 return E_NOTIMPL;
4221 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
4223 HTMLElement *This = impl_from_IHTMLElement3(iface);
4224 FIXME("(%p)->(%p)\n", This, p);
4225 return E_NOTIMPL;
4228 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
4230 HTMLElement *This = impl_from_IHTMLElement3(iface);
4231 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4232 return E_NOTIMPL;
4235 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
4237 HTMLElement *This = impl_from_IHTMLElement3(iface);
4238 FIXME("(%p)->(%p)\n", This, p);
4239 return E_NOTIMPL;
4242 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
4244 HTMLElement *This = impl_from_IHTMLElement3(iface);
4245 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4246 return E_NOTIMPL;
4249 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
4251 HTMLElement *This = impl_from_IHTMLElement3(iface);
4252 FIXME("(%p)->(%p)\n", This, p);
4253 return E_NOTIMPL;
4256 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
4258 HTMLElement *This = impl_from_IHTMLElement3(iface);
4259 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4260 return E_NOTIMPL;
4263 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
4265 HTMLElement *This = impl_from_IHTMLElement3(iface);
4266 FIXME("(%p)->(%p)\n", This, p);
4267 return E_NOTIMPL;
4270 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
4272 HTMLElement *This = impl_from_IHTMLElement3(iface);
4273 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4274 return E_NOTIMPL;
4277 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
4279 HTMLElement *This = impl_from_IHTMLElement3(iface);
4280 FIXME("(%p)->(%p)\n", This, p);
4281 return E_NOTIMPL;
4284 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
4286 HTMLElement *This = impl_from_IHTMLElement3(iface);
4287 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4288 return E_NOTIMPL;
4291 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
4293 HTMLElement *This = impl_from_IHTMLElement3(iface);
4294 FIXME("(%p)->(%p)\n", This, p);
4295 return E_NOTIMPL;
4298 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
4300 HTMLElement *This = impl_from_IHTMLElement3(iface);
4301 FIXME("(%p)->(%p)\n", This, pfRet);
4302 return E_NOTIMPL;
4305 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
4307 HTMLElement *This = impl_from_IHTMLElement3(iface);
4308 FIXME("(%p)->(%p)\n", This, p);
4309 return E_NOTIMPL;
4312 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
4313 HTMLElement3_QueryInterface,
4314 HTMLElement3_AddRef,
4315 HTMLElement3_Release,
4316 HTMLElement3_GetTypeInfoCount,
4317 HTMLElement3_GetTypeInfo,
4318 HTMLElement3_GetIDsOfNames,
4319 HTMLElement3_Invoke,
4320 HTMLElement3_mergeAttributes,
4321 HTMLElement3_get_isMultiLine,
4322 HTMLElement3_get_canHaveHTML,
4323 HTMLElement3_put_onlayoutcomplete,
4324 HTMLElement3_get_onlayoutcomplete,
4325 HTMLElement3_put_onpage,
4326 HTMLElement3_get_onpage,
4327 HTMLElement3_put_inflateBlock,
4328 HTMLElement3_get_inflateBlock,
4329 HTMLElement3_put_onbeforedeactivate,
4330 HTMLElement3_get_onbeforedeactivate,
4331 HTMLElement3_setActive,
4332 HTMLElement3_put_contentEditable,
4333 HTMLElement3_get_contentEditable,
4334 HTMLElement3_get_isContentEditable,
4335 HTMLElement3_put_hideFocus,
4336 HTMLElement3_get_hideFocus,
4337 HTMLElement3_put_disabled,
4338 HTMLElement3_get_disabled,
4339 HTMLElement3_get_isDisabled,
4340 HTMLElement3_put_onmove,
4341 HTMLElement3_get_onmove,
4342 HTMLElement3_put_oncontrolselect,
4343 HTMLElement3_get_oncontrolselect,
4344 HTMLElement3_fireEvent,
4345 HTMLElement3_put_onresizestart,
4346 HTMLElement3_get_onresizestart,
4347 HTMLElement3_put_onresizeend,
4348 HTMLElement3_get_onresizeend,
4349 HTMLElement3_put_onmovestart,
4350 HTMLElement3_get_onmovestart,
4351 HTMLElement3_put_onmoveend,
4352 HTMLElement3_get_onmoveend,
4353 HTMLElement3_put_onmousecenter,
4354 HTMLElement3_get_onmousecenter,
4355 HTMLElement3_put_onmouseleave,
4356 HTMLElement3_get_onmouseleave,
4357 HTMLElement3_put_onactivate,
4358 HTMLElement3_get_onactivate,
4359 HTMLElement3_put_ondeactivate,
4360 HTMLElement3_get_ondeactivate,
4361 HTMLElement3_dragDrop,
4362 HTMLElement3_get_glyphMode
4365 static inline HTMLElement *impl_from_IHTMLElement4(IHTMLElement4 *iface)
4367 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement4_iface);
4370 static HRESULT WINAPI HTMLElement4_QueryInterface(IHTMLElement4 *iface,
4371 REFIID riid, void **ppv)
4373 HTMLElement *This = impl_from_IHTMLElement4(iface);
4374 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4377 static ULONG WINAPI HTMLElement4_AddRef(IHTMLElement4 *iface)
4379 HTMLElement *This = impl_from_IHTMLElement4(iface);
4380 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4383 static ULONG WINAPI HTMLElement4_Release(IHTMLElement4 *iface)
4385 HTMLElement *This = impl_from_IHTMLElement4(iface);
4386 return IHTMLElement_Release(&This->IHTMLElement_iface);
4389 static HRESULT WINAPI HTMLElement4_GetTypeInfoCount(IHTMLElement4 *iface, UINT *pctinfo)
4391 HTMLElement *This = impl_from_IHTMLElement4(iface);
4392 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4395 static HRESULT WINAPI HTMLElement4_GetTypeInfo(IHTMLElement4 *iface, UINT iTInfo,
4396 LCID lcid, ITypeInfo **ppTInfo)
4398 HTMLElement *This = impl_from_IHTMLElement4(iface);
4399 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4402 static HRESULT WINAPI HTMLElement4_GetIDsOfNames(IHTMLElement4 *iface, REFIID riid,
4403 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4405 HTMLElement *This = impl_from_IHTMLElement4(iface);
4406 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4407 lcid, rgDispId);
4410 static HRESULT WINAPI HTMLElement4_Invoke(IHTMLElement4 *iface, DISPID dispIdMember, REFIID riid,
4411 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4413 HTMLElement *This = impl_from_IHTMLElement4(iface);
4414 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4415 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4418 static HRESULT WINAPI HTMLElement4_put_onmousewheel(IHTMLElement4 *iface, VARIANT v)
4420 HTMLElement *This = impl_from_IHTMLElement4(iface);
4422 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4424 return set_node_event(&This->node, EVENTID_MOUSEWHEEL, &v);
4427 static HRESULT WINAPI HTMLElement4_get_onmousewheel(IHTMLElement4 *iface, VARIANT *p)
4429 HTMLElement *This = impl_from_IHTMLElement4(iface);
4431 TRACE("(%p)->(%p)\n", This, p);
4433 return get_node_event(&This->node, EVENTID_MOUSEWHEEL, p);
4436 static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
4438 HTMLElement *This = impl_from_IHTMLElement4(iface);
4439 FIXME("(%p)\n", This);
4440 return E_NOTIMPL;
4443 static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute)
4445 HTMLElement *This = impl_from_IHTMLElement4(iface);
4446 HTMLAttributeCollection *attrs;
4447 HRESULT hres;
4449 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute);
4451 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4452 if(FAILED(hres))
4453 return hres;
4455 hres = IHTMLAttributeCollection2_getNamedItem(&attrs->IHTMLAttributeCollection2_iface, bstrname, ppAttribute);
4456 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4457 return hres;
4460 static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4461 IHTMLDOMAttribute **ppretAttribute)
4463 HTMLElement *This = impl_from_IHTMLElement4(iface);
4464 HTMLDOMAttribute *attr, *iter, *replace = NULL;
4465 HTMLAttributeCollection *attrs;
4466 DISPID dispid;
4467 HRESULT hres;
4469 TRACE("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4471 attr = unsafe_impl_from_IHTMLDOMAttribute(pattr);
4472 if(!attr)
4473 return E_INVALIDARG;
4475 if(attr->elem) {
4476 WARN("Tried to set already attached attribute.\n");
4477 return E_INVALIDARG;
4480 hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface,
4481 attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid);
4482 if(FAILED(hres))
4483 return hres;
4485 hres = HTMLElement_get_attr_col(&This->node, &attrs);
4486 if(FAILED(hres))
4487 return hres;
4489 LIST_FOR_EACH_ENTRY(iter, &attrs->attrs, HTMLDOMAttribute, entry) {
4490 if(iter->dispid == dispid) {
4491 replace = iter;
4492 break;
4496 if(replace) {
4497 hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value);
4498 if(FAILED(hres)) {
4499 WARN("could not get attr value: %08x\n", hres);
4500 V_VT(&replace->value) = VT_EMPTY;
4502 if(!replace->name) {
4503 replace->name = attr->name;
4504 attr->name = NULL;
4506 list_add_head(&replace->entry, &attr->entry);
4507 list_remove(&replace->entry);
4508 replace->elem = NULL;
4509 }else {
4510 list_add_tail(&attrs->attrs, &attr->entry);
4513 IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface);
4514 attr->elem = This;
4515 attr->dispid = dispid;
4517 IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface);
4519 hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value);
4520 if(FAILED(hres))
4521 WARN("Could not set attribute value: %08x\n", hres);
4522 VariantClear(&attr->value);
4524 *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL;
4525 return S_OK;
4528 static HRESULT WINAPI HTMLElement4_removeAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
4529 IHTMLDOMAttribute **ppretAttribute)
4531 HTMLElement *This = impl_from_IHTMLElement4(iface);
4532 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4533 return E_NOTIMPL;
4536 static HRESULT WINAPI HTMLElement4_put_onbeforeactivate(IHTMLElement4 *iface, VARIANT v)
4538 HTMLElement *This = impl_from_IHTMLElement4(iface);
4540 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4542 return set_node_event(&This->node, EVENTID_BEFOREACTIVATE, &v);
4545 static HRESULT WINAPI HTMLElement4_get_onbeforeactivate(IHTMLElement4 *iface, VARIANT *p)
4547 HTMLElement *This = impl_from_IHTMLElement4(iface);
4549 TRACE("(%p)->(%p)\n", This, p);
4551 return get_node_event(&This->node, EVENTID_BEFOREACTIVATE, p);
4554 static HRESULT WINAPI HTMLElement4_put_onfocusin(IHTMLElement4 *iface, VARIANT v)
4556 HTMLElement *This = impl_from_IHTMLElement4(iface);
4558 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4560 return set_node_event(&This->node, EVENTID_FOCUSIN, &v);
4563 static HRESULT WINAPI HTMLElement4_get_onfocusin(IHTMLElement4 *iface, VARIANT *p)
4565 HTMLElement *This = impl_from_IHTMLElement4(iface);
4567 TRACE("(%p)->(%p)\n", This, p);
4569 return get_node_event(&This->node, EVENTID_FOCUSIN, p);
4572 static HRESULT WINAPI HTMLElement4_put_onfocusout(IHTMLElement4 *iface, VARIANT v)
4574 HTMLElement *This = impl_from_IHTMLElement4(iface);
4576 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4578 return set_node_event(&This->node, EVENTID_FOCUSOUT, &v);
4581 static HRESULT WINAPI HTMLElement4_get_onfocusout(IHTMLElement4 *iface, VARIANT *p)
4583 HTMLElement *This = impl_from_IHTMLElement4(iface);
4585 TRACE("(%p)->(%p)\n", This, p);
4587 return get_node_event(&This->node, EVENTID_FOCUSOUT, p);
4590 static const IHTMLElement4Vtbl HTMLElement4Vtbl = {
4591 HTMLElement4_QueryInterface,
4592 HTMLElement4_AddRef,
4593 HTMLElement4_Release,
4594 HTMLElement4_GetTypeInfoCount,
4595 HTMLElement4_GetTypeInfo,
4596 HTMLElement4_GetIDsOfNames,
4597 HTMLElement4_Invoke,
4598 HTMLElement4_put_onmousewheel,
4599 HTMLElement4_get_onmousewheel,
4600 HTMLElement4_normalize,
4601 HTMLElement4_getAttributeNode,
4602 HTMLElement4_setAttributeNode,
4603 HTMLElement4_removeAttributeNode,
4604 HTMLElement4_put_onbeforeactivate,
4605 HTMLElement4_get_onbeforeactivate,
4606 HTMLElement4_put_onfocusin,
4607 HTMLElement4_get_onfocusin,
4608 HTMLElement4_put_onfocusout,
4609 HTMLElement4_get_onfocusout
4612 static inline HTMLElement *impl_from_IHTMLElement6(IHTMLElement6 *iface)
4614 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement6_iface);
4617 static HRESULT WINAPI HTMLElement6_QueryInterface(IHTMLElement6 *iface,
4618 REFIID riid, void **ppv)
4620 HTMLElement *This = impl_from_IHTMLElement6(iface);
4621 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
4624 static ULONG WINAPI HTMLElement6_AddRef(IHTMLElement6 *iface)
4626 HTMLElement *This = impl_from_IHTMLElement6(iface);
4627 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
4630 static ULONG WINAPI HTMLElement6_Release(IHTMLElement6 *iface)
4632 HTMLElement *This = impl_from_IHTMLElement6(iface);
4633 return IHTMLElement_Release(&This->IHTMLElement_iface);
4636 static HRESULT WINAPI HTMLElement6_GetTypeInfoCount(IHTMLElement6 *iface, UINT *pctinfo)
4638 HTMLElement *This = impl_from_IHTMLElement6(iface);
4639 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
4642 static HRESULT WINAPI HTMLElement6_GetTypeInfo(IHTMLElement6 *iface, UINT iTInfo,
4643 LCID lcid, ITypeInfo **ppTInfo)
4645 HTMLElement *This = impl_from_IHTMLElement6(iface);
4646 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
4649 static HRESULT WINAPI HTMLElement6_GetIDsOfNames(IHTMLElement6 *iface, REFIID riid,
4650 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4652 HTMLElement *This = impl_from_IHTMLElement6(iface);
4653 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
4654 lcid, rgDispId);
4657 static HRESULT WINAPI HTMLElement6_Invoke(IHTMLElement6 *iface, DISPID dispIdMember, REFIID riid,
4658 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4660 HTMLElement *This = impl_from_IHTMLElement6(iface);
4661 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
4662 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4665 static HRESULT WINAPI HTMLElement6_getAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *AttributeValue)
4667 HTMLElement *This = impl_from_IHTMLElement6(iface);
4668 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
4669 return E_NOTIMPL;
4672 static HRESULT WINAPI HTMLElement6_setAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4674 HTMLElement *This = impl_from_IHTMLElement6(iface);
4675 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), debugstr_variant(pvarAttributeValue));
4676 return E_NOTIMPL;
4679 static HRESULT WINAPI HTMLElement6_removeAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName)
4681 HTMLElement *This = impl_from_IHTMLElement6(iface);
4682 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName));
4683 return E_NOTIMPL;
4686 static HRESULT WINAPI HTMLElement6_getAttributeNodeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, IHTMLDOMAttribute2 **ppretAttribute)
4688 HTMLElement *This = impl_from_IHTMLElement6(iface);
4689 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), ppretAttribute);
4690 return E_NOTIMPL;
4693 static HRESULT WINAPI HTMLElement6_setAttributeNodeNS(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4695 HTMLElement *This = impl_from_IHTMLElement6(iface);
4696 FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
4697 return E_NOTIMPL;
4700 static HRESULT WINAPI HTMLElement6_hasAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR name, VARIANT_BOOL *pfHasAttribute)
4702 HTMLElement *This = impl_from_IHTMLElement6(iface);
4703 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(name), pfHasAttribute);
4704 return E_NOTIMPL;
4707 static HRESULT WINAPI HTMLElement6_getAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *AttributeValue)
4709 HTMLElement *This = impl_from_IHTMLElement6(iface);
4711 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), AttributeValue);
4713 return IHTMLElement_getAttribute(&This->IHTMLElement_iface, strAttributeName, 0, AttributeValue);
4716 static HRESULT WINAPI HTMLElement6_setAttribute(IHTMLElement6 *iface, BSTR strAttributeName, VARIANT *pvarAttributeValue)
4718 HTMLElement *This = impl_from_IHTMLElement6(iface);
4720 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName), pvarAttributeValue);
4722 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, strAttributeName, *pvarAttributeValue, 0);
4725 static HRESULT WINAPI HTMLElement6_removeAttribute(IHTMLElement6 *iface, BSTR strAttributeName)
4727 HTMLElement *This = impl_from_IHTMLElement6(iface);
4728 VARIANT_BOOL success;
4730 WARN("(%p)->(%s) forwarding to IHTMLElement\n", This, debugstr_w(strAttributeName));
4732 return IHTMLElement_removeAttribute(&This->IHTMLElement_iface, strAttributeName, 0, &success);
4735 static HRESULT WINAPI HTMLElement6_getAttributeNode(IHTMLElement6 *iface, BSTR strAttributeName, IHTMLDOMAttribute2 **ppretAttribute)
4737 HTMLElement *This = impl_from_IHTMLElement6(iface);
4738 IHTMLDOMAttribute *attr;
4739 HRESULT hres;
4741 WARN("(%p)->(%s %p) forwarding to IHTMLElement4\n", This, debugstr_w(strAttributeName), ppretAttribute);
4743 hres = IHTMLElement4_getAttributeNode(&This->IHTMLElement4_iface, strAttributeName, &attr);
4744 if(FAILED(hres))
4745 return hres;
4747 if(attr) {
4748 hres = IHTMLDOMAttribute_QueryInterface(attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4749 IHTMLDOMAttribute_Release(attr);
4750 }else {
4751 *ppretAttribute = NULL;
4753 return hres;
4756 static HRESULT WINAPI HTMLElement6_setAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4758 HTMLElement *This = impl_from_IHTMLElement6(iface);
4759 IHTMLDOMAttribute *attr, *ret_attr;
4760 HRESULT hres;
4762 WARN("(%p)->(%p %p) forwarding to IHTMLElement4\n", This, pattr, ppretAttribute);
4764 hres = IHTMLDOMAttribute2_QueryInterface(pattr, &IID_IHTMLDOMAttribute, (void**)&attr);
4765 if(FAILED(hres))
4766 return hres;
4768 hres = IHTMLElement4_setAttributeNode(&This->IHTMLElement4_iface, attr, &ret_attr);
4769 if(FAILED(hres))
4770 return hres;
4772 if(ret_attr) {
4773 hres = IHTMLDOMAttribute_QueryInterface(ret_attr, &IID_IHTMLDOMAttribute2, (void**)ppretAttribute);
4774 IHTMLDOMAttribute_Release(ret_attr);
4775 }else {
4776 *ppretAttribute = NULL;
4778 return hres;
4781 static HRESULT WINAPI HTMLElement6_removeAttributeNode(IHTMLElement6 *iface, IHTMLDOMAttribute2 *pattr, IHTMLDOMAttribute2 **ppretAttribute)
4783 HTMLElement *This = impl_from_IHTMLElement6(iface);
4784 FIXME("(%p)->()\n", This);
4785 return E_NOTIMPL;
4788 static HRESULT WINAPI HTMLElement6_hasAttribute(IHTMLElement6 *iface, BSTR name, VARIANT_BOOL *p)
4790 HTMLElement *This = impl_from_IHTMLElement6(iface);
4792 TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), p);
4794 *p = element_has_attribute(This, name);
4795 return S_OK;
4798 static HRESULT WINAPI HTMLElement6_getElementsByTagNameNS(IHTMLElement6 *iface, VARIANT *varNS, BSTR bstrLocalName, IHTMLElementCollection **pelColl)
4800 HTMLElement *This = impl_from_IHTMLElement6(iface);
4801 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(varNS), debugstr_w(bstrLocalName), pelColl);
4802 return E_NOTIMPL;
4805 static HRESULT WINAPI HTMLElement6_get_tagName(IHTMLElement6 *iface, BSTR *p)
4807 HTMLElement *This = impl_from_IHTMLElement6(iface);
4809 TRACE("(%p)->(%p)\n", This, p);
4811 return IHTMLElement_get_tagName(&This->IHTMLElement_iface, p);
4814 static HRESULT WINAPI HTMLElement6_get_nodeName(IHTMLElement6 *iface, BSTR *p)
4816 HTMLElement *This = impl_from_IHTMLElement6(iface);
4818 TRACE("(%p)->(%p)\n", This, p);
4820 return IHTMLDOMNode_get_nodeName(&This->node.IHTMLDOMNode_iface, p);
4823 static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, BSTR v, IHTMLElementCollection **pel)
4825 HTMLElement *This = impl_from_IHTMLElement6(iface);
4826 nsIDOMHTMLCollection *nscol = NULL;
4827 nsAString nsstr;
4828 nsresult nsres;
4830 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
4832 if(This->dom_element) {
4833 nsAString_InitDepend(&nsstr, v);
4834 nsres = nsIDOMElement_GetElementsByClassName(This->dom_element, &nsstr, &nscol);
4835 nsAString_Finish(&nsstr);
4836 if(NS_FAILED(nsres)) {
4837 ERR("GetElementsByClassName failed: %08x\n", nsres);
4838 return E_FAIL;
4842 *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex));
4843 nsIDOMHTMLCollection_Release(nscol);
4844 return S_OK;
4847 static HRESULT WINAPI HTMLElement6_msMatchesSelector(IHTMLElement6 *iface, BSTR v, VARIANT_BOOL *pfMatches)
4849 HTMLElement *This = impl_from_IHTMLElement6(iface);
4850 nsAString nsstr;
4851 cpp_bool b;
4852 nsresult nsres;
4854 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pfMatches);
4856 if(!This->dom_element) {
4857 FIXME("No dom element\n");
4858 return E_UNEXPECTED;
4861 nsAString_InitDepend(&nsstr, v);
4862 nsres = nsIDOMElement_MozMatchesSelector(This->dom_element, &nsstr, &b);
4863 nsAString_Finish(&nsstr);
4864 if(NS_FAILED(nsres)) {
4865 WARN("MozMatchesSelector failed: %08x\n", nsres);
4866 return map_nsresult(nsres);
4869 *pfMatches = b;
4870 return S_OK;
4873 static HRESULT WINAPI HTMLElement6_put_onabort(IHTMLElement6 *iface, VARIANT v)
4875 HTMLElement *This = impl_from_IHTMLElement6(iface);
4877 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4879 return set_node_event(&This->node, EVENTID_ABORT, &v);
4882 static HRESULT WINAPI HTMLElement6_get_onabort(IHTMLElement6 *iface, VARIANT *p)
4884 HTMLElement *This = impl_from_IHTMLElement6(iface);
4886 TRACE("(%p)->(%p)\n", This, p);
4888 return get_node_event(&This->node, EVENTID_ABORT, p);
4891 static HRESULT WINAPI HTMLElement6_put_oncanplay(IHTMLElement6 *iface, VARIANT v)
4893 HTMLElement *This = impl_from_IHTMLElement6(iface);
4894 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4895 return E_NOTIMPL;
4898 static HRESULT WINAPI HTMLElement6_get_oncanplay(IHTMLElement6 *iface, VARIANT *p)
4900 HTMLElement *This = impl_from_IHTMLElement6(iface);
4901 FIXME("(%p)->(%p)\n", This, p);
4902 return E_NOTIMPL;
4905 static HRESULT WINAPI HTMLElement6_put_oncanplaythrough(IHTMLElement6 *iface, VARIANT v)
4907 HTMLElement *This = impl_from_IHTMLElement6(iface);
4908 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4909 return E_NOTIMPL;
4912 static HRESULT WINAPI HTMLElement6_get_oncanplaythrough(IHTMLElement6 *iface, VARIANT *p)
4914 HTMLElement *This = impl_from_IHTMLElement6(iface);
4915 FIXME("(%p)->(%p)\n", This, p);
4916 return E_NOTIMPL;
4919 static HRESULT WINAPI HTMLElement6_put_onchange(IHTMLElement6 *iface, VARIANT v)
4921 HTMLElement *This = impl_from_IHTMLElement6(iface);
4923 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4925 return set_node_event(&This->node, EVENTID_CHANGE, &v);
4928 static HRESULT WINAPI HTMLElement6_get_onchange(IHTMLElement6 *iface, VARIANT *p)
4930 HTMLElement *This = impl_from_IHTMLElement6(iface);
4932 TRACE("(%p)->(%p)\n", This, p);
4934 return get_node_event(&This->node, EVENTID_CHANGE, p);
4937 static HRESULT WINAPI HTMLElement6_put_ondurationchange(IHTMLElement6 *iface, VARIANT v)
4939 HTMLElement *This = impl_from_IHTMLElement6(iface);
4940 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4941 return E_NOTIMPL;
4944 static HRESULT WINAPI HTMLElement6_get_ondurationchange(IHTMLElement6 *iface, VARIANT *p)
4946 HTMLElement *This = impl_from_IHTMLElement6(iface);
4947 FIXME("(%p)->(%p)\n", This, p);
4948 return E_NOTIMPL;
4951 static HRESULT WINAPI HTMLElement6_put_onemptied(IHTMLElement6 *iface, VARIANT v)
4953 HTMLElement *This = impl_from_IHTMLElement6(iface);
4954 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4955 return E_NOTIMPL;
4958 static HRESULT WINAPI HTMLElement6_get_onemptied(IHTMLElement6 *iface, VARIANT *p)
4960 HTMLElement *This = impl_from_IHTMLElement6(iface);
4961 FIXME("(%p)->(%p)\n", This, p);
4962 return E_NOTIMPL;
4965 static HRESULT WINAPI HTMLElement6_put_onended(IHTMLElement6 *iface, VARIANT v)
4967 HTMLElement *This = impl_from_IHTMLElement6(iface);
4968 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
4969 return E_NOTIMPL;
4972 static HRESULT WINAPI HTMLElement6_get_onended(IHTMLElement6 *iface, VARIANT *p)
4974 HTMLElement *This = impl_from_IHTMLElement6(iface);
4975 FIXME("(%p)->(%p)\n", This, p);
4976 return E_NOTIMPL;
4979 static HRESULT WINAPI HTMLElement6_put_onerror(IHTMLElement6 *iface, VARIANT v)
4981 HTMLElement *This = impl_from_IHTMLElement6(iface);
4983 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
4985 return set_node_event(&This->node, EVENTID_ERROR, &v);
4988 static HRESULT WINAPI HTMLElement6_get_onerror(IHTMLElement6 *iface, VARIANT *p)
4990 HTMLElement *This = impl_from_IHTMLElement6(iface);
4992 TRACE("(%p)->(%p)\n", This, p);
4994 return get_node_event(&This->node, EVENTID_ERROR, p);
4997 static HRESULT WINAPI HTMLElement6_put_oninput(IHTMLElement6 *iface, VARIANT v)
4999 HTMLElement *This = impl_from_IHTMLElement6(iface);
5001 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5003 return set_node_event(&This->node, EVENTID_INPUT, &v);
5006 static HRESULT WINAPI HTMLElement6_get_oninput(IHTMLElement6 *iface, VARIANT *p)
5008 HTMLElement *This = impl_from_IHTMLElement6(iface);
5010 TRACE("(%p)->(%p)\n", This, p);
5012 return get_node_event(&This->node, EVENTID_INPUT, p);
5015 static HRESULT WINAPI HTMLElement6_put_onload(IHTMLElement6 *iface, VARIANT v)
5017 HTMLElement *This = impl_from_IHTMLElement6(iface);
5019 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5021 return set_node_event(&This->node, EVENTID_LOAD, &v);
5024 static HRESULT WINAPI HTMLElement6_get_onload(IHTMLElement6 *iface, VARIANT *p)
5026 HTMLElement *This = impl_from_IHTMLElement6(iface);
5028 TRACE("(%p)->(%p)\n", This, p);
5030 return get_node_event(&This->node, EVENTID_LOAD, p);
5033 static HRESULT WINAPI HTMLElement6_put_onloadeddata(IHTMLElement6 *iface, VARIANT v)
5035 HTMLElement *This = impl_from_IHTMLElement6(iface);
5036 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5037 return E_NOTIMPL;
5040 static HRESULT WINAPI HTMLElement6_get_onloadeddata(IHTMLElement6 *iface, VARIANT *p)
5042 HTMLElement *This = impl_from_IHTMLElement6(iface);
5043 FIXME("(%p)->(%p)\n", This, p);
5044 return E_NOTIMPL;
5047 static HRESULT WINAPI HTMLElement6_put_onloadedmetadata(IHTMLElement6 *iface, VARIANT v)
5049 HTMLElement *This = impl_from_IHTMLElement6(iface);
5050 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5051 return E_NOTIMPL;
5054 static HRESULT WINAPI HTMLElement6_get_onloadedmetadata(IHTMLElement6 *iface, VARIANT *p)
5056 HTMLElement *This = impl_from_IHTMLElement6(iface);
5057 FIXME("(%p)->(%p)\n", This, p);
5058 return E_NOTIMPL;
5061 static HRESULT WINAPI HTMLElement6_put_onloadstart(IHTMLElement6 *iface, VARIANT v)
5063 HTMLElement *This = impl_from_IHTMLElement6(iface);
5064 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5065 return E_NOTIMPL;
5068 static HRESULT WINAPI HTMLElement6_get_onloadstart(IHTMLElement6 *iface, VARIANT *p)
5070 HTMLElement *This = impl_from_IHTMLElement6(iface);
5071 FIXME("(%p)->(%p)\n", This, p);
5072 return E_NOTIMPL;
5075 static HRESULT WINAPI HTMLElement6_put_onpause(IHTMLElement6 *iface, VARIANT v)
5077 HTMLElement *This = impl_from_IHTMLElement6(iface);
5078 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5079 return E_NOTIMPL;
5082 static HRESULT WINAPI HTMLElement6_get_onpause(IHTMLElement6 *iface, VARIANT *p)
5084 HTMLElement *This = impl_from_IHTMLElement6(iface);
5085 FIXME("(%p)->(%p)\n", This, p);
5086 return E_NOTIMPL;
5089 static HRESULT WINAPI HTMLElement6_put_onplay(IHTMLElement6 *iface, VARIANT v)
5091 HTMLElement *This = impl_from_IHTMLElement6(iface);
5092 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5093 return E_NOTIMPL;
5096 static HRESULT WINAPI HTMLElement6_get_onplay(IHTMLElement6 *iface, VARIANT *p)
5098 HTMLElement *This = impl_from_IHTMLElement6(iface);
5099 FIXME("(%p)->(%p)\n", This, p);
5100 return E_NOTIMPL;
5103 static HRESULT WINAPI HTMLElement6_put_onplaying(IHTMLElement6 *iface, VARIANT v)
5105 HTMLElement *This = impl_from_IHTMLElement6(iface);
5106 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5107 return E_NOTIMPL;
5110 static HRESULT WINAPI HTMLElement6_get_onplaying(IHTMLElement6 *iface, VARIANT *p)
5112 HTMLElement *This = impl_from_IHTMLElement6(iface);
5113 FIXME("(%p)->(%p)\n", This, p);
5114 return E_NOTIMPL;
5117 static HRESULT WINAPI HTMLElement6_put_onprogress(IHTMLElement6 *iface, VARIANT v)
5119 HTMLElement *This = impl_from_IHTMLElement6(iface);
5120 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5121 return E_NOTIMPL;
5124 static HRESULT WINAPI HTMLElement6_get_onprogress(IHTMLElement6 *iface, VARIANT *p)
5126 HTMLElement *This = impl_from_IHTMLElement6(iface);
5127 FIXME("(%p)->(%p)\n", This, p);
5128 return E_NOTIMPL;
5131 static HRESULT WINAPI HTMLElement6_put_onratechange(IHTMLElement6 *iface, VARIANT v)
5133 HTMLElement *This = impl_from_IHTMLElement6(iface);
5134 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5135 return E_NOTIMPL;
5138 static HRESULT WINAPI HTMLElement6_get_onratechange(IHTMLElement6 *iface, VARIANT *p)
5140 HTMLElement *This = impl_from_IHTMLElement6(iface);
5141 FIXME("(%p)->(%p)\n", This, p);
5142 return E_NOTIMPL;
5145 static HRESULT WINAPI HTMLElement6_put_onreset(IHTMLElement6 *iface, VARIANT v)
5147 HTMLElement *This = impl_from_IHTMLElement6(iface);
5148 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5149 return E_NOTIMPL;
5152 static HRESULT WINAPI HTMLElement6_get_onreset(IHTMLElement6 *iface, VARIANT *p)
5154 HTMLElement *This = impl_from_IHTMLElement6(iface);
5155 FIXME("(%p)->(%p)\n", This, p);
5156 return E_NOTIMPL;
5159 static HRESULT WINAPI HTMLElement6_put_onseeked(IHTMLElement6 *iface, VARIANT v)
5161 HTMLElement *This = impl_from_IHTMLElement6(iface);
5162 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5163 return E_NOTIMPL;
5166 static HRESULT WINAPI HTMLElement6_get_onseeked(IHTMLElement6 *iface, VARIANT *p)
5168 HTMLElement *This = impl_from_IHTMLElement6(iface);
5169 FIXME("(%p)->(%p)\n", This, p);
5170 return E_NOTIMPL;
5173 static HRESULT WINAPI HTMLElement6_put_onseeking(IHTMLElement6 *iface, VARIANT v)
5175 HTMLElement *This = impl_from_IHTMLElement6(iface);
5176 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5177 return E_NOTIMPL;
5180 static HRESULT WINAPI HTMLElement6_get_onseeking(IHTMLElement6 *iface, VARIANT *p)
5182 HTMLElement *This = impl_from_IHTMLElement6(iface);
5183 FIXME("(%p)->(%p)\n", This, p);
5184 return E_NOTIMPL;
5187 static HRESULT WINAPI HTMLElement6_put_onselect(IHTMLElement6 *iface, VARIANT v)
5189 HTMLElement *This = impl_from_IHTMLElement6(iface);
5190 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5191 return E_NOTIMPL;
5194 static HRESULT WINAPI HTMLElement6_get_onselect(IHTMLElement6 *iface, VARIANT *p)
5196 HTMLElement *This = impl_from_IHTMLElement6(iface);
5197 FIXME("(%p)->(%p)\n", This, p);
5198 return E_NOTIMPL;
5201 static HRESULT WINAPI HTMLElement6_put_onstalled(IHTMLElement6 *iface, VARIANT v)
5203 HTMLElement *This = impl_from_IHTMLElement6(iface);
5204 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5205 return E_NOTIMPL;
5208 static HRESULT WINAPI HTMLElement6_get_onstalled(IHTMLElement6 *iface, VARIANT *p)
5210 HTMLElement *This = impl_from_IHTMLElement6(iface);
5211 FIXME("(%p)->(%p)\n", This, p);
5212 return E_NOTIMPL;
5215 static HRESULT WINAPI HTMLElement6_put_onsubmit(IHTMLElement6 *iface, VARIANT v)
5217 HTMLElement *This = impl_from_IHTMLElement6(iface);
5219 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5221 return set_node_event(&This->node, EVENTID_SUBMIT, &v);
5224 static HRESULT WINAPI HTMLElement6_get_onsubmit(IHTMLElement6 *iface, VARIANT *p)
5226 HTMLElement *This = impl_from_IHTMLElement6(iface);
5228 TRACE("(%p)->(%p)\n", This, p);
5230 return get_node_event(&This->node, EVENTID_SUBMIT, p);
5233 static HRESULT WINAPI HTMLElement6_put_onsuspend(IHTMLElement6 *iface, VARIANT v)
5235 HTMLElement *This = impl_from_IHTMLElement6(iface);
5236 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5237 return E_NOTIMPL;
5240 static HRESULT WINAPI HTMLElement6_get_onsuspend(IHTMLElement6 *iface, VARIANT *p)
5242 HTMLElement *This = impl_from_IHTMLElement6(iface);
5243 FIXME("(%p)->(%p)\n", This, p);
5244 return E_NOTIMPL;
5247 static HRESULT WINAPI HTMLElement6_put_ontimeupdate(IHTMLElement6 *iface, VARIANT v)
5249 HTMLElement *This = impl_from_IHTMLElement6(iface);
5250 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5251 return E_NOTIMPL;
5254 static HRESULT WINAPI HTMLElement6_get_ontimeupdate(IHTMLElement6 *iface, VARIANT *p)
5256 HTMLElement *This = impl_from_IHTMLElement6(iface);
5257 FIXME("(%p)->(%p)\n", This, p);
5258 return E_NOTIMPL;
5261 static HRESULT WINAPI HTMLElement6_put_onvolumechange(IHTMLElement6 *iface, VARIANT v)
5263 HTMLElement *This = impl_from_IHTMLElement6(iface);
5264 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5265 return E_NOTIMPL;
5268 static HRESULT WINAPI HTMLElement6_get_onvolumechange(IHTMLElement6 *iface, VARIANT *p)
5270 HTMLElement *This = impl_from_IHTMLElement6(iface);
5271 FIXME("(%p)->(%p)\n", This, p);
5272 return E_NOTIMPL;
5275 static HRESULT WINAPI HTMLElement6_put_onwaiting(IHTMLElement6 *iface, VARIANT v)
5277 HTMLElement *This = impl_from_IHTMLElement6(iface);
5278 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5279 return E_NOTIMPL;
5282 static HRESULT WINAPI HTMLElement6_get_onwaiting(IHTMLElement6 *iface, VARIANT *p)
5284 HTMLElement *This = impl_from_IHTMLElement6(iface);
5285 FIXME("(%p)->(%p)\n", This, p);
5286 return E_NOTIMPL;
5289 static HRESULT WINAPI HTMLElement6_hasAttributes(IHTMLElement6 *iface, VARIANT_BOOL *pfHasAttributes)
5291 HTMLElement *This = impl_from_IHTMLElement6(iface);
5292 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
5293 return E_NOTIMPL;
5296 static const IHTMLElement6Vtbl HTMLElement6Vtbl = {
5297 HTMLElement6_QueryInterface,
5298 HTMLElement6_AddRef,
5299 HTMLElement6_Release,
5300 HTMLElement6_GetTypeInfoCount,
5301 HTMLElement6_GetTypeInfo,
5302 HTMLElement6_GetIDsOfNames,
5303 HTMLElement6_Invoke,
5304 HTMLElement6_getAttributeNS,
5305 HTMLElement6_setAttributeNS,
5306 HTMLElement6_removeAttributeNS,
5307 HTMLElement6_getAttributeNodeNS,
5308 HTMLElement6_setAttributeNodeNS,
5309 HTMLElement6_hasAttributeNS,
5310 HTMLElement6_getAttribute,
5311 HTMLElement6_setAttribute,
5312 HTMLElement6_removeAttribute,
5313 HTMLElement6_getAttributeNode,
5314 HTMLElement6_setAttributeNode,
5315 HTMLElement6_removeAttributeNode,
5316 HTMLElement6_hasAttribute,
5317 HTMLElement6_getElementsByTagNameNS,
5318 HTMLElement6_get_tagName,
5319 HTMLElement6_get_nodeName,
5320 HTMLElement6_getElementsByClassName,
5321 HTMLElement6_msMatchesSelector,
5322 HTMLElement6_put_onabort,
5323 HTMLElement6_get_onabort,
5324 HTMLElement6_put_oncanplay,
5325 HTMLElement6_get_oncanplay,
5326 HTMLElement6_put_oncanplaythrough,
5327 HTMLElement6_get_oncanplaythrough,
5328 HTMLElement6_put_onchange,
5329 HTMLElement6_get_onchange,
5330 HTMLElement6_put_ondurationchange,
5331 HTMLElement6_get_ondurationchange,
5332 HTMLElement6_put_onemptied,
5333 HTMLElement6_get_onemptied,
5334 HTMLElement6_put_onended,
5335 HTMLElement6_get_onended,
5336 HTMLElement6_put_onerror,
5337 HTMLElement6_get_onerror,
5338 HTMLElement6_put_oninput,
5339 HTMLElement6_get_oninput,
5340 HTMLElement6_put_onload,
5341 HTMLElement6_get_onload,
5342 HTMLElement6_put_onloadeddata,
5343 HTMLElement6_get_onloadeddata,
5344 HTMLElement6_put_onloadedmetadata,
5345 HTMLElement6_get_onloadedmetadata,
5346 HTMLElement6_put_onloadstart,
5347 HTMLElement6_get_onloadstart,
5348 HTMLElement6_put_onpause,
5349 HTMLElement6_get_onpause,
5350 HTMLElement6_put_onplay,
5351 HTMLElement6_get_onplay,
5352 HTMLElement6_put_onplaying,
5353 HTMLElement6_get_onplaying,
5354 HTMLElement6_put_onprogress,
5355 HTMLElement6_get_onprogress,
5356 HTMLElement6_put_onratechange,
5357 HTMLElement6_get_onratechange,
5358 HTMLElement6_put_onreset,
5359 HTMLElement6_get_onreset,
5360 HTMLElement6_put_onseeked,
5361 HTMLElement6_get_onseeked,
5362 HTMLElement6_put_onseeking,
5363 HTMLElement6_get_onseeking,
5364 HTMLElement6_put_onselect,
5365 HTMLElement6_get_onselect,
5366 HTMLElement6_put_onstalled,
5367 HTMLElement6_get_onstalled,
5368 HTMLElement6_put_onsubmit,
5369 HTMLElement6_get_onsubmit,
5370 HTMLElement6_put_onsuspend,
5371 HTMLElement6_get_onsuspend,
5372 HTMLElement6_put_ontimeupdate,
5373 HTMLElement6_get_ontimeupdate,
5374 HTMLElement6_put_onvolumechange,
5375 HTMLElement6_get_onvolumechange,
5376 HTMLElement6_put_onwaiting,
5377 HTMLElement6_get_onwaiting,
5378 HTMLElement6_hasAttributes
5381 static inline HTMLElement *impl_from_IHTMLElement7(IHTMLElement7 *iface)
5383 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement7_iface);
5386 static HRESULT WINAPI HTMLElement7_QueryInterface(IHTMLElement7 *iface,
5387 REFIID riid, void **ppv)
5389 HTMLElement *This = impl_from_IHTMLElement7(iface);
5390 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5393 static ULONG WINAPI HTMLElement7_AddRef(IHTMLElement7 *iface)
5395 HTMLElement *This = impl_from_IHTMLElement7(iface);
5396 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5399 static ULONG WINAPI HTMLElement7_Release(IHTMLElement7 *iface)
5401 HTMLElement *This = impl_from_IHTMLElement7(iface);
5402 return IHTMLElement_Release(&This->IHTMLElement_iface);
5405 static HRESULT WINAPI HTMLElement7_GetTypeInfoCount(IHTMLElement7 *iface, UINT *pctinfo)
5407 HTMLElement *This = impl_from_IHTMLElement7(iface);
5408 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5411 static HRESULT WINAPI HTMLElement7_GetTypeInfo(IHTMLElement7 *iface, UINT iTInfo,
5412 LCID lcid, ITypeInfo **ppTInfo)
5414 HTMLElement *This = impl_from_IHTMLElement7(iface);
5415 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5418 static HRESULT WINAPI HTMLElement7_GetIDsOfNames(IHTMLElement7 *iface, REFIID riid,
5419 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5421 HTMLElement *This = impl_from_IHTMLElement7(iface);
5422 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5423 lcid, rgDispId);
5426 static HRESULT WINAPI HTMLElement7_Invoke(IHTMLElement7 *iface, DISPID dispIdMember, REFIID riid,
5427 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5429 HTMLElement *This = impl_from_IHTMLElement7(iface);
5430 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5431 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5434 static HRESULT WINAPI HTMLElement7_put_onmspointerdown(IHTMLElement7 *iface, VARIANT v)
5436 HTMLElement *This = impl_from_IHTMLElement7(iface);
5437 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5438 return E_NOTIMPL;
5441 static HRESULT WINAPI HTMLElement7_get_onmspointerdown(IHTMLElement7 *iface, VARIANT *p)
5443 HTMLElement *This = impl_from_IHTMLElement7(iface);
5444 FIXME("(%p)->(%p)\n", This, p);
5445 return E_NOTIMPL;
5448 static HRESULT WINAPI HTMLElement7_put_onmspointermove(IHTMLElement7 *iface, VARIANT v)
5450 HTMLElement *This = impl_from_IHTMLElement7(iface);
5451 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5452 return E_NOTIMPL;
5455 static HRESULT WINAPI HTMLElement7_get_onmspointermove(IHTMLElement7 *iface, VARIANT *p)
5457 HTMLElement *This = impl_from_IHTMLElement7(iface);
5458 FIXME("(%p)->(%p)\n", This, p);
5459 return E_NOTIMPL;
5462 static HRESULT WINAPI HTMLElement7_put_onmspointerup(IHTMLElement7 *iface, VARIANT v)
5464 HTMLElement *This = impl_from_IHTMLElement7(iface);
5465 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5466 return E_NOTIMPL;
5469 static HRESULT WINAPI HTMLElement7_get_onmspointerup(IHTMLElement7 *iface, VARIANT *p)
5471 HTMLElement *This = impl_from_IHTMLElement7(iface);
5472 FIXME("(%p)->(%p)\n", This, p);
5473 return E_NOTIMPL;
5476 static HRESULT WINAPI HTMLElement7_put_onmspointerover(IHTMLElement7 *iface, VARIANT v)
5478 HTMLElement *This = impl_from_IHTMLElement7(iface);
5479 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5480 return E_NOTIMPL;
5483 static HRESULT WINAPI HTMLElement7_get_onmspointerover(IHTMLElement7 *iface, VARIANT *p)
5485 HTMLElement *This = impl_from_IHTMLElement7(iface);
5486 FIXME("(%p)->(%p)\n", This, p);
5487 return E_NOTIMPL;
5490 static HRESULT WINAPI HTMLElement7_put_onmspointerout(IHTMLElement7 *iface, VARIANT v)
5492 HTMLElement *This = impl_from_IHTMLElement7(iface);
5493 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5494 return E_NOTIMPL;
5497 static HRESULT WINAPI HTMLElement7_get_onmspointerout(IHTMLElement7 *iface, VARIANT *p)
5499 HTMLElement *This = impl_from_IHTMLElement7(iface);
5500 FIXME("(%p)->(%p)\n", This, p);
5501 return E_NOTIMPL;
5504 static HRESULT WINAPI HTMLElement7_put_onmspointercancel(IHTMLElement7 *iface, VARIANT v)
5506 HTMLElement *This = impl_from_IHTMLElement7(iface);
5507 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5508 return E_NOTIMPL;
5511 static HRESULT WINAPI HTMLElement7_get_onmspointercancel(IHTMLElement7 *iface, VARIANT *p)
5513 HTMLElement *This = impl_from_IHTMLElement7(iface);
5514 FIXME("(%p)->(%p)\n", This, p);
5515 return E_NOTIMPL;
5518 static HRESULT WINAPI HTMLElement7_put_onmspointerhover(IHTMLElement7 *iface, VARIANT v)
5520 HTMLElement *This = impl_from_IHTMLElement7(iface);
5521 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5522 return E_NOTIMPL;
5525 static HRESULT WINAPI HTMLElement7_get_onmspointerhover(IHTMLElement7 *iface, VARIANT *p)
5527 HTMLElement *This = impl_from_IHTMLElement7(iface);
5528 FIXME("(%p)->(%p)\n", This, p);
5529 return E_NOTIMPL;
5532 static HRESULT WINAPI HTMLElement7_put_onmslostpointercapture(IHTMLElement7 *iface, VARIANT v)
5534 HTMLElement *This = impl_from_IHTMLElement7(iface);
5535 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5536 return E_NOTIMPL;
5539 static HRESULT WINAPI HTMLElement7_get_onmslostpointercapture(IHTMLElement7 *iface, VARIANT *p)
5541 HTMLElement *This = impl_from_IHTMLElement7(iface);
5542 FIXME("(%p)->(%p)\n", This, p);
5543 return E_NOTIMPL;
5546 static HRESULT WINAPI HTMLElement7_put_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT v)
5548 HTMLElement *This = impl_from_IHTMLElement7(iface);
5549 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5550 return E_NOTIMPL;
5553 static HRESULT WINAPI HTMLElement7_get_onmsgotpointercapture(IHTMLElement7 *iface, VARIANT *p)
5555 HTMLElement *This = impl_from_IHTMLElement7(iface);
5556 FIXME("(%p)->(%p)\n", This, p);
5557 return E_NOTIMPL;
5560 static HRESULT WINAPI HTMLElement7_put_onmsgesturestart(IHTMLElement7 *iface, VARIANT v)
5562 HTMLElement *This = impl_from_IHTMLElement7(iface);
5563 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5564 return E_NOTIMPL;
5567 static HRESULT WINAPI HTMLElement7_get_onmsgesturestart(IHTMLElement7 *iface, VARIANT *p)
5569 HTMLElement *This = impl_from_IHTMLElement7(iface);
5570 FIXME("(%p)->(%p)\n", This, p);
5571 return E_NOTIMPL;
5574 static HRESULT WINAPI HTMLElement7_put_onmsgesturechange(IHTMLElement7 *iface, VARIANT v)
5576 HTMLElement *This = impl_from_IHTMLElement7(iface);
5577 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5578 return E_NOTIMPL;
5581 static HRESULT WINAPI HTMLElement7_get_onmsgesturechange(IHTMLElement7 *iface, VARIANT *p)
5583 HTMLElement *This = impl_from_IHTMLElement7(iface);
5584 FIXME("(%p)->(%p)\n", This, p);
5585 return E_NOTIMPL;
5588 static HRESULT WINAPI HTMLElement7_put_onmsgestureend(IHTMLElement7 *iface, VARIANT v)
5590 HTMLElement *This = impl_from_IHTMLElement7(iface);
5591 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5592 return E_NOTIMPL;
5595 static HRESULT WINAPI HTMLElement7_get_onmsgestureend(IHTMLElement7 *iface, VARIANT *p)
5597 HTMLElement *This = impl_from_IHTMLElement7(iface);
5598 FIXME("(%p)->(%p)\n", This, p);
5599 return E_NOTIMPL;
5602 static HRESULT WINAPI HTMLElement7_put_onmsgesturehold(IHTMLElement7 *iface, VARIANT v)
5604 HTMLElement *This = impl_from_IHTMLElement7(iface);
5605 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5606 return E_NOTIMPL;
5609 static HRESULT WINAPI HTMLElement7_get_onmsgesturehold(IHTMLElement7 *iface, VARIANT *p)
5611 HTMLElement *This = impl_from_IHTMLElement7(iface);
5612 FIXME("(%p)->(%p)\n", This, p);
5613 return E_NOTIMPL;
5616 static HRESULT WINAPI HTMLElement7_put_onmsgesturetap(IHTMLElement7 *iface, VARIANT v)
5618 HTMLElement *This = impl_from_IHTMLElement7(iface);
5619 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5620 return E_NOTIMPL;
5623 static HRESULT WINAPI HTMLElement7_get_onmsgesturetap(IHTMLElement7 *iface, VARIANT *p)
5625 HTMLElement *This = impl_from_IHTMLElement7(iface);
5626 FIXME("(%p)->(%p)\n", This, p);
5627 return E_NOTIMPL;
5630 static HRESULT WINAPI HTMLElement7_put_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT v)
5632 HTMLElement *This = impl_from_IHTMLElement7(iface);
5633 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5634 return E_NOTIMPL;
5637 static HRESULT WINAPI HTMLElement7_get_onmsgesturedoubletap(IHTMLElement7 *iface, VARIANT *p)
5639 HTMLElement *This = impl_from_IHTMLElement7(iface);
5640 FIXME("(%p)->(%p)\n", This, p);
5641 return E_NOTIMPL;
5644 static HRESULT WINAPI HTMLElement7_put_onmsinertiastart(IHTMLElement7 *iface, VARIANT v)
5646 HTMLElement *This = impl_from_IHTMLElement7(iface);
5647 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5648 return E_NOTIMPL;
5651 static HRESULT WINAPI HTMLElement7_get_onmsinertiastart(IHTMLElement7 *iface, VARIANT *p)
5653 HTMLElement *This = impl_from_IHTMLElement7(iface);
5654 FIXME("(%p)->(%p)\n", This, p);
5655 return E_NOTIMPL;
5658 static HRESULT WINAPI HTMLElement7_msSetPointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5660 HTMLElement *This = impl_from_IHTMLElement7(iface);
5661 FIXME("(%p)->(%d)\n", This, pointer_id);
5662 return E_NOTIMPL;
5665 static HRESULT WINAPI HTMLElement7_msReleasePointerCapture(IHTMLElement7 *iface, LONG pointer_id)
5667 HTMLElement *This = impl_from_IHTMLElement7(iface);
5668 FIXME("(%p)->(%d)\n", This, pointer_id);
5669 return E_NOTIMPL;
5672 static HRESULT WINAPI HTMLElement7_put_onmstransitionstart(IHTMLElement7 *iface, VARIANT v)
5674 HTMLElement *This = impl_from_IHTMLElement7(iface);
5675 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5676 return E_NOTIMPL;
5679 static HRESULT WINAPI HTMLElement7_get_onmstransitionstart(IHTMLElement7 *iface, VARIANT *p)
5681 HTMLElement *This = impl_from_IHTMLElement7(iface);
5682 FIXME("(%p)->(%p)\n", This, p);
5683 return E_NOTIMPL;
5686 static HRESULT WINAPI HTMLElement7_put_onmstransitionend(IHTMLElement7 *iface, VARIANT v)
5688 HTMLElement *This = impl_from_IHTMLElement7(iface);
5689 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5690 return E_NOTIMPL;
5693 static HRESULT WINAPI HTMLElement7_get_onmstransitionend(IHTMLElement7 *iface, VARIANT *p)
5695 HTMLElement *This = impl_from_IHTMLElement7(iface);
5696 FIXME("(%p)->(%p)\n", This, p);
5697 return E_NOTIMPL;
5700 static HRESULT WINAPI HTMLElement7_put_onmsanimationstart(IHTMLElement7 *iface, VARIANT v)
5702 HTMLElement *This = impl_from_IHTMLElement7(iface);
5703 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5704 return E_NOTIMPL;
5707 static HRESULT WINAPI HTMLElement7_get_onmsanimationstart(IHTMLElement7 *iface, VARIANT *p)
5709 HTMLElement *This = impl_from_IHTMLElement7(iface);
5710 FIXME("(%p)->(%p)\n", This, p);
5711 return E_NOTIMPL;
5714 static HRESULT WINAPI HTMLElement7_put_onmsanimationend(IHTMLElement7 *iface, VARIANT v)
5716 HTMLElement *This = impl_from_IHTMLElement7(iface);
5717 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5718 return E_NOTIMPL;
5721 static HRESULT WINAPI HTMLElement7_get_onmsanimationend(IHTMLElement7 *iface, VARIANT *p)
5723 HTMLElement *This = impl_from_IHTMLElement7(iface);
5724 FIXME("(%p)->(%p)\n", This, p);
5725 return E_NOTIMPL;
5728 static HRESULT WINAPI HTMLElement7_put_onmsanimationiteration(IHTMLElement7 *iface, VARIANT v)
5730 HTMLElement *This = impl_from_IHTMLElement7(iface);
5731 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5732 return E_NOTIMPL;
5735 static HRESULT WINAPI HTMLElement7_get_onmsanimationiteration(IHTMLElement7 *iface, VARIANT *p)
5737 HTMLElement *This = impl_from_IHTMLElement7(iface);
5738 FIXME("(%p)->(%p)\n", This, p);
5739 return E_NOTIMPL;
5742 static HRESULT WINAPI HTMLElement7_put_oninvalid(IHTMLElement7 *iface, VARIANT v)
5744 HTMLElement *This = impl_from_IHTMLElement7(iface);
5745 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5746 return E_NOTIMPL;
5749 static HRESULT WINAPI HTMLElement7_get_oninvalid(IHTMLElement7 *iface, VARIANT *p)
5751 HTMLElement *This = impl_from_IHTMLElement7(iface);
5752 FIXME("(%p)->(%p)\n", This, p);
5753 return E_NOTIMPL;
5756 static HRESULT WINAPI HTMLElement7_put_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR v)
5758 HTMLElement *This = impl_from_IHTMLElement7(iface);
5759 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
5760 return E_NOTIMPL;
5763 static HRESULT WINAPI HTMLElement7_get_xmsAcceleratorKey(IHTMLElement7 *iface, BSTR *p)
5765 HTMLElement *This = impl_from_IHTMLElement7(iface);
5766 FIXME("(%p)->(%p)\n", This, p);
5767 return E_NOTIMPL;
5770 static HRESULT WINAPI HTMLElement7_put_spellcheck(IHTMLElement7 *iface, VARIANT v)
5772 HTMLElement *This = impl_from_IHTMLElement7(iface);
5774 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
5776 if(!This->html_element) {
5777 FIXME("non-HTML element\n");
5778 return E_NOTIMPL;
5781 if(V_VT(&v) != VT_BOOL) {
5782 FIXME("unsupported argument %s\n", debugstr_variant(&v));
5783 return E_NOTIMPL;
5786 return map_nsresult(nsIDOMHTMLElement_SetSpellcheck(This->html_element, !!V_BOOL(&v)));
5789 static HRESULT WINAPI HTMLElement7_get_spellcheck(IHTMLElement7 *iface, VARIANT *p)
5791 HTMLElement *This = impl_from_IHTMLElement7(iface);
5792 cpp_bool spellcheck;
5793 nsresult nsres;
5795 TRACE("(%p)->(%p)\n", This, p);
5797 if(!This->html_element) {
5798 FIXME("non-HTML element\n");
5799 return E_NOTIMPL;
5802 nsres = nsIDOMHTMLElement_GetSpellcheck(This->html_element, &spellcheck);
5803 if(NS_FAILED(nsres))
5804 return map_nsresult(nsres);
5806 V_VT(p) = VT_BOOL;
5807 V_BOOL(p) = spellcheck ? VARIANT_TRUE : VARIANT_FALSE;
5808 return S_OK;
5811 static HRESULT WINAPI HTMLElement7_put_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT v)
5813 HTMLElement *This = impl_from_IHTMLElement7(iface);
5814 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5815 return E_NOTIMPL;
5818 static HRESULT WINAPI HTMLElement7_get_onmsmanipulationstatechanged(IHTMLElement7 *iface, VARIANT *p)
5820 HTMLElement *This = impl_from_IHTMLElement7(iface);
5821 FIXME("(%p)->(%p)\n", This, p);
5822 return E_NOTIMPL;
5825 static HRESULT WINAPI HTMLElement7_put_oncuechange(IHTMLElement7 *iface, VARIANT v)
5827 HTMLElement *This = impl_from_IHTMLElement7(iface);
5828 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
5829 return E_NOTIMPL;
5832 static HRESULT WINAPI HTMLElement7_get_oncuechange(IHTMLElement7 *iface, VARIANT *p)
5834 HTMLElement *This = impl_from_IHTMLElement7(iface);
5835 FIXME("(%p)->(%p)\n", This, p);
5836 return E_NOTIMPL;
5839 static const IHTMLElement7Vtbl HTMLElement7Vtbl = {
5840 HTMLElement7_QueryInterface,
5841 HTMLElement7_AddRef,
5842 HTMLElement7_Release,
5843 HTMLElement7_GetTypeInfoCount,
5844 HTMLElement7_GetTypeInfo,
5845 HTMLElement7_GetIDsOfNames,
5846 HTMLElement7_Invoke,
5847 HTMLElement7_put_onmspointerdown,
5848 HTMLElement7_get_onmspointerdown,
5849 HTMLElement7_put_onmspointermove,
5850 HTMLElement7_get_onmspointermove,
5851 HTMLElement7_put_onmspointerup,
5852 HTMLElement7_get_onmspointerup,
5853 HTMLElement7_put_onmspointerover,
5854 HTMLElement7_get_onmspointerover,
5855 HTMLElement7_put_onmspointerout,
5856 HTMLElement7_get_onmspointerout,
5857 HTMLElement7_put_onmspointercancel,
5858 HTMLElement7_get_onmspointercancel,
5859 HTMLElement7_put_onmspointerhover,
5860 HTMLElement7_get_onmspointerhover,
5861 HTMLElement7_put_onmslostpointercapture,
5862 HTMLElement7_get_onmslostpointercapture,
5863 HTMLElement7_put_onmsgotpointercapture,
5864 HTMLElement7_get_onmsgotpointercapture,
5865 HTMLElement7_put_onmsgesturestart,
5866 HTMLElement7_get_onmsgesturestart,
5867 HTMLElement7_put_onmsgesturechange,
5868 HTMLElement7_get_onmsgesturechange,
5869 HTMLElement7_put_onmsgestureend,
5870 HTMLElement7_get_onmsgestureend,
5871 HTMLElement7_put_onmsgesturehold,
5872 HTMLElement7_get_onmsgesturehold,
5873 HTMLElement7_put_onmsgesturetap,
5874 HTMLElement7_get_onmsgesturetap,
5875 HTMLElement7_put_onmsgesturedoubletap,
5876 HTMLElement7_get_onmsgesturedoubletap,
5877 HTMLElement7_put_onmsinertiastart,
5878 HTMLElement7_get_onmsinertiastart,
5879 HTMLElement7_msSetPointerCapture,
5880 HTMLElement7_msReleasePointerCapture,
5881 HTMLElement7_put_onmstransitionstart,
5882 HTMLElement7_get_onmstransitionstart,
5883 HTMLElement7_put_onmstransitionend,
5884 HTMLElement7_get_onmstransitionend,
5885 HTMLElement7_put_onmsanimationstart,
5886 HTMLElement7_get_onmsanimationstart,
5887 HTMLElement7_put_onmsanimationend,
5888 HTMLElement7_get_onmsanimationend,
5889 HTMLElement7_put_onmsanimationiteration,
5890 HTMLElement7_get_onmsanimationiteration,
5891 HTMLElement7_put_oninvalid,
5892 HTMLElement7_get_oninvalid,
5893 HTMLElement7_put_xmsAcceleratorKey,
5894 HTMLElement7_get_xmsAcceleratorKey,
5895 HTMLElement7_put_spellcheck,
5896 HTMLElement7_get_spellcheck,
5897 HTMLElement7_put_onmsmanipulationstatechanged,
5898 HTMLElement7_get_onmsmanipulationstatechanged,
5899 HTMLElement7_put_oncuechange,
5900 HTMLElement7_get_oncuechange
5904 static inline HTMLElement *impl_from_IHTMLUniqueName(IHTMLUniqueName *iface)
5906 return CONTAINING_RECORD(iface, HTMLElement, IHTMLUniqueName_iface);
5909 static HRESULT WINAPI HTMLUniqueName_QueryInterface(IHTMLUniqueName *iface, REFIID riid, void **ppv)
5911 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5912 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
5915 static ULONG WINAPI HTMLUniqueName_AddRef(IHTMLUniqueName *iface)
5917 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5918 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
5921 static ULONG WINAPI HTMLUniqueName_Release(IHTMLUniqueName *iface)
5923 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5924 return IHTMLElement_Release(&This->IHTMLElement_iface);
5927 static HRESULT WINAPI HTMLUniqueName_GetTypeInfoCount(IHTMLUniqueName *iface, UINT *pctinfo)
5929 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5930 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
5933 static HRESULT WINAPI HTMLUniqueName_GetTypeInfo(IHTMLUniqueName *iface, UINT iTInfo,
5934 LCID lcid, ITypeInfo **ppTInfo)
5936 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5937 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
5940 static HRESULT WINAPI HTMLUniqueName_GetIDsOfNames(IHTMLUniqueName *iface, REFIID riid,
5941 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
5943 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5944 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
5945 lcid, rgDispId);
5948 static HRESULT WINAPI HTMLUniqueName_Invoke(IHTMLUniqueName *iface, DISPID dispIdMember, REFIID riid,
5949 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
5951 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5952 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
5953 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
5956 HRESULT elem_unique_id(unsigned id, BSTR *p)
5958 WCHAR buf[32];
5960 swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
5961 *p = SysAllocString(buf);
5962 return *p ? S_OK : E_OUTOFMEMORY;
5965 static void ensure_unique_id(HTMLElement *elem)
5967 if(!elem->unique_id)
5968 elem->unique_id = ++elem->node.doc->unique_id;
5971 static HRESULT WINAPI HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName *iface, LONG *p)
5973 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5975 TRACE("(%p)->(%p)\n", This, p);
5977 ensure_unique_id(This);
5978 *p = This->unique_id;
5979 return S_OK;
5982 static HRESULT WINAPI HTMLUniqueName_get_uniqueID(IHTMLUniqueName *iface, BSTR *p)
5984 HTMLElement *This = impl_from_IHTMLUniqueName(iface);
5986 TRACE("(%p)->(%p)\n", This, p);
5988 ensure_unique_id(This);
5989 return elem_unique_id(This->unique_id, p);
5992 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl = {
5993 HTMLUniqueName_QueryInterface,
5994 HTMLUniqueName_AddRef,
5995 HTMLUniqueName_Release,
5996 HTMLUniqueName_GetTypeInfoCount,
5997 HTMLUniqueName_GetTypeInfo,
5998 HTMLUniqueName_GetIDsOfNames,
5999 HTMLUniqueName_Invoke,
6000 HTMLUniqueName_get_uniqueNumber,
6001 HTMLUniqueName_get_uniqueID
6004 static inline HTMLElement *impl_from_IElementSelector(IElementSelector *iface)
6006 return CONTAINING_RECORD(iface, HTMLElement, IElementSelector_iface);
6009 static HRESULT WINAPI ElementSelector_QueryInterface(IElementSelector *iface, REFIID riid, void **ppv)
6011 HTMLElement *This = impl_from_IElementSelector(iface);
6012 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
6015 static ULONG WINAPI ElementSelector_AddRef(IElementSelector *iface)
6017 HTMLElement *This = impl_from_IElementSelector(iface);
6018 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
6021 static ULONG WINAPI ElementSelector_Release(IElementSelector *iface)
6023 HTMLElement *This = impl_from_IElementSelector(iface);
6024 return IHTMLElement_Release(&This->IHTMLElement_iface);
6027 static HRESULT WINAPI ElementSelector_GetTypeInfoCount(IElementSelector *iface, UINT *pctinfo)
6029 HTMLElement *This = impl_from_IElementSelector(iface);
6030 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
6033 static HRESULT WINAPI ElementSelector_GetTypeInfo(IElementSelector *iface, UINT iTInfo,
6034 LCID lcid, ITypeInfo **ppTInfo)
6036 HTMLElement *This = impl_from_IElementSelector(iface);
6037 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6040 static HRESULT WINAPI ElementSelector_GetIDsOfNames(IElementSelector *iface, REFIID riid,
6041 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6043 HTMLElement *This = impl_from_IElementSelector(iface);
6044 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId);
6047 static HRESULT WINAPI ElementSelector_Invoke(IElementSelector *iface, DISPID dispIdMember, REFIID riid,
6048 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6050 HTMLElement *This = impl_from_IElementSelector(iface);
6051 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
6052 pDispParams, pVarResult, pExcepInfo, puArgErr);
6055 static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BSTR v, IHTMLElement **pel)
6057 HTMLElement *This = impl_from_IElementSelector(iface);
6058 nsIDOMElement *nselem;
6059 HTMLElement *elem;
6060 nsAString nsstr;
6061 nsresult nsres;
6062 HRESULT hres;
6064 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
6066 if(!This->dom_element) {
6067 FIXME("comment element\n");
6068 return E_NOTIMPL;
6071 nsAString_InitDepend(&nsstr, v);
6072 nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
6073 nsAString_Finish(&nsstr);
6074 if(NS_FAILED(nsres)) {
6075 ERR("QuerySelector failed: %08x\n", nsres);
6076 return E_FAIL;
6079 if(!nselem) {
6080 *pel = NULL;
6081 return S_OK;
6084 hres = get_element(nselem, &elem);
6085 nsIDOMElement_Release(nselem);
6086 if(FAILED(hres))
6087 return hres;
6089 *pel = &elem->IHTMLElement_iface;
6090 return S_OK;
6093 static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, BSTR v, IHTMLDOMChildrenCollection **pel)
6095 HTMLElement *This = impl_from_IElementSelector(iface);
6096 nsIDOMNodeList *node_list;
6097 nsAString nsstr;
6098 HRESULT hres;
6100 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
6102 if(!This->dom_element) {
6103 FIXME("comment element\n");
6104 return E_NOTIMPL;
6107 nsAString_InitDepend(&nsstr, v);
6108 hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
6109 nsAString_Finish(&nsstr);
6110 if(FAILED(hres)) {
6111 ERR("QuerySelectorAll failed: %08x\n", hres);
6112 return hres;
6115 hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
6116 nsIDOMNodeList_Release(node_list);
6117 return hres;
6120 static const IElementSelectorVtbl ElementSelectorVtbl = {
6121 ElementSelector_QueryInterface,
6122 ElementSelector_AddRef,
6123 ElementSelector_Release,
6124 ElementSelector_GetTypeInfoCount,
6125 ElementSelector_GetTypeInfo,
6126 ElementSelector_GetIDsOfNames,
6127 ElementSelector_Invoke,
6128 ElementSelector_querySelector,
6129 ElementSelector_querySelectorAll
6132 static inline HTMLElement *impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo *iface)
6134 return CONTAINING_RECORD(iface, HTMLElement, IProvideMultipleClassInfo_iface);
6137 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo *iface,
6138 REFIID riid, void **ppv)
6140 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6141 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
6144 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideMultipleClassInfo *iface)
6146 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6147 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
6150 static ULONG WINAPI ProvideClassInfo_Release(IProvideMultipleClassInfo *iface)
6152 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6153 return IHTMLElement_Release(&This->IHTMLElement_iface);
6156 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *iface, ITypeInfo **ppTI)
6158 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6159 TRACE("(%p)->(%p)\n", This, ppTI);
6160 return get_class_typeinfo(This->node.vtbl->clsid, ppTI);
6163 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
6165 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6166 FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
6167 return E_NOTIMPL;
6170 static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo *iface, ULONG *pcti)
6172 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6173 FIXME("(%p)->(%p)\n", This, pcti);
6174 *pcti = 1;
6175 return S_OK;
6178 static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo *iface, ULONG iti,
6179 DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
6181 HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
6182 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
6183 return E_NOTIMPL;
6186 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = {
6187 ProvideClassInfo_QueryInterface,
6188 ProvideClassInfo_AddRef,
6189 ProvideClassInfo_Release,
6190 ProvideClassInfo_GetClassInfo,
6191 ProvideClassInfo2_GetGUID,
6192 ProvideMultipleClassInfo_GetMultiTypeInfoCount,
6193 ProvideMultipleClassInfo_GetInfoOfIndex
6196 static inline HTMLElement *impl_from_IElementTraversal(IElementTraversal *iface)
6198 return CONTAINING_RECORD(iface, HTMLElement, IElementTraversal_iface);
6201 static HRESULT WINAPI ElementTraversal_QueryInterface(IElementTraversal *iface, REFIID riid, void **ppv)
6203 HTMLElement *This = impl_from_IElementTraversal(iface);
6204 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
6207 static ULONG WINAPI ElementTraversal_AddRef(IElementTraversal *iface)
6209 HTMLElement *This = impl_from_IElementTraversal(iface);
6211 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
6214 static ULONG WINAPI ElementTraversal_Release(IElementTraversal *iface)
6216 HTMLElement *This = impl_from_IElementTraversal(iface);
6218 return IHTMLElement_Release(&This->IHTMLElement_iface);
6221 static HRESULT WINAPI ElementTraversal_GetTypeInfoCount(IElementTraversal *iface, UINT *pctinfo)
6223 HTMLElement *This = impl_from_IElementTraversal(iface);
6224 return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo);
6227 static HRESULT WINAPI ElementTraversal_GetTypeInfo(IElementTraversal *iface, UINT iTInfo,
6228 LCID lcid, ITypeInfo **ppTInfo)
6230 HTMLElement *This = impl_from_IElementTraversal(iface);
6231 return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6234 static HRESULT WINAPI ElementTraversal_GetIDsOfNames(IElementTraversal *iface, REFIID riid,
6235 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6237 HTMLElement *This = impl_from_IElementTraversal(iface);
6238 return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6239 lcid, rgDispId);
6242 static HRESULT WINAPI ElementTraversal_Invoke(IElementTraversal *iface, DISPID dispIdMember, REFIID riid,
6243 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6245 HTMLElement *This = impl_from_IElementTraversal(iface);
6246 return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
6247 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
6250 static HRESULT WINAPI ElementTraversal_get_firstElementChild(IElementTraversal *iface, IHTMLElement **p)
6252 HTMLElement *This = impl_from_IElementTraversal(iface);
6253 nsIDOMElement *nselem = NULL;
6254 HTMLElement *elem;
6255 HRESULT hres;
6257 TRACE("(%p)->(%p)\n", This, p);
6259 if(!This->dom_element) {
6260 *p = NULL;
6261 return S_OK;
6264 nsIDOMElement_GetFirstElementChild(This->dom_element, &nselem);
6265 if(!nselem) {
6266 *p = NULL;
6267 return S_OK;
6270 hres = get_element(nselem, &elem);
6271 nsIDOMElement_Release(nselem);
6272 if(FAILED(hres))
6273 return hres;
6275 *p = &elem->IHTMLElement_iface;
6276 return S_OK;
6279 static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *iface, IHTMLElement **p)
6281 HTMLElement *This = impl_from_IElementTraversal(iface);
6282 FIXME("(%p)->(%p)\n", This, p);
6283 return E_NOTIMPL;
6286 static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
6288 HTMLElement *This = impl_from_IElementTraversal(iface);
6289 FIXME("(%p)->(%p)\n", This, p);
6290 return E_NOTIMPL;
6293 static HRESULT WINAPI ElementTraversal_get_nextElementSibling(IElementTraversal *iface, IHTMLElement **p)
6295 HTMLElement *This = impl_from_IElementTraversal(iface);
6296 FIXME("(%p)->(%p)\n", This, p);
6297 return E_NOTIMPL;
6300 static HRESULT WINAPI ElementTraversal_get_childElementCount(IElementTraversal *iface, LONG *p)
6302 HTMLElement *This = impl_from_IElementTraversal(iface);
6303 FIXME("(%p)->(%p)\n", This, p);
6304 return E_NOTIMPL;
6307 static const IElementTraversalVtbl ElementTraversalVtbl = {
6308 ElementTraversal_QueryInterface,
6309 ElementTraversal_AddRef,
6310 ElementTraversal_Release,
6311 ElementTraversal_GetTypeInfoCount,
6312 ElementTraversal_GetTypeInfo,
6313 ElementTraversal_GetIDsOfNames,
6314 ElementTraversal_Invoke,
6315 ElementTraversal_get_firstElementChild,
6316 ElementTraversal_get_lastElementChild,
6317 ElementTraversal_get_previousElementSibling,
6318 ElementTraversal_get_nextElementSibling,
6319 ElementTraversal_get_childElementCount
6322 static inline HTMLElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
6324 return CONTAINING_RECORD(iface, HTMLElement, node);
6327 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
6329 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6331 if(IsEqualGUID(&IID_IUnknown, riid)) {
6332 *ppv = &This->IHTMLElement_iface;
6333 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
6334 *ppv = &This->IHTMLElement_iface;
6335 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
6336 *ppv = &This->IHTMLElement_iface;
6337 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
6338 *ppv = &This->IHTMLElement2_iface;
6339 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
6340 *ppv = &This->IHTMLElement3_iface;
6341 }else if(IsEqualGUID(&IID_IHTMLElement4, riid)) {
6342 *ppv = &This->IHTMLElement4_iface;
6343 }else if(IsEqualGUID(&IID_IHTMLElement6, riid)) {
6344 *ppv = &This->IHTMLElement6_iface;
6345 }else if(IsEqualGUID(&IID_IHTMLElement7, riid)) {
6346 *ppv = &This->IHTMLElement7_iface;
6347 }else if(IsEqualGUID(&IID_IHTMLUniqueName, riid)) {
6348 *ppv = &This->IHTMLUniqueName_iface;
6349 }else if(IsEqualGUID(&IID_IElementSelector, riid)) {
6350 *ppv = &This->IElementSelector_iface;
6351 }else if(IsEqualGUID(&IID_IElementTraversal, riid)) {
6352 *ppv = &This->IElementTraversal_iface;
6353 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
6354 *ppv = &This->cp_container.IConnectionPointContainer_iface;
6355 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
6356 *ppv = &This->IProvideMultipleClassInfo_iface;
6357 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
6358 *ppv = &This->IProvideMultipleClassInfo_iface;
6359 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo, riid)) {
6360 *ppv = &This->IProvideMultipleClassInfo_iface;
6361 }else if(IsEqualGUID(&IID_IWineHTMLElementPrivate, riid)) {
6362 *ppv = &This->IWineHTMLElementPrivate_iface;
6363 }else {
6364 return HTMLDOMNode_QI(&This->node, riid, ppv);
6367 IUnknown_AddRef((IUnknown*)*ppv);
6368 return S_OK;
6371 void HTMLElement_destructor(HTMLDOMNode *iface)
6373 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6375 ConnectionPointContainer_Destroy(&This->cp_container);
6377 if(This->style) {
6378 This->style->elem = NULL;
6379 IHTMLStyle_Release(&This->style->IHTMLStyle_iface);
6381 if(This->runtime_style) {
6382 This->runtime_style->elem = NULL;
6383 IHTMLStyle_Release(&This->runtime_style->IHTMLStyle_iface);
6385 if(This->attrs) {
6386 HTMLDOMAttribute *attr;
6388 LIST_FOR_EACH_ENTRY(attr, &This->attrs->attrs, HTMLDOMAttribute, entry)
6389 attr->elem = NULL;
6391 This->attrs->elem = NULL;
6392 IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface);
6395 heap_free(This->filter);
6397 HTMLDOMNode_destructor(&This->node);
6400 HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
6402 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6403 HTMLElement *new_elem;
6404 HRESULT hres;
6406 hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
6407 if(FAILED(hres))
6408 return hres;
6410 if(This->filter) {
6411 new_elem->filter = heap_strdupW(This->filter);
6412 if(!new_elem->filter) {
6413 IHTMLElement_Release(&This->IHTMLElement_iface);
6414 return E_OUTOFMEMORY;
6418 *ret = &new_elem->node;
6419 return S_OK;
6422 HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
6424 HTMLElement *This = impl_from_HTMLDOMNode(iface);
6426 switch(eid) {
6427 case EVENTID_KEYDOWN: {
6428 nsIDOMKeyEvent *key_event;
6429 nsresult nsres;
6431 nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
6432 if(NS_SUCCEEDED(nsres)) {
6433 UINT32 code = 0;
6435 nsIDOMKeyEvent_GetKeyCode(key_event, &code);
6437 if(code == VK_F1 /* DOM_VK_F1 */) {
6438 DOMEvent *help_event;
6439 HRESULT hres;
6441 TRACE("F1 pressed\n");
6443 hres = create_document_event(This->node.doc, EVENTID_HELP, &help_event);
6444 if(SUCCEEDED(hres)) {
6445 dispatch_event(&This->node.event_target, help_event);
6446 IDOMEvent_Release(&help_event->IDOMEvent_iface);
6448 *prevent_default = TRUE;
6451 nsIDOMKeyEvent_Release(key_event);
6456 return S_OK;
6459 cp_static_data_t HTMLElementEvents2_data = { HTMLElementEvents2_tid, NULL /* FIXME */, TRUE };
6461 const cpc_entry_t HTMLElement_cpc[] = {
6462 HTMLELEMENT_CPC,
6463 {NULL}
6466 static const NodeImplVtbl HTMLElementImplVtbl = {
6467 &CLSID_HTMLUnknownElement,
6468 HTMLElement_QI,
6469 HTMLElement_destructor,
6470 HTMLElement_cpc,
6471 HTMLElement_clone,
6472 HTMLElement_handle_event,
6473 HTMLElement_get_attr_col
6476 static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
6478 return CONTAINING_RECORD(iface, HTMLElement, node.event_target.dispex);
6481 static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
6482 DWORD grfdex, DISPID *pid)
6484 HTMLElement *This = impl_from_DispatchEx(dispex);
6486 if(This->node.vtbl->get_dispid)
6487 return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
6489 return DISP_E_UNKNOWNNAME;
6492 static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
6493 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
6494 IServiceProvider *caller)
6496 HTMLElement *This = impl_from_DispatchEx(dispex);
6498 if(This->node.vtbl->invoke)
6499 return This->node.vtbl->invoke(&This->node, id, lcid, flags,
6500 params, res, ei, caller);
6502 ERR("(%p): element has no invoke method\n", This);
6503 return E_NOTIMPL;
6506 static HRESULT HTMLElement_populate_props(DispatchEx *dispex)
6508 HTMLElement *This = impl_from_DispatchEx(dispex);
6509 nsIDOMMozNamedAttrMap *attrs;
6510 nsIDOMAttr *attr;
6511 nsAString nsstr;
6512 const PRUnichar *str;
6513 BSTR name;
6514 VARIANT value;
6515 unsigned i;
6516 UINT32 len;
6517 DISPID id;
6518 nsresult nsres;
6519 HRESULT hres;
6521 if(!This->dom_element)
6522 return S_FALSE;
6524 if(dispex_compat_mode(dispex) >= COMPAT_MODE_IE9)
6525 return S_OK;
6527 nsres = nsIDOMElement_GetAttributes(This->dom_element, &attrs);
6528 if(NS_FAILED(nsres))
6529 return E_FAIL;
6531 nsres = nsIDOMMozNamedAttrMap_GetLength(attrs, &len);
6532 if(NS_FAILED(nsres)) {
6533 nsIDOMMozNamedAttrMap_Release(attrs);
6534 return E_FAIL;
6537 nsAString_Init(&nsstr, NULL);
6538 for(i=0; i<len; i++) {
6539 nsres = nsIDOMMozNamedAttrMap_Item(attrs, i, &attr);
6540 if(NS_FAILED(nsres))
6541 continue;
6543 nsres = nsIDOMAttr_GetNodeName(attr, &nsstr);
6544 if(NS_FAILED(nsres)) {
6545 nsIDOMAttr_Release(attr);
6546 continue;
6549 nsAString_GetData(&nsstr, &str);
6550 name = SysAllocString(str);
6551 if(!name) {
6552 nsIDOMAttr_Release(attr);
6553 continue;
6556 hres = IDispatchEx_GetDispID(&dispex->IDispatchEx_iface, name, fdexNameCaseInsensitive, &id);
6557 if(hres != DISP_E_UNKNOWNNAME) {
6558 nsIDOMAttr_Release(attr);
6559 SysFreeString(name);
6560 continue;
6563 nsres = nsIDOMAttr_GetNodeValue(attr, &nsstr);
6564 nsIDOMAttr_Release(attr);
6565 if(NS_FAILED(nsres)) {
6566 SysFreeString(name);
6567 continue;
6570 nsAString_GetData(&nsstr, &str);
6571 V_VT(&value) = VT_BSTR;
6572 if(*str) {
6573 V_BSTR(&value) = SysAllocString(str);
6574 if(!V_BSTR(&value)) {
6575 SysFreeString(name);
6576 continue;
6578 } else
6579 V_BSTR(&value) = NULL;
6581 IHTMLElement_setAttribute(&This->IHTMLElement_iface, name, value, 0);
6582 SysFreeString(name);
6583 VariantClear(&value);
6585 nsAString_Finish(&nsstr);
6587 nsIDOMMozNamedAttrMap_Release(attrs);
6588 return S_OK;
6591 static nsISupports *HTMLElement_get_gecko_target(DispatchEx *dispex)
6593 HTMLElement *This = impl_from_DispatchEx(dispex);
6594 return (nsISupports*)This->node.nsnode;
6597 static void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
6599 HTMLElement *This = impl_from_DispatchEx(dispex);
6600 ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid);
6603 static HRESULT HTMLElement_handle_event_default(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *nsevent, BOOL *prevent_default)
6605 HTMLElement *This = impl_from_DispatchEx(dispex);
6607 if(!This->node.vtbl->handle_event)
6608 return S_OK;
6609 return This->node.vtbl->handle_event(&This->node, eid, nsevent, prevent_default);
6612 static EventTarget *HTMLElement_get_parent_event_target(DispatchEx *dispex)
6614 HTMLElement *This = impl_from_DispatchEx(dispex);
6615 HTMLDOMNode *node;
6616 nsIDOMNode *nsnode;
6617 nsresult nsres;
6618 HRESULT hres;
6620 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &nsnode);
6621 assert(nsres == NS_OK);
6622 if(!nsnode)
6623 return NULL;
6625 hres = get_node(nsnode, TRUE, &node);
6626 nsIDOMNode_Release(nsnode);
6627 if(FAILED(hres))
6628 return NULL;
6630 return &node->event_target;
6633 static ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx *dispex)
6635 HTMLElement *This = impl_from_DispatchEx(dispex);
6636 IConnectionPointContainer_AddRef(&This->cp_container.IConnectionPointContainer_iface);
6637 return &This->cp_container;
6640 static IHTMLEventObj *HTMLElement_set_current_event(DispatchEx *dispex, IHTMLEventObj *event)
6642 HTMLElement *This = impl_from_DispatchEx(dispex);
6643 return default_set_current_event(This->node.doc->window, event);
6646 static HRESULT IHTMLElement6_setAttribute_hook(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
6647 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
6649 VARIANT args[2];
6650 HRESULT hres;
6651 DISPPARAMS new_dp = { args, NULL, 2, 0 };
6653 if(!(flags & DISPATCH_METHOD) || dp->cArgs < 2 || dp->cNamedArgs)
6654 return S_FALSE;
6656 switch(V_VT(&dp->rgvarg[dp->cArgs - 2])) {
6657 case VT_EMPTY:
6658 case VT_BSTR:
6659 case VT_NULL:
6660 return S_FALSE;
6661 default:
6662 break;
6665 hres = change_type(&args[0], &dp->rgvarg[dp->cArgs - 2], VT_BSTR, caller);
6666 if(FAILED(hres))
6667 return hres;
6668 args[1] = dp->rgvarg[dp->cArgs - 1];
6670 hres = dispex_call_builtin(dispex, DISPID_IHTMLELEMENT6_IE9_SETATTRIBUTE, &new_dp, res, ei, caller);
6671 VariantClear(&args[0]);
6672 return hres;
6675 void HTMLElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
6677 static const dispex_hook_t elem6_ie10_hooks[] = {
6678 {DISPID_IHTMLELEMENT6_IE9_SETATTRIBUTE, IHTMLElement6_setAttribute_hook},
6679 {DISPID_UNKNOWN}
6681 static const dispex_hook_t elem2_ie11_hooks[] = {
6682 {DISPID_IHTMLELEMENT2_DOSCROLL, NULL},
6683 {DISPID_IHTMLELEMENT2_READYSTATE, NULL},
6684 {DISPID_UNKNOWN}
6687 HTMLDOMNode_init_dispex_info(info, mode);
6689 dispex_info_add_interface(info, IHTMLElement2_tid, mode >= COMPAT_MODE_IE11 ? elem2_ie11_hooks : NULL);
6691 if(mode >= COMPAT_MODE_IE8)
6692 dispex_info_add_interface(info, IElementSelector_tid, NULL);
6694 if(mode >= COMPAT_MODE_IE9) {
6695 dispex_info_add_interface(info, IHTMLElement6_tid, mode >= COMPAT_MODE_IE10 ? elem6_ie10_hooks : NULL);
6696 dispex_info_add_interface(info, IElementTraversal_tid, NULL);
6699 if(mode >= COMPAT_MODE_IE10)
6701 dispex_info_add_interface(info, IHTMLElement7_tid, NULL);
6702 dispex_info_add_interface(info, IWineHTMLElementPrivate_tid, NULL);
6706 static const tid_t HTMLElement_iface_tids[] = {
6707 HTMLELEMENT_TIDS,
6711 static event_target_vtbl_t HTMLElement_event_target_vtbl = {
6713 NULL,
6714 HTMLElement_get_dispid,
6715 HTMLElement_invoke,
6716 NULL,
6717 HTMLElement_populate_props
6719 HTMLElement_get_gecko_target,
6720 HTMLElement_bind_event,
6721 HTMLElement_get_parent_event_target,
6722 HTMLElement_handle_event_default,
6723 HTMLElement_get_cp_container,
6724 HTMLElement_set_current_event
6727 struct token_list {
6728 DispatchEx dispex;
6729 IWineDOMTokenList IWineDOMTokenList_iface;
6730 IHTMLElement *element;
6732 LONG ref;
6735 static inline struct token_list *impl_from_IWineDOMTokenList(IWineDOMTokenList *iface)
6737 return CONTAINING_RECORD(iface, struct token_list, IWineDOMTokenList_iface);
6740 static HRESULT WINAPI token_list_QueryInterface(IWineDOMTokenList *iface, REFIID riid, void **ppv)
6742 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6744 TRACE("(%p)->(%s %p)\n", token_list, debugstr_mshtml_guid(riid), ppv);
6746 if(IsEqualGUID(&IID_IUnknown, riid)) {
6747 *ppv = &token_list->IWineDOMTokenList_iface;
6748 }else if(IsEqualGUID(&IID_IWineDOMTokenList, riid)) {
6749 *ppv = &token_list->IWineDOMTokenList_iface;
6750 }else if(dispex_query_interface(&token_list->dispex, riid, ppv)) {
6751 return *ppv ? S_OK : E_NOINTERFACE;
6752 }else {
6753 WARN("(%p)->(%s %p)\n", token_list, debugstr_mshtml_guid(riid), ppv);
6754 *ppv = NULL;
6755 return E_NOINTERFACE;
6758 IUnknown_AddRef((IUnknown*)*ppv);
6759 return S_OK;
6762 static ULONG WINAPI token_list_AddRef(IWineDOMTokenList *iface)
6764 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6765 LONG ref = InterlockedIncrement(&token_list->ref);
6767 TRACE("(%p) ref=%d\n", token_list, ref);
6769 return ref;
6772 static ULONG WINAPI token_list_Release(IWineDOMTokenList *iface)
6774 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6775 LONG ref = InterlockedDecrement(&token_list->ref);
6777 TRACE("(%p) ref=%d\n", token_list, ref);
6779 if(!ref) {
6780 IHTMLElement_Release(token_list->element);
6781 release_dispex(&token_list->dispex);
6782 heap_free(token_list);
6785 return ref;
6788 static HRESULT WINAPI token_list_GetTypeInfoCount(IWineDOMTokenList *iface, UINT *pctinfo)
6790 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6791 FIXME("(%p)->(%p)\n", token_list, pctinfo);
6792 return E_NOTIMPL;
6795 static HRESULT WINAPI token_list_GetTypeInfo(IWineDOMTokenList *iface, UINT iTInfo,
6796 LCID lcid, ITypeInfo **ppTInfo)
6798 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6800 return IDispatchEx_GetTypeInfo(&token_list->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
6803 static HRESULT WINAPI token_list_GetIDsOfNames(IWineDOMTokenList *iface, REFIID riid,
6804 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
6806 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6808 return IDispatchEx_GetIDsOfNames(&token_list->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
6809 lcid, rgDispId);
6812 static HRESULT WINAPI token_list_Invoke(IWineDOMTokenList *iface, DISPID dispIdMember,
6813 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
6814 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
6816 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6818 return IDispatchEx_Invoke(&token_list->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
6819 pDispParams, pVarResult, pExcepInfo, puArgErr);
6822 static const WCHAR *find_token(const WCHAR *list, const WCHAR *token, unsigned int token_len)
6824 const WCHAR *ptr, *next;
6826 if (!list || !token)
6827 return NULL;
6829 ptr = list;
6830 while (*ptr)
6832 while (iswspace(*ptr))
6833 ++ptr;
6834 if (!*ptr)
6835 break;
6836 next = ptr + 1;
6837 while (*next && !iswspace(*next))
6838 ++next;
6840 if (next - ptr == token_len && !wcsncmp(ptr, token, token_len))
6841 return ptr;
6842 ptr = next;
6844 return NULL;
6847 static HRESULT token_list_add_remove(IWineDOMTokenList *iface, BSTR token, BOOL remove)
6849 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6850 unsigned int i, len, old_len, new_len;
6851 const WCHAR *old_pos;
6852 BSTR new, old;
6853 HRESULT hr;
6855 TRACE("iface %p, token %s, remove %#x.\n", iface, debugstr_w(token), remove);
6857 len = token ? lstrlenW(token) : 0;
6858 if (!len)
6860 WARN("Empty token.\n");
6861 return E_INVALIDARG;
6864 for (i = 0; i < len; ++i)
6865 if (iswspace(token[i]))
6867 WARN("Token has spaces.\n");
6868 return E_INVALIDARG;
6871 if (FAILED(hr = IHTMLElement_get_className(token_list->element, &old)))
6872 return hr;
6874 TRACE("old %s.\n", debugstr_w(old));
6876 if (((old_pos = find_token(old, token, len)) && !remove)
6877 || (!old_pos && remove))
6879 SysFreeString(old);
6880 return S_OK;
6883 old_len = old ? lstrlenW(old) : 0;
6884 if (remove)
6886 while (old_pos != old && iswspace(old_pos[-1]))
6888 --old_pos;
6889 ++len;
6891 while (iswspace(old_pos[len]))
6892 ++len;
6894 if (old_pos != old && old_pos[len])
6895 --len;
6897 new_len = old_len - len;
6899 else
6901 new_len = old_len + len + !!old_len;
6904 if (!(new = SysAllocStringLen(NULL, new_len)))
6906 ERR("No memory.\n");
6907 SysFreeString(old);
6908 return E_OUTOFMEMORY;
6911 if (remove)
6913 memcpy(new, old, sizeof(*new) * (old_pos - old));
6914 memcpy(new + (old_pos - old), old_pos + len, sizeof(*new) * (old_len - (old_pos - old) - len + 1));
6916 else
6918 memcpy(new, old, sizeof(*new) * old_len);
6919 if (old_len)
6920 new[old_len++]= L' ';
6921 memcpy(new + old_len, token, sizeof(*new) * len);
6922 new[old_len + len] = 0;
6925 SysFreeString(old);
6927 TRACE("new %s.\n", debugstr_w(new));
6929 hr = IHTMLElement_put_className(token_list->element, new);
6930 SysFreeString(new);
6931 return hr;
6934 static HRESULT WINAPI token_list_add(IWineDOMTokenList *iface, BSTR token)
6936 return token_list_add_remove(iface, token, FALSE);
6939 static HRESULT WINAPI token_list_remove(IWineDOMTokenList *iface, BSTR token)
6941 return token_list_add_remove(iface, token, TRUE);
6944 static HRESULT WINAPI token_list_toString(IWineDOMTokenList *iface, BSTR *String)
6946 struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
6948 TRACE("(%p)->(%p)\n", token_list, String);
6950 return IHTMLElement_get_className(token_list->element, String);
6953 static const IWineDOMTokenListVtbl WineDOMTokenListVtbl = {
6954 token_list_QueryInterface,
6955 token_list_AddRef,
6956 token_list_Release,
6957 token_list_GetTypeInfoCount,
6958 token_list_GetTypeInfo,
6959 token_list_GetIDsOfNames,
6960 token_list_Invoke,
6961 token_list_add,
6962 token_list_remove,
6963 token_list_toString
6966 static inline struct token_list *token_list_from_DispatchEx(DispatchEx *iface)
6968 return CONTAINING_RECORD(iface, struct token_list, dispex);
6971 static HRESULT token_list_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params,
6972 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
6974 struct token_list *token_list = token_list_from_DispatchEx(dispex);
6975 HRESULT hres;
6977 switch(flags) {
6978 case DISPATCH_PROPERTYGET:
6979 hres = IHTMLElement_get_className(token_list->element, &V_BSTR(res));
6980 if(FAILED(hres))
6981 return hres;
6982 V_VT(res) = VT_BSTR;
6983 break;
6984 default:
6985 FIXME("Unimplemented flags %x\n", flags);
6986 return E_NOTIMPL;
6989 return S_OK;
6992 static const dispex_static_data_vtbl_t token_list_dispex_vtbl = {
6993 token_list_value
6996 static const tid_t token_list_iface_tids[] = {
6997 IWineDOMTokenList_tid,
7000 static dispex_static_data_t token_list_dispex = {
7001 L"DOMTokenList",
7002 &token_list_dispex_vtbl,
7003 IWineDOMTokenList_tid,
7004 token_list_iface_tids
7007 static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *element, IWineDOMTokenList **ret)
7009 struct token_list *obj;
7011 obj = heap_alloc_zero(sizeof(*obj));
7012 if(!obj)
7014 ERR("No memory.\n");
7015 return E_OUTOFMEMORY;
7018 obj->IWineDOMTokenList_iface.lpVtbl = &WineDOMTokenListVtbl;
7019 obj->ref = 1;
7020 init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineDOMTokenList_iface, &token_list_dispex, compat_mode);
7021 IHTMLElement_AddRef(element);
7022 obj->element = element;
7024 *ret = &obj->IWineDOMTokenList_iface;
7025 return S_OK;
7028 static inline HTMLElement *impl_from_IWineHTMLElementPrivateVtbl(IWineHTMLElementPrivate *iface)
7030 return CONTAINING_RECORD(iface, HTMLElement, IWineHTMLElementPrivate_iface);
7033 static HRESULT WINAPI htmlelement_private_QueryInterface(IWineHTMLElementPrivate *iface,
7034 REFIID riid, void **ppv)
7036 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7038 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
7041 static ULONG WINAPI htmlelement_private_AddRef(IWineHTMLElementPrivate *iface)
7043 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7045 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
7048 static ULONG WINAPI htmlelement_private_Release(IWineHTMLElementPrivate *iface)
7050 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7052 return IHTMLElement_Release(&This->IHTMLElement_iface);
7055 static HRESULT WINAPI htmlelement_private_GetTypeInfoCount(IWineHTMLElementPrivate *iface, UINT *pctinfo)
7057 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7059 return HTMLElement_GetTypeInfoCount(&This->IHTMLElement_iface, pctinfo);
7062 static HRESULT WINAPI htmlelement_private_GetTypeInfo(IWineHTMLElementPrivate *iface, UINT iTInfo,
7063 LCID lcid, ITypeInfo **ppTInfo)
7065 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7067 return HTMLElement_GetTypeInfo(&This->IHTMLElement_iface, iTInfo, lcid, ppTInfo);
7070 static HRESULT WINAPI htmlelement_private_GetIDsOfNames(IWineHTMLElementPrivate *iface, REFIID riid,
7071 LPOLESTR *rgszNames, UINT cNames,
7072 LCID lcid, DISPID *rgDispId)
7074 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7076 return HTMLElement_GetIDsOfNames(&This->IHTMLElement_iface, riid, rgszNames, cNames, lcid,
7077 rgDispId);
7080 static HRESULT WINAPI htmlelement_private_Invoke(IWineHTMLElementPrivate *iface, DISPID dispIdMember,
7081 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7082 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7084 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7086 return HTMLElement_Invoke(&This->IHTMLElement_iface, dispIdMember, riid, lcid, wFlags,
7087 pDispParams, pVarResult, pExcepInfo, puArgErr);
7090 static HRESULT WINAPI htmlelement_private_get_classList(IWineHTMLElementPrivate *iface, IDispatch **class_list)
7092 HTMLElement *This = impl_from_IWineHTMLElementPrivateVtbl(iface);
7094 TRACE("iface %p, class_list %p.\n", iface, class_list);
7096 return create_token_list(dispex_compat_mode(&This->node.event_target.dispex), &This->IHTMLElement_iface,
7097 (IWineDOMTokenList **)class_list);
7100 static const IWineHTMLElementPrivateVtbl WineHTMLElementPrivateVtbl = {
7101 htmlelement_private_QueryInterface,
7102 htmlelement_private_AddRef,
7103 htmlelement_private_Release,
7104 htmlelement_private_GetTypeInfoCount,
7105 htmlelement_private_GetTypeInfo,
7106 htmlelement_private_GetIDsOfNames,
7107 htmlelement_private_Invoke,
7108 htmlelement_private_get_classList,
7111 static dispex_static_data_t HTMLElement_dispex = {
7112 L"HTMLElement",
7113 &HTMLElement_event_target_vtbl.dispex_vtbl,
7114 DispHTMLUnknownElement_tid,
7115 HTMLElement_iface_tids,
7116 HTMLElement_init_dispex_info
7119 static dispex_static_data_t HTMLUnknownElement_dispex = {
7120 L"HTMLUnknownElement",
7121 &HTMLElement_event_target_vtbl.dispex_vtbl,
7122 DispHTMLUnknownElement_tid,
7123 HTMLElement_iface_tids,
7124 HTMLElement_init_dispex_info
7127 void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMElement *nselem, dispex_static_data_t *dispex_data)
7129 This->IHTMLElement_iface.lpVtbl = &HTMLElementVtbl;
7130 This->IHTMLElement2_iface.lpVtbl = &HTMLElement2Vtbl;
7131 This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
7132 This->IHTMLElement4_iface.lpVtbl = &HTMLElement4Vtbl;
7133 This->IHTMLElement6_iface.lpVtbl = &HTMLElement6Vtbl;
7134 This->IHTMLElement7_iface.lpVtbl = &HTMLElement7Vtbl;
7135 This->IHTMLUniqueName_iface.lpVtbl = &HTMLUniqueNameVtbl;
7136 This->IElementSelector_iface.lpVtbl = &ElementSelectorVtbl;
7137 This->IElementTraversal_iface.lpVtbl = &ElementTraversalVtbl;
7138 This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
7139 This->IWineHTMLElementPrivate_iface.lpVtbl = &WineHTMLElementPrivateVtbl;
7141 if(dispex_data && !dispex_data->vtbl)
7142 dispex_data->vtbl = &HTMLElement_event_target_vtbl.dispex_vtbl;
7144 if(nselem) {
7145 nsIDOMHTMLElement *html_element;
7146 nsresult nsres;
7148 HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLUnknownElement_dispex);
7150 /* No AddRef, share reference with HTMLDOMNode */
7151 assert((nsIDOMNode*)nselem == This->node.nsnode);
7152 This->dom_element = nselem;
7154 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&html_element);
7155 if(NS_SUCCEEDED(nsres)) {
7156 This->html_element = html_element;
7157 /* share reference with HTMLDOMNode */
7158 assert((nsIDOMNode*)html_element == This->node.nsnode);
7159 nsIDOMHTMLElement_Release(html_element);
7163 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface, This->node.vtbl->cpc_entries);
7166 HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
7168 nsIDOMElement *nselem;
7169 nsAString tag_name_str;
7170 const PRUnichar *tag_name;
7171 const tag_desc_t *tag;
7172 HTMLElement *elem;
7173 nsresult nsres;
7174 HRESULT hres;
7176 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
7177 if(NS_FAILED(nsres)) {
7178 ERR("no nsIDOMElement iface\n");
7179 return E_FAIL;
7182 nsAString_Init(&tag_name_str, NULL);
7183 nsIDOMElement_GetTagName(nselem, &tag_name_str);
7185 nsAString_GetData(&tag_name_str, &tag_name);
7187 tag = get_tag_desc(tag_name);
7188 if(tag) {
7189 hres = tag->constructor(doc, nselem, &elem);
7190 }else {
7191 nsIDOMSVGElement *svg_element;
7193 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element);
7194 if(NS_SUCCEEDED(nsres)) {
7195 hres = create_svg_element(doc, svg_element, tag_name, &elem);
7196 nsIDOMSVGElement_Release(svg_element);
7197 }else if(use_generic) {
7198 hres = HTMLGenericElement_Create(doc, nselem, &elem);
7199 }else {
7200 elem = heap_alloc_zero(sizeof(HTMLElement));
7201 if(elem) {
7202 elem->node.vtbl = &HTMLElementImplVtbl;
7203 HTMLElement_Init(elem, doc, nselem, &HTMLUnknownElement_dispex);
7204 hres = S_OK;
7205 }else {
7206 hres = E_OUTOFMEMORY;
7211 TRACE("%s ret %p\n", debugstr_w(tag_name), elem);
7213 nsIDOMElement_Release(nselem);
7214 nsAString_Finish(&tag_name_str);
7215 if(FAILED(hres))
7216 return hres;
7218 *ret = elem;
7219 return S_OK;
7222 static HRESULT HTMLElement_Ctor(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
7224 HTMLElement *ret;
7226 ret = heap_alloc_zero(sizeof(*ret));
7227 if(!ret)
7228 return E_OUTOFMEMORY;
7230 ret->node.vtbl = &HTMLElementImplVtbl;
7231 HTMLElement_Init(ret, doc, nselem, &HTMLElement_dispex);
7233 *elem = ret;
7234 return S_OK;
7237 HRESULT get_element(nsIDOMElement *nselem, HTMLElement **ret)
7239 HTMLDOMNode *node;
7240 HRESULT hres;
7242 hres = get_node((nsIDOMNode*)nselem, TRUE, &node);
7243 if(FAILED(hres))
7244 return hres;
7246 *ret = impl_from_HTMLDOMNode(node);
7247 return S_OK;
7250 /* interface IHTMLFiltersCollection */
7251 static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
7253 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7255 TRACE("%p %s %p\n", This, debugstr_mshtml_guid(riid), ppv );
7257 if(IsEqualGUID(&IID_IUnknown, riid)) {
7258 *ppv = &This->IHTMLFiltersCollection_iface;
7259 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
7260 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
7261 *ppv = &This->IHTMLFiltersCollection_iface;
7262 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
7263 return *ppv ? S_OK : E_NOINTERFACE;
7264 }else {
7265 *ppv = NULL;
7266 FIXME("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
7267 return E_NOINTERFACE;
7270 IUnknown_AddRef((IUnknown*)*ppv);
7271 return S_OK;
7274 static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
7276 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7277 LONG ref = InterlockedIncrement(&This->ref);
7279 TRACE("(%p) ref=%d\n", This, ref);
7281 return ref;
7284 static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
7286 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7287 LONG ref = InterlockedDecrement(&This->ref);
7289 TRACE("(%p) ref=%d\n", This, ref);
7291 if(!ref)
7293 heap_free(This);
7296 return ref;
7299 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
7301 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7302 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7305 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
7306 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
7308 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7309 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7312 static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
7313 REFIID riid, LPOLESTR *rgszNames, UINT cNames,
7314 LCID lcid, DISPID *rgDispId)
7316 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7317 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7318 lcid, rgDispId);
7321 static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
7322 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
7323 EXCEPINFO *pExcepInfo, UINT *puArgErr)
7325 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7326 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7327 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7330 static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
7332 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7334 if(!p)
7335 return E_POINTER;
7337 FIXME("(%p)->(%p) Always returning 0\n", This, p);
7338 *p = 0;
7340 return S_OK;
7343 static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
7345 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7346 FIXME("(%p)->(%p)\n", This, p);
7347 return E_NOTIMPL;
7350 static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
7352 HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
7353 FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
7354 return E_NOTIMPL;
7357 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
7358 HTMLFiltersCollection_QueryInterface,
7359 HTMLFiltersCollection_AddRef,
7360 HTMLFiltersCollection_Release,
7361 HTMLFiltersCollection_GetTypeInfoCount,
7362 HTMLFiltersCollection_GetTypeInfo,
7363 HTMLFiltersCollection_GetIDsOfNames,
7364 HTMLFiltersCollection_Invoke,
7365 HTMLFiltersCollection_get_length,
7366 HTMLFiltersCollection_get__newEnum,
7367 HTMLFiltersCollection_item
7370 static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
7372 WCHAR *ptr;
7373 int idx = 0;
7375 for(ptr = name; *ptr && is_digit(*ptr); ptr++)
7376 idx = idx*10 + (*ptr-'0');
7377 if(*ptr)
7378 return DISP_E_UNKNOWNNAME;
7380 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
7381 TRACE("ret %x\n", *dispid);
7382 return S_OK;
7385 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
7386 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
7388 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
7390 V_VT(res) = VT_DISPATCH;
7391 V_DISPATCH(res) = NULL;
7393 FIXME("always returning NULL\n");
7395 return S_OK;
7398 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
7399 NULL,
7400 HTMLFiltersCollection_get_dispid,
7401 HTMLFiltersCollection_invoke,
7402 NULL
7405 static const tid_t HTMLFiltersCollection_iface_tids[] = {
7406 IHTMLFiltersCollection_tid,
7409 static dispex_static_data_t HTMLFiltersCollection_dispex = {
7410 L"FiltersCollection",
7411 &HTMLFiltersCollection_dispex_vtbl,
7412 IHTMLFiltersCollection_tid,
7413 HTMLFiltersCollection_iface_tids
7416 static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret)
7418 HTMLFiltersCollection *collection;
7420 if(!(collection = heap_alloc(sizeof(HTMLFiltersCollection))))
7421 return E_OUTOFMEMORY;
7423 collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
7424 collection->ref = 1;
7426 init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface,
7427 &HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8));
7429 *ret = &collection->IHTMLFiltersCollection_iface;
7430 return S_OK;
7433 /* interface IHTMLAttributeCollection */
7434 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection *iface)
7436 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection_iface);
7439 static HRESULT WINAPI HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection *iface, REFIID riid, void **ppv)
7441 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7443 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
7445 if(IsEqualGUID(&IID_IUnknown, riid)) {
7446 *ppv = &This->IHTMLAttributeCollection_iface;
7447 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection, riid)) {
7448 *ppv = &This->IHTMLAttributeCollection_iface;
7449 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2, riid)) {
7450 *ppv = &This->IHTMLAttributeCollection2_iface;
7451 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3, riid)) {
7452 *ppv = &This->IHTMLAttributeCollection3_iface;
7453 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
7454 return *ppv ? S_OK : E_NOINTERFACE;
7455 }else {
7456 *ppv = NULL;
7457 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
7458 return E_NOINTERFACE;
7461 IUnknown_AddRef((IUnknown*)*ppv);
7462 return S_OK;
7465 static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *iface)
7467 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7468 LONG ref = InterlockedIncrement(&This->ref);
7470 TRACE("(%p) ref=%d\n", This, ref);
7472 return ref;
7475 static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *iface)
7477 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7478 LONG ref = InterlockedDecrement(&This->ref);
7480 TRACE("(%p) ref=%d\n", This, ref);
7482 if(!ref) {
7483 while(!list_empty(&This->attrs)) {
7484 HTMLDOMAttribute *attr = LIST_ENTRY(list_head(&This->attrs), HTMLDOMAttribute, entry);
7486 list_remove(&attr->entry);
7487 attr->elem = NULL;
7488 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
7491 heap_free(This);
7494 return ref;
7497 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection *iface, UINT *pctinfo)
7499 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7500 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7503 static HRESULT WINAPI HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection *iface, UINT iTInfo,
7504 LCID lcid, ITypeInfo **ppTInfo)
7506 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7507 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7510 static HRESULT WINAPI HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection *iface, REFIID riid,
7511 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7513 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7514 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7515 lcid, rgDispId);
7518 static HRESULT WINAPI HTMLAttributeCollection_Invoke(IHTMLAttributeCollection *iface, DISPID dispIdMember,
7519 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7520 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7522 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7523 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7524 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7527 static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid)
7529 IDispatchEx *dispex = &This->elem->node.event_target.dispex.IDispatchEx_iface;
7530 DISPID id = DISPID_STARTENUM;
7531 LONG len = -1;
7532 HRESULT hres;
7534 FIXME("filter non-enumerable attributes out\n");
7536 while(1) {
7537 hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id);
7538 if(FAILED(hres))
7539 return hres;
7540 else if(hres == S_FALSE)
7541 break;
7543 len++;
7544 if(len == *idx)
7545 break;
7548 if(dispid) {
7549 *dispid = id;
7550 return *idx==len ? S_OK : DISP_E_UNKNOWNNAME;
7553 *idx = len+1;
7554 return S_OK;
7557 static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id)
7559 HRESULT hres;
7561 if(name[0]>='0' && name[0]<='9') {
7562 WCHAR *end_ptr;
7563 LONG idx;
7565 idx = wcstoul(name, &end_ptr, 10);
7566 if(!*end_ptr) {
7567 hres = get_attr_dispid_by_idx(This, &idx, id);
7568 if(SUCCEEDED(hres))
7569 return hres;
7573 if(!This->elem) {
7574 WARN("NULL elem\n");
7575 return E_UNEXPECTED;
7578 hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface,
7579 name, fdexNameCaseInsensitive, id);
7580 return hres;
7583 static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr)
7585 HTMLDOMAttribute *iter;
7586 LONG pos = 0;
7587 HRESULT hres;
7589 *attr = NULL;
7590 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
7591 if(iter->dispid == id) {
7592 *attr = iter;
7593 break;
7595 pos++;
7598 if(!*attr) {
7599 if(!This->elem) {
7600 WARN("NULL elem\n");
7601 return E_UNEXPECTED;
7604 hres = HTMLDOMAttribute_Create(NULL, This->elem, id, dispex_compat_mode(&This->elem->node.event_target.dispex), attr);
7605 if(FAILED(hres))
7606 return hres;
7609 IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface);
7610 if(list_pos)
7611 *list_pos = pos;
7612 return S_OK;
7615 static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollection *iface, LONG *p)
7617 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7618 HRESULT hres;
7620 TRACE("(%p)->(%p)\n", This, p);
7622 *p = -1;
7623 hres = get_attr_dispid_by_idx(This, p, NULL);
7624 return hres;
7627 static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection *iface, IUnknown **p)
7629 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7630 FIXME("(%p)->(%p)\n", This, p);
7631 return E_NOTIMPL;
7634 static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem)
7636 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
7637 HTMLDOMAttribute *attr;
7638 DISPID id;
7639 HRESULT hres;
7641 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(name), ppItem);
7643 switch(V_VT(name)) {
7644 case VT_I4:
7645 hres = get_attr_dispid_by_idx(This, &V_I4(name), &id);
7646 break;
7647 case VT_BSTR:
7648 hres = get_attr_dispid_by_name(This, V_BSTR(name), &id);
7649 break;
7650 default:
7651 FIXME("unsupported name %s\n", debugstr_variant(name));
7652 hres = E_NOTIMPL;
7654 if(hres == DISP_E_UNKNOWNNAME)
7655 return E_INVALIDARG;
7656 if(FAILED(hres))
7657 return hres;
7659 hres = get_domattr(This, id, NULL, &attr);
7660 if(FAILED(hres))
7661 return hres;
7663 *ppItem = (IDispatch*)&attr->IHTMLDOMAttribute_iface;
7664 return S_OK;
7667 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl = {
7668 HTMLAttributeCollection_QueryInterface,
7669 HTMLAttributeCollection_AddRef,
7670 HTMLAttributeCollection_Release,
7671 HTMLAttributeCollection_GetTypeInfoCount,
7672 HTMLAttributeCollection_GetTypeInfo,
7673 HTMLAttributeCollection_GetIDsOfNames,
7674 HTMLAttributeCollection_Invoke,
7675 HTMLAttributeCollection_get_length,
7676 HTMLAttributeCollection__newEnum,
7677 HTMLAttributeCollection_item
7680 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2 *iface)
7682 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection2_iface);
7685 static HRESULT WINAPI HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2 *iface, REFIID riid, void **ppv)
7687 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7688 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
7691 static ULONG WINAPI HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2 *iface)
7693 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7694 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
7697 static ULONG WINAPI HTMLAttributeCollection2_Release(IHTMLAttributeCollection2 *iface)
7699 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7700 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
7703 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2 *iface, UINT *pctinfo)
7705 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7706 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7709 static HRESULT WINAPI HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2 *iface, UINT iTInfo,
7710 LCID lcid, ITypeInfo **ppTInfo)
7712 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7713 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7716 static HRESULT WINAPI HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2 *iface, REFIID riid,
7717 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7719 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7720 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7721 lcid, rgDispId);
7724 static HRESULT WINAPI HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2 *iface, DISPID dispIdMember,
7725 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7726 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7728 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7729 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7730 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7733 static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2 *iface, BSTR bstrName,
7734 IHTMLDOMAttribute **newretNode)
7736 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7737 HTMLDOMAttribute *attr;
7738 DISPID id;
7739 HRESULT hres;
7741 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
7743 hres = get_attr_dispid_by_name(This, bstrName, &id);
7744 if(hres == DISP_E_UNKNOWNNAME) {
7745 *newretNode = NULL;
7746 return S_OK;
7747 } else if(FAILED(hres)) {
7748 return hres;
7751 hres = get_domattr(This, id, NULL, &attr);
7752 if(FAILED(hres))
7753 return hres;
7755 *newretNode = &attr->IHTMLDOMAttribute_iface;
7756 return S_OK;
7759 static HRESULT WINAPI HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2 *iface,
7760 IHTMLDOMAttribute *ppNode, IHTMLDOMAttribute **newretNode)
7762 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7763 FIXME("(%p)->(%p %p)\n", This, ppNode, newretNode);
7764 return E_NOTIMPL;
7767 static HRESULT WINAPI HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2 *iface,
7768 BSTR bstrName, IHTMLDOMAttribute **newretNode)
7770 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface);
7771 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode);
7772 return E_NOTIMPL;
7775 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl = {
7776 HTMLAttributeCollection2_QueryInterface,
7777 HTMLAttributeCollection2_AddRef,
7778 HTMLAttributeCollection2_Release,
7779 HTMLAttributeCollection2_GetTypeInfoCount,
7780 HTMLAttributeCollection2_GetTypeInfo,
7781 HTMLAttributeCollection2_GetIDsOfNames,
7782 HTMLAttributeCollection2_Invoke,
7783 HTMLAttributeCollection2_getNamedItem,
7784 HTMLAttributeCollection2_setNamedItem,
7785 HTMLAttributeCollection2_removeNamedItem
7788 static inline HTMLAttributeCollection *impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3 *iface)
7790 return CONTAINING_RECORD(iface, HTMLAttributeCollection, IHTMLAttributeCollection3_iface);
7793 static HRESULT WINAPI HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3 *iface, REFIID riid, void **ppv)
7795 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7796 return IHTMLAttributeCollection_QueryInterface(&This->IHTMLAttributeCollection_iface, riid, ppv);
7799 static ULONG WINAPI HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3 *iface)
7801 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7802 return IHTMLAttributeCollection_AddRef(&This->IHTMLAttributeCollection_iface);
7805 static ULONG WINAPI HTMLAttributeCollection3_Release(IHTMLAttributeCollection3 *iface)
7807 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7808 return IHTMLAttributeCollection_Release(&This->IHTMLAttributeCollection_iface);
7811 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3 *iface, UINT *pctinfo)
7813 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7814 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
7817 static HRESULT WINAPI HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3 *iface, UINT iTInfo,
7818 LCID lcid, ITypeInfo **ppTInfo)
7820 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7821 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
7824 static HRESULT WINAPI HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3 *iface, REFIID riid,
7825 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
7827 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7828 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
7829 lcid, rgDispId);
7832 static HRESULT WINAPI HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3 *iface, DISPID dispIdMember,
7833 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
7834 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
7836 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7837 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
7838 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
7841 static HRESULT WINAPI HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3 *iface, BSTR bstrName,
7842 IHTMLDOMAttribute **ppNodeOut)
7844 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7845 return IHTMLAttributeCollection2_getNamedItem(&This->IHTMLAttributeCollection2_iface, bstrName, ppNodeOut);
7848 static HRESULT WINAPI HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3 *iface,
7849 IHTMLDOMAttribute *pNodeIn, IHTMLDOMAttribute **ppNodeOut)
7851 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7852 FIXME("(%p)->(%p %p)\n", This, pNodeIn, ppNodeOut);
7853 return E_NOTIMPL;
7856 static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3 *iface,
7857 BSTR bstrName, IHTMLDOMAttribute **ppNodeOut)
7859 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7860 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrName), ppNodeOut);
7861 return E_NOTIMPL;
7864 static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut)
7866 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7867 HTMLDOMAttribute *attr;
7868 DISPID id;
7869 HRESULT hres;
7871 TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut);
7873 hres = get_attr_dispid_by_idx(This, &index, &id);
7874 if(hres == DISP_E_UNKNOWNNAME)
7875 return E_INVALIDARG;
7876 if(FAILED(hres))
7877 return hres;
7879 hres = get_domattr(This, id, NULL, &attr);
7880 if(FAILED(hres))
7881 return hres;
7883 *ppNodeOut = &attr->IHTMLDOMAttribute_iface;
7884 return S_OK;
7887 static HRESULT WINAPI HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3 *iface, LONG *p)
7889 HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface);
7890 return IHTMLAttributeCollection_get_length(&This->IHTMLAttributeCollection_iface, p);
7893 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl = {
7894 HTMLAttributeCollection3_QueryInterface,
7895 HTMLAttributeCollection3_AddRef,
7896 HTMLAttributeCollection3_Release,
7897 HTMLAttributeCollection3_GetTypeInfoCount,
7898 HTMLAttributeCollection3_GetTypeInfo,
7899 HTMLAttributeCollection3_GetIDsOfNames,
7900 HTMLAttributeCollection3_Invoke,
7901 HTMLAttributeCollection3_getNamedItem,
7902 HTMLAttributeCollection3_setNamedItem,
7903 HTMLAttributeCollection3_removeNamedItem,
7904 HTMLAttributeCollection3_item,
7905 HTMLAttributeCollection3_get_length
7908 static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(DispatchEx *iface)
7910 return CONTAINING_RECORD(iface, HTMLAttributeCollection, dispex);
7913 static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
7915 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7916 HTMLDOMAttribute *attr;
7917 LONG pos;
7918 HRESULT hres;
7920 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
7922 hres = get_attr_dispid_by_name(This, name, dispid);
7923 if(FAILED(hres))
7924 return hres;
7926 hres = get_domattr(This, *dispid, &pos, &attr);
7927 if(FAILED(hres))
7928 return hres;
7929 IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
7931 *dispid = MSHTML_DISPID_CUSTOM_MIN+pos;
7932 return S_OK;
7935 static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
7936 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
7938 HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
7940 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
7942 switch(flags) {
7943 case DISPATCH_PROPERTYGET: {
7944 HTMLDOMAttribute *iter;
7945 DWORD pos;
7947 pos = id-MSHTML_DISPID_CUSTOM_MIN;
7949 LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
7950 if(!pos) {
7951 IHTMLDOMAttribute_AddRef(&iter->IHTMLDOMAttribute_iface);
7952 V_VT(res) = VT_DISPATCH;
7953 V_DISPATCH(res) = (IDispatch*)&iter->IHTMLDOMAttribute_iface;
7954 return S_OK;
7956 pos--;
7959 WARN("invalid arg\n");
7960 return E_INVALIDARG;
7963 default:
7964 FIXME("unimplemented flags %x\n", flags);
7965 return E_NOTIMPL;
7969 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl = {
7970 NULL,
7971 HTMLAttributeCollection_get_dispid,
7972 HTMLAttributeCollection_invoke,
7973 NULL
7976 static const tid_t HTMLAttributeCollection_iface_tids[] = {
7977 IHTMLAttributeCollection_tid,
7978 IHTMLAttributeCollection2_tid,
7979 IHTMLAttributeCollection3_tid,
7983 static dispex_static_data_t HTMLAttributeCollection_dispex = {
7984 L"NamedNodeMap",
7985 &HTMLAttributeCollection_dispex_vtbl,
7986 DispHTMLAttributeCollection_tid,
7987 HTMLAttributeCollection_iface_tids
7990 HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac)
7992 HTMLElement *This = impl_from_HTMLDOMNode(iface);
7994 if(This->attrs) {
7995 IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface);
7996 *ac = This->attrs;
7997 return S_OK;
8000 This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection));
8001 if(!This->attrs)
8002 return E_OUTOFMEMORY;
8004 This->attrs->IHTMLAttributeCollection_iface.lpVtbl = &HTMLAttributeCollectionVtbl;
8005 This->attrs->IHTMLAttributeCollection2_iface.lpVtbl = &HTMLAttributeCollection2Vtbl;
8006 This->attrs->IHTMLAttributeCollection3_iface.lpVtbl = &HTMLAttributeCollection3Vtbl;
8007 This->attrs->ref = 2;
8009 This->attrs->elem = This;
8010 list_init(&This->attrs->attrs);
8011 init_dispatch(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface,
8012 &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
8014 *ac = This->attrs;
8015 return S_OK;