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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "htmlevent.h"
35 #include "htmlstyle.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 static const WCHAR aW
[] = {'A',0};
40 static const WCHAR bodyW
[] = {'B','O','D','Y',0};
41 static const WCHAR embedW
[] = {'E','M','B','E','D',0};
42 static const WCHAR formW
[] = {'F','O','R','M',0};
43 static const WCHAR frameW
[] = {'F','R','A','M','E',0};
44 static const WCHAR headW
[] = {'H','E','A','D',0};
45 static const WCHAR iframeW
[] = {'I','F','R','A','M','E',0};
46 static const WCHAR imgW
[] = {'I','M','G',0};
47 static const WCHAR inputW
[] = {'I','N','P','U','T',0};
48 static const WCHAR metaW
[] = {'M','E','T','A',0};
49 static const WCHAR objectW
[] = {'O','B','J','E','C','T',0};
50 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
51 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
52 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
53 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
54 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
55 static const WCHAR tdW
[] = {'T','D',0};
56 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
57 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
58 static const WCHAR trW
[] = {'T','R',0};
62 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
65 static const tag_desc_t tag_descs
[] = {
66 {aW
, HTMLAnchorElement_Create
},
67 {bodyW
, HTMLBodyElement_Create
},
68 {embedW
, HTMLEmbedElement_Create
},
69 {formW
, HTMLFormElement_Create
},
70 {frameW
, HTMLFrameElement_Create
},
71 {headW
, HTMLHeadElement_Create
},
72 {iframeW
, HTMLIFrame_Create
},
73 {imgW
, HTMLImgElement_Create
},
74 {inputW
, HTMLInputElement_Create
},
75 {metaW
, HTMLMetaElement_Create
},
76 {objectW
, HTMLObjectElement_Create
},
77 {optionW
, HTMLOptionElement_Create
},
78 {scriptW
, HTMLScriptElement_Create
},
79 {selectW
, HTMLSelectElement_Create
},
80 {styleW
, HTMLStyleElement_Create
},
81 {tableW
, HTMLTable_Create
},
82 {tdW
, HTMLTableCell_Create
},
83 {textareaW
, HTMLTextAreaElement_Create
},
84 {title_tagW
, HTMLTitleElement_Create
},
85 {trW
, HTMLTableRow_Create
}
88 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
90 DWORD min
=0, max
=sizeof(tag_descs
)/sizeof(*tag_descs
)-1, i
;
95 r
= strcmpW(tag_name
, tag_descs
[i
].name
);
108 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
110 nsIDOMDocumentFragment
*nsfragment
;
111 nsIDOMNode
*nsparent
;
117 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
118 if(NS_FAILED(nsres
)) {
119 ERR("CreateRange failed: %08x\n", nsres
);
123 nsAString_InitDepend(&html_str
, html
);
124 nsIDOMRange_CreateContextualFragment(range
, &html_str
, &nsfragment
);
125 nsIDOMRange_Release(range
);
126 nsAString_Finish(&html_str
);
127 if(NS_FAILED(nsres
)) {
128 ERR("CreateContextualFragment failed: %08x\n", nsres
);
132 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
133 if(NS_SUCCEEDED(nsres
) && nsparent
) {
136 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
137 nsIDOMNode_Release(nsparent
);
138 if(NS_FAILED(nsres
)) {
139 ERR("ReplaceChild failed: %08x\n", nsres
);
142 nsIDOMNode_Release(nstmp
);
145 ERR("GetParentNode failed: %08x\n", nsres
);
149 nsIDOMDocumentFragment_Release(nsfragment
);
156 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
159 } HTMLFiltersCollection
;
161 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
163 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
166 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
168 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
170 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
173 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMHTMLElement
**ret
)
175 nsIDOMElement
*nselem
;
180 WARN("NULL nsdoc\n");
184 nsAString_InitDepend(&tag_str
, tag
);
185 nsres
= nsIDOMDocument_CreateElement(doc
->nsdoc
, &tag_str
, &nselem
);
186 nsAString_Finish(&tag_str
);
187 if(NS_FAILED(nsres
)) {
188 ERR("CreateElement failed: %08x\n", nsres
);
192 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)ret
);
193 nsIDOMElement_Release(nselem
);
194 if(NS_FAILED(nsres
)) {
195 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres
);
202 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
203 REFIID riid
, void **ppv
)
205 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
207 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
210 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
212 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
214 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
217 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
219 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
221 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
224 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
226 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
227 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
230 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
231 LCID lcid
, ITypeInfo
**ppTInfo
)
233 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
234 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
237 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
238 LPOLESTR
*rgszNames
, UINT cNames
,
239 LCID lcid
, DISPID
*rgDispId
)
241 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
242 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
246 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
247 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
248 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
250 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
251 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
252 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
255 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
256 VARIANT AttributeValue
, LONG lFlags
)
258 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
260 DISPID dispid
, dispidNamed
= DISPID_PROPERTYPUT
;
261 DISPPARAMS dispParams
;
264 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
), debugstr_variant(&AttributeValue
), lFlags
);
266 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
267 fdexNameCaseInsensitive
| fdexNameEnsure
, &dispid
);
271 dispParams
.cArgs
= 1;
272 dispParams
.cNamedArgs
= 1;
273 dispParams
.rgdispidNamedArgs
= &dispidNamed
;
274 dispParams
.rgvarg
= &AttributeValue
;
276 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
,
277 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dispParams
, NULL
, &excep
, NULL
);
281 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
282 LONG lFlags
, VARIANT
*AttributeValue
)
284 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
287 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
290 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
292 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
293 fdexNameCaseInsensitive
, &dispid
);
294 if(hres
== DISP_E_UNKNOWNNAME
) {
295 V_VT(AttributeValue
) = VT_NULL
;
300 V_VT(AttributeValue
) = VT_NULL
;
304 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
305 DISPATCH_PROPERTYGET
, &dispParams
, AttributeValue
, &excep
, NULL
);
310 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
311 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
313 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
315 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
317 return remove_prop(&This
->node
.dispex
, strAttributeName
, pfSuccess
);
320 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
322 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
323 nsAString classname_str
;
326 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
329 FIXME("NULL nselem\n");
333 nsAString_InitDepend(&classname_str
, v
);
334 nsres
= nsIDOMHTMLElement_SetClassName(This
->nselem
, &classname_str
);
335 nsAString_Finish(&classname_str
);
337 ERR("SetClassName failed: %08x\n", nsres
);
342 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
344 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
348 TRACE("(%p)->(%p)\n", This
, p
);
351 FIXME("NULL nselem\n");
355 nsAString_Init(&class_str
, NULL
);
356 nsres
= nsIDOMHTMLElement_GetClassName(This
->nselem
, &class_str
);
357 return return_nsstr(nsres
, &class_str
, p
);
360 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
362 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
366 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
369 FIXME("nselem == NULL\n");
373 nsAString_InitDepend(&id_str
, v
);
374 nsres
= nsIDOMHTMLElement_SetId(This
->nselem
, &id_str
);
375 nsAString_Finish(&id_str
);
377 ERR("SetId failed: %08x\n", nsres
);
382 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
384 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
388 TRACE("(%p)->(%p)\n", This
, p
);
395 nsAString_Init(&id_str
, NULL
);
396 nsres
= nsIDOMHTMLElement_GetId(This
->nselem
, &id_str
);
397 return return_nsstr(nsres
, &id_str
, p
);
400 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
402 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
406 TRACE("(%p)->(%p)\n", This
, p
);
409 static const WCHAR comment_tagW
[] = {'!',0};
411 WARN("NULL nselem, assuming comment\n");
413 *p
= SysAllocString(comment_tagW
);
414 return *p
? S_OK
: E_OUTOFMEMORY
;
417 nsAString_Init(&tag_str
, NULL
);
418 nsres
= nsIDOMHTMLElement_GetTagName(This
->nselem
, &tag_str
);
419 return return_nsstr(nsres
, &tag_str
, p
);
422 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
424 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
428 TRACE("(%p)->(%p)\n", This
, p
);
430 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
434 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
435 IHTMLDOMNode_Release(node
);
442 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
444 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
446 TRACE("(%p)->(%p)\n", This
, p
);
449 nsIDOMElementCSSInlineStyle
*nselemstyle
;
450 nsIDOMCSSStyleDeclaration
*nsstyle
;
455 FIXME("NULL nselem\n");
459 nsres
= nsIDOMHTMLElement_QueryInterface(This
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
460 (void**)&nselemstyle
);
461 if(NS_FAILED(nsres
)) {
462 ERR("Could not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres
);
466 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, &nsstyle
);
467 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
468 if(NS_FAILED(nsres
)) {
469 ERR("GetStyle failed: %08x\n", nsres
);
473 hres
= HTMLStyle_Create(This
, nsstyle
, &This
->style
);
474 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
479 *p
= &This
->style
->IHTMLStyle_iface
;
480 IHTMLStyle_AddRef(*p
);
484 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
486 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
487 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
491 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
493 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
494 FIXME("(%p)->(%p)\n", This
, p
);
498 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
500 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
502 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
504 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
507 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
509 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
511 TRACE("(%p)->(%p)\n", This
, p
);
513 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
516 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
518 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
520 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
522 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
525 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
527 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
529 TRACE("(%p)->(%p)\n", This
, p
);
531 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
534 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
536 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
538 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
540 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
543 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
545 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
547 TRACE("(%p)->(%p)\n", This
, p
);
549 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
552 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
554 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
556 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
558 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
561 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
563 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
564 FIXME("(%p)->(%p)\n", This
, p
);
568 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
570 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
571 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
575 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
577 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
578 FIXME("(%p)->(%p)\n", This
, p
);
582 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
584 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
586 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
588 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
591 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
593 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
595 TRACE("(%p)->(%p)\n", This
, p
);
597 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
600 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
602 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
604 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
606 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
609 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
611 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
613 TRACE("(%p)->(%p)\n", This
, p
);
615 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
618 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
620 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
622 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
624 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
627 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
629 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
631 TRACE("(%p)->(%p)\n", This
, p
);
633 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
636 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
638 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
640 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
642 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
645 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
647 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
649 TRACE("(%p)->(%p)\n", This
, p
);
651 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
654 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
656 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
658 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
660 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
663 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
665 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
667 TRACE("(%p)->(%p)\n", This
, p
);
669 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
672 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
674 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
676 TRACE("(%p)->(%p)\n", This
, p
);
681 if(This
->node
.vtbl
->get_document
)
682 return This
->node
.vtbl
->get_document(&This
->node
, p
);
684 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
685 IDispatch_AddRef(*p
);
689 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
691 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
693 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
697 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
703 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, TRUE
, &var
);
709 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
713 nsAString_InitDepend(&title_str
, v
);
714 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
715 nsAString_Finish(&title_str
);
717 ERR("SetTitle failed: %08x\n", nsres
);
722 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
724 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
728 TRACE("(%p)->(%p)\n", This
, p
);
734 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, FALSE
, &var
);
735 if(hres
== DISP_E_UNKNOWNNAME
) {
737 }else if(V_VT(var
) != VT_BSTR
) {
738 FIXME("title = %s\n", debugstr_variant(var
));
741 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
747 nsAString_Init(&title_str
, NULL
);
748 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
749 return return_nsstr(nsres
, &title_str
, p
);
752 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
754 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
755 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
759 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
761 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
762 FIXME("(%p)->(%p)\n", This
, p
);
766 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
768 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
770 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
772 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
775 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
777 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
779 TRACE("(%p)->(%p)\n", This
, p
);
781 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
784 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
786 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
787 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
791 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
792 VARIANT_BOOL
*pfResult
)
794 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
795 FIXME("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
799 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
801 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
802 FIXME("(%p)->(%p)\n", This
, p
);
806 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
808 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
809 FIXME("(%p)->(%p)\n", This
, p
);
813 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
815 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
816 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
820 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
822 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
823 FIXME("(%p)->(%p)\n", This
, p
);
827 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
829 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
830 PRInt32 off_left
= 0;
833 TRACE("(%p)->(%p)\n", This
, p
);
835 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, &off_left
);
836 if(NS_FAILED(nsres
)) {
837 ERR("GetOffsetLeft failed: %08x\n", nsres
);
845 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
847 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
851 TRACE("(%p)->(%p)\n", This
, p
);
853 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, &top
);
854 if(NS_FAILED(nsres
)) {
855 ERR("GetOffsetTop failed: %08x\n", nsres
);
863 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
865 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
869 TRACE("(%p)->(%p)\n", This
, p
);
871 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, &offset
);
872 if(NS_FAILED(nsres
)) {
873 ERR("GetOffsetWidth failed: %08x\n", nsres
);
881 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
883 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
887 TRACE("(%p)->(%p)\n", This
, p
);
889 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, &offset
);
890 if(NS_FAILED(nsres
)) {
891 ERR("GetOffsetHeight failed: %08x\n", nsres
);
899 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
901 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
902 nsIDOMElement
*nsparent
;
906 TRACE("(%p)->(%p)\n", This
, p
);
908 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
909 if(NS_FAILED(nsres
)) {
910 ERR("GetOffsetParent failed: %08x\n", nsres
);
917 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
918 nsIDOMElement_Release(nsparent
);
922 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
932 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
934 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
938 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
941 FIXME("NULL nselem\n");
945 nsAString_InitDepend(&html_str
, v
);
946 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
947 nsAString_Finish(&html_str
);
948 if(NS_FAILED(nsres
)) {
949 FIXME("SetInnerHtml failed %08x\n", nsres
);
956 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
958 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
962 TRACE("(%p)->(%p)\n", This
, p
);
965 FIXME("NULL nselem\n");
969 nsAString_Init(&html_str
, NULL
);
970 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
971 return return_nsstr(nsres
, &html_str
, p
);
974 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
976 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
977 nsIDOMNode
*nschild
, *tmp
;
978 nsIDOMText
*text_node
;
982 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
985 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
986 if(NS_FAILED(nsres
)) {
987 ERR("GetLastChild failed: %08x\n", nsres
);
993 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
994 nsIDOMNode_Release(nschild
);
995 if(NS_FAILED(nsres
)) {
996 ERR("RemoveChild failed: %08x\n", nsres
);
999 nsIDOMNode_Release(tmp
);
1002 nsAString_InitDepend(&text_str
, v
);
1003 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1004 nsAString_Finish(&text_str
);
1005 if(NS_FAILED(nsres
)) {
1006 ERR("CreateTextNode failed: %08x\n", nsres
);
1010 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1011 if(NS_FAILED(nsres
)) {
1012 ERR("AppendChild failed: %08x\n", nsres
);
1016 nsIDOMNode_Release(tmp
);
1020 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1022 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1024 TRACE("(%p)->(%p)\n", This
, p
);
1026 return get_node_text(&This
->node
, p
);
1029 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1031 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1033 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1035 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1038 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1040 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1044 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1046 nsAString_Init(&html_str
, NULL
);
1047 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1048 if(SUCCEEDED(hres
)) {
1049 const PRUnichar
*html
;
1051 nsAString_GetData(&html_str
, &html
);
1052 *p
= SysAllocString(html
);
1054 hres
= E_OUTOFMEMORY
;
1057 nsAString_Finish(&html_str
);
1059 TRACE("ret %s\n", debugstr_w(*p
));
1063 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1065 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1066 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1070 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1072 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1073 FIXME("(%p)->(%p)\n", This
, p
);
1077 static HRESULT
HTMLElement_InsertAdjacentNode(HTMLElement
*This
, BSTR where
, nsIDOMNode
*nsnode
)
1079 static const WCHAR wszBeforeBegin
[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
1080 static const WCHAR wszAfterBegin
[] = {'a','f','t','e','r','B','e','g','i','n',0};
1081 static const WCHAR wszBeforeEnd
[] = {'b','e','f','o','r','e','E','n','d',0};
1082 static const WCHAR wszAfterEnd
[] = {'a','f','t','e','r','E','n','d',0};
1085 if (!strcmpiW(where
, wszBeforeBegin
))
1089 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1090 if (!parent
) return E_INVALIDARG
;
1091 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &unused
);
1092 if (unused
) nsIDOMNode_Release(unused
);
1093 nsIDOMNode_Release(parent
);
1095 else if (!strcmpiW(where
, wszAfterBegin
))
1098 nsIDOMNode
*first_child
;
1099 nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1100 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &unused
);
1101 if (unused
) nsIDOMNode_Release(unused
);
1102 if (first_child
) nsIDOMNode_Release(first_child
);
1104 else if (!strcmpiW(where
, wszBeforeEnd
))
1107 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &unused
);
1108 if (unused
) nsIDOMNode_Release(unused
);
1110 else if (!strcmpiW(where
, wszAfterEnd
))
1113 nsIDOMNode
*next_sibling
;
1115 nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1116 if (!parent
) return E_INVALIDARG
;
1118 nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1121 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &unused
);
1122 nsIDOMNode_Release(next_sibling
);
1125 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &unused
);
1126 nsIDOMNode_Release(parent
);
1127 if (unused
) nsIDOMNode_Release(unused
);
1131 ERR("invalid where: %s\n", debugstr_w(where
));
1132 return E_INVALIDARG
;
1135 if (NS_FAILED(nsres
))
1141 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1144 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1151 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1153 if(!This
->node
.doc
->nsdoc
) {
1154 WARN("NULL nsdoc\n");
1155 return E_UNEXPECTED
;
1158 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1159 if(NS_FAILED(nsres
))
1161 ERR("CreateRange failed: %08x\n", nsres
);
1165 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1167 nsAString_InitDepend(&ns_html
, html
);
1168 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1169 nsAString_Finish(&ns_html
);
1170 nsIDOMRange_Release(range
);
1172 if(NS_FAILED(nsres
) || !nsnode
)
1174 ERR("CreateTextNode failed: %08x\n", nsres
);
1178 hr
= HTMLElement_InsertAdjacentNode(This
, where
, nsnode
);
1179 nsIDOMNode_Release(nsnode
);
1184 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1187 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1193 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1195 if(!This
->node
.doc
->nsdoc
) {
1196 WARN("NULL nsdoc\n");
1197 return E_UNEXPECTED
;
1201 nsAString_InitDepend(&ns_text
, text
);
1202 nsres
= nsIDOMDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1203 nsAString_Finish(&ns_text
);
1205 if(NS_FAILED(nsres
) || !nsnode
)
1207 ERR("CreateTextNode failed: %08x\n", nsres
);
1211 hr
= HTMLElement_InsertAdjacentNode(This
, where
, nsnode
);
1212 nsIDOMNode_Release(nsnode
);
1217 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1219 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1220 FIXME("(%p)->(%p)\n", This
, p
);
1224 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1226 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1227 FIXME("(%p)->(%p)\n", This
, p
);
1231 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1233 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1235 TRACE("(%p)\n", This
);
1237 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1240 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1241 IHTMLFiltersCollection
**p
)
1243 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1244 TRACE("(%p)->(%p)\n", This
, p
);
1249 *p
= HTMLFiltersCollection_Create();
1254 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
1256 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1257 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1261 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1263 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1264 FIXME("(%p)->(%p)\n", This
, p
);
1268 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1270 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1271 FIXME("(%p)->(%p)\n", This
, String
);
1275 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1277 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1278 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1282 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1284 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1285 FIXME("(%p)->(%p)\n", This
, p
);
1289 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1291 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1292 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1296 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1298 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1299 FIXME("(%p)->(%p)\n", This
, p
);
1303 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1305 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1306 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1310 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1312 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1313 FIXME("(%p)->(%p)\n", This
, p
);
1317 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1319 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1320 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1324 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1326 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1327 FIXME("(%p)->(%p)\n", This
, p
);
1331 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1333 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1334 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1338 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1340 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1341 FIXME("(%p)->(%p)\n", This
, p
);
1345 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1347 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1348 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1352 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1354 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1355 FIXME("(%p)->(%p)\n", This
, p
);
1359 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1361 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1362 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1366 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1368 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1369 FIXME("(%p)->(%p)\n", This
, p
);
1373 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1375 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1376 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1380 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1382 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1383 FIXME("(%p)->(%p)\n", This
, p
);
1387 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1389 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1390 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1394 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1396 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1397 FIXME("(%p)->(%p)\n", This
, p
);
1401 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1403 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1404 nsIDOMNodeList
*nsnode_list
;
1407 TRACE("(%p)->(%p)\n", This
, p
);
1409 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1410 if(NS_FAILED(nsres
)) {
1411 ERR("GetChildNodes failed: %08x\n", nsres
);
1415 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
, nsnode_list
);
1417 nsIDOMNodeList_Release(nsnode_list
);
1421 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1423 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1425 TRACE("(%p)->(%p)\n", This
, p
);
1427 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1431 static const IHTMLElementVtbl HTMLElementVtbl
= {
1432 HTMLElement_QueryInterface
,
1434 HTMLElement_Release
,
1435 HTMLElement_GetTypeInfoCount
,
1436 HTMLElement_GetTypeInfo
,
1437 HTMLElement_GetIDsOfNames
,
1439 HTMLElement_setAttribute
,
1440 HTMLElement_getAttribute
,
1441 HTMLElement_removeAttribute
,
1442 HTMLElement_put_className
,
1443 HTMLElement_get_className
,
1446 HTMLElement_get_tagName
,
1447 HTMLElement_get_parentElement
,
1448 HTMLElement_get_style
,
1449 HTMLElement_put_onhelp
,
1450 HTMLElement_get_onhelp
,
1451 HTMLElement_put_onclick
,
1452 HTMLElement_get_onclick
,
1453 HTMLElement_put_ondblclick
,
1454 HTMLElement_get_ondblclick
,
1455 HTMLElement_put_onkeydown
,
1456 HTMLElement_get_onkeydown
,
1457 HTMLElement_put_onkeyup
,
1458 HTMLElement_get_onkeyup
,
1459 HTMLElement_put_onkeypress
,
1460 HTMLElement_get_onkeypress
,
1461 HTMLElement_put_onmouseout
,
1462 HTMLElement_get_onmouseout
,
1463 HTMLElement_put_onmouseover
,
1464 HTMLElement_get_onmouseover
,
1465 HTMLElement_put_onmousemove
,
1466 HTMLElement_get_onmousemove
,
1467 HTMLElement_put_onmousedown
,
1468 HTMLElement_get_onmousedown
,
1469 HTMLElement_put_onmouseup
,
1470 HTMLElement_get_onmouseup
,
1471 HTMLElement_get_document
,
1472 HTMLElement_put_title
,
1473 HTMLElement_get_title
,
1474 HTMLElement_put_language
,
1475 HTMLElement_get_language
,
1476 HTMLElement_put_onselectstart
,
1477 HTMLElement_get_onselectstart
,
1478 HTMLElement_scrollIntoView
,
1479 HTMLElement_contains
,
1480 HTMLElement_get_sourceIndex
,
1481 HTMLElement_get_recordNumber
,
1482 HTMLElement_put_lang
,
1483 HTMLElement_get_lang
,
1484 HTMLElement_get_offsetLeft
,
1485 HTMLElement_get_offsetTop
,
1486 HTMLElement_get_offsetWidth
,
1487 HTMLElement_get_offsetHeight
,
1488 HTMLElement_get_offsetParent
,
1489 HTMLElement_put_innerHTML
,
1490 HTMLElement_get_innerHTML
,
1491 HTMLElement_put_innerText
,
1492 HTMLElement_get_innerText
,
1493 HTMLElement_put_outerHTML
,
1494 HTMLElement_get_outerHTML
,
1495 HTMLElement_put_outerText
,
1496 HTMLElement_get_outerText
,
1497 HTMLElement_insertAdjacentHTML
,
1498 HTMLElement_insertAdjacentText
,
1499 HTMLElement_get_parentTextEdit
,
1500 HTMLElement_get_isTextEdit
,
1502 HTMLElement_get_filters
,
1503 HTMLElement_put_ondragstart
,
1504 HTMLElement_get_ondragstart
,
1505 HTMLElement_toString
,
1506 HTMLElement_put_onbeforeupdate
,
1507 HTMLElement_get_onbeforeupdate
,
1508 HTMLElement_put_onafterupdate
,
1509 HTMLElement_get_onafterupdate
,
1510 HTMLElement_put_onerrorupdate
,
1511 HTMLElement_get_onerrorupdate
,
1512 HTMLElement_put_onrowexit
,
1513 HTMLElement_get_onrowexit
,
1514 HTMLElement_put_onrowenter
,
1515 HTMLElement_get_onrowenter
,
1516 HTMLElement_put_ondatasetchanged
,
1517 HTMLElement_get_ondatasetchanged
,
1518 HTMLElement_put_ondataavailable
,
1519 HTMLElement_get_ondataavailable
,
1520 HTMLElement_put_ondatasetcomplete
,
1521 HTMLElement_get_ondatasetcomplete
,
1522 HTMLElement_put_onfilterchange
,
1523 HTMLElement_get_onfilterchange
,
1524 HTMLElement_get_children
,
1528 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1530 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1533 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1535 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
1538 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1540 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1544 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1545 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1546 *ppv
= &This
->IHTMLElement_iface
;
1547 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1548 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1549 *ppv
= &This
->IHTMLElement_iface
;
1550 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
1551 TRACE("(%p)->(IID_IHTMLElement %p)\n", This
, ppv
);
1552 *ppv
= &This
->IHTMLElement_iface
;
1553 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
1554 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This
, ppv
);
1555 *ppv
= &This
->IHTMLElement2_iface
;
1556 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
1557 TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This
, ppv
);
1558 *ppv
= &This
->IHTMLElement3_iface
;
1559 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
1560 TRACE("(%p)->(IID_IHTMLElement4 %p)\n", This
, ppv
);
1561 *ppv
= &This
->IHTMLElement4_iface
;
1562 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
1563 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
1564 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
1568 IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
1572 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
1575 void HTMLElement_destructor(HTMLDOMNode
*iface
)
1577 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1579 ConnectionPointContainer_Destroy(&This
->cp_container
);
1582 nsIDOMHTMLElement_Release(This
->nselem
);
1584 This
->style
->elem
= NULL
;
1585 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
1588 HTMLDOMAttribute
*attr
;
1590 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
1593 This
->attrs
->elem
= NULL
;
1594 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
1597 heap_free(This
->filter
);
1599 HTMLDOMNode_destructor(&This
->node
);
1602 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
1604 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1605 HTMLElement
*new_elem
;
1608 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
1613 new_elem
->filter
= heap_strdupW(This
->filter
);
1614 if(!new_elem
->filter
) {
1615 IHTMLElement_Release(&This
->IHTMLElement_iface
);
1616 return E_OUTOFMEMORY
;
1620 *ret
= &new_elem
->node
;
1624 static const NodeImplVtbl HTMLElementImplVtbl
= {
1626 HTMLElement_destructor
,
1628 HTMLElement_get_attr_col
1631 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
1633 return CONTAINING_RECORD(iface
, HTMLElement
, node
.dispex
);
1636 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
1637 DWORD grfdex
, DISPID
*pid
)
1639 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1641 if(This
->node
.vtbl
->get_dispid
)
1642 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
1644 return DISP_E_UNKNOWNNAME
;
1647 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
1648 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
1649 IServiceProvider
*caller
)
1651 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1653 if(This
->node
.vtbl
->invoke
)
1654 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
1655 params
, res
, ei
, caller
);
1657 ERR("(%p): element has no invoke method\n", This
);
1661 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
1663 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1664 nsIDOMNamedNodeMap
*attrs
;
1667 const PRUnichar
*str
;
1679 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
1680 if(NS_FAILED(nsres
))
1683 nsres
= nsIDOMNamedNodeMap_GetLength(attrs
, &len
);
1684 if(NS_FAILED(nsres
)) {
1685 nsIDOMNamedNodeMap_Release(attrs
);
1689 nsAString_Init(&nsstr
, NULL
);
1690 for(i
=0; i
<len
; i
++) {
1691 nsres
= nsIDOMNamedNodeMap_Item(attrs
, i
, &node
);
1692 if(NS_FAILED(nsres
))
1695 nsres
= nsIDOMNode_GetNodeName(node
, &nsstr
);
1696 if(NS_FAILED(nsres
)) {
1697 nsIDOMNode_Release(node
);
1701 nsAString_GetData(&nsstr
, &str
);
1702 name
= SysAllocString(str
);
1704 nsIDOMNode_Release(node
);
1708 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
1709 if(hres
!= DISP_E_UNKNOWNNAME
) {
1710 nsIDOMNode_Release(node
);
1711 SysFreeString(name
);
1715 nsres
= nsIDOMNode_GetNodeValue(node
, &nsstr
);
1716 nsIDOMNode_Release(node
);
1717 if(NS_FAILED(nsres
)) {
1718 SysFreeString(name
);
1722 nsAString_GetData(&nsstr
, &str
);
1723 V_VT(&value
) = VT_BSTR
;
1725 V_BSTR(&value
) = SysAllocString(str
);
1726 if(!V_BSTR(&value
)) {
1727 SysFreeString(name
);
1731 V_BSTR(&value
) = NULL
;
1733 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
1734 SysFreeString(name
);
1735 VariantClear(&value
);
1737 nsAString_Finish(&nsstr
);
1739 nsIDOMNamedNodeMap_Release(attrs
);
1743 static const tid_t HTMLElement_iface_tids
[] = {
1748 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
1750 HTMLElement_get_dispid
,
1752 HTMLElement_populate_props
1755 static dispex_static_data_t HTMLElement_dispex
= {
1756 &HTMLElement_dispex_vtbl
,
1757 DispHTMLUnknownElement_tid
,
1759 HTMLElement_iface_tids
1762 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
1764 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
1766 HTMLElement2_Init(This
);
1767 HTMLElement3_Init(This
);
1769 if(dispex_data
&& !dispex_data
->vtbl
)
1770 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
1771 init_dispex(&This
->node
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
1772 dispex_data
? dispex_data
: &HTMLElement_dispex
);
1775 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
1777 /* No AddRef, share reference with HTMLDOMNode */
1778 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
1779 This
->nselem
= nselem
;
1782 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
);
1785 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
1787 nsIDOMHTMLElement
*nselem
;
1788 nsAString class_name_str
;
1789 const PRUnichar
*class_name
;
1790 const tag_desc_t
*tag
;
1795 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
1796 if(NS_FAILED(nsres
))
1799 nsAString_Init(&class_name_str
, NULL
);
1800 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
1802 nsAString_GetData(&class_name_str
, &class_name
);
1804 tag
= get_tag_desc(class_name
);
1806 hres
= tag
->constructor(doc
, nselem
, &elem
);
1807 }else if(use_generic
) {
1808 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
1810 elem
= heap_alloc_zero(sizeof(HTMLElement
));
1812 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
1813 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
1816 hres
= E_OUTOFMEMORY
;
1820 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
1822 nsIDOMElement_Release(nselem
);
1823 nsAString_Finish(&class_name_str
);
1831 /* interface IHTMLFiltersCollection */
1832 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
1834 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1836 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppv
);
1838 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1839 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1840 *ppv
= &This
->IHTMLFiltersCollection_iface
;
1841 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
1842 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
1843 *ppv
= &This
->IHTMLFiltersCollection_iface
;
1844 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
1845 return *ppv
? S_OK
: E_NOINTERFACE
;
1849 IUnknown_AddRef((IUnknown
*)*ppv
);
1853 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
1854 return E_NOINTERFACE
;
1857 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
1859 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1860 LONG ref
= InterlockedIncrement(&This
->ref
);
1862 TRACE("(%p) ref=%d\n", This
, ref
);
1867 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
1869 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1870 LONG ref
= InterlockedDecrement(&This
->ref
);
1872 TRACE("(%p) ref=%d\n", This
, ref
);
1882 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
1884 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1885 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
1888 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
1889 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
1891 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1892 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1895 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
1896 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
1897 LCID lcid
, DISPID
*rgDispId
)
1899 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1900 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
1904 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
1905 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
1906 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1908 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1909 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
1910 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1913 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
1915 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1920 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
1926 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
1928 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1929 FIXME("(%p)->(%p)\n", This
, p
);
1933 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
1935 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1936 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
1940 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
1941 HTMLFiltersCollection_QueryInterface
,
1942 HTMLFiltersCollection_AddRef
,
1943 HTMLFiltersCollection_Release
,
1944 HTMLFiltersCollection_GetTypeInfoCount
,
1945 HTMLFiltersCollection_GetTypeInfo
,
1946 HTMLFiltersCollection_GetIDsOfNames
,
1947 HTMLFiltersCollection_Invoke
,
1948 HTMLFiltersCollection_get_length
,
1949 HTMLFiltersCollection_get__newEnum
,
1950 HTMLFiltersCollection_item
1953 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
1958 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
1959 idx
= idx
*10 + (*ptr
-'0');
1961 return DISP_E_UNKNOWNNAME
;
1963 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
1964 TRACE("ret %x\n", *dispid
);
1968 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
1969 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
1971 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
1973 V_VT(res
) = VT_DISPATCH
;
1974 V_DISPATCH(res
) = NULL
;
1976 FIXME("always returning NULL\n");
1981 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
1983 HTMLFiltersCollection_get_dispid
,
1984 HTMLFiltersCollection_invoke
,
1988 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
1989 IHTMLFiltersCollection_tid
,
1992 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
1993 &HTMLFiltersCollection_dispex_vtbl
,
1994 IHTMLFiltersCollection_tid
,
1996 HTMLFiltersCollection_iface_tids
1999 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
2001 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
2003 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
2006 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
2007 &HTMLFiltersCollection_dispex
);
2009 return &ret
->IHTMLFiltersCollection_iface
;
2012 /* interface IHTMLAttributeCollection */
2013 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
2015 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
2018 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
2020 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2024 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
2025 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
2026 *ppv
= &This
->IHTMLAttributeCollection_iface
;
2027 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
2028 TRACE("(%p)->(IID_IHTMLAttributeCollection %p)\n", This
, ppv
);
2029 *ppv
= &This
->IHTMLAttributeCollection_iface
;
2030 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
2031 TRACE("(%p)->(IID_IHTMLAttributeCollection2 %p)\n", This
, ppv
);
2032 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
2033 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
2034 TRACE("(%p)->(IID_IHTMLAttributeCollection3 %p)\n", This
, ppv
);
2035 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
2036 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
2037 return *ppv
? S_OK
: E_NOINTERFACE
;
2041 IUnknown_AddRef((IUnknown
*)*ppv
);
2045 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2046 return E_NOINTERFACE
;
2049 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
2051 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2052 LONG ref
= InterlockedIncrement(&This
->ref
);
2054 TRACE("(%p) ref=%d\n", This
, ref
);
2059 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
2061 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2062 LONG ref
= InterlockedDecrement(&This
->ref
);
2064 TRACE("(%p) ref=%d\n", This
, ref
);
2067 while(!list_empty(&This
->attrs
)) {
2068 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
2070 list_remove(&attr
->entry
);
2072 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
2081 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
2083 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2084 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2087 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
2088 LCID lcid
, ITypeInfo
**ppTInfo
)
2090 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2091 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2094 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
2095 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2097 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2098 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2102 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
2103 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2104 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2106 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2107 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2108 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2111 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
2113 IDispatchEx
*dispex
= &This
->elem
->node
.dispex
.IDispatchEx_iface
;
2114 DISPID id
= DISPID_STARTENUM
;
2118 FIXME("filter non-enumerable attributes out\n");
2121 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
2124 else if(hres
== S_FALSE
)
2134 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
2141 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
2145 if(name
[0]>='0' && name
[0]<='9') {
2149 idx
= strtoulW(name
, &end_ptr
, 10);
2151 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
2158 WARN("NULL elem\n");
2159 return E_UNEXPECTED
;
2162 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.dispex
.IDispatchEx_iface
,
2163 name
, fdexNameCaseInsensitive
, id
);
2167 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
2169 HTMLDOMAttribute
*iter
;
2174 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
2175 if(iter
->dispid
== id
) {
2184 WARN("NULL elem\n");
2185 return E_UNEXPECTED
;
2189 hres
= HTMLDOMAttribute_Create(This
->elem
, id
, attr
);
2194 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
2200 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
2202 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2205 TRACE("(%p)->(%p)\n", This
, p
);
2208 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
2212 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
2214 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2215 FIXME("(%p)->(%p)\n", This
, p
);
2219 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
2221 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2222 HTMLDOMAttribute
*attr
;
2226 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
2228 switch(V_VT(name
)) {
2230 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
2233 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
2236 FIXME("unsupported name %s\n", debugstr_variant(name
));
2239 if(hres
== DISP_E_UNKNOWNNAME
)
2240 return E_INVALIDARG
;
2244 hres
= get_domattr(This
, id
, NULL
, &attr
);
2248 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
2252 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
2253 HTMLAttributeCollection_QueryInterface
,
2254 HTMLAttributeCollection_AddRef
,
2255 HTMLAttributeCollection_Release
,
2256 HTMLAttributeCollection_GetTypeInfoCount
,
2257 HTMLAttributeCollection_GetTypeInfo
,
2258 HTMLAttributeCollection_GetIDsOfNames
,
2259 HTMLAttributeCollection_Invoke
,
2260 HTMLAttributeCollection_get_length
,
2261 HTMLAttributeCollection__newEnum
,
2262 HTMLAttributeCollection_item
2265 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
2267 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
2270 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
2272 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2273 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
2276 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
2278 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2279 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
2282 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
2284 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2285 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
2288 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
2290 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2291 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2294 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
2295 LCID lcid
, ITypeInfo
**ppTInfo
)
2297 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2298 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2301 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
2302 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2304 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2305 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2309 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
2310 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2311 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2313 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2314 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2315 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2318 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
2319 IHTMLDOMAttribute
**newretNode
)
2321 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2322 HTMLDOMAttribute
*attr
;
2326 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
2328 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
2329 if(hres
== DISP_E_UNKNOWNNAME
) {
2332 } else if(FAILED(hres
)) {
2336 hres
= get_domattr(This
, id
, NULL
, &attr
);
2340 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
2344 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
2345 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
2347 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2348 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
2352 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
2353 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
2355 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2356 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
2360 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
2361 HTMLAttributeCollection2_QueryInterface
,
2362 HTMLAttributeCollection2_AddRef
,
2363 HTMLAttributeCollection2_Release
,
2364 HTMLAttributeCollection2_GetTypeInfoCount
,
2365 HTMLAttributeCollection2_GetTypeInfo
,
2366 HTMLAttributeCollection2_GetIDsOfNames
,
2367 HTMLAttributeCollection2_Invoke
,
2368 HTMLAttributeCollection2_getNamedItem
,
2369 HTMLAttributeCollection2_setNamedItem
,
2370 HTMLAttributeCollection2_removeNamedItem
2373 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
2375 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
2378 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
2380 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2381 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
2384 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
2386 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2387 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
2390 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
2392 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2393 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
2396 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
2398 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2399 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2402 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
2403 LCID lcid
, ITypeInfo
**ppTInfo
)
2405 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2406 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2409 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
2410 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2412 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2413 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2417 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
2418 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2419 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2421 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2422 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2423 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2426 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
2427 IHTMLDOMAttribute
**ppNodeOut
)
2429 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2430 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
2433 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
2434 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
2436 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2437 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
2441 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
2442 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
2444 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2445 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
2449 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
2451 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2452 HTMLDOMAttribute
*attr
;
2456 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
2458 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
2459 if(hres
== DISP_E_UNKNOWNNAME
)
2460 return E_INVALIDARG
;
2464 hres
= get_domattr(This
, id
, NULL
, &attr
);
2468 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
2472 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
2474 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2475 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
2478 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
2479 HTMLAttributeCollection3_QueryInterface
,
2480 HTMLAttributeCollection3_AddRef
,
2481 HTMLAttributeCollection3_Release
,
2482 HTMLAttributeCollection3_GetTypeInfoCount
,
2483 HTMLAttributeCollection3_GetTypeInfo
,
2484 HTMLAttributeCollection3_GetIDsOfNames
,
2485 HTMLAttributeCollection3_Invoke
,
2486 HTMLAttributeCollection3_getNamedItem
,
2487 HTMLAttributeCollection3_setNamedItem
,
2488 HTMLAttributeCollection3_removeNamedItem
,
2489 HTMLAttributeCollection3_item
,
2490 HTMLAttributeCollection3_get_length
2493 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
2495 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
2498 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
2500 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
2501 HTMLDOMAttribute
*attr
;
2505 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
2507 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
2511 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
2514 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
2516 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
2520 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
2521 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2523 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
2525 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
2528 case DISPATCH_PROPERTYGET
: {
2529 HTMLDOMAttribute
*iter
;
2531 id
= id
-MSHTML_DISPID_CUSTOM_MIN
+1;
2533 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
2538 return E_INVALIDARG
;
2540 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
2541 V_VT(res
) = VT_DISPATCH
;
2542 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
2547 FIXME("unimplemented flags %x\n", flags
);
2552 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
2554 HTMLAttributeCollection_get_dispid
,
2555 HTMLAttributeCollection_invoke
,
2559 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
2560 IHTMLAttributeCollection_tid
,
2561 IHTMLAttributeCollection2_tid
,
2562 IHTMLAttributeCollection3_tid
,
2566 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
2567 &HTMLAttributeCollection_dispex_vtbl
,
2568 DispHTMLAttributeCollection_tid
,
2570 HTMLAttributeCollection_iface_tids
2573 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
2575 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
2578 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
2583 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
2585 return E_OUTOFMEMORY
;
2587 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
2588 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
2589 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
2590 This
->attrs
->ref
= 2;
2592 This
->attrs
->elem
= This
;
2593 list_init(&This
->attrs
->attrs
);
2594 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
2595 &HTMLAttributeCollection_dispex
);