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 objectW
[] = {'O','B','J','E','C','T',0};
49 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
50 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
51 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
52 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
53 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
54 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
55 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
56 static const WCHAR trW
[] = {'T','R',0};
60 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
63 static const tag_desc_t tag_descs
[] = {
64 {aW
, HTMLAnchorElement_Create
},
65 {bodyW
, HTMLBodyElement_Create
},
66 {embedW
, HTMLEmbedElement_Create
},
67 {formW
, HTMLFormElement_Create
},
68 {frameW
, HTMLFrameElement_Create
},
69 {headW
, HTMLHeadElement_Create
},
70 {iframeW
, HTMLIFrame_Create
},
71 {imgW
, HTMLImgElement_Create
},
72 {inputW
, HTMLInputElement_Create
},
73 {objectW
, HTMLObjectElement_Create
},
74 {optionW
, HTMLOptionElement_Create
},
75 {scriptW
, HTMLScriptElement_Create
},
76 {selectW
, HTMLSelectElement_Create
},
77 {styleW
, HTMLStyleElement_Create
},
78 {tableW
, HTMLTable_Create
},
79 {textareaW
, HTMLTextAreaElement_Create
},
80 {title_tagW
, HTMLTitleElement_Create
},
81 {trW
, HTMLTableRow_Create
}
84 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
86 DWORD min
=0, max
=sizeof(tag_descs
)/sizeof(*tag_descs
)-1, i
;
91 r
= strcmpW(tag_name
, tag_descs
[i
].name
);
104 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
106 nsIDOMDocumentFragment
*nsfragment
;
107 nsIDOMNSRange
*nsrange
;
108 nsIDOMNode
*nsparent
;
114 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
115 if(NS_FAILED(nsres
)) {
116 ERR("CreateRange failed: %08x\n", nsres
);
120 nsres
= nsIDOMRange_QueryInterface(range
, &IID_nsIDOMNSRange
, (void**)&nsrange
);
121 nsIDOMRange_Release(range
);
122 if(NS_FAILED(nsres
)) {
123 ERR("Could not get nsIDOMNSRange: %08x\n", nsres
);
127 nsAString_InitDepend(&html_str
, html
);
128 nsIDOMNSRange_CreateContextualFragment(nsrange
, &html_str
, &nsfragment
);
129 nsIDOMNSRange_Release(nsrange
);
130 nsAString_Finish(&html_str
);
131 if(NS_FAILED(nsres
)) {
132 ERR("CreateContextualFragment failed: %08x\n", nsres
);
136 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
137 if(NS_SUCCEEDED(nsres
) && nsparent
) {
140 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
141 nsIDOMNode_Release(nsparent
);
142 if(NS_FAILED(nsres
)) {
143 ERR("ReplaceChild failed: %08x\n", nsres
);
146 nsIDOMNode_Release(nstmp
);
149 ERR("GetParentNode failed: %08x\n", nsres
);
153 nsIDOMDocumentFragment_Release(nsfragment
);
160 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
163 } HTMLFiltersCollection
;
165 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
167 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
170 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
172 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
174 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
177 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMHTMLElement
**ret
)
179 nsIDOMElement
*nselem
;
184 WARN("NULL nsdoc\n");
188 nsAString_InitDepend(&tag_str
, tag
);
189 nsres
= nsIDOMDocument_CreateElement(doc
->nsdoc
, &tag_str
, &nselem
);
190 nsAString_Finish(&tag_str
);
191 if(NS_FAILED(nsres
)) {
192 ERR("CreateElement failed: %08x\n", nsres
);
196 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)ret
);
197 nsIDOMElement_Release(nselem
);
198 if(NS_FAILED(nsres
)) {
199 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres
);
206 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
207 REFIID riid
, void **ppv
)
209 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
211 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
214 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
216 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
218 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
221 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
223 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
225 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
228 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
230 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
231 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
234 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
235 LCID lcid
, ITypeInfo
**ppTInfo
)
237 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
238 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
241 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
242 LPOLESTR
*rgszNames
, UINT cNames
,
243 LCID lcid
, DISPID
*rgDispId
)
245 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
246 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
250 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
251 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
252 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
254 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
255 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
256 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
259 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
260 VARIANT AttributeValue
, LONG lFlags
)
262 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
264 DISPID dispid
, dispidNamed
= DISPID_PROPERTYPUT
;
265 DISPPARAMS dispParams
;
268 TRACE("(%p)->(%s . %08x)\n", This
, debugstr_w(strAttributeName
), lFlags
);
270 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
271 fdexNameCaseInsensitive
| fdexNameEnsure
, &dispid
);
275 dispParams
.cArgs
= 1;
276 dispParams
.cNamedArgs
= 1;
277 dispParams
.rgdispidNamedArgs
= &dispidNamed
;
278 dispParams
.rgvarg
= &AttributeValue
;
280 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
,
281 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dispParams
, NULL
, &excep
, NULL
);
285 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
286 LONG lFlags
, VARIANT
*AttributeValue
)
288 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
291 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
294 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
296 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
297 fdexNameCaseInsensitive
, &dispid
);
298 if(hres
== DISP_E_UNKNOWNNAME
) {
299 V_VT(AttributeValue
) = VT_NULL
;
304 V_VT(AttributeValue
) = VT_NULL
;
308 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
309 DISPATCH_PROPERTYGET
, &dispParams
, AttributeValue
, &excep
, NULL
);
314 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
315 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
317 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
319 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
321 return remove_prop(&This
->node
.dispex
, strAttributeName
, pfSuccess
);
324 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
326 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
327 nsAString classname_str
;
330 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
333 FIXME("NULL nselem\n");
337 nsAString_InitDepend(&classname_str
, v
);
338 nsres
= nsIDOMHTMLElement_SetClassName(This
->nselem
, &classname_str
);
339 nsAString_Finish(&classname_str
);
341 ERR("SetClassName failed: %08x\n", nsres
);
346 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
348 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
353 TRACE("(%p)->(%p)\n", This
, p
);
356 FIXME("NULL nselem\n");
360 nsAString_Init(&class_str
, NULL
);
361 nsres
= nsIDOMHTMLElement_GetClassName(This
->nselem
, &class_str
);
363 if(NS_SUCCEEDED(nsres
)) {
364 const PRUnichar
*class;
365 nsAString_GetData(&class_str
, &class);
366 *p
= *class ? SysAllocString(class) : NULL
;
368 ERR("GetClassName failed: %08x\n", nsres
);
372 nsAString_Finish(&class_str
);
374 TRACE("className=%s\n", debugstr_w(*p
));
378 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
380 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
384 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
387 FIXME("nselem == NULL\n");
391 nsAString_InitDepend(&id_str
, v
);
392 nsres
= nsIDOMHTMLElement_SetId(This
->nselem
, &id_str
);
393 nsAString_Finish(&id_str
);
395 ERR("SetId failed: %08x\n", nsres
);
400 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
402 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
407 TRACE("(%p)->(%p)\n", This
, p
);
414 nsAString_Init(&id_str
, NULL
);
415 nsres
= nsIDOMHTMLElement_GetId(This
->nselem
, &id_str
);
416 nsAString_GetData(&id_str
, &id
);
419 ERR("GetId failed: %08x\n", nsres
);
421 *p
= SysAllocString(id
);
423 nsAString_Finish(&id_str
);
427 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
429 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
430 const PRUnichar
*tag
;
434 TRACE("(%p)->(%p)\n", This
, p
);
437 static const WCHAR comment_tagW
[] = {'!',0};
439 WARN("NULL nselem, assuming comment\n");
441 *p
= SysAllocString(comment_tagW
);
445 nsAString_Init(&tag_str
, NULL
);
446 nsres
= nsIDOMHTMLElement_GetTagName(This
->nselem
, &tag_str
);
447 if(NS_SUCCEEDED(nsres
)) {
448 nsAString_GetData(&tag_str
, &tag
);
449 *p
= SysAllocString(tag
);
451 ERR("GetTagName failed: %08x\n", nsres
);
454 nsAString_Finish(&tag_str
);
459 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
461 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
465 TRACE("(%p)->(%p)\n", This
, p
);
467 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
471 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
472 IHTMLDOMNode_Release(node
);
479 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
481 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
483 TRACE("(%p)->(%p)\n", This
, p
);
486 nsIDOMElementCSSInlineStyle
*nselemstyle
;
487 nsIDOMCSSStyleDeclaration
*nsstyle
;
492 FIXME("NULL nselem\n");
496 nsres
= nsIDOMHTMLElement_QueryInterface(This
->nselem
, &IID_nsIDOMElementCSSInlineStyle
,
497 (void**)&nselemstyle
);
498 if(NS_FAILED(nsres
)) {
499 ERR("Could not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres
);
503 nsres
= nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle
, &nsstyle
);
504 nsIDOMElementCSSInlineStyle_Release(nselemstyle
);
505 if(NS_FAILED(nsres
)) {
506 ERR("GetStyle failed: %08x\n", nsres
);
510 hres
= HTMLStyle_Create(nsstyle
, &This
->style
);
511 nsIDOMCSSStyleDeclaration_Release(nsstyle
);
516 *p
= &This
->style
->IHTMLStyle_iface
;
517 IHTMLStyle_AddRef(*p
);
521 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
523 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
524 FIXME("(%p)->()\n", This
);
528 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
530 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
531 FIXME("(%p)->(%p)\n", This
, p
);
535 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
537 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
539 TRACE("(%p)->()\n", This
);
541 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
544 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
546 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
548 TRACE("(%p)->(%p)\n", This
, p
);
550 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
553 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
555 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
557 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
559 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
562 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
564 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
566 TRACE("(%p)->(%p)\n", This
, p
);
568 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
571 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
573 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
575 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
577 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
580 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
582 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
584 TRACE("(%p)->(%p)\n", This
, p
);
586 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
589 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
591 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
593 TRACE("(%p)->()\n", This
);
595 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
598 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
600 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
601 FIXME("(%p)->(%p)\n", This
, p
);
605 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
607 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
608 FIXME("(%p)->()\n", This
);
612 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
614 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
615 FIXME("(%p)->(%p)\n", This
, p
);
619 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
621 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
623 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
625 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
628 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
630 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
632 TRACE("(%p)->(%p)\n", This
, p
);
634 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
637 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
639 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
641 TRACE("(%p)->()\n", This
);
643 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
646 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
648 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
650 TRACE("(%p)->(%p)\n", This
, p
);
652 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
655 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
657 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
659 TRACE("(%p)->()\n", This
);
661 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
664 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
666 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
668 TRACE("(%p)->(%p)\n", This
, p
);
670 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
673 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
675 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
677 TRACE("(%p)->()\n", This
);
679 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
682 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
684 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
686 TRACE("(%p)->(%p)\n", This
, p
);
688 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
691 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
693 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
695 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
697 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
700 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
702 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
704 TRACE("(%p)->(%p)\n", This
, p
);
706 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
709 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
711 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
713 TRACE("(%p)->(%p)\n", This
, p
);
718 if(This
->node
.vtbl
->get_document
)
719 return This
->node
.vtbl
->get_document(&This
->node
, p
);
721 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
722 IDispatch_AddRef(*p
);
726 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
728 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
730 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
734 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
740 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, TRUE
, &var
);
746 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
750 nsAString_InitDepend(&title_str
, v
);
751 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
752 nsAString_Finish(&title_str
);
754 ERR("SetTitle failed: %08x\n", nsres
);
759 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
761 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
765 TRACE("(%p)->(%p)\n", This
, p
);
771 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, FALSE
, &var
);
772 if(hres
== DISP_E_UNKNOWNNAME
) {
774 }else if(V_VT(var
) != VT_BSTR
) {
775 FIXME("title = %s\n", debugstr_variant(var
));
778 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
784 nsAString_Init(&title_str
, NULL
);
785 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
786 if(NS_SUCCEEDED(nsres
)) {
787 const PRUnichar
*title
;
789 nsAString_GetData(&title_str
, &title
);
790 *p
= *title
? SysAllocString(title
) : NULL
;
792 ERR("GetTitle failed: %08x\n", nsres
);
799 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
801 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
802 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
806 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
808 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
809 FIXME("(%p)->(%p)\n", This
, p
);
813 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
815 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
817 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
819 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
822 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
824 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
826 TRACE("(%p)->(%p)\n", This
, p
);
828 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
831 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
833 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
834 FIXME("(%p)->()\n", This
);
838 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
839 VARIANT_BOOL
*pfResult
)
841 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
842 FIXME("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
846 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
848 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
849 FIXME("(%p)->(%p)\n", This
, p
);
853 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
855 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
856 FIXME("(%p)->(%p)\n", This
, p
);
860 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
862 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
863 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
867 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
869 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
870 FIXME("(%p)->(%p)\n", This
, p
);
874 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
876 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
877 PRInt32 off_left
= 0;
880 TRACE("(%p)->(%p)\n", This
, p
);
882 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, &off_left
);
883 if(NS_FAILED(nsres
)) {
884 ERR("GetOffsetLeft failed: %08x\n", nsres
);
892 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
894 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
898 TRACE("(%p)->(%p)\n", This
, p
);
900 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, &top
);
901 if(NS_FAILED(nsres
)) {
902 ERR("GetOffsetTop failed: %08x\n", nsres
);
910 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
912 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
916 TRACE("(%p)->(%p)\n", This
, p
);
918 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, &offset
);
919 if(NS_FAILED(nsres
)) {
920 ERR("GetOffsetWidth failed: %08x\n", nsres
);
928 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
930 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
934 TRACE("(%p)->(%p)\n", This
, p
);
936 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, &offset
);
937 if(NS_FAILED(nsres
)) {
938 ERR("GetOffsetHeight failed: %08x\n", nsres
);
946 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
948 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
949 nsIDOMElement
*nsparent
;
953 TRACE("(%p)->(%p)\n", This
, p
);
955 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
956 if(NS_FAILED(nsres
)) {
957 ERR("GetOffsetParent failed: %08x\n", nsres
);
964 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
965 nsIDOMElement_Release(nsparent
);
969 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
978 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
980 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
984 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
987 FIXME("NULL nselem\n");
991 nsAString_InitDepend(&html_str
, v
);
992 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
993 nsAString_Finish(&html_str
);
994 if(NS_FAILED(nsres
)) {
995 FIXME("SetInnerHtml failed %08x\n", nsres
);
1002 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1004 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1008 TRACE("(%p)->(%p)\n", This
, p
);
1011 FIXME("NULL nselem\n");
1015 nsAString_Init(&html_str
, NULL
);
1016 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
1017 if(NS_SUCCEEDED(nsres
)) {
1018 const PRUnichar
*html
;
1020 nsAString_GetData(&html_str
, &html
);
1021 *p
= *html
? SysAllocString(html
) : NULL
;
1023 FIXME("SetInnerHtml failed %08x\n", nsres
);
1027 nsAString_Finish(&html_str
);
1031 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1033 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1034 nsIDOMNode
*nschild
, *tmp
;
1035 nsIDOMText
*text_node
;
1039 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1042 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
1043 if(NS_FAILED(nsres
)) {
1044 ERR("GetLastChild failed: %08x\n", nsres
);
1050 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
1051 nsIDOMNode_Release(nschild
);
1052 if(NS_FAILED(nsres
)) {
1053 ERR("RemoveChild failed: %08x\n", nsres
);
1056 nsIDOMNode_Release(tmp
);
1059 nsAString_InitDepend(&text_str
, v
);
1060 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1061 nsAString_Finish(&text_str
);
1062 if(NS_FAILED(nsres
)) {
1063 ERR("CreateTextNode failed: %08x\n", nsres
);
1067 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1068 if(NS_FAILED(nsres
)) {
1069 ERR("AppendChild failed: %08x\n", nsres
);
1073 nsIDOMNode_Release(tmp
);
1077 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1079 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1081 TRACE("(%p)->(%p)\n", This
, p
);
1083 return get_node_text(&This
->node
, p
);
1086 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1088 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1090 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1092 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1095 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1097 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1101 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1103 nsAString_Init(&html_str
, NULL
);
1104 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1105 if(SUCCEEDED(hres
)) {
1106 const PRUnichar
*html
;
1108 nsAString_GetData(&html_str
, &html
);
1109 *p
= SysAllocString(html
);
1111 hres
= E_OUTOFMEMORY
;
1114 nsAString_Finish(&html_str
);
1116 TRACE("ret %s\n", debugstr_w(*p
));
1120 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1122 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1123 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1127 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1129 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1130 FIXME("(%p)->(%p)\n", This
, p
);
1134 static HRESULT
HTMLElement_InsertAdjacentNode(HTMLElement
*This
, BSTR where
, nsIDOMNode
*nsnode
)
1136 static const WCHAR wszBeforeBegin
[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
1137 static const WCHAR wszAfterBegin
[] = {'a','f','t','e','r','B','e','g','i','n',0};
1138 static const WCHAR wszBeforeEnd
[] = {'b','e','f','o','r','e','E','n','d',0};
1139 static const WCHAR wszAfterEnd
[] = {'a','f','t','e','r','E','n','d',0};
1142 if (!strcmpiW(where
, wszBeforeBegin
))
1146 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1147 if (!parent
) return E_INVALIDARG
;
1148 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &unused
);
1149 if (unused
) nsIDOMNode_Release(unused
);
1150 nsIDOMNode_Release(parent
);
1152 else if (!strcmpiW(where
, wszAfterBegin
))
1155 nsIDOMNode
*first_child
;
1156 nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1157 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &unused
);
1158 if (unused
) nsIDOMNode_Release(unused
);
1159 if (first_child
) nsIDOMNode_Release(first_child
);
1161 else if (!strcmpiW(where
, wszBeforeEnd
))
1164 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &unused
);
1165 if (unused
) nsIDOMNode_Release(unused
);
1167 else if (!strcmpiW(where
, wszAfterEnd
))
1170 nsIDOMNode
*next_sibling
;
1172 nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1173 if (!parent
) return E_INVALIDARG
;
1175 nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1178 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &unused
);
1179 nsIDOMNode_Release(next_sibling
);
1182 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &unused
);
1183 nsIDOMNode_Release(parent
);
1184 if (unused
) nsIDOMNode_Release(unused
);
1188 ERR("invalid where: %s\n", debugstr_w(where
));
1189 return E_INVALIDARG
;
1192 if (NS_FAILED(nsres
))
1198 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1201 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1203 nsIDOMNSRange
*nsrange
;
1209 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1211 if(!This
->node
.doc
->nsdoc
) {
1212 WARN("NULL nsdoc\n");
1213 return E_UNEXPECTED
;
1216 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1217 if(NS_FAILED(nsres
))
1219 ERR("CreateRange failed: %08x\n", nsres
);
1223 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1225 nsIDOMRange_QueryInterface(range
, &IID_nsIDOMNSRange
, (void **)&nsrange
);
1226 nsIDOMRange_Release(range
);
1227 if(NS_FAILED(nsres
))
1229 ERR("getting nsIDOMNSRange failed: %08x\n", nsres
);
1233 nsAString_InitDepend(&ns_html
, html
);
1235 nsres
= nsIDOMNSRange_CreateContextualFragment(nsrange
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1236 nsIDOMNSRange_Release(nsrange
);
1237 nsAString_Finish(&ns_html
);
1239 if(NS_FAILED(nsres
) || !nsnode
)
1241 ERR("CreateTextNode failed: %08x\n", nsres
);
1245 hr
= HTMLElement_InsertAdjacentNode(This
, where
, nsnode
);
1246 nsIDOMNode_Release(nsnode
);
1251 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1254 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1260 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1262 if(!This
->node
.doc
->nsdoc
) {
1263 WARN("NULL nsdoc\n");
1264 return E_UNEXPECTED
;
1268 nsAString_InitDepend(&ns_text
, text
);
1269 nsres
= nsIDOMDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1270 nsAString_Finish(&ns_text
);
1272 if(NS_FAILED(nsres
) || !nsnode
)
1274 ERR("CreateTextNode failed: %08x\n", nsres
);
1278 hr
= HTMLElement_InsertAdjacentNode(This
, where
, nsnode
);
1279 nsIDOMNode_Release(nsnode
);
1284 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1286 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1287 FIXME("(%p)->(%p)\n", This
, p
);
1291 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1293 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1294 FIXME("(%p)->(%p)\n", This
, p
);
1298 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1300 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1302 TRACE("(%p)\n", This
);
1304 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1307 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1308 IHTMLFiltersCollection
**p
)
1310 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1311 TRACE("(%p)->(%p)\n", This
, p
);
1316 *p
= HTMLFiltersCollection_Create();
1321 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
1323 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1324 FIXME("(%p)->()\n", This
);
1328 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1330 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1331 FIXME("(%p)->(%p)\n", This
, p
);
1335 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1337 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1338 FIXME("(%p)->(%p)\n", This
, String
);
1342 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1344 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1345 FIXME("(%p)->()\n", This
);
1349 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1351 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1352 FIXME("(%p)->(%p)\n", This
, p
);
1356 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1358 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1359 FIXME("(%p)->()\n", This
);
1363 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1365 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1366 FIXME("(%p)->(%p)\n", This
, p
);
1370 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1372 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1373 FIXME("(%p)->()\n", This
);
1377 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1379 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1380 FIXME("(%p)->(%p)\n", This
, p
);
1384 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1386 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1387 FIXME("(%p)->()\n", This
);
1391 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1393 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1394 FIXME("(%p)->(%p)\n", This
, p
);
1398 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1400 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1401 FIXME("(%p)->()\n", This
);
1405 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1407 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1408 FIXME("(%p)->(%p)\n", This
, p
);
1412 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1414 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1415 FIXME("(%p)->()\n", This
);
1419 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1421 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1422 FIXME("(%p)->(%p)\n", This
, p
);
1426 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1428 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1429 FIXME("(%p)->()\n", This
);
1433 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1435 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1436 FIXME("(%p)->(%p)\n", This
, p
);
1440 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1442 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1443 FIXME("(%p)->()\n", This
);
1447 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1449 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1450 FIXME("(%p)->(%p)\n", This
, p
);
1454 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1456 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1457 FIXME("(%p)->()\n", This
);
1461 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1463 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1464 FIXME("(%p)->(%p)\n", This
, p
);
1468 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1470 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1471 nsIDOMNodeList
*nsnode_list
;
1474 TRACE("(%p)->(%p)\n", This
, p
);
1476 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1477 if(NS_FAILED(nsres
)) {
1478 ERR("GetChildNodes failed: %08x\n", nsres
);
1482 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
,
1483 (IUnknown
*)&This
->IHTMLElement_iface
, nsnode_list
);
1485 nsIDOMNodeList_Release(nsnode_list
);
1489 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1491 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1493 TRACE("(%p)->(%p)\n", This
, p
);
1495 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1499 static const IHTMLElementVtbl HTMLElementVtbl
= {
1500 HTMLElement_QueryInterface
,
1502 HTMLElement_Release
,
1503 HTMLElement_GetTypeInfoCount
,
1504 HTMLElement_GetTypeInfo
,
1505 HTMLElement_GetIDsOfNames
,
1507 HTMLElement_setAttribute
,
1508 HTMLElement_getAttribute
,
1509 HTMLElement_removeAttribute
,
1510 HTMLElement_put_className
,
1511 HTMLElement_get_className
,
1514 HTMLElement_get_tagName
,
1515 HTMLElement_get_parentElement
,
1516 HTMLElement_get_style
,
1517 HTMLElement_put_onhelp
,
1518 HTMLElement_get_onhelp
,
1519 HTMLElement_put_onclick
,
1520 HTMLElement_get_onclick
,
1521 HTMLElement_put_ondblclick
,
1522 HTMLElement_get_ondblclick
,
1523 HTMLElement_put_onkeydown
,
1524 HTMLElement_get_onkeydown
,
1525 HTMLElement_put_onkeyup
,
1526 HTMLElement_get_onkeyup
,
1527 HTMLElement_put_onkeypress
,
1528 HTMLElement_get_onkeypress
,
1529 HTMLElement_put_onmouseout
,
1530 HTMLElement_get_onmouseout
,
1531 HTMLElement_put_onmouseover
,
1532 HTMLElement_get_onmouseover
,
1533 HTMLElement_put_onmousemove
,
1534 HTMLElement_get_onmousemove
,
1535 HTMLElement_put_onmousedown
,
1536 HTMLElement_get_onmousedown
,
1537 HTMLElement_put_onmouseup
,
1538 HTMLElement_get_onmouseup
,
1539 HTMLElement_get_document
,
1540 HTMLElement_put_title
,
1541 HTMLElement_get_title
,
1542 HTMLElement_put_language
,
1543 HTMLElement_get_language
,
1544 HTMLElement_put_onselectstart
,
1545 HTMLElement_get_onselectstart
,
1546 HTMLElement_scrollIntoView
,
1547 HTMLElement_contains
,
1548 HTMLElement_get_sourceIndex
,
1549 HTMLElement_get_recordNumber
,
1550 HTMLElement_put_lang
,
1551 HTMLElement_get_lang
,
1552 HTMLElement_get_offsetLeft
,
1553 HTMLElement_get_offsetTop
,
1554 HTMLElement_get_offsetWidth
,
1555 HTMLElement_get_offsetHeight
,
1556 HTMLElement_get_offsetParent
,
1557 HTMLElement_put_innerHTML
,
1558 HTMLElement_get_innerHTML
,
1559 HTMLElement_put_innerText
,
1560 HTMLElement_get_innerText
,
1561 HTMLElement_put_outerHTML
,
1562 HTMLElement_get_outerHTML
,
1563 HTMLElement_put_outerText
,
1564 HTMLElement_get_outerText
,
1565 HTMLElement_insertAdjacentHTML
,
1566 HTMLElement_insertAdjacentText
,
1567 HTMLElement_get_parentTextEdit
,
1568 HTMLElement_get_isTextEdit
,
1570 HTMLElement_get_filters
,
1571 HTMLElement_put_ondragstart
,
1572 HTMLElement_get_ondragstart
,
1573 HTMLElement_toString
,
1574 HTMLElement_put_onbeforeupdate
,
1575 HTMLElement_get_onbeforeupdate
,
1576 HTMLElement_put_onafterupdate
,
1577 HTMLElement_get_onafterupdate
,
1578 HTMLElement_put_onerrorupdate
,
1579 HTMLElement_get_onerrorupdate
,
1580 HTMLElement_put_onrowexit
,
1581 HTMLElement_get_onrowexit
,
1582 HTMLElement_put_onrowenter
,
1583 HTMLElement_get_onrowenter
,
1584 HTMLElement_put_ondatasetchanged
,
1585 HTMLElement_get_ondatasetchanged
,
1586 HTMLElement_put_ondataavailable
,
1587 HTMLElement_get_ondataavailable
,
1588 HTMLElement_put_ondatasetcomplete
,
1589 HTMLElement_get_ondatasetcomplete
,
1590 HTMLElement_put_onfilterchange
,
1591 HTMLElement_get_onfilterchange
,
1592 HTMLElement_get_children
,
1596 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1598 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1601 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
1603 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
1606 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
1608 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1612 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1613 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1614 *ppv
= &This
->IHTMLElement_iface
;
1615 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
1616 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
1617 *ppv
= &This
->IHTMLElement_iface
;
1618 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
1619 TRACE("(%p)->(IID_IHTMLElement %p)\n", This
, ppv
);
1620 *ppv
= &This
->IHTMLElement_iface
;
1621 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
1622 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This
, ppv
);
1623 *ppv
= &This
->IHTMLElement2_iface
;
1624 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
1625 TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This
, ppv
);
1626 *ppv
= &This
->IHTMLElement3_iface
;
1627 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
1628 TRACE("(%p)->(IID_IHTMLElement4 %p)\n", This
, ppv
);
1629 *ppv
= &This
->IHTMLElement4_iface
;
1630 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
1631 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
1632 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
1636 IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
1640 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
1643 void HTMLElement_destructor(HTMLDOMNode
*iface
)
1645 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1647 ConnectionPointContainer_Destroy(&This
->cp_container
);
1650 nsIDOMHTMLElement_Release(This
->nselem
);
1652 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
1654 HTMLDOMAttribute
*attr
;
1656 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
1659 This
->attrs
->elem
= NULL
;
1660 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
1663 HTMLDOMNode_destructor(&This
->node
);
1666 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
1668 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
1669 HTMLElement
*new_elem
;
1672 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
1676 IHTMLElement_AddRef(&new_elem
->IHTMLElement_iface
);
1677 *ret
= &new_elem
->node
;
1681 static const NodeImplVtbl HTMLElementImplVtbl
= {
1683 HTMLElement_destructor
,
1685 HTMLElement_get_attr_col
1688 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
1690 return CONTAINING_RECORD(iface
, HTMLElement
, node
.dispex
);
1693 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
1694 DWORD grfdex
, DISPID
*pid
)
1696 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1698 if(This
->node
.vtbl
->get_dispid
)
1699 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
1701 return DISP_E_UNKNOWNNAME
;
1704 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
1705 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
1706 IServiceProvider
*caller
)
1708 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1710 if(This
->node
.vtbl
->invoke
)
1711 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
1712 params
, res
, ei
, caller
);
1714 ERR("(%p): element has no invoke method\n", This
);
1718 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
1720 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
1721 nsIDOMNamedNodeMap
*attrs
;
1724 const PRUnichar
*str
;
1736 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
1737 if(NS_FAILED(nsres
))
1740 nsres
= nsIDOMNamedNodeMap_GetLength(attrs
, &len
);
1741 if(NS_FAILED(nsres
)) {
1742 nsIDOMNamedNodeMap_Release(attrs
);
1746 nsAString_Init(&nsstr
, NULL
);
1747 for(i
=0; i
<len
; i
++) {
1748 nsres
= nsIDOMNamedNodeMap_Item(attrs
, i
, &node
);
1749 if(NS_FAILED(nsres
))
1752 nsres
= nsIDOMNode_GetNodeName(node
, &nsstr
);
1753 if(NS_FAILED(nsres
)) {
1754 nsIDOMNode_Release(node
);
1758 nsAString_GetData(&nsstr
, &str
);
1759 name
= SysAllocString(str
);
1761 nsIDOMNode_Release(node
);
1765 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
1766 if(hres
!= DISP_E_UNKNOWNNAME
) {
1767 nsIDOMNode_Release(node
);
1768 SysFreeString(name
);
1772 nsres
= nsIDOMNode_GetNodeValue(node
, &nsstr
);
1773 nsIDOMNode_Release(node
);
1774 if(NS_FAILED(nsres
)) {
1775 SysFreeString(name
);
1779 nsAString_GetData(&nsstr
, &str
);
1780 V_VT(&value
) = VT_BSTR
;
1782 V_BSTR(&value
) = SysAllocString(str
);
1783 if(!V_BSTR(&value
)) {
1784 SysFreeString(name
);
1788 V_BSTR(&value
) = NULL
;
1790 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
1791 SysFreeString(name
);
1792 VariantClear(&value
);
1794 nsAString_Finish(&nsstr
);
1796 nsIDOMNamedNodeMap_Release(attrs
);
1800 static const tid_t HTMLElement_iface_tids
[] = {
1805 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
1807 HTMLElement_get_dispid
,
1809 HTMLElement_populate_props
1812 static dispex_static_data_t HTMLElement_dispex
= {
1813 &HTMLElement_dispex_vtbl
,
1814 DispHTMLUnknownElement_tid
,
1816 HTMLElement_iface_tids
1819 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
1821 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
1823 HTMLElement2_Init(This
);
1824 HTMLElement3_Init(This
);
1826 if(dispex_data
&& !dispex_data
->vtbl
)
1827 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
1828 init_dispex(&This
->node
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
1829 dispex_data
? dispex_data
: &HTMLElement_dispex
);
1832 nsIDOMHTMLElement_AddRef(nselem
);
1833 This
->nselem
= nselem
;
1835 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
1837 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
);
1840 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
1842 nsIDOMHTMLElement
*nselem
;
1843 nsAString class_name_str
;
1844 const PRUnichar
*class_name
;
1845 const tag_desc_t
*tag
;
1850 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
1851 if(NS_FAILED(nsres
))
1854 nsAString_Init(&class_name_str
, NULL
);
1855 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
1857 nsAString_GetData(&class_name_str
, &class_name
);
1859 tag
= get_tag_desc(class_name
);
1861 hres
= tag
->constructor(doc
, nselem
, &elem
);
1862 }else if(use_generic
) {
1863 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
1865 elem
= heap_alloc_zero(sizeof(HTMLElement
));
1867 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
1868 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
1871 hres
= E_OUTOFMEMORY
;
1875 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
1877 nsIDOMElement_Release(nselem
);
1878 nsAString_Finish(&class_name_str
);
1886 /* interface IHTMLFiltersCollection */
1887 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
1889 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1891 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppv
);
1893 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1894 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
1895 *ppv
= &This
->IHTMLFiltersCollection_iface
;
1896 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
1897 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
1898 *ppv
= &This
->IHTMLFiltersCollection_iface
;
1899 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
1900 return *ppv
? S_OK
: E_NOINTERFACE
;
1904 IUnknown_AddRef((IUnknown
*)*ppv
);
1908 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
1909 return E_NOINTERFACE
;
1912 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
1914 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1915 LONG ref
= InterlockedIncrement(&This
->ref
);
1917 TRACE("(%p) ref=%d\n", This
, ref
);
1922 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
1924 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1925 LONG ref
= InterlockedDecrement(&This
->ref
);
1927 TRACE("(%p) ref=%d\n", This
, ref
);
1937 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
1939 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1940 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
1943 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
1944 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
1946 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1947 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1950 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
1951 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
1952 LCID lcid
, DISPID
*rgDispId
)
1954 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1955 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
1959 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
1960 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
1961 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1963 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1964 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
1965 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1968 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
1970 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1975 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
1981 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
1983 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1984 FIXME("(%p)->(%p)\n", This
, p
);
1988 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
1990 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
1991 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
1995 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
1996 HTMLFiltersCollection_QueryInterface
,
1997 HTMLFiltersCollection_AddRef
,
1998 HTMLFiltersCollection_Release
,
1999 HTMLFiltersCollection_GetTypeInfoCount
,
2000 HTMLFiltersCollection_GetTypeInfo
,
2001 HTMLFiltersCollection_GetIDsOfNames
,
2002 HTMLFiltersCollection_Invoke
,
2003 HTMLFiltersCollection_get_length
,
2004 HTMLFiltersCollection_get__newEnum
,
2005 HTMLFiltersCollection_item
2008 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
2013 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
2014 idx
= idx
*10 + (*ptr
-'0');
2016 return DISP_E_UNKNOWNNAME
;
2018 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
2019 TRACE("ret %x\n", *dispid
);
2023 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2024 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2026 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
2028 V_VT(res
) = VT_DISPATCH
;
2029 V_DISPATCH(res
) = NULL
;
2031 FIXME("always returning NULL\n");
2036 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
2038 HTMLFiltersCollection_get_dispid
,
2039 HTMLFiltersCollection_invoke
,
2043 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
2044 IHTMLFiltersCollection_tid
,
2047 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
2048 &HTMLFiltersCollection_dispex_vtbl
,
2049 IHTMLFiltersCollection_tid
,
2051 HTMLFiltersCollection_iface_tids
2054 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
2056 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
2058 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
2061 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
2062 &HTMLFiltersCollection_dispex
);
2064 return &ret
->IHTMLFiltersCollection_iface
;
2067 /* interface IHTMLAttributeCollection */
2068 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
2070 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
2073 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
2075 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2079 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
2080 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
2081 *ppv
= &This
->IHTMLAttributeCollection_iface
;
2082 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
2083 TRACE("(%p)->(IID_IHTMLAttributeCollection %p)\n", This
, ppv
);
2084 *ppv
= &This
->IHTMLAttributeCollection_iface
;
2085 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
2086 TRACE("(%p)->(IID_IHTMLAttributeCollection2 %p)\n", This
, ppv
);
2087 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
2088 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
2089 TRACE("(%p)->(IID_IHTMLAttributeCollection3 %p)\n", This
, ppv
);
2090 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
2091 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
2092 return *ppv
? S_OK
: E_NOINTERFACE
;
2096 IUnknown_AddRef((IUnknown
*)*ppv
);
2100 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2101 return E_NOINTERFACE
;
2104 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
2106 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2107 LONG ref
= InterlockedIncrement(&This
->ref
);
2109 TRACE("(%p) ref=%d\n", This
, ref
);
2114 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
2116 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2117 LONG ref
= InterlockedDecrement(&This
->ref
);
2119 TRACE("(%p) ref=%d\n", This
, ref
);
2122 while(!list_empty(&This
->attrs
)) {
2123 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
2125 list_remove(&attr
->entry
);
2127 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
2136 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
2138 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2139 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2142 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
2143 LCID lcid
, ITypeInfo
**ppTInfo
)
2145 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2146 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2149 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
2150 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2152 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2153 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2157 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
2158 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2159 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2161 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2162 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2163 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2166 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
2168 IDispatchEx
*dispex
= &This
->elem
->node
.dispex
.IDispatchEx_iface
;
2169 DISPID id
= DISPID_STARTENUM
;
2173 FIXME("filter non-enumerable attributes out\n");
2176 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
2179 else if(hres
== S_FALSE
)
2189 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
2196 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
2200 if(name
[0]>='0' && name
[0]<='9') {
2204 idx
= strtoulW(name
, &end_ptr
, 10);
2206 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
2213 WARN("NULL elem\n");
2214 return E_UNEXPECTED
;
2217 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.dispex
.IDispatchEx_iface
,
2218 name
, fdexNameCaseInsensitive
, id
);
2222 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
2224 HTMLDOMAttribute
*iter
;
2229 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
2230 if(iter
->dispid
== id
) {
2239 WARN("NULL elem\n");
2240 return E_UNEXPECTED
;
2244 hres
= HTMLDOMAttribute_Create(This
->elem
, id
, attr
);
2249 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
2255 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
2257 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2260 TRACE("(%p)->(%p)\n", This
, p
);
2263 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
2267 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
2269 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2270 FIXME("(%p)->(%p)\n", This
, p
);
2274 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
2276 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
2277 HTMLDOMAttribute
*attr
;
2281 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
2283 switch(V_VT(name
)) {
2285 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
2288 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
2291 FIXME("unsupported vt %x\n", V_VT(name
));
2294 if(hres
== DISP_E_UNKNOWNNAME
)
2295 return E_INVALIDARG
;
2299 hres
= get_domattr(This
, id
, NULL
, &attr
);
2303 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
2307 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
2308 HTMLAttributeCollection_QueryInterface
,
2309 HTMLAttributeCollection_AddRef
,
2310 HTMLAttributeCollection_Release
,
2311 HTMLAttributeCollection_GetTypeInfoCount
,
2312 HTMLAttributeCollection_GetTypeInfo
,
2313 HTMLAttributeCollection_GetIDsOfNames
,
2314 HTMLAttributeCollection_Invoke
,
2315 HTMLAttributeCollection_get_length
,
2316 HTMLAttributeCollection__newEnum
,
2317 HTMLAttributeCollection_item
2320 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
2322 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
2325 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
2327 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2328 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
2331 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
2333 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2334 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
2337 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
2339 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2340 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
2343 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
2345 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2346 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2349 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
2350 LCID lcid
, ITypeInfo
**ppTInfo
)
2352 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2353 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2356 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
2357 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2359 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2360 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2364 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
2365 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2366 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2368 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2369 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2370 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2373 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
2374 IHTMLDOMAttribute
**newretNode
)
2376 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2377 HTMLDOMAttribute
*attr
;
2381 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
2383 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
2384 if(hres
== DISP_E_UNKNOWNNAME
) {
2387 } else if(FAILED(hres
)) {
2391 hres
= get_domattr(This
, id
, NULL
, &attr
);
2395 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
2399 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
2400 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
2402 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2403 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
2407 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
2408 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
2410 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
2411 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
2415 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
2416 HTMLAttributeCollection2_QueryInterface
,
2417 HTMLAttributeCollection2_AddRef
,
2418 HTMLAttributeCollection2_Release
,
2419 HTMLAttributeCollection2_GetTypeInfoCount
,
2420 HTMLAttributeCollection2_GetTypeInfo
,
2421 HTMLAttributeCollection2_GetIDsOfNames
,
2422 HTMLAttributeCollection2_Invoke
,
2423 HTMLAttributeCollection2_getNamedItem
,
2424 HTMLAttributeCollection2_setNamedItem
,
2425 HTMLAttributeCollection2_removeNamedItem
2428 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
2430 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
2433 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
2435 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2436 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
2439 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
2441 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2442 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
2445 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
2447 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2448 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
2451 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
2453 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2454 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2457 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
2458 LCID lcid
, ITypeInfo
**ppTInfo
)
2460 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2461 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2464 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
2465 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2467 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2468 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2472 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
2473 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2474 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2476 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2477 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2478 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2481 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
2482 IHTMLDOMAttribute
**ppNodeOut
)
2484 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2485 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
2488 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
2489 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
2491 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2492 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
2496 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
2497 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
2499 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2500 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
2504 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
2506 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2507 HTMLDOMAttribute
*attr
;
2511 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
2513 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
2514 if(hres
== DISP_E_UNKNOWNNAME
)
2515 return E_INVALIDARG
;
2519 hres
= get_domattr(This
, id
, NULL
, &attr
);
2523 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
2527 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
2529 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
2530 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
2533 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
2534 HTMLAttributeCollection3_QueryInterface
,
2535 HTMLAttributeCollection3_AddRef
,
2536 HTMLAttributeCollection3_Release
,
2537 HTMLAttributeCollection3_GetTypeInfoCount
,
2538 HTMLAttributeCollection3_GetTypeInfo
,
2539 HTMLAttributeCollection3_GetIDsOfNames
,
2540 HTMLAttributeCollection3_Invoke
,
2541 HTMLAttributeCollection3_getNamedItem
,
2542 HTMLAttributeCollection3_setNamedItem
,
2543 HTMLAttributeCollection3_removeNamedItem
,
2544 HTMLAttributeCollection3_item
,
2545 HTMLAttributeCollection3_get_length
2548 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
2550 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
2553 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
2555 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
2556 HTMLDOMAttribute
*attr
;
2560 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
2562 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
2566 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
2569 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
2571 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
2575 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
2576 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2578 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
2580 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
2583 case DISPATCH_PROPERTYGET
: {
2584 HTMLDOMAttribute
*iter
;
2586 id
= id
-MSHTML_DISPID_CUSTOM_MIN
+1;
2588 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
2593 return E_INVALIDARG
;
2595 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
2596 V_VT(res
) = VT_DISPATCH
;
2597 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
2602 FIXME("unimplemented flags %x\n", flags
);
2607 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
2609 HTMLAttributeCollection_get_dispid
,
2610 HTMLAttributeCollection_invoke
,
2614 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
2615 IHTMLAttributeCollection_tid
,
2616 IHTMLAttributeCollection2_tid
,
2617 IHTMLAttributeCollection3_tid
,
2621 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
2622 &HTMLAttributeCollection_dispex_vtbl
,
2623 DispHTMLAttributeCollection_tid
,
2625 HTMLAttributeCollection_iface_tids
2628 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
2630 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
2633 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
2638 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
2640 return E_OUTOFMEMORY
;
2642 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
2643 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
2644 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
2645 This
->attrs
->ref
= 2;
2647 This
->attrs
->elem
= This
;
2648 list_init(&This
->attrs
->attrs
);
2649 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
2650 &HTMLAttributeCollection_dispex
);