2 * Copyright 2006-2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
36 #include "htmlevent.h"
37 #include "htmlstyle.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
41 static const WCHAR aW
[] = {'A',0};
42 static const WCHAR areaW
[] = {'A','R','E','A',0};
43 static const WCHAR bodyW
[] = {'B','O','D','Y',0};
44 static const WCHAR buttonW
[] = {'B','U','T','T','O','N',0};
45 static const WCHAR embedW
[] = {'E','M','B','E','D',0};
46 static const WCHAR formW
[] = {'F','O','R','M',0};
47 static const WCHAR frameW
[] = {'F','R','A','M','E',0};
48 static const WCHAR headW
[] = {'H','E','A','D',0};
49 static const WCHAR iframeW
[] = {'I','F','R','A','M','E',0};
50 static const WCHAR imgW
[] = {'I','M','G',0};
51 static const WCHAR inputW
[] = {'I','N','P','U','T',0};
52 static const WCHAR labelW
[] = {'L','A','B','E','L',0};
53 static const WCHAR linkW
[] = {'L','I','N','K',0};
54 static const WCHAR metaW
[] = {'M','E','T','A',0};
55 static const WCHAR objectW
[] = {'O','B','J','E','C','T',0};
56 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
57 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
58 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
59 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
60 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
61 static const WCHAR tdW
[] = {'T','D',0};
62 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
63 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
64 static const WCHAR trW
[] = {'T','R',0};
68 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
71 static const tag_desc_t tag_descs
[] = {
72 {aW
, HTMLAnchorElement_Create
},
73 {areaW
, HTMLAreaElement_Create
},
74 {bodyW
, HTMLBodyElement_Create
},
75 {buttonW
, HTMLButtonElement_Create
},
76 {embedW
, HTMLEmbedElement_Create
},
77 {formW
, HTMLFormElement_Create
},
78 {frameW
, HTMLFrameElement_Create
},
79 {headW
, HTMLHeadElement_Create
},
80 {iframeW
, HTMLIFrame_Create
},
81 {imgW
, HTMLImgElement_Create
},
82 {inputW
, HTMLInputElement_Create
},
83 {labelW
, HTMLLabelElement_Create
},
84 {linkW
, HTMLLinkElement_Create
},
85 {metaW
, HTMLMetaElement_Create
},
86 {objectW
, HTMLObjectElement_Create
},
87 {optionW
, HTMLOptionElement_Create
},
88 {scriptW
, HTMLScriptElement_Create
},
89 {selectW
, HTMLSelectElement_Create
},
90 {styleW
, HTMLStyleElement_Create
},
91 {tableW
, HTMLTable_Create
},
92 {tdW
, HTMLTableCell_Create
},
93 {textareaW
, HTMLTextAreaElement_Create
},
94 {title_tagW
, HTMLTitleElement_Create
},
95 {trW
, HTMLTableRow_Create
}
98 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
100 DWORD min
=0, max
=sizeof(tag_descs
)/sizeof(*tag_descs
)-1, i
;
105 r
= strcmpW(tag_name
, tag_descs
[i
].name
);
118 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
120 nsIDOMDocumentFragment
*nsfragment
;
121 nsIDOMNode
*nsparent
;
127 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
128 if(NS_FAILED(nsres
)) {
129 ERR("CreateRange failed: %08x\n", nsres
);
133 nsAString_InitDepend(&html_str
, html
);
134 nsIDOMRange_CreateContextualFragment(range
, &html_str
, &nsfragment
);
135 nsIDOMRange_Release(range
);
136 nsAString_Finish(&html_str
);
137 if(NS_FAILED(nsres
)) {
138 ERR("CreateContextualFragment failed: %08x\n", nsres
);
142 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
143 if(NS_SUCCEEDED(nsres
) && nsparent
) {
146 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
147 nsIDOMNode_Release(nsparent
);
148 if(NS_FAILED(nsres
)) {
149 ERR("ReplaceChild failed: %08x\n", nsres
);
152 nsIDOMNode_Release(nstmp
);
155 ERR("GetParentNode failed: %08x\n", nsres
);
159 nsIDOMDocumentFragment_Release(nsfragment
);
163 nsresult
get_elem_attr_value(nsIDOMHTMLElement
*nselem
, const WCHAR
*name
, nsAString
*val_str
, const PRUnichar
**val
)
168 nsAString_InitDepend(&name_str
, name
);
169 nsAString_Init(val_str
, NULL
);
170 nsres
= nsIDOMHTMLElement_GetAttribute(nselem
, &name_str
, val_str
);
171 nsAString_Finish(&name_str
);
172 if(NS_FAILED(nsres
)) {
173 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name
), nsres
);
174 nsAString_Finish(val_str
);
178 nsAString_GetData(val_str
, val
);
182 HRESULT
elem_string_attr_getter(HTMLElement
*elem
, const WCHAR
*name
, BOOL use_null
, BSTR
*p
)
184 const PRUnichar
*val
;
189 nsres
= get_elem_attr_value(elem
->nselem
, name
, &val_str
, &val
);
193 TRACE("%s: returning %s\n", debugstr_w(name
), debugstr_w(val
));
195 if(*val
|| !use_null
) {
196 *p
= SysAllocString(val
);
198 hres
= E_OUTOFMEMORY
;
202 nsAString_Finish(&val_str
);
206 HRESULT
elem_string_attr_setter(HTMLElement
*elem
, const WCHAR
*name
, const WCHAR
*value
)
208 nsAString name_str
, val_str
;
211 nsAString_InitDepend(&name_str
, name
);
212 nsAString_InitDepend(&val_str
, value
);
213 nsres
= nsIDOMHTMLElement_SetAttribute(elem
->nselem
, &name_str
, &val_str
);
214 nsAString_Finish(&name_str
);
215 nsAString_Finish(&val_str
);
217 if(NS_FAILED(nsres
)) {
218 WARN("SetAttribute failed: %08x\n", nsres
);
225 HRESULT
get_readystate_string(READYSTATE readystate
, BSTR
*p
)
227 static const WCHAR uninitializedW
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
228 static const WCHAR loadingW
[] = {'l','o','a','d','i','n','g',0};
229 static const WCHAR loadedW
[] = {'l','o','a','d','e','d',0};
230 static const WCHAR interactiveW
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
231 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
233 static const LPCWSTR readystate_strs
[] = {
241 assert(readystate
<= READYSTATE_COMPLETE
);
242 *p
= SysAllocString(readystate_strs
[readystate
]);
243 return *p
? S_OK
: E_OUTOFMEMORY
;
249 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
252 } HTMLFiltersCollection
;
254 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
256 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
259 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
261 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
263 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
266 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMHTMLElement
**ret
)
268 nsIDOMElement
*nselem
;
273 WARN("NULL nsdoc\n");
277 nsAString_InitDepend(&tag_str
, tag
);
278 nsres
= nsIDOMHTMLDocument_CreateElement(doc
->nsdoc
, &tag_str
, &nselem
);
279 nsAString_Finish(&tag_str
);
280 if(NS_FAILED(nsres
)) {
281 ERR("CreateElement failed: %08x\n", nsres
);
285 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)ret
);
286 nsIDOMElement_Release(nselem
);
287 if(NS_FAILED(nsres
)) {
288 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres
);
295 HRESULT
create_element(HTMLDocumentNode
*doc
, const WCHAR
*tag
, HTMLElement
**ret
)
297 nsIDOMHTMLElement
*nselem
;
300 /* Use owner doc if called on document fragment */
304 hres
= create_nselem(doc
, tag
, &nselem
);
308 hres
= HTMLElement_Create(doc
, (nsIDOMNode
*)nselem
, TRUE
, ret
);
309 nsIDOMHTMLElement_Release(nselem
);
315 IHTMLRect IHTMLRect_iface
;
319 nsIDOMClientRect
*nsrect
;
322 static inline HTMLRect
*impl_from_IHTMLRect(IHTMLRect
*iface
)
324 return CONTAINING_RECORD(iface
, HTMLRect
, IHTMLRect_iface
);
327 static HRESULT WINAPI
HTMLRect_QueryInterface(IHTMLRect
*iface
, REFIID riid
, void **ppv
)
329 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
331 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
333 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
334 *ppv
= &This
->IHTMLRect_iface
;
335 }else if(IsEqualGUID(&IID_IHTMLRect
, riid
)) {
336 *ppv
= &This
->IHTMLRect_iface
;
337 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
338 return *ppv
? S_OK
: E_NOINTERFACE
;
340 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
342 return E_NOINTERFACE
;
345 IUnknown_AddRef((IUnknown
*)*ppv
);
349 static ULONG WINAPI
HTMLRect_AddRef(IHTMLRect
*iface
)
351 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
352 LONG ref
= InterlockedIncrement(&This
->ref
);
354 TRACE("(%p) ref=%d\n", This
, ref
);
359 static ULONG WINAPI
HTMLRect_Release(IHTMLRect
*iface
)
361 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
362 LONG ref
= InterlockedDecrement(&This
->ref
);
364 TRACE("(%p) ref=%d\n", This
, ref
);
368 nsIDOMClientRect_Release(This
->nsrect
);
375 static HRESULT WINAPI
HTMLRect_GetTypeInfoCount(IHTMLRect
*iface
, UINT
*pctinfo
)
377 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
378 FIXME("(%p)->(%p)\n", This
, pctinfo
);
382 static HRESULT WINAPI
HTMLRect_GetTypeInfo(IHTMLRect
*iface
, UINT iTInfo
,
383 LCID lcid
, ITypeInfo
**ppTInfo
)
385 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
387 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
390 static HRESULT WINAPI
HTMLRect_GetIDsOfNames(IHTMLRect
*iface
, REFIID riid
,
391 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
393 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
395 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
399 static HRESULT WINAPI
HTMLRect_Invoke(IHTMLRect
*iface
, DISPID dispIdMember
,
400 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
401 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
403 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
405 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
406 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
409 static HRESULT WINAPI
HTMLRect_put_left(IHTMLRect
*iface
, LONG v
)
411 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
412 FIXME("(%p)->(%d)\n", This
, v
);
416 static HRESULT WINAPI
HTMLRect_get_left(IHTMLRect
*iface
, LONG
*p
)
418 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
422 TRACE("(%p)->(%p)\n", This
, p
);
424 nsres
= nsIDOMClientRect_GetLeft(This
->nsrect
, &left
);
425 if(NS_FAILED(nsres
)) {
426 ERR("GetLeft failed: %08x\n", nsres
);
430 *p
= floor(left
+0.5);
434 static HRESULT WINAPI
HTMLRect_put_top(IHTMLRect
*iface
, LONG v
)
436 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
437 FIXME("(%p)->(%d)\n", This
, v
);
441 static HRESULT WINAPI
HTMLRect_get_top(IHTMLRect
*iface
, LONG
*p
)
443 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
447 TRACE("(%p)->(%p)\n", This
, p
);
449 nsres
= nsIDOMClientRect_GetTop(This
->nsrect
, &top
);
450 if(NS_FAILED(nsres
)) {
451 ERR("GetTop failed: %08x\n", nsres
);
459 static HRESULT WINAPI
HTMLRect_put_right(IHTMLRect
*iface
, LONG v
)
461 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
462 FIXME("(%p)->(%d)\n", This
, v
);
466 static HRESULT WINAPI
HTMLRect_get_right(IHTMLRect
*iface
, LONG
*p
)
468 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
472 TRACE("(%p)->(%p)\n", This
, p
);
474 nsres
= nsIDOMClientRect_GetRight(This
->nsrect
, &right
);
475 if(NS_FAILED(nsres
)) {
476 ERR("GetRight failed: %08x\n", nsres
);
480 *p
= floor(right
+0.5);
484 static HRESULT WINAPI
HTMLRect_put_bottom(IHTMLRect
*iface
, LONG v
)
486 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
487 FIXME("(%p)->(%d)\n", This
, v
);
491 static HRESULT WINAPI
HTMLRect_get_bottom(IHTMLRect
*iface
, LONG
*p
)
493 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
497 TRACE("(%p)->(%p)\n", This
, p
);
499 nsres
= nsIDOMClientRect_GetBottom(This
->nsrect
, &bottom
);
500 if(NS_FAILED(nsres
)) {
501 ERR("GetBottom failed: %08x\n", nsres
);
505 *p
= floor(bottom
+0.5);
509 static const IHTMLRectVtbl HTMLRectVtbl
= {
510 HTMLRect_QueryInterface
,
513 HTMLRect_GetTypeInfoCount
,
514 HTMLRect_GetTypeInfo
,
515 HTMLRect_GetIDsOfNames
,
527 static const tid_t HTMLRect_iface_tids
[] = {
531 static dispex_static_data_t HTMLRect_dispex
= {
538 static HRESULT
create_html_rect(nsIDOMClientRect
*nsrect
, IHTMLRect
**ret
)
542 rect
= heap_alloc_zero(sizeof(HTMLRect
));
544 return E_OUTOFMEMORY
;
546 rect
->IHTMLRect_iface
.lpVtbl
= &HTMLRectVtbl
;
549 init_dispex(&rect
->dispex
, (IUnknown
*)&rect
->IHTMLRect_iface
, &HTMLRect_dispex
);
551 nsIDOMClientRect_AddRef(nsrect
);
552 rect
->nsrect
= nsrect
;
554 *ret
= &rect
->IHTMLRect_iface
;
558 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
559 REFIID riid
, void **ppv
)
561 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
563 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
566 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
568 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
570 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
573 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
575 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
577 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
580 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
582 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
583 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
586 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
587 LCID lcid
, ITypeInfo
**ppTInfo
)
589 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
590 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
593 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
594 LPOLESTR
*rgszNames
, UINT cNames
,
595 LCID lcid
, DISPID
*rgDispId
)
597 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
598 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
602 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
603 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
604 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
606 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
607 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
608 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
611 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
612 VARIANT AttributeValue
, LONG lFlags
)
614 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
616 DISPID dispid
, dispidNamed
= DISPID_PROPERTYPUT
;
617 DISPPARAMS dispParams
;
620 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
), debugstr_variant(&AttributeValue
), lFlags
);
622 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
623 (lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
) | fdexNameEnsure
, &dispid
);
627 if(dispid
== DISPID_IHTMLELEMENT_STYLE
) {
628 TRACE("Ignoring call on style attribute\n");
632 dispParams
.cArgs
= 1;
633 dispParams
.cNamedArgs
= 1;
634 dispParams
.rgdispidNamedArgs
= &dispidNamed
;
635 dispParams
.rgvarg
= &AttributeValue
;
637 return IDispatchEx_InvokeEx(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispid
,
638 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dispParams
, NULL
, &excep
, NULL
);
641 HRESULT
get_elem_attr_value_by_dispid(HTMLElement
*elem
, DISPID dispid
, DWORD flags
, VARIANT
*ret
)
643 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
647 hres
= IDispatchEx_InvokeEx(&elem
->node
.event_target
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
648 DISPATCH_PROPERTYGET
, &dispParams
, ret
, &excep
, NULL
);
652 if(flags
& ATTRFLAG_ASSTRING
) {
657 IDispatch_Release(V_DISPATCH(ret
));
659 V_BSTR(ret
) = SysAllocString(NULL
);
662 hres
= VariantChangeType(ret
, ret
, 0, VT_BSTR
);
671 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
672 LONG lFlags
, VARIANT
*AttributeValue
)
674 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
678 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
680 if(lFlags
& ~(ATTRFLAG_CASESENSITIVE
|ATTRFLAG_ASSTRING
))
681 FIXME("Unsupported flags %x\n", lFlags
);
683 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
684 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
685 if(hres
== DISP_E_UNKNOWNNAME
) {
686 V_VT(AttributeValue
) = VT_NULL
;
691 V_VT(AttributeValue
) = VT_NULL
;
695 return get_elem_attr_value_by_dispid(This
, dispid
, lFlags
, AttributeValue
);
698 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
699 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
701 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
705 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
707 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
708 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &id
);
709 if(hres
== DISP_E_UNKNOWNNAME
) {
710 *pfSuccess
= VARIANT_FALSE
;
716 if(id
== DISPID_IHTMLELEMENT_STYLE
) {
719 TRACE("Special case: style\n");
721 hres
= IHTMLElement_get_style(&This
->IHTMLElement_iface
, &style
);
725 hres
= IHTMLStyle_put_cssText(style
, NULL
);
726 IHTMLStyle_Release(style
);
730 *pfSuccess
= VARIANT_TRUE
;
734 return remove_attribute(&This
->node
.event_target
.dispex
, id
, pfSuccess
);
737 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
739 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
740 nsAString classname_str
;
743 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
746 FIXME("NULL nselem\n");
750 nsAString_InitDepend(&classname_str
, v
);
751 nsres
= nsIDOMHTMLElement_SetClassName(This
->nselem
, &classname_str
);
752 nsAString_Finish(&classname_str
);
754 ERR("SetClassName failed: %08x\n", nsres
);
759 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
761 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
765 TRACE("(%p)->(%p)\n", This
, p
);
768 FIXME("NULL nselem\n");
772 nsAString_Init(&class_str
, NULL
);
773 nsres
= nsIDOMHTMLElement_GetClassName(This
->nselem
, &class_str
);
774 return return_nsstr(nsres
, &class_str
, p
);
777 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
779 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
783 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
786 FIXME("nselem == NULL\n");
790 nsAString_InitDepend(&id_str
, v
);
791 nsres
= nsIDOMHTMLElement_SetId(This
->nselem
, &id_str
);
792 nsAString_Finish(&id_str
);
794 ERR("SetId failed: %08x\n", nsres
);
799 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
801 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
805 TRACE("(%p)->(%p)\n", This
, p
);
812 nsAString_Init(&id_str
, NULL
);
813 nsres
= nsIDOMHTMLElement_GetId(This
->nselem
, &id_str
);
814 return return_nsstr(nsres
, &id_str
, p
);
817 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
819 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
823 TRACE("(%p)->(%p)\n", This
, p
);
826 static const WCHAR comment_tagW
[] = {'!',0};
828 WARN("NULL nselem, assuming comment\n");
830 *p
= SysAllocString(comment_tagW
);
831 return *p
? S_OK
: E_OUTOFMEMORY
;
834 nsAString_Init(&tag_str
, NULL
);
835 nsres
= nsIDOMHTMLElement_GetTagName(This
->nselem
, &tag_str
);
836 return return_nsstr(nsres
, &tag_str
, p
);
839 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
841 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
845 TRACE("(%p)->(%p)\n", This
, p
);
847 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
856 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
857 IHTMLDOMNode_Release(node
);
864 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
866 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
868 TRACE("(%p)->(%p)\n", This
, p
);
873 hres
= HTMLStyle_Create(This
, &This
->style
);
878 *p
= &This
->style
->IHTMLStyle_iface
;
879 IHTMLStyle_AddRef(*p
);
883 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
885 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
886 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
890 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
892 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
893 FIXME("(%p)->(%p)\n", This
, p
);
897 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
899 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
901 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
903 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
906 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
908 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
910 TRACE("(%p)->(%p)\n", This
, p
);
912 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
915 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
917 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
919 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
921 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
924 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
926 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
928 TRACE("(%p)->(%p)\n", This
, p
);
930 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
933 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
935 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
937 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
939 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
942 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
944 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
946 TRACE("(%p)->(%p)\n", This
, p
);
948 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
951 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
953 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
955 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
957 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
960 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
962 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
963 FIXME("(%p)->(%p)\n", This
, p
);
967 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
969 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
971 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
973 return set_node_event(&This
->node
, EVENTID_KEYPRESS
, &v
);
976 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
978 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
980 TRACE("(%p)->(%p)\n", This
, p
);
982 return get_node_event(&This
->node
, EVENTID_KEYPRESS
, p
);
985 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
987 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
989 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
991 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
994 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
996 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
998 TRACE("(%p)->(%p)\n", This
, p
);
1000 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
1003 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
1005 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1007 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1009 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
1012 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
1014 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1016 TRACE("(%p)->(%p)\n", This
, p
);
1018 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
1021 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
1023 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1025 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1027 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
1030 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
1032 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1034 TRACE("(%p)->(%p)\n", This
, p
);
1036 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
1039 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
1041 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1043 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1045 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
1048 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
1050 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1052 TRACE("(%p)->(%p)\n", This
, p
);
1054 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
1057 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
1059 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1061 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1063 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
1066 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
1068 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1070 TRACE("(%p)->(%p)\n", This
, p
);
1072 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
1075 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
1077 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1079 TRACE("(%p)->(%p)\n", This
, p
);
1084 if(This
->node
.vtbl
->get_document
)
1085 return This
->node
.vtbl
->get_document(&This
->node
, p
);
1087 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
1088 IDispatch_AddRef(*p
);
1092 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
1094 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
1096 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1097 nsAString title_str
;
1100 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1106 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, TRUE
, &var
);
1111 V_VT(var
) = VT_BSTR
;
1112 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
1116 nsAString_InitDepend(&title_str
, v
);
1117 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
1118 nsAString_Finish(&title_str
);
1119 if(NS_FAILED(nsres
))
1120 ERR("SetTitle failed: %08x\n", nsres
);
1125 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
1127 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1128 nsAString title_str
;
1131 TRACE("(%p)->(%p)\n", This
, p
);
1137 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, FALSE
, &var
);
1138 if(hres
== DISP_E_UNKNOWNNAME
) {
1140 }else if(V_VT(var
) != VT_BSTR
) {
1141 FIXME("title = %s\n", debugstr_variant(var
));
1144 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
1150 nsAString_Init(&title_str
, NULL
);
1151 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
1152 return return_nsstr(nsres
, &title_str
, p
);
1155 static const WCHAR languageW
[] = {'l','a','n','g','u','a','g','e',0};
1157 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
1159 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1161 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1163 return elem_string_attr_setter(This
, languageW
, v
);
1166 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
1168 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1170 TRACE("(%p)->(%p)\n", This
, p
);
1172 return elem_string_attr_getter(This
, languageW
, TRUE
, p
);
1175 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
1177 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1179 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1181 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
1184 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
1186 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1188 TRACE("(%p)->(%p)\n", This
, p
);
1190 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
1193 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
1195 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1196 cpp_bool start
= TRUE
;
1199 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
1201 switch(V_VT(&varargStart
)) {
1206 start
= V_BOOL(&varargStart
) != VARIANT_FALSE
;
1209 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart
));
1213 FIXME("Unsupported for comments\n");
1217 nsres
= nsIDOMHTMLElement_ScrollIntoView(This
->nselem
, start
, 1);
1218 assert(nsres
== NS_OK
);
1223 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
1224 VARIANT_BOOL
*pfResult
)
1226 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1227 cpp_bool result
= FALSE
;
1229 TRACE("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
1235 child
= unsafe_impl_from_IHTMLElement(pChild
);
1237 ERR("not our element\n");
1241 nsres
= nsIDOMNode_Contains(This
->node
.nsnode
, child
->node
.nsnode
, &result
);
1242 assert(nsres
== NS_OK
);
1245 *pfResult
= result
? VARIANT_TRUE
: VARIANT_FALSE
;
1249 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
1251 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1253 TRACE("(%p)->(%p)\n", This
, p
);
1255 return get_elem_source_index(This
, p
);
1258 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
1260 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1261 FIXME("(%p)->(%p)\n", This
, p
);
1265 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
1267 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1268 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1272 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
1274 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1275 FIXME("(%p)->(%p)\n", This
, p
);
1279 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
1281 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1284 TRACE("(%p)->(%p)\n", This
, p
);
1286 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, p
);
1287 if(NS_FAILED(nsres
)) {
1288 ERR("GetOffsetLeft failed: %08x\n", nsres
);
1295 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
1297 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1300 TRACE("(%p)->(%p)\n", This
, p
);
1302 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, p
);
1303 if(NS_FAILED(nsres
)) {
1304 ERR("GetOffsetTop failed: %08x\n", nsres
);
1311 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
1313 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1316 TRACE("(%p)->(%p)\n", This
, p
);
1318 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, p
);
1319 if(NS_FAILED(nsres
)) {
1320 ERR("GetOffsetWidth failed: %08x\n", nsres
);
1327 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
1329 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1332 TRACE("(%p)->(%p)\n", This
, p
);
1334 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, p
);
1335 if(NS_FAILED(nsres
)) {
1336 ERR("GetOffsetHeight failed: %08x\n", nsres
);
1343 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
1345 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1346 nsIDOMElement
*nsparent
;
1350 TRACE("(%p)->(%p)\n", This
, p
);
1352 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
1353 if(NS_FAILED(nsres
)) {
1354 ERR("GetOffsetParent failed: %08x\n", nsres
);
1361 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
1362 nsIDOMElement_Release(nsparent
);
1366 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
1376 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
1378 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1382 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1385 FIXME("NULL nselem\n");
1389 nsAString_InitDepend(&html_str
, v
);
1390 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
1391 nsAString_Finish(&html_str
);
1392 if(NS_FAILED(nsres
)) {
1393 FIXME("SetInnerHtml failed %08x\n", nsres
);
1400 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1402 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1406 TRACE("(%p)->(%p)\n", This
, p
);
1409 FIXME("NULL nselem\n");
1413 nsAString_Init(&html_str
, NULL
);
1414 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
1415 return return_nsstr(nsres
, &html_str
, p
);
1418 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1420 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1421 nsIDOMNode
*nschild
, *tmp
;
1422 nsIDOMText
*text_node
;
1426 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1429 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
1430 if(NS_FAILED(nsres
)) {
1431 ERR("GetLastChild failed: %08x\n", nsres
);
1437 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
1438 nsIDOMNode_Release(nschild
);
1439 if(NS_FAILED(nsres
)) {
1440 ERR("RemoveChild failed: %08x\n", nsres
);
1443 nsIDOMNode_Release(tmp
);
1446 nsAString_InitDepend(&text_str
, v
);
1447 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1448 nsAString_Finish(&text_str
);
1449 if(NS_FAILED(nsres
)) {
1450 ERR("CreateTextNode failed: %08x\n", nsres
);
1454 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1455 if(NS_FAILED(nsres
)) {
1456 ERR("AppendChild failed: %08x\n", nsres
);
1460 nsIDOMNode_Release(tmp
);
1464 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1466 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1468 TRACE("(%p)->(%p)\n", This
, p
);
1470 return get_node_text(&This
->node
, p
);
1473 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1475 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1477 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1479 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1482 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1484 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1488 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1490 nsAString_Init(&html_str
, NULL
);
1491 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1492 if(SUCCEEDED(hres
)) {
1493 const PRUnichar
*html
;
1495 nsAString_GetData(&html_str
, &html
);
1496 *p
= SysAllocString(html
);
1498 hres
= E_OUTOFMEMORY
;
1501 nsAString_Finish(&html_str
);
1503 TRACE("ret %s\n", debugstr_w(*p
));
1507 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1509 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1510 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1514 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1516 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1517 FIXME("(%p)->(%p)\n", This
, p
);
1521 static HRESULT
insert_adjacent_node(HTMLElement
*This
, const WCHAR
*where
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret_node
)
1523 nsIDOMNode
*ret_nsnode
;
1525 HRESULT hres
= S_OK
;
1527 static const WCHAR beforebeginW
[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
1528 static const WCHAR afterbeginW
[] = {'a','f','t','e','r','b','e','g','i','n',0};
1529 static const WCHAR beforeendW
[] = {'b','e','f','o','r','e','e','n','d',0};
1530 static const WCHAR afterendW
[] = {'a','f','t','e','r','e','n','d',0};
1532 if (!strcmpiW(where
, beforebeginW
)) {
1535 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1536 if(NS_FAILED(nsres
))
1540 return E_INVALIDARG
;
1542 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &ret_nsnode
);
1543 nsIDOMNode_Release(parent
);
1544 }else if(!strcmpiW(where
, afterbeginW
)) {
1545 nsIDOMNode
*first_child
;
1547 nsres
= nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1548 if(NS_FAILED(nsres
))
1551 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &ret_nsnode
);
1552 if(NS_FAILED(nsres
))
1556 nsIDOMNode_Release(first_child
);
1557 }else if (!strcmpiW(where
, beforeendW
)) {
1558 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &ret_nsnode
);
1559 }else if (!strcmpiW(where
, afterendW
)) {
1560 nsIDOMNode
*next_sibling
, *parent
;
1562 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1563 if(NS_FAILED(nsres
))
1566 return E_INVALIDARG
;
1568 nsres
= nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1569 if(NS_SUCCEEDED(nsres
)) {
1571 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &ret_nsnode
);
1572 nsIDOMNode_Release(next_sibling
);
1574 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &ret_nsnode
);
1578 nsIDOMNode_Release(parent
);
1580 ERR("invalid where: %s\n", debugstr_w(where
));
1581 return E_INVALIDARG
;
1584 if (NS_FAILED(nsres
))
1588 hres
= get_node(This
->node
.doc
, ret_nsnode
, TRUE
, ret_node
);
1589 nsIDOMNode_Release(ret_nsnode
);
1593 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1596 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1603 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1605 if(!This
->node
.doc
->nsdoc
) {
1606 WARN("NULL nsdoc\n");
1607 return E_UNEXPECTED
;
1610 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1611 if(NS_FAILED(nsres
))
1613 ERR("CreateRange failed: %08x\n", nsres
);
1617 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1619 nsAString_InitDepend(&ns_html
, html
);
1620 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1621 nsAString_Finish(&ns_html
);
1622 nsIDOMRange_Release(range
);
1624 if(NS_FAILED(nsres
) || !nsnode
)
1626 ERR("CreateTextNode failed: %08x\n", nsres
);
1630 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1631 nsIDOMNode_Release(nsnode
);
1635 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1638 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1644 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1646 if(!This
->node
.doc
->nsdoc
) {
1647 WARN("NULL nsdoc\n");
1648 return E_UNEXPECTED
;
1652 nsAString_InitDepend(&ns_text
, text
);
1653 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1654 nsAString_Finish(&ns_text
);
1656 if(NS_FAILED(nsres
) || !nsnode
)
1658 ERR("CreateTextNode failed: %08x\n", nsres
);
1662 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1663 nsIDOMNode_Release(nsnode
);
1668 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1670 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1671 FIXME("(%p)->(%p)\n", This
, p
);
1675 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1677 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1679 TRACE("(%p)->(%p)\n", This
, p
);
1681 *p
= This
->node
.vtbl
->is_text_edit
&& This
->node
.vtbl
->is_text_edit(&This
->node
)
1682 ? VARIANT_TRUE
: VARIANT_FALSE
;
1686 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1688 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1690 TRACE("(%p)\n", This
);
1692 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1695 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1696 IHTMLFiltersCollection
**p
)
1698 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1699 TRACE("(%p)->(%p)\n", This
, p
);
1704 *p
= HTMLFiltersCollection_Create();
1709 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
1711 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1712 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1716 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1718 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1719 FIXME("(%p)->(%p)\n", This
, p
);
1723 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1725 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1726 FIXME("(%p)->(%p)\n", This
, String
);
1730 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1732 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1733 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1737 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1739 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1740 FIXME("(%p)->(%p)\n", This
, p
);
1744 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1746 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1747 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1751 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1753 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1754 FIXME("(%p)->(%p)\n", This
, p
);
1758 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1760 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1761 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1765 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1767 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1768 FIXME("(%p)->(%p)\n", This
, p
);
1772 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1774 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1775 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1779 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1781 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1782 FIXME("(%p)->(%p)\n", This
, p
);
1786 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1788 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1789 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1793 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1795 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1796 FIXME("(%p)->(%p)\n", This
, p
);
1800 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1802 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1803 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1807 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1809 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1810 FIXME("(%p)->(%p)\n", This
, p
);
1814 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1816 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1818 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1820 return set_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, &v
);
1823 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1825 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1827 TRACE("(%p)->(%p)\n", This
, p
);
1829 return get_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, p
);
1832 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1834 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1835 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1839 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1841 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1842 FIXME("(%p)->(%p)\n", This
, p
);
1846 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1848 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1849 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1853 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1855 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1856 FIXME("(%p)->(%p)\n", This
, p
);
1860 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1862 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1863 nsIDOMNodeList
*nsnode_list
;
1866 TRACE("(%p)->(%p)\n", This
, p
);
1868 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1869 if(NS_FAILED(nsres
)) {
1870 ERR("GetChildNodes failed: %08x\n", nsres
);
1874 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
, nsnode_list
);
1876 nsIDOMNodeList_Release(nsnode_list
);
1880 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1882 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1884 TRACE("(%p)->(%p)\n", This
, p
);
1886 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1890 static const IHTMLElementVtbl HTMLElementVtbl
= {
1891 HTMLElement_QueryInterface
,
1893 HTMLElement_Release
,
1894 HTMLElement_GetTypeInfoCount
,
1895 HTMLElement_GetTypeInfo
,
1896 HTMLElement_GetIDsOfNames
,
1898 HTMLElement_setAttribute
,
1899 HTMLElement_getAttribute
,
1900 HTMLElement_removeAttribute
,
1901 HTMLElement_put_className
,
1902 HTMLElement_get_className
,
1905 HTMLElement_get_tagName
,
1906 HTMLElement_get_parentElement
,
1907 HTMLElement_get_style
,
1908 HTMLElement_put_onhelp
,
1909 HTMLElement_get_onhelp
,
1910 HTMLElement_put_onclick
,
1911 HTMLElement_get_onclick
,
1912 HTMLElement_put_ondblclick
,
1913 HTMLElement_get_ondblclick
,
1914 HTMLElement_put_onkeydown
,
1915 HTMLElement_get_onkeydown
,
1916 HTMLElement_put_onkeyup
,
1917 HTMLElement_get_onkeyup
,
1918 HTMLElement_put_onkeypress
,
1919 HTMLElement_get_onkeypress
,
1920 HTMLElement_put_onmouseout
,
1921 HTMLElement_get_onmouseout
,
1922 HTMLElement_put_onmouseover
,
1923 HTMLElement_get_onmouseover
,
1924 HTMLElement_put_onmousemove
,
1925 HTMLElement_get_onmousemove
,
1926 HTMLElement_put_onmousedown
,
1927 HTMLElement_get_onmousedown
,
1928 HTMLElement_put_onmouseup
,
1929 HTMLElement_get_onmouseup
,
1930 HTMLElement_get_document
,
1931 HTMLElement_put_title
,
1932 HTMLElement_get_title
,
1933 HTMLElement_put_language
,
1934 HTMLElement_get_language
,
1935 HTMLElement_put_onselectstart
,
1936 HTMLElement_get_onselectstart
,
1937 HTMLElement_scrollIntoView
,
1938 HTMLElement_contains
,
1939 HTMLElement_get_sourceIndex
,
1940 HTMLElement_get_recordNumber
,
1941 HTMLElement_put_lang
,
1942 HTMLElement_get_lang
,
1943 HTMLElement_get_offsetLeft
,
1944 HTMLElement_get_offsetTop
,
1945 HTMLElement_get_offsetWidth
,
1946 HTMLElement_get_offsetHeight
,
1947 HTMLElement_get_offsetParent
,
1948 HTMLElement_put_innerHTML
,
1949 HTMLElement_get_innerHTML
,
1950 HTMLElement_put_innerText
,
1951 HTMLElement_get_innerText
,
1952 HTMLElement_put_outerHTML
,
1953 HTMLElement_get_outerHTML
,
1954 HTMLElement_put_outerText
,
1955 HTMLElement_get_outerText
,
1956 HTMLElement_insertAdjacentHTML
,
1957 HTMLElement_insertAdjacentText
,
1958 HTMLElement_get_parentTextEdit
,
1959 HTMLElement_get_isTextEdit
,
1961 HTMLElement_get_filters
,
1962 HTMLElement_put_ondragstart
,
1963 HTMLElement_get_ondragstart
,
1964 HTMLElement_toString
,
1965 HTMLElement_put_onbeforeupdate
,
1966 HTMLElement_get_onbeforeupdate
,
1967 HTMLElement_put_onafterupdate
,
1968 HTMLElement_get_onafterupdate
,
1969 HTMLElement_put_onerrorupdate
,
1970 HTMLElement_get_onerrorupdate
,
1971 HTMLElement_put_onrowexit
,
1972 HTMLElement_get_onrowexit
,
1973 HTMLElement_put_onrowenter
,
1974 HTMLElement_get_onrowenter
,
1975 HTMLElement_put_ondatasetchanged
,
1976 HTMLElement_get_ondatasetchanged
,
1977 HTMLElement_put_ondataavailable
,
1978 HTMLElement_get_ondataavailable
,
1979 HTMLElement_put_ondatasetcomplete
,
1980 HTMLElement_get_ondatasetcomplete
,
1981 HTMLElement_put_onfilterchange
,
1982 HTMLElement_get_onfilterchange
,
1983 HTMLElement_get_children
,
1987 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1989 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1992 static inline HTMLElement
*impl_from_IHTMLElement2(IHTMLElement2
*iface
)
1994 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement2_iface
);
1997 static HRESULT WINAPI
HTMLElement2_QueryInterface(IHTMLElement2
*iface
,
1998 REFIID riid
, void **ppv
)
2000 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2001 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
2004 static ULONG WINAPI
HTMLElement2_AddRef(IHTMLElement2
*iface
)
2006 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2007 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
2010 static ULONG WINAPI
HTMLElement2_Release(IHTMLElement2
*iface
)
2012 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2013 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
2016 static HRESULT WINAPI
HTMLElement2_GetTypeInfoCount(IHTMLElement2
*iface
, UINT
*pctinfo
)
2018 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2019 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
2022 static HRESULT WINAPI
HTMLElement2_GetTypeInfo(IHTMLElement2
*iface
, UINT iTInfo
,
2023 LCID lcid
, ITypeInfo
**ppTInfo
)
2025 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2026 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2029 static HRESULT WINAPI
HTMLElement2_GetIDsOfNames(IHTMLElement2
*iface
, REFIID riid
,
2030 LPOLESTR
*rgszNames
, UINT cNames
,
2031 LCID lcid
, DISPID
*rgDispId
)
2033 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2034 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2038 static HRESULT WINAPI
HTMLElement2_Invoke(IHTMLElement2
*iface
, DISPID dispIdMember
,
2039 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2040 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2042 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2043 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2044 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2047 static HRESULT WINAPI
HTMLElement2_get_scopeName(IHTMLElement2
*iface
, BSTR
*p
)
2049 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2050 FIXME("(%p)->(%p)\n", This
, p
);
2054 static HRESULT WINAPI
HTMLElement2_setCapture(IHTMLElement2
*iface
, VARIANT_BOOL containerCapture
)
2056 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2057 FIXME("(%p)->(%x)\n", This
, containerCapture
);
2061 static HRESULT WINAPI
HTMLElement2_releaseCapture(IHTMLElement2
*iface
)
2063 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2064 FIXME("(%p)\n", This
);
2068 static HRESULT WINAPI
HTMLElement2_put_onlosecapture(IHTMLElement2
*iface
, VARIANT v
)
2070 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2071 FIXME("(%p)->()\n", This
);
2075 static HRESULT WINAPI
HTMLElement2_get_onlosecapture(IHTMLElement2
*iface
, VARIANT
*p
)
2077 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2078 FIXME("(%p)->(%p)\n", This
, p
);
2082 static HRESULT WINAPI
HTMLElement2_componentFromPoint(IHTMLElement2
*iface
,
2083 LONG x
, LONG y
, BSTR
*component
)
2085 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2086 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, component
);
2090 static HRESULT WINAPI
HTMLElement2_doScroll(IHTMLElement2
*iface
, VARIANT component
)
2092 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2094 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&component
));
2096 if(!This
->node
.doc
->content_ready
2097 || !This
->node
.doc
->basedoc
.doc_obj
->in_place_active
)
2104 static HRESULT WINAPI
HTMLElement2_put_onscroll(IHTMLElement2
*iface
, VARIANT v
)
2106 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2107 FIXME("(%p)->()\n", This
);
2111 static HRESULT WINAPI
HTMLElement2_get_onscroll(IHTMLElement2
*iface
, VARIANT
*p
)
2113 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2114 FIXME("(%p)->(%p)\n", This
, p
);
2118 static HRESULT WINAPI
HTMLElement2_put_ondrag(IHTMLElement2
*iface
, VARIANT v
)
2120 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2122 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2124 return set_node_event(&This
->node
, EVENTID_DRAG
, &v
);
2127 static HRESULT WINAPI
HTMLElement2_get_ondrag(IHTMLElement2
*iface
, VARIANT
*p
)
2129 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2131 TRACE("(%p)->(%p)\n", This
, p
);
2133 return get_node_event(&This
->node
, EVENTID_DRAG
, p
);
2136 static HRESULT WINAPI
HTMLElement2_put_ondragend(IHTMLElement2
*iface
, VARIANT v
)
2138 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2139 FIXME("(%p)->()\n", This
);
2143 static HRESULT WINAPI
HTMLElement2_get_ondragend(IHTMLElement2
*iface
, VARIANT
*p
)
2145 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2146 FIXME("(%p)->(%p)\n", This
, p
);
2150 static HRESULT WINAPI
HTMLElement2_put_ondragenter(IHTMLElement2
*iface
, VARIANT v
)
2152 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2153 FIXME("(%p)->()\n", This
);
2157 static HRESULT WINAPI
HTMLElement2_get_ondragenter(IHTMLElement2
*iface
, VARIANT
*p
)
2159 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2160 FIXME("(%p)->(%p)\n", This
, p
);
2164 static HRESULT WINAPI
HTMLElement2_put_ondragover(IHTMLElement2
*iface
, VARIANT v
)
2166 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2167 FIXME("(%p)->()\n", This
);
2171 static HRESULT WINAPI
HTMLElement2_get_ondragover(IHTMLElement2
*iface
, VARIANT
*p
)
2173 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2174 FIXME("(%p)->(%p)\n", This
, p
);
2178 static HRESULT WINAPI
HTMLElement2_put_ondragleave(IHTMLElement2
*iface
, VARIANT v
)
2180 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2181 FIXME("(%p)->()\n", This
);
2185 static HRESULT WINAPI
HTMLElement2_get_ondragleave(IHTMLElement2
*iface
, VARIANT
*p
)
2187 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2188 FIXME("(%p)->(%p)\n", This
, p
);
2192 static HRESULT WINAPI
HTMLElement2_put_ondrop(IHTMLElement2
*iface
, VARIANT v
)
2194 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2195 FIXME("(%p)->()\n", This
);
2199 static HRESULT WINAPI
HTMLElement2_get_ondrop(IHTMLElement2
*iface
, VARIANT
*p
)
2201 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2202 FIXME("(%p)->(%p)\n", This
, p
);
2206 static HRESULT WINAPI
HTMLElement2_put_onbeforecut(IHTMLElement2
*iface
, VARIANT v
)
2208 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2209 FIXME("(%p)->()\n", This
);
2213 static HRESULT WINAPI
HTMLElement2_get_onbeforecut(IHTMLElement2
*iface
, VARIANT
*p
)
2215 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2216 FIXME("(%p)->(%p)\n", This
, p
);
2220 static HRESULT WINAPI
HTMLElement2_put_oncut(IHTMLElement2
*iface
, VARIANT v
)
2222 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2223 FIXME("(%p)->()\n", This
);
2227 static HRESULT WINAPI
HTMLElement2_get_oncut(IHTMLElement2
*iface
, VARIANT
*p
)
2229 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2230 FIXME("(%p)->(%p)\n", This
, p
);
2234 static HRESULT WINAPI
HTMLElement2_put_onbeforecopy(IHTMLElement2
*iface
, VARIANT v
)
2236 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2237 FIXME("(%p)->()\n", This
);
2241 static HRESULT WINAPI
HTMLElement2_get_onbeforecopy(IHTMLElement2
*iface
, VARIANT
*p
)
2243 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2244 FIXME("(%p)->(%p)\n", This
, p
);
2248 static HRESULT WINAPI
HTMLElement2_put_oncopy(IHTMLElement2
*iface
, VARIANT v
)
2250 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2251 FIXME("(%p)->()\n", This
);
2255 static HRESULT WINAPI
HTMLElement2_get_oncopy(IHTMLElement2
*iface
, VARIANT
*p
)
2257 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2258 FIXME("(%p)->(%p)\n", This
, p
);
2262 static HRESULT WINAPI
HTMLElement2_put_onbeforepaste(IHTMLElement2
*iface
, VARIANT v
)
2264 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2265 FIXME("(%p)->()\n", This
);
2269 static HRESULT WINAPI
HTMLElement2_get_onbeforepaste(IHTMLElement2
*iface
, VARIANT
*p
)
2271 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2272 FIXME("(%p)->(%p)\n", This
, p
);
2276 static HRESULT WINAPI
HTMLElement2_put_onpaste(IHTMLElement2
*iface
, VARIANT v
)
2278 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2280 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2282 return set_node_event(&This
->node
, EVENTID_PASTE
, &v
);
2285 static HRESULT WINAPI
HTMLElement2_get_onpaste(IHTMLElement2
*iface
, VARIANT
*p
)
2287 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2289 TRACE("(%p)->(%p)\n", This
, p
);
2291 return get_node_event(&This
->node
, EVENTID_PASTE
, p
);
2294 static HRESULT WINAPI
HTMLElement2_get_currentStyle(IHTMLElement2
*iface
, IHTMLCurrentStyle
**p
)
2296 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2298 TRACE("(%p)->(%p)\n", This
, p
);
2300 return HTMLCurrentStyle_Create(This
, p
);
2303 static HRESULT WINAPI
HTMLElement2_put_onpropertychange(IHTMLElement2
*iface
, VARIANT v
)
2305 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2306 FIXME("(%p)->()\n", This
);
2310 static HRESULT WINAPI
HTMLElement2_get_onpropertychange(IHTMLElement2
*iface
, VARIANT
*p
)
2312 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2313 FIXME("(%p)->(%p)\n", This
, p
);
2317 static HRESULT WINAPI
HTMLElement2_getClientRects(IHTMLElement2
*iface
, IHTMLRectCollection
**pRectCol
)
2319 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2320 FIXME("(%p)->(%p)\n", This
, pRectCol
);
2324 static HRESULT WINAPI
HTMLElement2_getBoundingClientRect(IHTMLElement2
*iface
, IHTMLRect
**pRect
)
2326 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2327 nsIDOMClientRect
*nsrect
;
2331 TRACE("(%p)->(%p)\n", This
, pRect
);
2333 nsres
= nsIDOMHTMLElement_GetBoundingClientRect(This
->nselem
, &nsrect
);
2334 if(NS_FAILED(nsres
) || !nsrect
) {
2335 ERR("GetBoindingClientRect failed: %08x\n", nsres
);
2339 hres
= create_html_rect(nsrect
, pRect
);
2341 nsIDOMClientRect_Release(nsrect
);
2345 static HRESULT WINAPI
HTMLElement2_setExpression(IHTMLElement2
*iface
, BSTR propname
,
2346 BSTR expression
, BSTR language
)
2348 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2349 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(propname
), debugstr_w(expression
),
2350 debugstr_w(language
));
2354 static HRESULT WINAPI
HTMLElement2_getExpression(IHTMLElement2
*iface
, BSTR propname
,
2355 VARIANT
*expression
)
2357 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2358 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), expression
);
2362 static HRESULT WINAPI
HTMLElement2_removeExpression(IHTMLElement2
*iface
, BSTR propname
,
2363 VARIANT_BOOL
*pfSuccess
)
2365 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2366 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), pfSuccess
);
2370 static HRESULT WINAPI
HTMLElement2_put_tabIndex(IHTMLElement2
*iface
, short v
)
2372 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2375 TRACE("(%p)->(%d)\n", This
, v
);
2377 nsres
= nsIDOMHTMLElement_SetTabIndex(This
->nselem
, v
);
2378 if(NS_FAILED(nsres
))
2379 ERR("GetTabIndex failed: %08x\n", nsres
);
2384 static HRESULT WINAPI
HTMLElement2_get_tabIndex(IHTMLElement2
*iface
, short *p
)
2386 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2390 TRACE("(%p)->(%p)\n", This
, p
);
2392 nsres
= nsIDOMHTMLElement_GetTabIndex(This
->nselem
, &index
);
2393 if(NS_FAILED(nsres
)) {
2394 ERR("GetTabIndex failed: %08x\n", nsres
);
2402 static HRESULT WINAPI
HTMLElement2_focus(IHTMLElement2
*iface
)
2404 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2407 TRACE("(%p)\n", This
);
2409 nsres
= nsIDOMHTMLElement_Focus(This
->nselem
);
2410 if(NS_FAILED(nsres
))
2411 ERR("Focus failed: %08x\n", nsres
);
2416 static HRESULT WINAPI
HTMLElement2_put_accessKey(IHTMLElement2
*iface
, BSTR v
)
2418 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2421 static WCHAR accessKeyW
[] = {'a','c','c','e','s','s','K','e','y',0};
2423 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2425 V_VT(&var
) = VT_BSTR
;
2427 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, accessKeyW
, var
, 0);
2430 static HRESULT WINAPI
HTMLElement2_get_accessKey(IHTMLElement2
*iface
, BSTR
*p
)
2432 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2433 FIXME("(%p)->(%p)\n", This
, p
);
2437 static HRESULT WINAPI
HTMLElement2_put_onblur(IHTMLElement2
*iface
, VARIANT v
)
2439 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2441 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2443 return set_node_event(&This
->node
, EVENTID_BLUR
, &v
);
2446 static HRESULT WINAPI
HTMLElement2_get_onblur(IHTMLElement2
*iface
, VARIANT
*p
)
2448 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2450 TRACE("(%p)->(%p)\n", This
, p
);
2452 return get_node_event(&This
->node
, EVENTID_BLUR
, p
);
2455 static HRESULT WINAPI
HTMLElement2_put_onfocus(IHTMLElement2
*iface
, VARIANT v
)
2457 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2459 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2461 return set_node_event(&This
->node
, EVENTID_FOCUS
, &v
);
2464 static HRESULT WINAPI
HTMLElement2_get_onfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2466 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2468 TRACE("(%p)->(%p)\n", This
, p
);
2470 return get_node_event(&This
->node
, EVENTID_FOCUS
, p
);
2473 static HRESULT WINAPI
HTMLElement2_put_onresize(IHTMLElement2
*iface
, VARIANT v
)
2475 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2476 FIXME("(%p)->()\n", This
);
2480 static HRESULT WINAPI
HTMLElement2_get_onresize(IHTMLElement2
*iface
, VARIANT
*p
)
2482 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2483 FIXME("(%p)->(%p)\n", This
, p
);
2487 static HRESULT WINAPI
HTMLElement2_blur(IHTMLElement2
*iface
)
2489 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2492 TRACE("(%p)\n", This
);
2494 nsres
= nsIDOMHTMLElement_Blur(This
->nselem
);
2495 if(NS_FAILED(nsres
)) {
2496 ERR("Blur failed: %08x\n", nsres
);
2503 static HRESULT WINAPI
HTMLElement2_addFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2505 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2506 FIXME("(%p)->(%p)\n", This
, pUnk
);
2510 static HRESULT WINAPI
HTMLElement2_removeFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2512 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2513 FIXME("(%p)->(%p)\n", This
, pUnk
);
2517 static HRESULT WINAPI
HTMLElement2_get_clientHeight(IHTMLElement2
*iface
, LONG
*p
)
2519 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2522 TRACE("(%p)->(%p)\n", This
, p
);
2524 nsres
= nsIDOMHTMLElement_GetClientHeight(This
->nselem
, p
);
2525 assert(nsres
== NS_OK
);
2529 static HRESULT WINAPI
HTMLElement2_get_clientWidth(IHTMLElement2
*iface
, LONG
*p
)
2531 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2534 TRACE("(%p)->(%p)\n", This
, p
);
2536 nsres
= nsIDOMHTMLElement_GetClientWidth(This
->nselem
, p
);
2537 assert(nsres
== NS_OK
);
2541 static HRESULT WINAPI
HTMLElement2_get_clientTop(IHTMLElement2
*iface
, LONG
*p
)
2543 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2546 TRACE("(%p)->(%p)\n", This
, p
);
2548 nsres
= nsIDOMHTMLElement_GetClientTop(This
->nselem
, p
);
2549 assert(nsres
== NS_OK
);
2551 TRACE("*p = %d\n", *p
);
2555 static HRESULT WINAPI
HTMLElement2_get_clientLeft(IHTMLElement2
*iface
, LONG
*p
)
2557 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2560 TRACE("(%p)->(%p)\n", This
, p
);
2562 nsres
= nsIDOMHTMLElement_GetClientLeft(This
->nselem
, p
);
2563 assert(nsres
== NS_OK
);
2565 TRACE("*p = %d\n", *p
);
2569 static HRESULT WINAPI
HTMLElement2_attachEvent(IHTMLElement2
*iface
, BSTR event
,
2570 IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
2572 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2574 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2576 return attach_event(&This
->node
.event_target
, event
, pDisp
, pfResult
);
2579 static HRESULT WINAPI
HTMLElement2_detachEvent(IHTMLElement2
*iface
, BSTR event
, IDispatch
*pDisp
)
2581 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2583 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2585 return detach_event(&This
->node
.event_target
, event
, pDisp
);
2588 static HRESULT WINAPI
HTMLElement2_get_readyState(IHTMLElement2
*iface
, VARIANT
*p
)
2590 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2593 TRACE("(%p)->(%p)\n", This
, p
);
2595 if(This
->node
.vtbl
->get_readystate
) {
2598 hres
= This
->node
.vtbl
->get_readystate(&This
->node
, &str
);
2602 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
2604 str
= SysAllocString(completeW
);
2606 return E_OUTOFMEMORY
;
2614 static HRESULT WINAPI
HTMLElement2_put_onreadystatechange(IHTMLElement2
*iface
, VARIANT v
)
2616 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2618 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2620 return set_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, &v
);
2623 static HRESULT WINAPI
HTMLElement2_get_onreadystatechange(IHTMLElement2
*iface
, VARIANT
*p
)
2625 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2627 TRACE("(%p)->(%p)\n", This
, p
);
2629 return get_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, p
);
2632 static HRESULT WINAPI
HTMLElement2_put_onrowsdelete(IHTMLElement2
*iface
, VARIANT v
)
2634 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2635 FIXME("(%p)->()\n", This
);
2639 static HRESULT WINAPI
HTMLElement2_get_onrowsdelete(IHTMLElement2
*iface
, VARIANT
*p
)
2641 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2642 FIXME("(%p)->(%p)\n", This
, p
);
2646 static HRESULT WINAPI
HTMLElement2_put_onrowsinserted(IHTMLElement2
*iface
, VARIANT v
)
2648 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2649 FIXME("(%p)->()\n", This
);
2653 static HRESULT WINAPI
HTMLElement2_get_onrowsinserted(IHTMLElement2
*iface
, VARIANT
*p
)
2655 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2656 FIXME("(%p)->(%p)\n", This
, p
);
2660 static HRESULT WINAPI
HTMLElement2_put_oncellchange(IHTMLElement2
*iface
, VARIANT v
)
2662 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2663 FIXME("(%p)->()\n", This
);
2667 static HRESULT WINAPI
HTMLElement2_get_oncellchange(IHTMLElement2
*iface
, VARIANT
*p
)
2669 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2670 FIXME("(%p)->(%p)\n", This
, p
);
2674 static HRESULT WINAPI
HTMLElement2_put_dir(IHTMLElement2
*iface
, BSTR v
)
2676 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2680 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2683 FIXME("Unsupported for comment nodes.\n");
2687 nsAString_InitDepend(&nsstr
, v
);
2688 nsres
= nsIDOMHTMLElement_SetDir(This
->nselem
, &nsstr
);
2689 nsAString_Finish(&nsstr
);
2690 if(NS_FAILED(nsres
)) {
2691 ERR("SetDir failed: %08x\n", nsres
);
2698 static HRESULT WINAPI
HTMLElement2_get_dir(IHTMLElement2
*iface
, BSTR
*p
)
2700 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2704 TRACE("(%p)->(%p)\n", This
, p
);
2711 nsAString_Init(&dir_str
, NULL
);
2712 nsres
= nsIDOMHTMLElement_GetDir(This
->nselem
, &dir_str
);
2713 return return_nsstr(nsres
, &dir_str
, p
);
2716 static HRESULT WINAPI
HTMLElement2_createControlRange(IHTMLElement2
*iface
, IDispatch
**range
)
2718 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2719 FIXME("(%p)->(%p)\n", This
, range
);
2723 static HRESULT WINAPI
HTMLElement2_get_scrollHeight(IHTMLElement2
*iface
, LONG
*p
)
2725 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2728 TRACE("(%p)->(%p)\n", This
, p
);
2730 nsres
= nsIDOMHTMLElement_GetScrollHeight(This
->nselem
, p
);
2731 assert(nsres
== NS_OK
);
2733 TRACE("*p = %d\n", *p
);
2737 static HRESULT WINAPI
HTMLElement2_get_scrollWidth(IHTMLElement2
*iface
, LONG
*p
)
2739 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2742 TRACE("(%p)->(%p)\n", This
, p
);
2744 nsres
= nsIDOMHTMLElement_GetScrollWidth(This
->nselem
, p
);
2745 assert(nsres
== NS_OK
);
2747 TRACE("*p = %d\n", *p
);
2751 static HRESULT WINAPI
HTMLElement2_put_scrollTop(IHTMLElement2
*iface
, LONG v
)
2753 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2755 TRACE("(%p)->(%d)\n", This
, v
);
2758 FIXME("NULL nselem\n");
2762 nsIDOMHTMLElement_SetScrollTop(This
->nselem
, v
);
2766 static HRESULT WINAPI
HTMLElement2_get_scrollTop(IHTMLElement2
*iface
, LONG
*p
)
2768 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2771 TRACE("(%p)->(%p)\n", This
, p
);
2773 nsres
= nsIDOMHTMLElement_GetScrollTop(This
->nselem
, p
);
2774 assert(nsres
== NS_OK
);
2776 TRACE("*p = %d\n", *p
);
2780 static HRESULT WINAPI
HTMLElement2_put_scrollLeft(IHTMLElement2
*iface
, LONG v
)
2782 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2784 TRACE("(%p)->(%d)\n", This
, v
);
2787 FIXME("NULL nselem\n");
2791 nsIDOMHTMLElement_SetScrollLeft(This
->nselem
, v
);
2795 static HRESULT WINAPI
HTMLElement2_get_scrollLeft(IHTMLElement2
*iface
, LONG
*p
)
2797 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2800 TRACE("(%p)->(%p)\n", This
, p
);
2803 return E_INVALIDARG
;
2807 FIXME("NULL nselem\n");
2811 nsres
= nsIDOMHTMLElement_GetScrollLeft(This
->nselem
, p
);
2812 assert(nsres
== NS_OK
);
2814 TRACE("*p = %d\n", *p
);
2818 static HRESULT WINAPI
HTMLElement2_clearAttributes(IHTMLElement2
*iface
)
2820 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2821 FIXME("(%p)\n", This
);
2825 static HRESULT WINAPI
HTMLElement2_mergeAttributes(IHTMLElement2
*iface
, IHTMLElement
*mergeThis
)
2827 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2828 FIXME("(%p)->(%p)\n", This
, mergeThis
);
2832 static HRESULT WINAPI
HTMLElement2_put_oncontextmenu(IHTMLElement2
*iface
, VARIANT v
)
2834 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2835 FIXME("(%p)->()\n", This
);
2839 static HRESULT WINAPI
HTMLElement2_get_oncontextmenu(IHTMLElement2
*iface
, VARIANT
*p
)
2841 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2842 FIXME("(%p)->(%p)\n", This
, p
);
2846 static HRESULT WINAPI
HTMLElement2_insertAdjacentElement(IHTMLElement2
*iface
, BSTR where
,
2847 IHTMLElement
*insertedElement
, IHTMLElement
**inserted
)
2849 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2850 HTMLDOMNode
*ret_node
;
2854 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(where
), insertedElement
, inserted
);
2856 elem
= unsafe_impl_from_IHTMLElement(insertedElement
);
2858 return E_INVALIDARG
;
2860 hres
= insert_adjacent_node(This
, where
, elem
->node
.nsnode
, &ret_node
);
2864 hres
= IHTMLDOMNode_QueryInterface(&ret_node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)inserted
);
2865 IHTMLDOMNode_Release(&ret_node
->IHTMLDOMNode_iface
);
2869 static HRESULT WINAPI
HTMLElement2_applyElement(IHTMLElement2
*iface
, IHTMLElement
*apply
,
2870 BSTR where
, IHTMLElement
**applied
)
2872 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2873 FIXME("(%p)->(%p %s %p)\n", This
, apply
, debugstr_w(where
), applied
);
2877 static HRESULT WINAPI
HTMLElement2_getAdjacentText(IHTMLElement2
*iface
, BSTR where
, BSTR
*text
)
2879 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2880 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(where
), text
);
2884 static HRESULT WINAPI
HTMLElement2_replaceAdjacentText(IHTMLElement2
*iface
, BSTR where
,
2885 BSTR newText
, BSTR
*oldText
)
2887 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2888 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(where
), debugstr_w(newText
), oldText
);
2892 static HRESULT WINAPI
HTMLElement2_get_canHandleChildren(IHTMLElement2
*iface
, VARIANT_BOOL
*p
)
2894 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2895 FIXME("(%p)->(%p)\n", This
, p
);
2899 static HRESULT WINAPI
HTMLElement2_addBehavior(IHTMLElement2
*iface
, BSTR bstrUrl
,
2900 VARIANT
*pvarFactory
, LONG
*pCookie
)
2902 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2903 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrUrl
), pvarFactory
, pCookie
);
2907 static HRESULT WINAPI
HTMLElement2_removeBehavior(IHTMLElement2
*iface
, LONG cookie
,
2908 VARIANT_BOOL
*pfResult
)
2910 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2911 FIXME("(%p)->(%d %p)\n", This
, cookie
, pfResult
);
2915 static HRESULT WINAPI
HTMLElement2_get_runtimeStyle(IHTMLElement2
*iface
, IHTMLStyle
**p
)
2917 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2919 FIXME("(%p)->(%p): hack\n", This
, p
);
2921 /* We can't implement correct behavior on top of Gecko (although we could
2922 try a bit harder). Making runtimeStyle behave like regular style is
2923 enough for most use cases. */
2924 if(!This
->runtime_style
) {
2927 hres
= HTMLStyle_Create(This
, &This
->runtime_style
);
2932 *p
= &This
->runtime_style
->IHTMLStyle_iface
;
2933 IHTMLStyle_AddRef(*p
);
2937 static HRESULT WINAPI
HTMLElement2_get_behaviorUrns(IHTMLElement2
*iface
, IDispatch
**p
)
2939 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2940 FIXME("(%p)->(%p)\n", This
, p
);
2944 static HRESULT WINAPI
HTMLElement2_put_tagUrn(IHTMLElement2
*iface
, BSTR v
)
2946 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2947 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2951 static HRESULT WINAPI
HTMLElement2_get_tagUrn(IHTMLElement2
*iface
, BSTR
*p
)
2953 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2954 FIXME("(%p)->(%p)\n", This
, p
);
2958 static HRESULT WINAPI
HTMLElement2_put_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT vv
)
2960 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2961 FIXME("(%p)->()\n", This
);
2965 static HRESULT WINAPI
HTMLElement2_get_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2967 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2968 FIXME("(%p)->(%p)\n", This
, p
);
2972 static HRESULT WINAPI
HTMLElement2_get_readyStateValue(IHTMLElement2
*iface
, LONG
*p
)
2974 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2975 FIXME("(%p)->(%p)\n", This
, p
);
2979 static HRESULT WINAPI
HTMLElement2_getElementsByTagName(IHTMLElement2
*iface
, BSTR v
,
2980 IHTMLElementCollection
**pelColl
)
2982 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2983 nsIDOMHTMLCollection
*nscol
;
2987 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2989 nsAString_InitDepend(&tag_str
, v
);
2990 nsres
= nsIDOMHTMLElement_GetElementsByTagName(This
->nselem
, &tag_str
, &nscol
);
2991 nsAString_Finish(&tag_str
);
2992 if(NS_FAILED(nsres
)) {
2993 ERR("GetElementByTagName failed: %08x\n", nsres
);
2997 *pelColl
= create_collection_from_htmlcol(This
->node
.doc
, nscol
);
2998 nsIDOMHTMLCollection_Release(nscol
);
3002 static const IHTMLElement2Vtbl HTMLElement2Vtbl
= {
3003 HTMLElement2_QueryInterface
,
3004 HTMLElement2_AddRef
,
3005 HTMLElement2_Release
,
3006 HTMLElement2_GetTypeInfoCount
,
3007 HTMLElement2_GetTypeInfo
,
3008 HTMLElement2_GetIDsOfNames
,
3009 HTMLElement2_Invoke
,
3010 HTMLElement2_get_scopeName
,
3011 HTMLElement2_setCapture
,
3012 HTMLElement2_releaseCapture
,
3013 HTMLElement2_put_onlosecapture
,
3014 HTMLElement2_get_onlosecapture
,
3015 HTMLElement2_componentFromPoint
,
3016 HTMLElement2_doScroll
,
3017 HTMLElement2_put_onscroll
,
3018 HTMLElement2_get_onscroll
,
3019 HTMLElement2_put_ondrag
,
3020 HTMLElement2_get_ondrag
,
3021 HTMLElement2_put_ondragend
,
3022 HTMLElement2_get_ondragend
,
3023 HTMLElement2_put_ondragenter
,
3024 HTMLElement2_get_ondragenter
,
3025 HTMLElement2_put_ondragover
,
3026 HTMLElement2_get_ondragover
,
3027 HTMLElement2_put_ondragleave
,
3028 HTMLElement2_get_ondragleave
,
3029 HTMLElement2_put_ondrop
,
3030 HTMLElement2_get_ondrop
,
3031 HTMLElement2_put_onbeforecut
,
3032 HTMLElement2_get_onbeforecut
,
3033 HTMLElement2_put_oncut
,
3034 HTMLElement2_get_oncut
,
3035 HTMLElement2_put_onbeforecopy
,
3036 HTMLElement2_get_onbeforecopy
,
3037 HTMLElement2_put_oncopy
,
3038 HTMLElement2_get_oncopy
,
3039 HTMLElement2_put_onbeforepaste
,
3040 HTMLElement2_get_onbeforepaste
,
3041 HTMLElement2_put_onpaste
,
3042 HTMLElement2_get_onpaste
,
3043 HTMLElement2_get_currentStyle
,
3044 HTMLElement2_put_onpropertychange
,
3045 HTMLElement2_get_onpropertychange
,
3046 HTMLElement2_getClientRects
,
3047 HTMLElement2_getBoundingClientRect
,
3048 HTMLElement2_setExpression
,
3049 HTMLElement2_getExpression
,
3050 HTMLElement2_removeExpression
,
3051 HTMLElement2_put_tabIndex
,
3052 HTMLElement2_get_tabIndex
,
3054 HTMLElement2_put_accessKey
,
3055 HTMLElement2_get_accessKey
,
3056 HTMLElement2_put_onblur
,
3057 HTMLElement2_get_onblur
,
3058 HTMLElement2_put_onfocus
,
3059 HTMLElement2_get_onfocus
,
3060 HTMLElement2_put_onresize
,
3061 HTMLElement2_get_onresize
,
3063 HTMLElement2_addFilter
,
3064 HTMLElement2_removeFilter
,
3065 HTMLElement2_get_clientHeight
,
3066 HTMLElement2_get_clientWidth
,
3067 HTMLElement2_get_clientTop
,
3068 HTMLElement2_get_clientLeft
,
3069 HTMLElement2_attachEvent
,
3070 HTMLElement2_detachEvent
,
3071 HTMLElement2_get_readyState
,
3072 HTMLElement2_put_onreadystatechange
,
3073 HTMLElement2_get_onreadystatechange
,
3074 HTMLElement2_put_onrowsdelete
,
3075 HTMLElement2_get_onrowsdelete
,
3076 HTMLElement2_put_onrowsinserted
,
3077 HTMLElement2_get_onrowsinserted
,
3078 HTMLElement2_put_oncellchange
,
3079 HTMLElement2_get_oncellchange
,
3080 HTMLElement2_put_dir
,
3081 HTMLElement2_get_dir
,
3082 HTMLElement2_createControlRange
,
3083 HTMLElement2_get_scrollHeight
,
3084 HTMLElement2_get_scrollWidth
,
3085 HTMLElement2_put_scrollTop
,
3086 HTMLElement2_get_scrollTop
,
3087 HTMLElement2_put_scrollLeft
,
3088 HTMLElement2_get_scrollLeft
,
3089 HTMLElement2_clearAttributes
,
3090 HTMLElement2_mergeAttributes
,
3091 HTMLElement2_put_oncontextmenu
,
3092 HTMLElement2_get_oncontextmenu
,
3093 HTMLElement2_insertAdjacentElement
,
3094 HTMLElement2_applyElement
,
3095 HTMLElement2_getAdjacentText
,
3096 HTMLElement2_replaceAdjacentText
,
3097 HTMLElement2_get_canHandleChildren
,
3098 HTMLElement2_addBehavior
,
3099 HTMLElement2_removeBehavior
,
3100 HTMLElement2_get_runtimeStyle
,
3101 HTMLElement2_get_behaviorUrns
,
3102 HTMLElement2_put_tagUrn
,
3103 HTMLElement2_get_tagUrn
,
3104 HTMLElement2_put_onbeforeeditfocus
,
3105 HTMLElement2_get_onbeforeeditfocus
,
3106 HTMLElement2_get_readyStateValue
,
3107 HTMLElement2_getElementsByTagName
,
3110 static inline HTMLElement
*impl_from_IHTMLElement3(IHTMLElement3
*iface
)
3112 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement3_iface
);
3115 static HRESULT WINAPI
HTMLElement3_QueryInterface(IHTMLElement3
*iface
,
3116 REFIID riid
, void **ppv
)
3118 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3119 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3122 static ULONG WINAPI
HTMLElement3_AddRef(IHTMLElement3
*iface
)
3124 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3125 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3128 static ULONG WINAPI
HTMLElement3_Release(IHTMLElement3
*iface
)
3130 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3131 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3134 static HRESULT WINAPI
HTMLElement3_GetTypeInfoCount(IHTMLElement3
*iface
, UINT
*pctinfo
)
3136 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3137 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
3140 static HRESULT WINAPI
HTMLElement3_GetTypeInfo(IHTMLElement3
*iface
, UINT iTInfo
,
3141 LCID lcid
, ITypeInfo
**ppTInfo
)
3143 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3144 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3147 static HRESULT WINAPI
HTMLElement3_GetIDsOfNames(IHTMLElement3
*iface
, REFIID riid
,
3148 LPOLESTR
*rgszNames
, UINT cNames
,
3149 LCID lcid
, DISPID
*rgDispId
)
3151 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3152 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3156 static HRESULT WINAPI
HTMLElement3_Invoke(IHTMLElement3
*iface
, DISPID dispIdMember
,
3157 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3158 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3160 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3161 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3162 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3165 static HRESULT WINAPI
HTMLElement3_mergeAttributes(IHTMLElement3
*iface
, IHTMLElement
*mergeThis
, VARIANT
*pvarFlags
)
3167 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3168 FIXME("(%p)->(%p %p)\n", This
, mergeThis
, pvarFlags
);
3172 static HRESULT WINAPI
HTMLElement3_get_isMultiLine(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3174 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3175 FIXME("(%p)->(%p)\n", This
, p
);
3179 static HRESULT WINAPI
HTMLElement3_get_canHaveHTML(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3181 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3182 FIXME("(%p)->(%p)\n", This
, p
);
3186 static HRESULT WINAPI
HTMLElement3_put_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT v
)
3188 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3189 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3193 static HRESULT WINAPI
HTMLElement3_get_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT
*p
)
3195 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3196 FIXME("(%p)->(%p)\n", This
, p
);
3200 static HRESULT WINAPI
HTMLElement3_put_onpage(IHTMLElement3
*iface
, VARIANT v
)
3202 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3203 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3207 static HRESULT WINAPI
HTMLElement3_get_onpage(IHTMLElement3
*iface
, VARIANT
*p
)
3209 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3210 FIXME("(%p)->(%p)\n", This
, p
);
3214 static HRESULT WINAPI
HTMLElement3_put_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3216 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3217 FIXME("(%p)->(%x)\n", This
, v
);
3221 static HRESULT WINAPI
HTMLElement3_get_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3223 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3224 FIXME("(%p)->(%p)\n", This
, p
);
3228 static HRESULT WINAPI
HTMLElement3_put_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT v
)
3230 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3231 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3235 static HRESULT WINAPI
HTMLElement3_get_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3237 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3238 FIXME("(%p)->(%p)\n", This
, p
);
3242 static HRESULT WINAPI
HTMLElement3_setActive(IHTMLElement3
*iface
)
3244 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3245 FIXME("(%p)\n", This
);
3249 static HRESULT WINAPI
HTMLElement3_put_contentEditable(IHTMLElement3
*iface
, BSTR v
)
3251 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3255 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3257 nsAString_InitDepend(&str
, v
);
3258 nsres
= nsIDOMHTMLElement_SetContentEditable(This
->nselem
, &str
);
3259 nsAString_Finish(&str
);
3261 if (NS_FAILED(nsres
)){
3262 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v
));
3269 static HRESULT WINAPI
HTMLElement3_get_contentEditable(IHTMLElement3
*iface
, BSTR
*p
)
3271 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3275 TRACE("(%p)->(%p)\n", This
, p
);
3277 nsAString_Init(&str
, NULL
);
3278 nsres
= nsIDOMHTMLElement_GetContentEditable(This
->nselem
, &str
);
3279 return return_nsstr(nsres
, &str
, p
);
3282 static HRESULT WINAPI
HTMLElement3_get_isContentEditable(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3284 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3285 FIXME("(%p)->(%p)\n", This
, p
);
3289 static HRESULT WINAPI
HTMLElement3_put_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3291 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3292 FIXME("(%p)->(%x)\n", This
, v
);
3296 static HRESULT WINAPI
HTMLElement3_get_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3298 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3299 FIXME("(%p)->(%p)\n", This
, p
);
3303 static const WCHAR disabledW
[] = {'d','i','s','a','b','l','e','d',0};
3305 static HRESULT WINAPI
HTMLElement3_put_disabled(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3307 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3311 TRACE("(%p)->(%x)\n", This
, v
);
3313 if(This
->node
.vtbl
->put_disabled
)
3314 return This
->node
.vtbl
->put_disabled(&This
->node
, v
);
3316 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, TRUE
, &var
);
3321 V_VT(var
) = VT_BOOL
;
3326 static HRESULT WINAPI
HTMLElement3_get_disabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3328 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3332 TRACE("(%p)->(%p)\n", This
, p
);
3334 if(This
->node
.vtbl
->get_disabled
)
3335 return This
->node
.vtbl
->get_disabled(&This
->node
, p
);
3337 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, FALSE
, &var
);
3338 if(hres
== DISP_E_UNKNOWNNAME
) {
3345 if(V_VT(var
) != VT_BOOL
) {
3346 FIXME("value is %s\n", debugstr_variant(var
));
3354 static HRESULT WINAPI
HTMLElement3_get_isDisabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3356 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3357 FIXME("(%p)->(%p)\n", This
, p
);
3361 static HRESULT WINAPI
HTMLElement3_put_onmove(IHTMLElement3
*iface
, VARIANT v
)
3363 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3364 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3368 static HRESULT WINAPI
HTMLElement3_get_onmove(IHTMLElement3
*iface
, VARIANT
*p
)
3370 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3371 FIXME("(%p)->(%p)\n", This
, p
);
3375 static HRESULT WINAPI
HTMLElement3_put_oncontrolselect(IHTMLElement3
*iface
, VARIANT v
)
3377 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3378 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3382 static HRESULT WINAPI
HTMLElement3_get_oncontrolselect(IHTMLElement3
*iface
, VARIANT
*p
)
3384 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3385 FIXME("(%p)->(%p)\n", This
, p
);
3389 static HRESULT WINAPI
HTMLElement3_fireEvent(IHTMLElement3
*iface
, BSTR bstrEventName
,
3390 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCancelled
)
3392 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3394 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrEventName
), debugstr_variant(pvarEventObject
),
3397 return dispatch_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCancelled
);
3400 static HRESULT WINAPI
HTMLElement3_put_onresizestart(IHTMLElement3
*iface
, VARIANT v
)
3402 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3403 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3407 static HRESULT WINAPI
HTMLElement3_get_onresizestart(IHTMLElement3
*iface
, VARIANT
*p
)
3409 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3410 FIXME("(%p)->(%p)\n", This
, p
);
3414 static HRESULT WINAPI
HTMLElement3_put_onresizeend(IHTMLElement3
*iface
, VARIANT v
)
3416 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3417 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3421 static HRESULT WINAPI
HTMLElement3_get_onresizeend(IHTMLElement3
*iface
, VARIANT
*p
)
3423 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3424 FIXME("(%p)->(%p)\n", This
, p
);
3428 static HRESULT WINAPI
HTMLElement3_put_onmovestart(IHTMLElement3
*iface
, VARIANT v
)
3430 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3431 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3435 static HRESULT WINAPI
HTMLElement3_get_onmovestart(IHTMLElement3
*iface
, VARIANT
*p
)
3437 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3438 FIXME("(%p)->(%p)\n", This
, p
);
3442 static HRESULT WINAPI
HTMLElement3_put_onmoveend(IHTMLElement3
*iface
, VARIANT v
)
3444 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3445 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3449 static HRESULT WINAPI
HTMLElement3_get_onmoveend(IHTMLElement3
*iface
, VARIANT
*p
)
3451 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3452 FIXME("(%p)->(%p)\n", This
, p
);
3456 static HRESULT WINAPI
HTMLElement3_put_onmousecenter(IHTMLElement3
*iface
, VARIANT v
)
3458 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3459 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3463 static HRESULT WINAPI
HTMLElement3_get_onmousecenter(IHTMLElement3
*iface
, VARIANT
*p
)
3465 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3466 FIXME("(%p)->(%p)\n", This
, p
);
3470 static HRESULT WINAPI
HTMLElement3_put_onmouseleave(IHTMLElement3
*iface
, VARIANT v
)
3472 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3473 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3477 static HRESULT WINAPI
HTMLElement3_get_onmouseleave(IHTMLElement3
*iface
, VARIANT
*p
)
3479 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3480 FIXME("(%p)->(%p)\n", This
, p
);
3484 static HRESULT WINAPI
HTMLElement3_put_onactivate(IHTMLElement3
*iface
, VARIANT v
)
3486 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3487 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3491 static HRESULT WINAPI
HTMLElement3_get_onactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3493 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3494 FIXME("(%p)->(%p)\n", This
, p
);
3498 static HRESULT WINAPI
HTMLElement3_put_ondeactivate(IHTMLElement3
*iface
, VARIANT v
)
3500 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3501 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3505 static HRESULT WINAPI
HTMLElement3_get_ondeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3507 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3508 FIXME("(%p)->(%p)\n", This
, p
);
3512 static HRESULT WINAPI
HTMLElement3_dragDrop(IHTMLElement3
*iface
, VARIANT_BOOL
*pfRet
)
3514 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3515 FIXME("(%p)->(%p)\n", This
, pfRet
);
3519 static HRESULT WINAPI
HTMLElement3_get_glyphMode(IHTMLElement3
*iface
, LONG
*p
)
3521 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3522 FIXME("(%p)->(%p)\n", This
, p
);
3526 static const IHTMLElement3Vtbl HTMLElement3Vtbl
= {
3527 HTMLElement3_QueryInterface
,
3528 HTMLElement3_AddRef
,
3529 HTMLElement3_Release
,
3530 HTMLElement3_GetTypeInfoCount
,
3531 HTMLElement3_GetTypeInfo
,
3532 HTMLElement3_GetIDsOfNames
,
3533 HTMLElement3_Invoke
,
3534 HTMLElement3_mergeAttributes
,
3535 HTMLElement3_get_isMultiLine
,
3536 HTMLElement3_get_canHaveHTML
,
3537 HTMLElement3_put_onlayoutcomplete
,
3538 HTMLElement3_get_onlayoutcomplete
,
3539 HTMLElement3_put_onpage
,
3540 HTMLElement3_get_onpage
,
3541 HTMLElement3_put_inflateBlock
,
3542 HTMLElement3_get_inflateBlock
,
3543 HTMLElement3_put_onbeforedeactivate
,
3544 HTMLElement3_get_onbeforedeactivate
,
3545 HTMLElement3_setActive
,
3546 HTMLElement3_put_contentEditable
,
3547 HTMLElement3_get_contentEditable
,
3548 HTMLElement3_get_isContentEditable
,
3549 HTMLElement3_put_hideFocus
,
3550 HTMLElement3_get_hideFocus
,
3551 HTMLElement3_put_disabled
,
3552 HTMLElement3_get_disabled
,
3553 HTMLElement3_get_isDisabled
,
3554 HTMLElement3_put_onmove
,
3555 HTMLElement3_get_onmove
,
3556 HTMLElement3_put_oncontrolselect
,
3557 HTMLElement3_get_oncontrolselect
,
3558 HTMLElement3_fireEvent
,
3559 HTMLElement3_put_onresizestart
,
3560 HTMLElement3_get_onresizestart
,
3561 HTMLElement3_put_onresizeend
,
3562 HTMLElement3_get_onresizeend
,
3563 HTMLElement3_put_onmovestart
,
3564 HTMLElement3_get_onmovestart
,
3565 HTMLElement3_put_onmoveend
,
3566 HTMLElement3_get_onmoveend
,
3567 HTMLElement3_put_onmousecenter
,
3568 HTMLElement3_get_onmousecenter
,
3569 HTMLElement3_put_onmouseleave
,
3570 HTMLElement3_get_onmouseleave
,
3571 HTMLElement3_put_onactivate
,
3572 HTMLElement3_get_onactivate
,
3573 HTMLElement3_put_ondeactivate
,
3574 HTMLElement3_get_ondeactivate
,
3575 HTMLElement3_dragDrop
,
3576 HTMLElement3_get_glyphMode
3579 static inline HTMLElement
*impl_from_IHTMLElement4(IHTMLElement4
*iface
)
3581 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement4_iface
);
3584 static HRESULT WINAPI
HTMLElement4_QueryInterface(IHTMLElement4
*iface
,
3585 REFIID riid
, void **ppv
)
3587 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3588 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3591 static ULONG WINAPI
HTMLElement4_AddRef(IHTMLElement4
*iface
)
3593 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3594 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3597 static ULONG WINAPI
HTMLElement4_Release(IHTMLElement4
*iface
)
3599 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3600 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3603 static HRESULT WINAPI
HTMLElement4_GetTypeInfoCount(IHTMLElement4
*iface
, UINT
*pctinfo
)
3605 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3606 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
3609 static HRESULT WINAPI
HTMLElement4_GetTypeInfo(IHTMLElement4
*iface
, UINT iTInfo
,
3610 LCID lcid
, ITypeInfo
**ppTInfo
)
3612 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3613 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3616 static HRESULT WINAPI
HTMLElement4_GetIDsOfNames(IHTMLElement4
*iface
, REFIID riid
,
3617 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3619 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3620 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3624 static HRESULT WINAPI
HTMLElement4_Invoke(IHTMLElement4
*iface
, DISPID dispIdMember
, REFIID riid
,
3625 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3627 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3628 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3629 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3632 static HRESULT WINAPI
HTMLElement4_put_onmousewheel(IHTMLElement4
*iface
, VARIANT v
)
3634 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3636 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3638 return set_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, &v
);
3641 static HRESULT WINAPI
HTMLElement4_get_onmousewheel(IHTMLElement4
*iface
, VARIANT
*p
)
3643 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3645 TRACE("(%p)->(%p)\n", This
, p
);
3647 return get_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, p
);
3650 static HRESULT WINAPI
HTMLElement4_normalize(IHTMLElement4
*iface
)
3652 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3653 FIXME("(%p)\n", This
);
3657 static HRESULT WINAPI
HTMLElement4_getAttributeNode(IHTMLElement4
*iface
, BSTR bstrname
, IHTMLDOMAttribute
**ppAttribute
)
3659 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3660 HTMLAttributeCollection
*attrs
;
3663 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrname
), ppAttribute
);
3665 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
3669 hres
= IHTMLAttributeCollection2_getNamedItem(&attrs
->IHTMLAttributeCollection2_iface
, bstrname
, ppAttribute
);
3670 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
3674 static HRESULT WINAPI
HTMLElement4_setAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3675 IHTMLDOMAttribute
**ppretAttribute
)
3677 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3678 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3682 static HRESULT WINAPI
HTMLElement4_removeAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3683 IHTMLDOMAttribute
**ppretAttribute
)
3685 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3686 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3690 static HRESULT WINAPI
HTMLElement4_put_onbeforeactivate(IHTMLElement4
*iface
, VARIANT v
)
3692 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3693 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3697 static HRESULT WINAPI
HTMLElement4_get_onbeforeactivate(IHTMLElement4
*iface
, VARIANT
*p
)
3699 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3700 FIXME("(%p)->(%p)\n", This
, p
);
3704 static HRESULT WINAPI
HTMLElement4_put_onfocusin(IHTMLElement4
*iface
, VARIANT v
)
3706 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3708 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3710 return set_node_event(&This
->node
, EVENTID_FOCUSIN
, &v
);
3713 static HRESULT WINAPI
HTMLElement4_get_onfocusin(IHTMLElement4
*iface
, VARIANT
*p
)
3715 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3717 TRACE("(%p)->(%p)\n", This
, p
);
3719 return get_node_event(&This
->node
, EVENTID_FOCUSIN
, p
);
3722 static HRESULT WINAPI
HTMLElement4_put_onfocusout(IHTMLElement4
*iface
, VARIANT v
)
3724 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3725 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3729 static HRESULT WINAPI
HTMLElement4_get_onfocusout(IHTMLElement4
*iface
, VARIANT
*p
)
3731 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3732 FIXME("(%p)->(%p)\n", This
, p
);
3736 static const IHTMLElement4Vtbl HTMLElement4Vtbl
= {
3737 HTMLElement4_QueryInterface
,
3738 HTMLElement4_AddRef
,
3739 HTMLElement4_Release
,
3740 HTMLElement4_GetTypeInfoCount
,
3741 HTMLElement4_GetTypeInfo
,
3742 HTMLElement4_GetIDsOfNames
,
3743 HTMLElement4_Invoke
,
3744 HTMLElement4_put_onmousewheel
,
3745 HTMLElement4_get_onmousewheel
,
3746 HTMLElement4_normalize
,
3747 HTMLElement4_getAttributeNode
,
3748 HTMLElement4_setAttributeNode
,
3749 HTMLElement4_removeAttributeNode
,
3750 HTMLElement4_put_onbeforeactivate
,
3751 HTMLElement4_get_onbeforeactivate
,
3752 HTMLElement4_put_onfocusin
,
3753 HTMLElement4_get_onfocusin
,
3754 HTMLElement4_put_onfocusout
,
3755 HTMLElement4_get_onfocusout
3758 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
3760 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
3763 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
3765 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3767 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
3768 *ppv
= &This
->IHTMLElement_iface
;
3769 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
3770 *ppv
= &This
->IHTMLElement_iface
;
3771 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
3772 *ppv
= &This
->IHTMLElement_iface
;
3773 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
3774 *ppv
= &This
->IHTMLElement2_iface
;
3775 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
3776 *ppv
= &This
->IHTMLElement3_iface
;
3777 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
3778 *ppv
= &This
->IHTMLElement4_iface
;
3779 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
3780 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
3782 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
3785 IUnknown_AddRef((IUnknown
*)*ppv
);
3789 void HTMLElement_destructor(HTMLDOMNode
*iface
)
3791 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3793 ConnectionPointContainer_Destroy(&This
->cp_container
);
3796 This
->style
->elem
= NULL
;
3797 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
3799 if(This
->runtime_style
) {
3800 This
->runtime_style
->elem
= NULL
;
3801 IHTMLStyle_Release(&This
->runtime_style
->IHTMLStyle_iface
);
3804 HTMLDOMAttribute
*attr
;
3806 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
3809 This
->attrs
->elem
= NULL
;
3810 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
3813 heap_free(This
->filter
);
3815 HTMLDOMNode_destructor(&This
->node
);
3818 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
3820 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3821 HTMLElement
*new_elem
;
3824 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
3829 new_elem
->filter
= heap_strdupW(This
->filter
);
3830 if(!new_elem
->filter
) {
3831 IHTMLElement_Release(&This
->IHTMLElement_iface
);
3832 return E_OUTOFMEMORY
;
3836 *ret
= &new_elem
->node
;
3840 HRESULT
HTMLElement_handle_event(HTMLDOMNode
*iface
, DWORD eid
, nsIDOMEvent
*event
, BOOL
*prevent_default
)
3842 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3845 case EVENTID_KEYDOWN
: {
3846 nsIDOMKeyEvent
*key_event
;
3849 nsres
= nsIDOMEvent_QueryInterface(event
, &IID_nsIDOMKeyEvent
, (void**)&key_event
);
3850 if(NS_SUCCEEDED(nsres
)) {
3853 nsIDOMKeyEvent_GetKeyCode(key_event
, &code
);
3856 case VK_F1
: /* DOM_VK_F1 */
3857 TRACE("F1 pressed\n");
3858 fire_event(This
->node
.doc
, EVENTID_HELP
, TRUE
, This
->node
.nsnode
, NULL
, NULL
);
3859 *prevent_default
= TRUE
;
3862 nsIDOMKeyEvent_Release(key_event
);
3870 cp_static_data_t HTMLElementEvents2_data
= { HTMLElementEvents2_tid
, NULL
/* FIXME */, TRUE
};
3872 const cpc_entry_t HTMLElement_cpc
[] = {
3877 static const NodeImplVtbl HTMLElementImplVtbl
= {
3879 HTMLElement_destructor
,
3882 HTMLElement_handle_event
,
3883 HTMLElement_get_attr_col
3886 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
3888 return CONTAINING_RECORD(iface
, HTMLElement
, node
.event_target
.dispex
);
3891 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
3892 DWORD grfdex
, DISPID
*pid
)
3894 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3896 if(This
->node
.vtbl
->get_dispid
)
3897 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
3899 return DISP_E_UNKNOWNNAME
;
3902 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
3903 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
3904 IServiceProvider
*caller
)
3906 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3908 if(This
->node
.vtbl
->invoke
)
3909 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
3910 params
, res
, ei
, caller
);
3912 ERR("(%p): element has no invoke method\n", This
);
3916 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
3918 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3919 nsIDOMMozNamedAttrMap
*attrs
;
3922 const PRUnichar
*str
;
3934 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
3935 if(NS_FAILED(nsres
))
3938 nsres
= nsIDOMMozNamedAttrMap_GetLength(attrs
, &len
);
3939 if(NS_FAILED(nsres
)) {
3940 nsIDOMMozNamedAttrMap_Release(attrs
);
3944 nsAString_Init(&nsstr
, NULL
);
3945 for(i
=0; i
<len
; i
++) {
3946 nsres
= nsIDOMMozNamedAttrMap_Item(attrs
, i
, &attr
);
3947 if(NS_FAILED(nsres
))
3950 nsres
= nsIDOMAttr_GetNodeName(attr
, &nsstr
);
3951 if(NS_FAILED(nsres
)) {
3952 nsIDOMAttr_Release(attr
);
3956 nsAString_GetData(&nsstr
, &str
);
3957 name
= SysAllocString(str
);
3959 nsIDOMAttr_Release(attr
);
3963 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
3964 if(hres
!= DISP_E_UNKNOWNNAME
) {
3965 nsIDOMAttr_Release(attr
);
3966 SysFreeString(name
);
3970 nsres
= nsIDOMAttr_GetNodeValue(attr
, &nsstr
);
3971 nsIDOMAttr_Release(attr
);
3972 if(NS_FAILED(nsres
)) {
3973 SysFreeString(name
);
3977 nsAString_GetData(&nsstr
, &str
);
3978 V_VT(&value
) = VT_BSTR
;
3980 V_BSTR(&value
) = SysAllocString(str
);
3981 if(!V_BSTR(&value
)) {
3982 SysFreeString(name
);
3986 V_BSTR(&value
) = NULL
;
3988 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
3989 SysFreeString(name
);
3990 VariantClear(&value
);
3992 nsAString_Finish(&nsstr
);
3994 nsIDOMMozNamedAttrMap_Release(attrs
);
3998 static event_target_t
**HTMLElement_get_event_target_ptr(DispatchEx
*dispex
)
4000 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
4001 return This
->node
.vtbl
->get_event_target_ptr
4002 ? This
->node
.vtbl
->get_event_target_ptr(&This
->node
)
4003 : &This
->node
.event_target
.ptr
;
4006 static void HTMLElement_bind_event(DispatchEx
*dispex
, int eid
)
4008 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
4009 This
->node
.doc
->node
.event_target
.dispex
.data
->vtbl
->bind_event(&This
->node
.doc
->node
.event_target
.dispex
, eid
);
4012 static const tid_t HTMLElement_iface_tids
[] = {
4017 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
4019 HTMLElement_get_dispid
,
4021 HTMLElement_populate_props
,
4022 HTMLElement_get_event_target_ptr
,
4023 HTMLElement_bind_event
4026 static dispex_static_data_t HTMLElement_dispex
= {
4027 &HTMLElement_dispex_vtbl
,
4028 DispHTMLUnknownElement_tid
,
4030 HTMLElement_iface_tids
4033 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
4035 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
4036 This
->IHTMLElement2_iface
.lpVtbl
= &HTMLElement2Vtbl
;
4037 This
->IHTMLElement3_iface
.lpVtbl
= &HTMLElement3Vtbl
;
4038 This
->IHTMLElement4_iface
.lpVtbl
= &HTMLElement4Vtbl
;
4040 if(dispex_data
&& !dispex_data
->vtbl
)
4041 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
4042 init_dispex(&This
->node
.event_target
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
4043 dispex_data
? dispex_data
: &HTMLElement_dispex
);
4046 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
4048 /* No AddRef, share reference with HTMLDOMNode */
4049 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
4050 This
->nselem
= nselem
;
4053 This
->node
.cp_container
= &This
->cp_container
;
4054 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
, This
->node
.vtbl
->cpc_entries
);
4057 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
4059 nsIDOMHTMLElement
*nselem
;
4060 nsAString class_name_str
;
4061 const PRUnichar
*class_name
;
4062 const tag_desc_t
*tag
;
4067 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
4068 if(NS_FAILED(nsres
))
4071 nsAString_Init(&class_name_str
, NULL
);
4072 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
4074 nsAString_GetData(&class_name_str
, &class_name
);
4076 tag
= get_tag_desc(class_name
);
4078 hres
= tag
->constructor(doc
, nselem
, &elem
);
4079 }else if(use_generic
) {
4080 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
4082 elem
= heap_alloc_zero(sizeof(HTMLElement
));
4084 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
4085 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
4088 hres
= E_OUTOFMEMORY
;
4092 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
4094 nsIDOMHTMLElement_Release(nselem
);
4095 nsAString_Finish(&class_name_str
);
4103 HRESULT
get_elem(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**ret
)
4108 hres
= get_node(doc
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
4112 *ret
= impl_from_HTMLDOMNode(node
);
4116 /* interface IHTMLFiltersCollection */
4117 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
4119 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4121 TRACE("%p %s %p\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4123 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4124 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4125 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
4126 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
4127 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4128 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4129 return *ppv
? S_OK
: E_NOINTERFACE
;
4132 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4133 return E_NOINTERFACE
;
4136 IUnknown_AddRef((IUnknown
*)*ppv
);
4140 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
4142 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4143 LONG ref
= InterlockedIncrement(&This
->ref
);
4145 TRACE("(%p) ref=%d\n", This
, ref
);
4150 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
4152 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4153 LONG ref
= InterlockedDecrement(&This
->ref
);
4155 TRACE("(%p) ref=%d\n", This
, ref
);
4165 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
4167 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4168 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4171 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
4172 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
4174 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4175 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4178 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
4179 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
4180 LCID lcid
, DISPID
*rgDispId
)
4182 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4183 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4187 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
4188 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
4189 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4191 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4192 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4193 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4196 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
4198 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4203 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
4209 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
4211 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4212 FIXME("(%p)->(%p)\n", This
, p
);
4216 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
4218 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4219 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
4223 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
4224 HTMLFiltersCollection_QueryInterface
,
4225 HTMLFiltersCollection_AddRef
,
4226 HTMLFiltersCollection_Release
,
4227 HTMLFiltersCollection_GetTypeInfoCount
,
4228 HTMLFiltersCollection_GetTypeInfo
,
4229 HTMLFiltersCollection_GetIDsOfNames
,
4230 HTMLFiltersCollection_Invoke
,
4231 HTMLFiltersCollection_get_length
,
4232 HTMLFiltersCollection_get__newEnum
,
4233 HTMLFiltersCollection_item
4236 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4241 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
4242 idx
= idx
*10 + (*ptr
-'0');
4244 return DISP_E_UNKNOWNNAME
;
4246 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
4247 TRACE("ret %x\n", *dispid
);
4251 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4252 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4254 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
4256 V_VT(res
) = VT_DISPATCH
;
4257 V_DISPATCH(res
) = NULL
;
4259 FIXME("always returning NULL\n");
4264 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
4266 HTMLFiltersCollection_get_dispid
,
4267 HTMLFiltersCollection_invoke
,
4271 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
4272 IHTMLFiltersCollection_tid
,
4275 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
4276 &HTMLFiltersCollection_dispex_vtbl
,
4277 IHTMLFiltersCollection_tid
,
4279 HTMLFiltersCollection_iface_tids
4282 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
4284 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
4286 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
4289 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
4290 &HTMLFiltersCollection_dispex
);
4292 return &ret
->IHTMLFiltersCollection_iface
;
4295 /* interface IHTMLAttributeCollection */
4296 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
4298 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
4301 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
4303 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4305 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4307 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4308 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4309 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
4310 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4311 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
4312 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
4313 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
4314 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
4315 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4316 return *ppv
? S_OK
: E_NOINTERFACE
;
4319 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4320 return E_NOINTERFACE
;
4323 IUnknown_AddRef((IUnknown
*)*ppv
);
4327 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
4329 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4330 LONG ref
= InterlockedIncrement(&This
->ref
);
4332 TRACE("(%p) ref=%d\n", This
, ref
);
4337 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
4339 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4340 LONG ref
= InterlockedDecrement(&This
->ref
);
4342 TRACE("(%p) ref=%d\n", This
, ref
);
4345 while(!list_empty(&This
->attrs
)) {
4346 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
4348 list_remove(&attr
->entry
);
4350 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4359 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
4361 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4362 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4365 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
4366 LCID lcid
, ITypeInfo
**ppTInfo
)
4368 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4369 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4372 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
4373 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4375 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4376 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4380 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
4381 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4382 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4384 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4385 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4386 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4389 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
4391 IDispatchEx
*dispex
= &This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
;
4392 DISPID id
= DISPID_STARTENUM
;
4396 FIXME("filter non-enumerable attributes out\n");
4399 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
4402 else if(hres
== S_FALSE
)
4412 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
4419 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
4423 if(name
[0]>='0' && name
[0]<='9') {
4427 idx
= strtoulW(name
, &end_ptr
, 10);
4429 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
4436 WARN("NULL elem\n");
4437 return E_UNEXPECTED
;
4440 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
,
4441 name
, fdexNameCaseInsensitive
, id
);
4445 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
4447 HTMLDOMAttribute
*iter
;
4452 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4453 if(iter
->dispid
== id
) {
4462 WARN("NULL elem\n");
4463 return E_UNEXPECTED
;
4466 hres
= HTMLDOMAttribute_Create(NULL
, This
->elem
, id
, attr
);
4471 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
4477 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
4479 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4482 TRACE("(%p)->(%p)\n", This
, p
);
4485 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
4489 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
4491 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4492 FIXME("(%p)->(%p)\n", This
, p
);
4496 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
4498 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4499 HTMLDOMAttribute
*attr
;
4503 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
4505 switch(V_VT(name
)) {
4507 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
4510 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
4513 FIXME("unsupported name %s\n", debugstr_variant(name
));
4516 if(hres
== DISP_E_UNKNOWNNAME
)
4517 return E_INVALIDARG
;
4521 hres
= get_domattr(This
, id
, NULL
, &attr
);
4525 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
4529 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
4530 HTMLAttributeCollection_QueryInterface
,
4531 HTMLAttributeCollection_AddRef
,
4532 HTMLAttributeCollection_Release
,
4533 HTMLAttributeCollection_GetTypeInfoCount
,
4534 HTMLAttributeCollection_GetTypeInfo
,
4535 HTMLAttributeCollection_GetIDsOfNames
,
4536 HTMLAttributeCollection_Invoke
,
4537 HTMLAttributeCollection_get_length
,
4538 HTMLAttributeCollection__newEnum
,
4539 HTMLAttributeCollection_item
4542 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
4544 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
4547 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
4549 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4550 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4553 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
4555 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4556 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4559 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
4561 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4562 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4565 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
4567 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4568 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4571 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
4572 LCID lcid
, ITypeInfo
**ppTInfo
)
4574 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4575 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4578 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
4579 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4581 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4582 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4586 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
4587 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4588 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4590 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4591 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4592 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4595 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
4596 IHTMLDOMAttribute
**newretNode
)
4598 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4599 HTMLDOMAttribute
*attr
;
4603 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4605 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
4606 if(hres
== DISP_E_UNKNOWNNAME
) {
4609 } else if(FAILED(hres
)) {
4613 hres
= get_domattr(This
, id
, NULL
, &attr
);
4617 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
4621 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
4622 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
4624 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4625 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
4629 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
4630 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
4632 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4633 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4637 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
4638 HTMLAttributeCollection2_QueryInterface
,
4639 HTMLAttributeCollection2_AddRef
,
4640 HTMLAttributeCollection2_Release
,
4641 HTMLAttributeCollection2_GetTypeInfoCount
,
4642 HTMLAttributeCollection2_GetTypeInfo
,
4643 HTMLAttributeCollection2_GetIDsOfNames
,
4644 HTMLAttributeCollection2_Invoke
,
4645 HTMLAttributeCollection2_getNamedItem
,
4646 HTMLAttributeCollection2_setNamedItem
,
4647 HTMLAttributeCollection2_removeNamedItem
4650 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
4652 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
4655 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
4657 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4658 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4661 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
4663 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4664 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4667 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
4669 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4670 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4673 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
4675 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4676 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4679 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
4680 LCID lcid
, ITypeInfo
**ppTInfo
)
4682 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4683 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4686 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
4687 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4689 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4690 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4694 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
4695 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4696 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4698 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4699 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4700 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4703 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
4704 IHTMLDOMAttribute
**ppNodeOut
)
4706 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4707 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
4710 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
4711 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
4713 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4714 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
4718 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
4719 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
4721 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4722 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
4726 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
4728 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4729 HTMLDOMAttribute
*attr
;
4733 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
4735 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
4736 if(hres
== DISP_E_UNKNOWNNAME
)
4737 return E_INVALIDARG
;
4741 hres
= get_domattr(This
, id
, NULL
, &attr
);
4745 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
4749 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
4751 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4752 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
4755 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
4756 HTMLAttributeCollection3_QueryInterface
,
4757 HTMLAttributeCollection3_AddRef
,
4758 HTMLAttributeCollection3_Release
,
4759 HTMLAttributeCollection3_GetTypeInfoCount
,
4760 HTMLAttributeCollection3_GetTypeInfo
,
4761 HTMLAttributeCollection3_GetIDsOfNames
,
4762 HTMLAttributeCollection3_Invoke
,
4763 HTMLAttributeCollection3_getNamedItem
,
4764 HTMLAttributeCollection3_setNamedItem
,
4765 HTMLAttributeCollection3_removeNamedItem
,
4766 HTMLAttributeCollection3_item
,
4767 HTMLAttributeCollection3_get_length
4770 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
4772 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
4775 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4777 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4778 HTMLDOMAttribute
*attr
;
4782 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
4784 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
4788 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
4791 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4793 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
4797 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
4798 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4800 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4802 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
4805 case DISPATCH_PROPERTYGET
: {
4806 HTMLDOMAttribute
*iter
;
4809 pos
= id
-MSHTML_DISPID_CUSTOM_MIN
;
4811 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4813 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
4814 V_VT(res
) = VT_DISPATCH
;
4815 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
4821 WARN("invalid arg\n");
4822 return E_INVALIDARG
;
4826 FIXME("unimplemented flags %x\n", flags
);
4831 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
4833 HTMLAttributeCollection_get_dispid
,
4834 HTMLAttributeCollection_invoke
,
4838 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
4839 IHTMLAttributeCollection_tid
,
4840 IHTMLAttributeCollection2_tid
,
4841 IHTMLAttributeCollection3_tid
,
4845 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
4846 &HTMLAttributeCollection_dispex_vtbl
,
4847 DispHTMLAttributeCollection_tid
,
4849 HTMLAttributeCollection_iface_tids
4852 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
4854 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
4857 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
4862 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
4864 return E_OUTOFMEMORY
;
4866 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
4867 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
4868 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
4869 This
->attrs
->ref
= 2;
4871 This
->attrs
->elem
= This
;
4872 list_init(&This
->attrs
->attrs
);
4873 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
4874 &HTMLAttributeCollection_dispex
);