mshtml: Pass DispatchEx pointer instead of outer IUnknown to DispatchEx's vtbl functions.
[wine.git] / dlls / mshtml / htmlelem.c
blob6349b017e92c48a172a82ba3ed31f43129149a45
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <stdarg.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"
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 #include "mshtml_private.h"
35 #include "htmlevent.h"
37 static const WCHAR aW[] = {'A',0};
38 static const WCHAR bodyW[] = {'B','O','D','Y',0};
39 static const WCHAR embedW[] = {'E','M','B','E','D',0};
40 static const WCHAR formW[] = {'F','O','R','M',0};
41 static const WCHAR frameW[] = {'F','R','A','M','E',0};
42 static const WCHAR iframeW[] = {'I','F','R','A','M','E',0};
43 static const WCHAR imgW[] = {'I','M','G',0};
44 static const WCHAR inputW[] = {'I','N','P','U','T',0};
45 static const WCHAR objectW[] = {'O','B','J','E','C','T',0};
46 static const WCHAR optionW[] = {'O','P','T','I','O','N',0};
47 static const WCHAR scriptW[] = {'S','C','R','I','P','T',0};
48 static const WCHAR selectW[] = {'S','E','L','E','C','T',0};
49 static const WCHAR styleW[] = {'S','T','Y','L','E',0};
50 static const WCHAR tableW[] = {'T','A','B','L','E',0};
51 static const WCHAR textareaW[] = {'T','E','X','T','A','R','E','A',0};
52 static const WCHAR trW[] = {'T','R',0};
54 typedef struct {
55 const WCHAR *name;
56 HRESULT (*constructor)(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
57 } tag_desc_t;
59 static const tag_desc_t tag_descs[] = {
60 {aW, HTMLAnchorElement_Create},
61 {bodyW, HTMLBodyElement_Create},
62 {embedW, HTMLEmbedElement_Create},
63 {formW, HTMLFormElement_Create},
64 {frameW, HTMLFrameElement_Create},
65 {iframeW, HTMLIFrame_Create},
66 {imgW, HTMLImgElement_Create},
67 {inputW, HTMLInputElement_Create},
68 {objectW, HTMLObjectElement_Create},
69 {optionW, HTMLOptionElement_Create},
70 {scriptW, HTMLScriptElement_Create},
71 {selectW, HTMLSelectElement_Create},
72 {styleW, HTMLStyleElement_Create},
73 {tableW, HTMLTable_Create},
74 {textareaW, HTMLTextAreaElement_Create},
75 {trW, HTMLTableRow_Create}
78 static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
80 DWORD min=0, max=sizeof(tag_descs)/sizeof(*tag_descs)-1, i;
81 int r;
83 while(min <= max) {
84 i = (min+max)/2;
85 r = strcmpW(tag_name, tag_descs[i].name);
86 if(!r)
87 return tag_descs+i;
89 if(r < 0)
90 max = i-1;
91 else
92 min = i+1;
95 return NULL;
98 typedef struct
100 DispatchEx dispex;
101 const IHTMLFiltersCollectionVtbl *lpHTMLFiltersCollectionVtbl;
103 LONG ref;
104 } HTMLFiltersCollection;
106 #define HTMLFILTERSCOLLECTION(x) ((IHTMLFiltersCollection*) &(x)->lpHTMLFiltersCollectionVtbl)
108 #define HTMLFILTERSCOLLECTION_THIS(iface) \
109 DEFINE_THIS(HTMLFiltersCollection, HTMLFiltersCollection, iface)
111 IHTMLFiltersCollection *HTMLFiltersCollection_Create(void);
114 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
116 #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
118 HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
120 nsIDOMElement *nselem;
121 nsAString tag_str;
122 nsresult nsres;
124 if(!doc->nsdoc) {
125 WARN("NULL nsdoc\n");
126 return E_UNEXPECTED;
129 nsAString_InitDepend(&tag_str, tag);
130 nsres = nsIDOMDocument_CreateElement(doc->nsdoc, &tag_str, &nselem);
131 nsAString_Finish(&tag_str);
132 if(NS_FAILED(nsres)) {
133 ERR("CreateElement failed: %08x\n", nsres);
134 return E_FAIL;
137 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)ret);
138 nsIDOMElement_Release(nselem);
139 if(NS_FAILED(nsres)) {
140 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres);
141 return E_FAIL;
144 return S_OK;
147 #define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
149 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
150 REFIID riid, void **ppv)
152 HTMLElement *This = HTMLELEM_THIS(iface);
154 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv);
157 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
159 HTMLElement *This = HTMLELEM_THIS(iface);
161 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node));
164 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
166 HTMLElement *This = HTMLELEM_THIS(iface);
168 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node));
171 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
173 HTMLElement *This = HTMLELEM_THIS(iface);
174 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
177 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
178 LCID lcid, ITypeInfo **ppTInfo)
180 HTMLElement *This = HTMLELEM_THIS(iface);
181 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
184 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
185 LPOLESTR *rgszNames, UINT cNames,
186 LCID lcid, DISPID *rgDispId)
188 HTMLElement *This = HTMLELEM_THIS(iface);
189 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
192 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
193 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
194 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
196 HTMLElement *This = HTMLELEM_THIS(iface);
197 return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
198 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
201 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
202 VARIANT AttributeValue, LONG lFlags)
204 HTMLElement *This = HTMLELEM_THIS(iface);
205 HRESULT hres;
206 DISPID dispid, dispidNamed = DISPID_PROPERTYPUT;
207 DISPPARAMS dispParams;
208 EXCEPINFO excep;
210 TRACE("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
212 hres = IDispatchEx_GetDispID(DISPATCHEX(&This->node.dispex), strAttributeName,
213 fdexNameCaseInsensitive | fdexNameEnsure, &dispid);
214 if(FAILED(hres))
215 return hres;
217 dispParams.cArgs = 1;
218 dispParams.cNamedArgs = 1;
219 dispParams.rgdispidNamedArgs = &dispidNamed;
220 dispParams.rgvarg = &AttributeValue;
222 hres = IDispatchEx_InvokeEx(DISPATCHEX(&This->node.dispex), dispid,
223 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams,
224 NULL, &excep, NULL);
225 return hres;
228 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
229 LONG lFlags, VARIANT *AttributeValue)
231 HTMLElement *This = HTMLELEM_THIS(iface);
232 DISPID dispid;
233 HRESULT hres;
234 DISPPARAMS dispParams = {NULL, NULL, 0, 0};
235 EXCEPINFO excep;
237 TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
239 hres = IDispatchEx_GetDispID(DISPATCHEX(&This->node.dispex), strAttributeName,
240 fdexNameCaseInsensitive, &dispid);
241 if(hres == DISP_E_UNKNOWNNAME) {
242 V_VT(AttributeValue) = VT_NULL;
243 return S_OK;
246 if(FAILED(hres)) {
247 V_VT(AttributeValue) = VT_NULL;
248 return hres;
251 hres = IDispatchEx_InvokeEx(DISPATCHEX(&This->node.dispex), dispid,
252 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispParams,
253 AttributeValue, &excep, NULL);
255 return hres;
258 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
259 LONG lFlags, VARIANT_BOOL *pfSuccess)
261 HTMLElement *This = HTMLELEM_THIS(iface);
263 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
265 return remove_prop(&This->node.dispex, strAttributeName, pfSuccess);
268 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
270 HTMLElement *This = HTMLELEM_THIS(iface);
271 nsAString classname_str;
272 nsresult nsres;
274 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
276 if(!This->nselem) {
277 FIXME("NULL nselem\n");
278 return E_NOTIMPL;
281 nsAString_InitDepend(&classname_str, v);
282 nsres = nsIDOMHTMLElement_SetClassName(This->nselem, &classname_str);
283 nsAString_Finish(&classname_str);
284 if(NS_FAILED(nsres))
285 ERR("SetClassName failed: %08x\n", nsres);
287 return S_OK;
290 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
292 HTMLElement *This = HTMLELEM_THIS(iface);
293 nsAString class_str;
294 nsresult nsres;
295 HRESULT hres = S_OK;
297 TRACE("(%p)->(%p)\n", This, p);
299 if(!This->nselem) {
300 FIXME("NULL nselem\n");
301 return E_NOTIMPL;
304 nsAString_Init(&class_str, NULL);
305 nsres = nsIDOMHTMLElement_GetClassName(This->nselem, &class_str);
307 if(NS_SUCCEEDED(nsres)) {
308 const PRUnichar *class;
309 nsAString_GetData(&class_str, &class);
310 *p = *class ? SysAllocString(class) : NULL;
311 }else {
312 ERR("GetClassName failed: %08x\n", nsres);
313 hres = E_FAIL;
316 nsAString_Finish(&class_str);
318 TRACE("className=%s\n", debugstr_w(*p));
319 return hres;
322 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
324 HTMLElement *This = HTMLELEM_THIS(iface);
325 nsAString id_str;
326 nsresult nsres;
328 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
330 if(!This->nselem) {
331 FIXME("nselem == NULL\n");
332 return S_OK;
335 nsAString_InitDepend(&id_str, v);
336 nsres = nsIDOMHTMLElement_SetId(This->nselem, &id_str);
337 nsAString_Finish(&id_str);
338 if(NS_FAILED(nsres))
339 ERR("SetId failed: %08x\n", nsres);
341 return S_OK;
344 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
346 HTMLElement *This = HTMLELEM_THIS(iface);
347 const PRUnichar *id;
348 nsAString id_str;
349 nsresult nsres;
351 TRACE("(%p)->(%p)\n", This, p);
353 *p = NULL;
355 if(!This->nselem)
356 return S_OK;
358 nsAString_Init(&id_str, NULL);
359 nsres = nsIDOMHTMLElement_GetId(This->nselem, &id_str);
360 nsAString_GetData(&id_str, &id);
362 if(NS_FAILED(nsres))
363 ERR("GetId failed: %08x\n", nsres);
364 else if(*id)
365 *p = SysAllocString(id);
367 nsAString_Finish(&id_str);
368 return S_OK;
371 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
373 HTMLElement *This = HTMLELEM_THIS(iface);
374 const PRUnichar *tag;
375 nsAString tag_str;
376 nsresult nsres;
378 TRACE("(%p)->(%p)\n", This, p);
380 if(!This->nselem) {
381 static const WCHAR comment_tagW[] = {'!',0};
383 WARN("NULL nselem, assuming comment\n");
385 *p = SysAllocString(comment_tagW);
386 return S_OK;
389 nsAString_Init(&tag_str, NULL);
390 nsres = nsIDOMHTMLElement_GetTagName(This->nselem, &tag_str);
391 if(NS_SUCCEEDED(nsres)) {
392 nsAString_GetData(&tag_str, &tag);
393 *p = SysAllocString(tag);
394 }else {
395 ERR("GetTagName failed: %08x\n", nsres);
396 *p = NULL;
398 nsAString_Finish(&tag_str);
400 return S_OK;
403 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
405 HTMLElement *This = HTMLELEM_THIS(iface);
406 IHTMLDOMNode *node;
407 HRESULT hres;
409 TRACE("(%p)->(%p)\n", This, p);
411 hres = IHTMLDOMNode_get_parentNode(HTMLDOMNODE(&This->node), &node);
412 if(FAILED(hres))
413 return hres;
415 hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
416 IHTMLDOMNode_Release(node);
417 if(FAILED(hres))
418 *p = NULL;
420 return S_OK;
423 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
425 HTMLElement *This = HTMLELEM_THIS(iface);
426 nsIDOMElementCSSInlineStyle *nselemstyle;
427 nsIDOMCSSStyleDeclaration *nsstyle;
428 nsresult nsres;
430 TRACE("(%p)->(%p)\n", This, p);
432 if(!This->nselem) {
433 FIXME("NULL nselem\n");
434 return E_NOTIMPL;
437 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle,
438 (void**)&nselemstyle);
439 if(NS_FAILED(nsres)) {
440 ERR("Coud not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres);
441 return E_FAIL;
444 nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
445 nsIDOMElementCSSInlineStyle_Release(nselemstyle);
446 if(NS_FAILED(nsres)) {
447 ERR("GetStyle failed: %08x\n", nsres);
448 return E_FAIL;
451 /* FIXME: Store style instead of creating a new instance in each call */
452 *p = HTMLStyle_Create(nsstyle);
454 nsIDOMCSSStyleDeclaration_Release(nsstyle);
455 return S_OK;
458 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
460 HTMLElement *This = HTMLELEM_THIS(iface);
461 FIXME("(%p)->()\n", This);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
467 HTMLElement *This = HTMLELEM_THIS(iface);
468 FIXME("(%p)->(%p)\n", This, p);
469 return E_NOTIMPL;
472 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
474 HTMLElement *This = HTMLELEM_THIS(iface);
476 TRACE("(%p)->()\n", This);
478 return set_node_event(&This->node, EVENTID_CLICK, &v);
481 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
483 HTMLElement *This = HTMLELEM_THIS(iface);
485 TRACE("(%p)->(%p)\n", This, p);
487 return get_node_event(&This->node, EVENTID_CLICK, p);
490 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
492 HTMLElement *This = HTMLELEM_THIS(iface);
494 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
496 return set_node_event(&This->node, EVENTID_DBLCLICK, &v);
499 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
501 HTMLElement *This = HTMLELEM_THIS(iface);
503 TRACE("(%p)->(%p)\n", This, p);
505 return get_node_event(&This->node, EVENTID_DBLCLICK, p);
508 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
510 HTMLElement *This = HTMLELEM_THIS(iface);
512 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
514 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
517 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
519 HTMLElement *This = HTMLELEM_THIS(iface);
521 TRACE("(%p)->(%p)\n", This, p);
523 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
526 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
528 HTMLElement *This = HTMLELEM_THIS(iface);
530 TRACE("(%p)->()\n", This);
532 return set_node_event(&This->node, EVENTID_KEYUP, &v);
535 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
537 HTMLElement *This = HTMLELEM_THIS(iface);
538 FIXME("(%p)->(%p)\n", This, p);
539 return E_NOTIMPL;
542 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
544 HTMLElement *This = HTMLELEM_THIS(iface);
545 FIXME("(%p)->()\n", This);
546 return E_NOTIMPL;
549 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
551 HTMLElement *This = HTMLELEM_THIS(iface);
552 FIXME("(%p)->(%p)\n", This, p);
553 return E_NOTIMPL;
556 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
558 HTMLElement *This = HTMLELEM_THIS(iface);
560 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
562 return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
565 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
567 HTMLElement *This = HTMLELEM_THIS(iface);
569 TRACE("(%p)->(%p)\n", This, p);
571 return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
574 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
576 HTMLElement *This = HTMLELEM_THIS(iface);
578 TRACE("(%p)->()\n", This);
580 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
583 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
585 HTMLElement *This = HTMLELEM_THIS(iface);
587 TRACE("(%p)->(%p)\n", This, p);
589 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
592 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
594 HTMLElement *This = HTMLELEM_THIS(iface);
595 FIXME("(%p)->()\n", This);
596 return E_NOTIMPL;
599 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
601 HTMLElement *This = HTMLELEM_THIS(iface);
602 FIXME("(%p)->(%p)\n", This, p);
603 return E_NOTIMPL;
606 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
608 HTMLElement *This = HTMLELEM_THIS(iface);
610 TRACE("(%p)->()\n", This);
612 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
615 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
617 HTMLElement *This = HTMLELEM_THIS(iface);
619 TRACE("(%p)->(%p)\n", This, p);
621 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
624 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
626 HTMLElement *This = HTMLELEM_THIS(iface);
628 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
630 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
633 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
635 HTMLElement *This = HTMLELEM_THIS(iface);
637 TRACE("(%p)->(%p)\n", This, p);
639 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
642 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
644 HTMLElement *This = HTMLELEM_THIS(iface);
646 TRACE("(%p)->(%p)\n", This, p);
648 if(!p)
649 return E_POINTER;
651 if(This->node.vtbl->get_document)
652 return This->node.vtbl->get_document(&This->node, p);
654 *p = (IDispatch*)&This->node.doc->basedoc.IHTMLDocument2_iface;
655 IDispatch_AddRef(*p);
656 return S_OK;
659 static const WCHAR titleW[] = {'t','i','t','l','e',0};
661 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
663 HTMLElement *This = HTMLELEM_THIS(iface);
664 nsAString title_str;
665 nsresult nsres;
667 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
669 if(!This->nselem) {
670 VARIANT *var;
671 HRESULT hres;
673 hres = dispex_get_dprop_ref(&This->node.dispex, titleW, TRUE, &var);
674 if(FAILED(hres))
675 return hres;
677 VariantClear(var);
678 V_VT(var) = VT_BSTR;
679 V_BSTR(var) = v ? SysAllocString(v) : NULL;
680 return S_OK;
683 nsAString_InitDepend(&title_str, v);
684 nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
685 nsAString_Finish(&title_str);
686 if(NS_FAILED(nsres))
687 ERR("SetTitle failed: %08x\n", nsres);
689 return S_OK;
692 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
694 HTMLElement *This = HTMLELEM_THIS(iface);
695 nsAString title_str;
696 nsresult nsres;
698 TRACE("(%p)->(%p)\n", This, p);
700 if(!This->nselem) {
701 VARIANT *var;
702 HRESULT hres;
704 hres = dispex_get_dprop_ref(&This->node.dispex, titleW, FALSE, &var);
705 if(hres == DISP_E_UNKNOWNNAME) {
706 *p = NULL;
707 }else if(V_VT(var) != VT_BSTR) {
708 FIXME("title = %s\n", debugstr_variant(var));
709 return E_FAIL;
710 }else {
711 *p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
714 return S_OK;
717 nsAString_Init(&title_str, NULL);
718 nsres = nsIDOMHTMLElement_GetTitle(This->nselem, &title_str);
719 if(NS_SUCCEEDED(nsres)) {
720 const PRUnichar *title;
722 nsAString_GetData(&title_str, &title);
723 *p = *title ? SysAllocString(title) : NULL;
724 }else {
725 ERR("GetTitle failed: %08x\n", nsres);
726 return E_FAIL;
729 return S_OK;
732 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
734 HTMLElement *This = HTMLELEM_THIS(iface);
735 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
736 return E_NOTIMPL;
739 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
741 HTMLElement *This = HTMLELEM_THIS(iface);
742 FIXME("(%p)->(%p)\n", This, p);
743 return E_NOTIMPL;
746 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
748 HTMLElement *This = HTMLELEM_THIS(iface);
750 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
752 return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
755 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
757 HTMLElement *This = HTMLELEM_THIS(iface);
759 TRACE("(%p)->(%p)\n", This, p);
761 return get_node_event(&This->node, EVENTID_SELECTSTART, p);
764 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
766 HTMLElement *This = HTMLELEM_THIS(iface);
767 FIXME("(%p)->()\n", This);
768 return E_NOTIMPL;
771 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
772 VARIANT_BOOL *pfResult)
774 HTMLElement *This = HTMLELEM_THIS(iface);
775 FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
776 return E_NOTIMPL;
779 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, LONG *p)
781 HTMLElement *This = HTMLELEM_THIS(iface);
782 FIXME("(%p)->(%p)\n", This, p);
783 return E_NOTIMPL;
786 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
788 HTMLElement *This = HTMLELEM_THIS(iface);
789 FIXME("(%p)->(%p)\n", This, p);
790 return E_NOTIMPL;
793 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
795 HTMLElement *This = HTMLELEM_THIS(iface);
796 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
797 return E_NOTIMPL;
800 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
802 HTMLElement *This = HTMLELEM_THIS(iface);
803 FIXME("(%p)->(%p)\n", This, p);
804 return E_NOTIMPL;
807 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
809 HTMLElement *This = HTMLELEM_THIS(iface);
810 FIXME("(%p)->(%p)\n", This, p);
811 return E_NOTIMPL;
814 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
816 HTMLElement *This = HTMLELEM_THIS(iface);
817 nsIDOMNSHTMLElement *nselem;
818 PRInt32 top = 0;
819 nsresult nsres;
821 TRACE("(%p)->(%p)\n", This, p);
823 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
824 if(NS_FAILED(nsres)) {
825 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
826 return E_FAIL;
829 nsres = nsIDOMNSHTMLElement_GetOffsetTop(nselem, &top);
830 nsIDOMNSHTMLElement_Release(nselem);
831 if(NS_FAILED(nsres)) {
832 ERR("GetOffsetTop failed: %08x\n", nsres);
833 return E_FAIL;
836 *p = top;
837 return S_OK;
840 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
842 HTMLElement *This = HTMLELEM_THIS(iface);
843 nsIDOMNSHTMLElement *nselem;
844 PRInt32 offset = 0;
845 nsresult nsres;
847 TRACE("(%p)->(%p)\n", This, p);
849 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
850 if(NS_FAILED(nsres)) {
851 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
852 return E_FAIL;
855 nsres = nsIDOMNSHTMLElement_GetOffsetWidth(nselem, &offset);
856 nsIDOMNSHTMLElement_Release(nselem);
857 if(NS_FAILED(nsres)) {
858 ERR("GetOffsetWidth failed: %08x\n", nsres);
859 return E_FAIL;
862 *p = offset;
863 return S_OK;
866 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
868 HTMLElement *This = HTMLELEM_THIS(iface);
869 nsIDOMNSHTMLElement *nselem;
870 PRInt32 offset = 0;
871 nsresult nsres;
873 TRACE("(%p)->(%p)\n", This, p);
875 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
876 if(NS_FAILED(nsres)) {
877 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
878 return E_FAIL;
881 nsres = nsIDOMNSHTMLElement_GetOffsetHeight(nselem, &offset);
882 nsIDOMNSHTMLElement_Release(nselem);
883 if(NS_FAILED(nsres)) {
884 ERR("GetOffsetHeight failed: %08x\n", nsres);
885 return E_FAIL;
888 *p = offset;
889 return S_OK;
892 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
894 HTMLElement *This = HTMLELEM_THIS(iface);
895 FIXME("(%p)->(%p)\n", This, p);
896 return E_NOTIMPL;
899 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
901 HTMLElement *This = HTMLELEM_THIS(iface);
902 nsIDOMNSHTMLElement *nselem;
903 nsAString html_str;
904 nsresult nsres;
906 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
908 if(!This->nselem) {
909 FIXME("NULL nselem\n");
910 return E_NOTIMPL;
913 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
914 if(NS_FAILED(nsres)) {
915 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
916 return E_FAIL;
919 nsAString_InitDepend(&html_str, v);
920 nsres = nsIDOMNSHTMLElement_SetInnerHTML(nselem, &html_str);
921 nsAString_Finish(&html_str);
923 if(NS_FAILED(nsres)) {
924 FIXME("SetInnerHtml failed %08x\n", nsres);
925 return E_FAIL;
928 return S_OK;
931 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
933 HTMLElement *This = HTMLELEM_THIS(iface);
934 nsIDOMNSHTMLElement *nselem;
935 nsAString html_str;
936 nsresult nsres;
938 TRACE("(%p)->(%p)\n", This, p);
940 if(!This->nselem) {
941 FIXME("NULL nselem\n");
942 return E_NOTIMPL;
945 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
946 if(NS_FAILED(nsres)) {
947 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
948 return E_FAIL;
951 nsAString_Init(&html_str, NULL);
952 nsres = nsIDOMNSHTMLElement_GetInnerHTML(nselem, &html_str);
953 if(NS_SUCCEEDED(nsres)) {
954 const PRUnichar *html;
956 nsAString_GetData(&html_str, &html);
957 *p = *html ? SysAllocString(html) : NULL;
958 }else {
959 FIXME("SetInnerHtml failed %08x\n", nsres);
960 *p = NULL;
963 nsAString_Finish(&html_str);
964 return S_OK;
967 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
969 HTMLElement *This = HTMLELEM_THIS(iface);
970 nsIDOMNode *nschild, *tmp;
971 nsIDOMText *text_node;
972 nsAString text_str;
973 nsresult nsres;
975 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
977 while(1) {
978 nsres = nsIDOMHTMLElement_GetLastChild(This->nselem, &nschild);
979 if(NS_FAILED(nsres)) {
980 ERR("GetLastChild failed: %08x\n", nsres);
981 return E_FAIL;
983 if(!nschild)
984 break;
986 nsres = nsIDOMHTMLElement_RemoveChild(This->nselem, nschild, &tmp);
987 nsIDOMNode_Release(nschild);
988 if(NS_FAILED(nsres)) {
989 ERR("RemoveChild failed: %08x\n", nsres);
990 return E_FAIL;
992 nsIDOMNode_Release(tmp);
995 nsAString_InitDepend(&text_str, v);
996 nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
997 nsAString_Finish(&text_str);
998 if(NS_FAILED(nsres)) {
999 ERR("CreateTextNode failed: %08x\n", nsres);
1000 return E_FAIL;
1003 nsres = nsIDOMHTMLElement_AppendChild(This->nselem, (nsIDOMNode*)text_node, &tmp);
1004 if(NS_FAILED(nsres)) {
1005 ERR("AppendChild failed: %08x\n", nsres);
1006 return E_FAIL;
1009 nsIDOMNode_Release(tmp);
1010 return S_OK;
1013 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
1015 HTMLElement *This = HTMLELEM_THIS(iface);
1017 TRACE("(%p)->(%p)\n", This, p);
1019 return get_node_text(&This->node, p);
1022 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
1024 HTMLElement *This = HTMLELEM_THIS(iface);
1025 nsIDOMDocumentFragment *nsfragment;
1026 nsIDOMDocumentRange *nsdocrange;
1027 nsIDOMNSRange *nsrange;
1028 nsIDOMNode *nsparent;
1029 nsIDOMRange *range;
1030 nsAString html_str;
1031 nsresult nsres;
1032 HRESULT hres = S_OK;
1034 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1036 nsres = nsIDOMHTMLDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange);
1037 if(NS_FAILED(nsres))
1038 return E_FAIL;
1040 nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &range);
1041 nsIDOMDocumentRange_Release(nsdocrange);
1042 if(NS_FAILED(nsres)) {
1043 ERR("CreateRange failed: %08x\n", nsres);
1044 return E_FAIL;
1047 nsres = nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void**)&nsrange);
1048 nsIDOMRange_Release(range);
1049 if(NS_FAILED(nsres)) {
1050 ERR("Could not get nsIDOMNSRange: %08x\n", nsres);
1051 return E_FAIL;
1054 nsAString_InitDepend(&html_str, v);
1055 nsIDOMNSRange_CreateContextualFragment(nsrange, &html_str, &nsfragment);
1056 nsIDOMNSRange_Release(nsrange);
1057 nsAString_Finish(&html_str);
1058 if(NS_FAILED(nsres)) {
1059 ERR("CreateContextualFragment failed: %08x\n", nsres);
1060 return E_FAIL;
1063 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &nsparent);
1064 if(NS_SUCCEEDED(nsres) && nsparent) {
1065 nsIDOMNode *nstmp;
1067 nsres = nsIDOMNode_ReplaceChild(nsparent, (nsIDOMNode*)nsfragment, This->node.nsnode, &nstmp);
1068 nsIDOMNode_Release(nsparent);
1069 if(NS_FAILED(nsres)) {
1070 ERR("ReplaceChild failed: %08x\n", nsres);
1071 hres = E_FAIL;
1072 }else if(nstmp) {
1073 nsIDOMNode_Release(nstmp);
1075 }else {
1076 ERR("GetParentNode failed: %08x\n", nsres);
1077 hres = E_FAIL;
1080 nsIDOMDocumentFragment_Release(nsfragment);
1081 return hres;
1084 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
1086 HTMLElement *This = HTMLELEM_THIS(iface);
1087 nsAString html_str;
1088 HRESULT hres;
1090 WARN("(%p)->(%p) semi-stub\n", This, p);
1092 nsAString_Init(&html_str, NULL);
1093 hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
1094 if(SUCCEEDED(hres)) {
1095 const PRUnichar *html;
1097 nsAString_GetData(&html_str, &html);
1098 *p = SysAllocString(html);
1099 if(!*p)
1100 hres = E_OUTOFMEMORY;
1103 nsAString_Finish(&html_str);
1105 TRACE("ret %s\n", debugstr_w(*p));
1106 return S_OK;
1109 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
1111 HTMLElement *This = HTMLELEM_THIS(iface);
1112 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1113 return E_NOTIMPL;
1116 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
1118 HTMLElement *This = HTMLELEM_THIS(iface);
1119 FIXME("(%p)->(%p)\n", This, p);
1120 return E_NOTIMPL;
1123 static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsIDOMNode *nsnode)
1125 static const WCHAR wszBeforeBegin[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
1126 static const WCHAR wszAfterBegin[] = {'a','f','t','e','r','B','e','g','i','n',0};
1127 static const WCHAR wszBeforeEnd[] = {'b','e','f','o','r','e','E','n','d',0};
1128 static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
1129 nsresult nsres;
1131 if (!strcmpiW(where, wszBeforeBegin))
1133 nsIDOMNode *unused;
1134 nsIDOMNode *parent;
1135 nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1136 if (!parent) return E_INVALIDARG;
1137 nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &unused);
1138 if (unused) nsIDOMNode_Release(unused);
1139 nsIDOMNode_Release(parent);
1141 else if (!strcmpiW(where, wszAfterBegin))
1143 nsIDOMNode *unused;
1144 nsIDOMNode *first_child;
1145 nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
1146 nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &unused);
1147 if (unused) nsIDOMNode_Release(unused);
1148 if (first_child) nsIDOMNode_Release(first_child);
1150 else if (!strcmpiW(where, wszBeforeEnd))
1152 nsIDOMNode *unused;
1153 nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &unused);
1154 if (unused) nsIDOMNode_Release(unused);
1156 else if (!strcmpiW(where, wszAfterEnd))
1158 nsIDOMNode *unused;
1159 nsIDOMNode *next_sibling;
1160 nsIDOMNode *parent;
1161 nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
1162 if (!parent) return E_INVALIDARG;
1164 nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
1165 if (next_sibling)
1167 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
1168 nsIDOMNode_Release(next_sibling);
1170 else
1171 nsres = nsIDOMNode_AppendChild(parent, nsnode, &unused);
1172 nsIDOMNode_Release(parent);
1173 if (unused) nsIDOMNode_Release(unused);
1175 else
1177 ERR("invalid where: %s\n", debugstr_w(where));
1178 return E_INVALIDARG;
1181 if (NS_FAILED(nsres))
1182 return E_FAIL;
1183 else
1184 return S_OK;
1187 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
1188 BSTR html)
1190 HTMLElement *This = HTMLELEM_THIS(iface);
1191 nsIDOMDocumentRange *nsdocrange;
1192 nsIDOMRange *range;
1193 nsIDOMNSRange *nsrange;
1194 nsIDOMNode *nsnode;
1195 nsAString ns_html;
1196 nsresult nsres;
1197 HRESULT hr;
1199 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
1201 if(!This->node.doc->nsdoc) {
1202 WARN("NULL nsdoc\n");
1203 return E_UNEXPECTED;
1206 nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
1207 if(NS_FAILED(nsres))
1209 ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
1210 return E_FAIL;
1212 nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &range);
1213 nsIDOMDocumentRange_Release(nsdocrange);
1214 if(NS_FAILED(nsres))
1216 ERR("CreateRange failed: %08x\n", nsres);
1217 return E_FAIL;
1220 nsIDOMRange_SetStartBefore(range, This->node.nsnode);
1222 nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
1223 nsIDOMRange_Release(range);
1224 if(NS_FAILED(nsres))
1226 ERR("getting nsIDOMNSRange failed: %08x\n", nsres);
1227 return E_FAIL;
1230 nsAString_InitDepend(&ns_html, html);
1232 nsres = nsIDOMNSRange_CreateContextualFragment(nsrange, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
1233 nsIDOMNSRange_Release(nsrange);
1234 nsAString_Finish(&ns_html);
1236 if(NS_FAILED(nsres) || !nsnode)
1238 ERR("CreateTextNode failed: %08x\n", nsres);
1239 return E_FAIL;
1242 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
1243 nsIDOMNode_Release(nsnode);
1245 return hr;
1248 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
1249 BSTR text)
1251 HTMLElement *This = HTMLELEM_THIS(iface);
1252 nsIDOMNode *nsnode;
1253 nsAString ns_text;
1254 nsresult nsres;
1255 HRESULT hr;
1257 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
1259 if(!This->node.doc->nsdoc) {
1260 WARN("NULL nsdoc\n");
1261 return E_UNEXPECTED;
1265 nsAString_InitDepend(&ns_text, text);
1266 nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
1267 nsAString_Finish(&ns_text);
1269 if(NS_FAILED(nsres) || !nsnode)
1271 ERR("CreateTextNode failed: %08x\n", nsres);
1272 return E_FAIL;
1275 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
1276 nsIDOMNode_Release(nsnode);
1278 return hr;
1281 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
1283 HTMLElement *This = HTMLELEM_THIS(iface);
1284 FIXME("(%p)->(%p)\n", This, p);
1285 return E_NOTIMPL;
1288 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
1290 HTMLElement *This = HTMLELEM_THIS(iface);
1291 FIXME("(%p)->(%p)\n", This, p);
1292 return E_NOTIMPL;
1295 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
1297 HTMLElement *This = HTMLELEM_THIS(iface);
1299 TRACE("(%p)\n", This);
1301 return call_event(&This->node, EVENTID_CLICK);
1304 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
1305 IHTMLFiltersCollection **p)
1307 HTMLElement *This = HTMLELEM_THIS(iface);
1308 TRACE("(%p)->(%p)\n", This, p);
1310 if(!p)
1311 return E_POINTER;
1313 *p = HTMLFiltersCollection_Create();
1315 return S_OK;
1318 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
1320 HTMLElement *This = HTMLELEM_THIS(iface);
1321 FIXME("(%p)->()\n", This);
1322 return E_NOTIMPL;
1325 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
1327 HTMLElement *This = HTMLELEM_THIS(iface);
1328 FIXME("(%p)->(%p)\n", This, p);
1329 return E_NOTIMPL;
1332 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
1334 HTMLElement *This = HTMLELEM_THIS(iface);
1335 FIXME("(%p)->(%p)\n", This, String);
1336 return E_NOTIMPL;
1339 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
1341 HTMLElement *This = HTMLELEM_THIS(iface);
1342 FIXME("(%p)->()\n", This);
1343 return E_NOTIMPL;
1346 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
1348 HTMLElement *This = HTMLELEM_THIS(iface);
1349 FIXME("(%p)->(%p)\n", This, p);
1350 return E_NOTIMPL;
1353 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
1355 HTMLElement *This = HTMLELEM_THIS(iface);
1356 FIXME("(%p)->()\n", This);
1357 return E_NOTIMPL;
1360 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
1362 HTMLElement *This = HTMLELEM_THIS(iface);
1363 FIXME("(%p)->(%p)\n", This, p);
1364 return E_NOTIMPL;
1367 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
1369 HTMLElement *This = HTMLELEM_THIS(iface);
1370 FIXME("(%p)->()\n", This);
1371 return E_NOTIMPL;
1374 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
1376 HTMLElement *This = HTMLELEM_THIS(iface);
1377 FIXME("(%p)->(%p)\n", This, p);
1378 return E_NOTIMPL;
1381 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
1383 HTMLElement *This = HTMLELEM_THIS(iface);
1384 FIXME("(%p)->()\n", This);
1385 return E_NOTIMPL;
1388 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
1390 HTMLElement *This = HTMLELEM_THIS(iface);
1391 FIXME("(%p)->(%p)\n", This, p);
1392 return E_NOTIMPL;
1395 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
1397 HTMLElement *This = HTMLELEM_THIS(iface);
1398 FIXME("(%p)->()\n", This);
1399 return E_NOTIMPL;
1402 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
1404 HTMLElement *This = HTMLELEM_THIS(iface);
1405 FIXME("(%p)->(%p)\n", This, p);
1406 return E_NOTIMPL;
1409 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
1411 HTMLElement *This = HTMLELEM_THIS(iface);
1412 FIXME("(%p)->()\n", This);
1413 return E_NOTIMPL;
1416 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
1418 HTMLElement *This = HTMLELEM_THIS(iface);
1419 FIXME("(%p)->(%p)\n", This, p);
1420 return E_NOTIMPL;
1423 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
1425 HTMLElement *This = HTMLELEM_THIS(iface);
1426 FIXME("(%p)->()\n", This);
1427 return E_NOTIMPL;
1430 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
1432 HTMLElement *This = HTMLELEM_THIS(iface);
1433 FIXME("(%p)->(%p)\n", This, p);
1434 return E_NOTIMPL;
1437 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
1439 HTMLElement *This = HTMLELEM_THIS(iface);
1440 FIXME("(%p)->()\n", This);
1441 return E_NOTIMPL;
1444 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
1446 HTMLElement *This = HTMLELEM_THIS(iface);
1447 FIXME("(%p)->(%p)\n", This, p);
1448 return E_NOTIMPL;
1451 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
1453 HTMLElement *This = HTMLELEM_THIS(iface);
1454 FIXME("(%p)->()\n", This);
1455 return E_NOTIMPL;
1458 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
1460 HTMLElement *This = HTMLELEM_THIS(iface);
1461 FIXME("(%p)->(%p)\n", This, p);
1462 return E_NOTIMPL;
1465 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
1467 HTMLElement *This = HTMLELEM_THIS(iface);
1468 nsIDOMNodeList *nsnode_list;
1469 nsresult nsres;
1471 TRACE("(%p)->(%p)\n", This, p);
1473 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
1474 if(NS_FAILED(nsres)) {
1475 ERR("GetChildNodes failed: %08x\n", nsres);
1476 return E_FAIL;
1479 *p = (IDispatch*)create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nsnode_list);
1481 nsIDOMNodeList_Release(nsnode_list);
1482 return S_OK;
1485 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
1487 HTMLElement *This = HTMLELEM_THIS(iface);
1489 TRACE("(%p)->(%p)\n", This, p);
1491 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
1492 return S_OK;
1495 #undef HTMLELEM_THIS
1497 static const IHTMLElementVtbl HTMLElementVtbl = {
1498 HTMLElement_QueryInterface,
1499 HTMLElement_AddRef,
1500 HTMLElement_Release,
1501 HTMLElement_GetTypeInfoCount,
1502 HTMLElement_GetTypeInfo,
1503 HTMLElement_GetIDsOfNames,
1504 HTMLElement_Invoke,
1505 HTMLElement_setAttribute,
1506 HTMLElement_getAttribute,
1507 HTMLElement_removeAttribute,
1508 HTMLElement_put_className,
1509 HTMLElement_get_className,
1510 HTMLElement_put_id,
1511 HTMLElement_get_id,
1512 HTMLElement_get_tagName,
1513 HTMLElement_get_parentElement,
1514 HTMLElement_get_style,
1515 HTMLElement_put_onhelp,
1516 HTMLElement_get_onhelp,
1517 HTMLElement_put_onclick,
1518 HTMLElement_get_onclick,
1519 HTMLElement_put_ondblclick,
1520 HTMLElement_get_ondblclick,
1521 HTMLElement_put_onkeydown,
1522 HTMLElement_get_onkeydown,
1523 HTMLElement_put_onkeyup,
1524 HTMLElement_get_onkeyup,
1525 HTMLElement_put_onkeypress,
1526 HTMLElement_get_onkeypress,
1527 HTMLElement_put_onmouseout,
1528 HTMLElement_get_onmouseout,
1529 HTMLElement_put_onmouseover,
1530 HTMLElement_get_onmouseover,
1531 HTMLElement_put_onmousemove,
1532 HTMLElement_get_onmousemove,
1533 HTMLElement_put_onmousedown,
1534 HTMLElement_get_onmousedown,
1535 HTMLElement_put_onmouseup,
1536 HTMLElement_get_onmouseup,
1537 HTMLElement_get_document,
1538 HTMLElement_put_title,
1539 HTMLElement_get_title,
1540 HTMLElement_put_language,
1541 HTMLElement_get_language,
1542 HTMLElement_put_onselectstart,
1543 HTMLElement_get_onselectstart,
1544 HTMLElement_scrollIntoView,
1545 HTMLElement_contains,
1546 HTMLElement_get_sourceIndex,
1547 HTMLElement_get_recordNumber,
1548 HTMLElement_put_lang,
1549 HTMLElement_get_lang,
1550 HTMLElement_get_offsetLeft,
1551 HTMLElement_get_offsetTop,
1552 HTMLElement_get_offsetWidth,
1553 HTMLElement_get_offsetHeight,
1554 HTMLElement_get_offsetParent,
1555 HTMLElement_put_innerHTML,
1556 HTMLElement_get_innerHTML,
1557 HTMLElement_put_innerText,
1558 HTMLElement_get_innerText,
1559 HTMLElement_put_outerHTML,
1560 HTMLElement_get_outerHTML,
1561 HTMLElement_put_outerText,
1562 HTMLElement_get_outerText,
1563 HTMLElement_insertAdjacentHTML,
1564 HTMLElement_insertAdjacentText,
1565 HTMLElement_get_parentTextEdit,
1566 HTMLElement_get_isTextEdit,
1567 HTMLElement_click,
1568 HTMLElement_get_filters,
1569 HTMLElement_put_ondragstart,
1570 HTMLElement_get_ondragstart,
1571 HTMLElement_toString,
1572 HTMLElement_put_onbeforeupdate,
1573 HTMLElement_get_onbeforeupdate,
1574 HTMLElement_put_onafterupdate,
1575 HTMLElement_get_onafterupdate,
1576 HTMLElement_put_onerrorupdate,
1577 HTMLElement_get_onerrorupdate,
1578 HTMLElement_put_onrowexit,
1579 HTMLElement_get_onrowexit,
1580 HTMLElement_put_onrowenter,
1581 HTMLElement_get_onrowenter,
1582 HTMLElement_put_ondatasetchanged,
1583 HTMLElement_get_ondatasetchanged,
1584 HTMLElement_put_ondataavailable,
1585 HTMLElement_get_ondataavailable,
1586 HTMLElement_put_ondatasetcomplete,
1587 HTMLElement_get_ondatasetcomplete,
1588 HTMLElement_put_onfilterchange,
1589 HTMLElement_get_onfilterchange,
1590 HTMLElement_get_children,
1591 HTMLElement_get_all
1594 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1596 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1598 *ppv = NULL;
1600 if(IsEqualGUID(&IID_IUnknown, riid)) {
1601 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1602 *ppv = HTMLELEM(This);
1603 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1604 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1605 *ppv = HTMLELEM(This);
1606 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
1607 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
1608 *ppv = HTMLELEM(This);
1609 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
1610 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This, ppv);
1611 *ppv = HTMLELEM2(This);
1612 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
1613 TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This, ppv);
1614 *ppv = HTMLELEM3(This);
1615 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
1616 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
1617 *ppv = CONPTCONT(&This->cp_container);
1620 if(*ppv) {
1621 IHTMLElement_AddRef(HTMLELEM(This));
1622 return S_OK;
1625 return HTMLDOMNode_QI(&This->node, riid, ppv);
1628 void HTMLElement_destructor(HTMLDOMNode *iface)
1630 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1632 ConnectionPointContainer_Destroy(&This->cp_container);
1634 if(This->nselem)
1635 nsIDOMHTMLElement_Release(This->nselem);
1637 HTMLDOMNode_destructor(&This->node);
1640 HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
1642 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1643 HTMLElement *new_elem;
1644 HRESULT hres;
1646 hres = HTMLElement_Create(This->node.doc, nsnode, FALSE, &new_elem);
1647 if(FAILED(hres))
1648 return hres;
1650 IHTMLElement_AddRef(HTMLELEM(new_elem));
1651 *ret = &new_elem->node;
1652 return S_OK;
1655 static const NodeImplVtbl HTMLElementImplVtbl = {
1656 HTMLElement_QI,
1657 HTMLElement_destructor,
1658 HTMLElement_clone
1661 static inline HTMLElement *impl_from_DispatchEx(DispatchEx *iface)
1663 return CONTAINING_RECORD(iface, HTMLElement, node.dispex);
1666 static HRESULT HTMLElement_get_dispid(DispatchEx *dispex, BSTR name,
1667 DWORD grfdex, DISPID *pid)
1669 HTMLElement *This = impl_from_DispatchEx(dispex);
1671 if(This->node.vtbl->get_dispid)
1672 return This->node.vtbl->get_dispid(&This->node, name, grfdex, pid);
1674 return DISP_E_UNKNOWNNAME;
1677 static HRESULT HTMLElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
1678 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei,
1679 IServiceProvider *caller)
1681 HTMLElement *This = impl_from_DispatchEx(dispex);
1683 if(This->node.vtbl->invoke)
1684 return This->node.vtbl->invoke(&This->node, id, lcid, flags,
1685 params, res, ei, caller);
1687 ERR("(%p): element has no invoke method\n", This);
1688 return E_NOTIMPL;
1691 static const tid_t HTMLElement_iface_tids[] = {
1692 HTMLELEMENT_TIDS,
1696 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl = {
1697 NULL,
1698 HTMLElement_get_dispid,
1699 HTMLElement_invoke
1702 static dispex_static_data_t HTMLElement_dispex = {
1703 &HTMLElement_dispex_vtbl,
1704 DispHTMLUnknownElement_tid,
1705 NULL,
1706 HTMLElement_iface_tids
1709 void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, dispex_static_data_t *dispex_data)
1711 This->lpHTMLElementVtbl = &HTMLElementVtbl;
1713 HTMLElement2_Init(This);
1714 HTMLElement3_Init(This);
1716 if(dispex_data && !dispex_data->vtbl)
1717 dispex_data->vtbl = &HTMLElement_dispex_vtbl;
1718 init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), dispex_data ? dispex_data : &HTMLElement_dispex);
1720 if(nselem)
1721 nsIDOMHTMLElement_AddRef(nselem);
1722 This->nselem = nselem;
1724 HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem);
1726 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)HTMLELEM(This));
1729 HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
1731 nsIDOMHTMLElement *nselem;
1732 nsAString class_name_str;
1733 const PRUnichar *class_name;
1734 const tag_desc_t *tag;
1735 HTMLElement *elem;
1736 nsresult nsres;
1737 HRESULT hres;
1739 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
1740 if(NS_FAILED(nsres))
1741 return E_FAIL;
1743 nsAString_Init(&class_name_str, NULL);
1744 nsIDOMHTMLElement_GetTagName(nselem, &class_name_str);
1746 nsAString_GetData(&class_name_str, &class_name);
1748 tag = get_tag_desc(class_name);
1749 if(tag) {
1750 hres = tag->constructor(doc, nselem, &elem);
1751 }else if(use_generic) {
1752 hres = HTMLGenericElement_Create(doc, nselem, &elem);
1753 }else {
1754 elem = heap_alloc_zero(sizeof(HTMLElement));
1755 if(elem) {
1756 HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
1757 elem->node.vtbl = &HTMLElementImplVtbl;
1758 hres = S_OK;
1759 }else {
1760 hres = E_OUTOFMEMORY;
1764 TRACE("%s ret %p\n", debugstr_w(class_name), elem);
1766 nsIDOMElement_Release(nselem);
1767 nsAString_Finish(&class_name_str);
1768 if(FAILED(hres))
1769 return hres;
1771 *ret = elem;
1772 return S_OK;
1775 /* interface IHTMLFiltersCollection */
1776 static HRESULT WINAPI HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection *iface, REFIID riid, void **ppv)
1778 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1780 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
1782 if(IsEqualGUID(&IID_IUnknown, riid)) {
1783 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1784 *ppv = HTMLFILTERSCOLLECTION(This);
1785 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection, riid)) {
1786 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This, ppv);
1787 *ppv = HTMLFILTERSCOLLECTION(This);
1788 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1789 return *ppv ? S_OK : E_NOINTERFACE;
1792 if(*ppv) {
1793 IUnknown_AddRef((IUnknown*)*ppv);
1794 return S_OK;
1797 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
1798 return E_NOINTERFACE;
1801 static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
1803 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1804 LONG ref = InterlockedIncrement(&This->ref);
1806 TRACE("(%p) ref=%d\n", This, ref);
1808 return ref;
1811 static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
1813 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1814 LONG ref = InterlockedDecrement(&This->ref);
1816 TRACE("(%p) ref=%d\n", This, ref);
1818 if(!ref)
1820 heap_free(This);
1823 return ref;
1826 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection *iface, UINT *pctinfo)
1828 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1829 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
1832 static HRESULT WINAPI HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection *iface,
1833 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
1835 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1836 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
1839 static HRESULT WINAPI HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection *iface,
1840 REFIID riid, LPOLESTR *rgszNames, UINT cNames,
1841 LCID lcid, DISPID *rgDispId)
1843 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1844 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
1847 static HRESULT WINAPI HTMLFiltersCollection_Invoke(IHTMLFiltersCollection *iface, DISPID dispIdMember, REFIID riid,
1848 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1849 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1851 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1852 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
1853 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1856 static HRESULT WINAPI HTMLFiltersCollection_get_length(IHTMLFiltersCollection *iface, LONG *p)
1858 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1860 if(!p)
1861 return E_POINTER;
1863 FIXME("(%p)->(%p) Always returning 0\n", This, p);
1864 *p = 0;
1866 return S_OK;
1869 static HRESULT WINAPI HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection *iface, IUnknown **p)
1871 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1872 FIXME("(%p)->(%p)\n", This, p);
1873 return E_NOTIMPL;
1876 static HRESULT WINAPI HTMLFiltersCollection_item(IHTMLFiltersCollection *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
1878 HTMLFiltersCollection *This = HTMLFILTERSCOLLECTION_THIS(iface);
1879 FIXME("(%p)->(%p, %p)\n", This, pvarIndex, pvarResult);
1880 return E_NOTIMPL;
1883 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl = {
1884 HTMLFiltersCollection_QueryInterface,
1885 HTMLFiltersCollection_AddRef,
1886 HTMLFiltersCollection_Release,
1887 HTMLFiltersCollection_GetTypeInfoCount,
1888 HTMLFiltersCollection_GetTypeInfo,
1889 HTMLFiltersCollection_GetIDsOfNames,
1890 HTMLFiltersCollection_Invoke,
1891 HTMLFiltersCollection_get_length,
1892 HTMLFiltersCollection_get__newEnum,
1893 HTMLFiltersCollection_item
1896 static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
1898 WCHAR *ptr;
1899 int idx = 0;
1901 for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
1902 idx = idx*10 + (*ptr-'0');
1903 if(*ptr)
1904 return DISP_E_UNKNOWNNAME;
1906 *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
1907 TRACE("ret %x\n", *dispid);
1908 return S_OK;
1911 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
1912 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
1914 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
1916 V_VT(res) = VT_DISPATCH;
1917 V_DISPATCH(res) = NULL;
1919 FIXME("always returning NULL\n");
1921 return S_OK;
1924 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl = {
1925 NULL,
1926 HTMLFiltersCollection_get_dispid,
1927 HTMLFiltersCollection_invoke
1930 static const tid_t HTMLFiltersCollection_iface_tids[] = {
1931 IHTMLFiltersCollection_tid,
1934 static dispex_static_data_t HTMLFiltersCollection_dispex = {
1935 &HTMLFiltersCollection_dispex_vtbl,
1936 IHTMLFiltersCollection_tid,
1937 NULL,
1938 HTMLFiltersCollection_iface_tids
1941 IHTMLFiltersCollection *HTMLFiltersCollection_Create()
1943 HTMLFiltersCollection *ret = heap_alloc(sizeof(HTMLFiltersCollection));
1945 ret->lpHTMLFiltersCollectionVtbl = &HTMLFiltersCollectionVtbl;
1946 ret->ref = 1;
1948 init_dispex(&ret->dispex, (IUnknown*)HTMLFILTERSCOLLECTION(ret), &HTMLFiltersCollection_dispex);
1950 return HTMLFILTERSCOLLECTION(ret);