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
);
851 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
852 IHTMLDOMNode_Release(node
);
859 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
861 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
863 TRACE("(%p)->(%p)\n", This
, p
);
868 hres
= HTMLStyle_Create(This
, &This
->style
);
873 *p
= &This
->style
->IHTMLStyle_iface
;
874 IHTMLStyle_AddRef(*p
);
878 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
880 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
881 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
885 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
887 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
888 FIXME("(%p)->(%p)\n", This
, p
);
892 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
894 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
896 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
898 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
901 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
903 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
905 TRACE("(%p)->(%p)\n", This
, p
);
907 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
910 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
912 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
914 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
916 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
919 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
921 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
923 TRACE("(%p)->(%p)\n", This
, p
);
925 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
928 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
930 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
932 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
934 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
937 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
939 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
941 TRACE("(%p)->(%p)\n", This
, p
);
943 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
946 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
948 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
950 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
952 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
955 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
957 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
958 FIXME("(%p)->(%p)\n", This
, p
);
962 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
964 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
966 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
968 return set_node_event(&This
->node
, EVENTID_KEYPRESS
, &v
);
971 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
973 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
975 TRACE("(%p)->(%p)\n", This
, p
);
977 return get_node_event(&This
->node
, EVENTID_KEYPRESS
, p
);
980 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
982 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
984 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
986 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
989 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
991 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
993 TRACE("(%p)->(%p)\n", This
, p
);
995 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
998 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
1000 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1002 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1004 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
1007 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
1009 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1011 TRACE("(%p)->(%p)\n", This
, p
);
1013 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
1016 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
1018 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1020 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1022 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
1025 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
1027 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1029 TRACE("(%p)->(%p)\n", This
, p
);
1031 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
1034 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
1036 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1038 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1040 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
1043 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
1045 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1047 TRACE("(%p)->(%p)\n", This
, p
);
1049 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
1052 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
1054 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1056 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1058 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
1061 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
1063 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1065 TRACE("(%p)->(%p)\n", This
, p
);
1067 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
1070 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
1072 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1074 TRACE("(%p)->(%p)\n", This
, p
);
1079 if(This
->node
.vtbl
->get_document
)
1080 return This
->node
.vtbl
->get_document(&This
->node
, p
);
1082 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
1083 IDispatch_AddRef(*p
);
1087 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
1089 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
1091 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1092 nsAString title_str
;
1095 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1101 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, TRUE
, &var
);
1106 V_VT(var
) = VT_BSTR
;
1107 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
1111 nsAString_InitDepend(&title_str
, v
);
1112 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
1113 nsAString_Finish(&title_str
);
1114 if(NS_FAILED(nsres
))
1115 ERR("SetTitle failed: %08x\n", nsres
);
1120 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
1122 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1123 nsAString title_str
;
1126 TRACE("(%p)->(%p)\n", This
, p
);
1132 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, FALSE
, &var
);
1133 if(hres
== DISP_E_UNKNOWNNAME
) {
1135 }else if(V_VT(var
) != VT_BSTR
) {
1136 FIXME("title = %s\n", debugstr_variant(var
));
1139 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
1145 nsAString_Init(&title_str
, NULL
);
1146 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
1147 return return_nsstr(nsres
, &title_str
, p
);
1150 static const WCHAR languageW
[] = {'l','a','n','g','u','a','g','e',0};
1152 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
1154 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1156 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1158 return elem_string_attr_setter(This
, languageW
, v
);
1161 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
1163 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1165 TRACE("(%p)->(%p)\n", This
, p
);
1167 return elem_string_attr_getter(This
, languageW
, TRUE
, p
);
1170 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
1172 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1174 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1176 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
1179 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
1181 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1183 TRACE("(%p)->(%p)\n", This
, p
);
1185 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
1188 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
1190 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1191 cpp_bool start
= TRUE
;
1194 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
1196 switch(V_VT(&varargStart
)) {
1201 start
= V_BOOL(&varargStart
) != VARIANT_FALSE
;
1204 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart
));
1208 FIXME("Unsupported for comments\n");
1212 nsres
= nsIDOMHTMLElement_ScrollIntoView(This
->nselem
, start
, 1);
1213 assert(nsres
== NS_OK
);
1218 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
1219 VARIANT_BOOL
*pfResult
)
1221 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1222 cpp_bool result
= FALSE
;
1224 TRACE("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
1230 child
= unsafe_impl_from_IHTMLElement(pChild
);
1232 ERR("not our element\n");
1236 nsres
= nsIDOMNode_Contains(This
->node
.nsnode
, child
->node
.nsnode
, &result
);
1237 assert(nsres
== NS_OK
);
1240 *pfResult
= result
? VARIANT_TRUE
: VARIANT_FALSE
;
1244 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
1246 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1248 TRACE("(%p)->(%p)\n", This
, p
);
1250 return get_elem_source_index(This
, p
);
1253 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
1255 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1256 FIXME("(%p)->(%p)\n", This
, p
);
1260 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
1262 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1263 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1267 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
1269 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1270 FIXME("(%p)->(%p)\n", This
, p
);
1274 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
1276 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1279 TRACE("(%p)->(%p)\n", This
, p
);
1281 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, p
);
1282 if(NS_FAILED(nsres
)) {
1283 ERR("GetOffsetLeft failed: %08x\n", nsres
);
1290 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
1292 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1295 TRACE("(%p)->(%p)\n", This
, p
);
1297 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, p
);
1298 if(NS_FAILED(nsres
)) {
1299 ERR("GetOffsetTop failed: %08x\n", nsres
);
1306 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
1308 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1311 TRACE("(%p)->(%p)\n", This
, p
);
1313 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, p
);
1314 if(NS_FAILED(nsres
)) {
1315 ERR("GetOffsetWidth failed: %08x\n", nsres
);
1322 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
1324 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1327 TRACE("(%p)->(%p)\n", This
, p
);
1329 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, p
);
1330 if(NS_FAILED(nsres
)) {
1331 ERR("GetOffsetHeight failed: %08x\n", nsres
);
1338 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
1340 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1341 nsIDOMElement
*nsparent
;
1345 TRACE("(%p)->(%p)\n", This
, p
);
1347 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
1348 if(NS_FAILED(nsres
)) {
1349 ERR("GetOffsetParent failed: %08x\n", nsres
);
1356 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
1357 nsIDOMElement_Release(nsparent
);
1361 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
1371 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
1373 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1377 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1380 FIXME("NULL nselem\n");
1384 nsAString_InitDepend(&html_str
, v
);
1385 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
1386 nsAString_Finish(&html_str
);
1387 if(NS_FAILED(nsres
)) {
1388 FIXME("SetInnerHtml failed %08x\n", nsres
);
1395 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1397 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1401 TRACE("(%p)->(%p)\n", This
, p
);
1404 FIXME("NULL nselem\n");
1408 nsAString_Init(&html_str
, NULL
);
1409 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
1410 return return_nsstr(nsres
, &html_str
, p
);
1413 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1415 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1416 nsIDOMNode
*nschild
, *tmp
;
1417 nsIDOMText
*text_node
;
1421 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1424 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
1425 if(NS_FAILED(nsres
)) {
1426 ERR("GetLastChild failed: %08x\n", nsres
);
1432 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
1433 nsIDOMNode_Release(nschild
);
1434 if(NS_FAILED(nsres
)) {
1435 ERR("RemoveChild failed: %08x\n", nsres
);
1438 nsIDOMNode_Release(tmp
);
1441 nsAString_InitDepend(&text_str
, v
);
1442 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1443 nsAString_Finish(&text_str
);
1444 if(NS_FAILED(nsres
)) {
1445 ERR("CreateTextNode failed: %08x\n", nsres
);
1449 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1450 if(NS_FAILED(nsres
)) {
1451 ERR("AppendChild failed: %08x\n", nsres
);
1455 nsIDOMNode_Release(tmp
);
1459 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1461 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1463 TRACE("(%p)->(%p)\n", This
, p
);
1465 return get_node_text(&This
->node
, p
);
1468 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1470 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1472 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1474 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1477 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1479 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1483 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1485 nsAString_Init(&html_str
, NULL
);
1486 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1487 if(SUCCEEDED(hres
)) {
1488 const PRUnichar
*html
;
1490 nsAString_GetData(&html_str
, &html
);
1491 *p
= SysAllocString(html
);
1493 hres
= E_OUTOFMEMORY
;
1496 nsAString_Finish(&html_str
);
1498 TRACE("ret %s\n", debugstr_w(*p
));
1502 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1504 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1505 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1509 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1511 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1512 FIXME("(%p)->(%p)\n", This
, p
);
1516 static HRESULT
insert_adjacent_node(HTMLElement
*This
, const WCHAR
*where
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret_node
)
1518 nsIDOMNode
*ret_nsnode
;
1520 HRESULT hres
= S_OK
;
1522 static const WCHAR beforebeginW
[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
1523 static const WCHAR afterbeginW
[] = {'a','f','t','e','r','b','e','g','i','n',0};
1524 static const WCHAR beforeendW
[] = {'b','e','f','o','r','e','e','n','d',0};
1525 static const WCHAR afterendW
[] = {'a','f','t','e','r','e','n','d',0};
1527 if (!strcmpiW(where
, beforebeginW
)) {
1530 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1531 if(NS_FAILED(nsres
))
1535 return E_INVALIDARG
;
1537 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &ret_nsnode
);
1538 nsIDOMNode_Release(parent
);
1539 }else if(!strcmpiW(where
, afterbeginW
)) {
1540 nsIDOMNode
*first_child
;
1542 nsres
= nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1543 if(NS_FAILED(nsres
))
1546 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &ret_nsnode
);
1547 if(NS_FAILED(nsres
))
1551 nsIDOMNode_Release(first_child
);
1552 }else if (!strcmpiW(where
, beforeendW
)) {
1553 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &ret_nsnode
);
1554 }else if (!strcmpiW(where
, afterendW
)) {
1555 nsIDOMNode
*next_sibling
, *parent
;
1557 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1558 if(NS_FAILED(nsres
))
1561 return E_INVALIDARG
;
1563 nsres
= nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1564 if(NS_SUCCEEDED(nsres
)) {
1566 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &ret_nsnode
);
1567 nsIDOMNode_Release(next_sibling
);
1569 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &ret_nsnode
);
1573 nsIDOMNode_Release(parent
);
1575 ERR("invalid where: %s\n", debugstr_w(where
));
1576 return E_INVALIDARG
;
1579 if (NS_FAILED(nsres
))
1583 hres
= get_node(This
->node
.doc
, ret_nsnode
, TRUE
, ret_node
);
1584 nsIDOMNode_Release(ret_nsnode
);
1588 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1591 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1598 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1600 if(!This
->node
.doc
->nsdoc
) {
1601 WARN("NULL nsdoc\n");
1602 return E_UNEXPECTED
;
1605 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1606 if(NS_FAILED(nsres
))
1608 ERR("CreateRange failed: %08x\n", nsres
);
1612 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1614 nsAString_InitDepend(&ns_html
, html
);
1615 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1616 nsAString_Finish(&ns_html
);
1617 nsIDOMRange_Release(range
);
1619 if(NS_FAILED(nsres
) || !nsnode
)
1621 ERR("CreateTextNode failed: %08x\n", nsres
);
1625 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1626 nsIDOMNode_Release(nsnode
);
1630 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1633 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1639 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1641 if(!This
->node
.doc
->nsdoc
) {
1642 WARN("NULL nsdoc\n");
1643 return E_UNEXPECTED
;
1647 nsAString_InitDepend(&ns_text
, text
);
1648 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1649 nsAString_Finish(&ns_text
);
1651 if(NS_FAILED(nsres
) || !nsnode
)
1653 ERR("CreateTextNode failed: %08x\n", nsres
);
1657 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1658 nsIDOMNode_Release(nsnode
);
1663 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1665 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1666 FIXME("(%p)->(%p)\n", This
, p
);
1670 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1672 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1674 TRACE("(%p)->(%p)\n", This
, p
);
1676 *p
= This
->node
.vtbl
->is_text_edit
&& This
->node
.vtbl
->is_text_edit(&This
->node
)
1677 ? VARIANT_TRUE
: VARIANT_FALSE
;
1681 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1683 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1685 TRACE("(%p)\n", This
);
1687 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1690 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1691 IHTMLFiltersCollection
**p
)
1693 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1694 TRACE("(%p)->(%p)\n", This
, p
);
1699 *p
= HTMLFiltersCollection_Create();
1704 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
1706 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1707 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1711 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1713 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1714 FIXME("(%p)->(%p)\n", This
, p
);
1718 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1720 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1721 FIXME("(%p)->(%p)\n", This
, String
);
1725 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1727 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1728 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1732 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1734 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1735 FIXME("(%p)->(%p)\n", This
, p
);
1739 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1741 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1742 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1746 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1748 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1749 FIXME("(%p)->(%p)\n", This
, p
);
1753 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1755 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1756 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1760 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1762 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1763 FIXME("(%p)->(%p)\n", This
, p
);
1767 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1769 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1770 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1774 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1776 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1777 FIXME("(%p)->(%p)\n", This
, p
);
1781 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1783 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1784 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1788 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1790 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1791 FIXME("(%p)->(%p)\n", This
, p
);
1795 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1797 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1798 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1802 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1804 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1805 FIXME("(%p)->(%p)\n", This
, p
);
1809 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1811 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1813 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1815 return set_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, &v
);
1818 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1820 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1822 TRACE("(%p)->(%p)\n", This
, p
);
1824 return get_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, p
);
1827 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1829 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1830 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1834 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1836 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1837 FIXME("(%p)->(%p)\n", This
, p
);
1841 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1843 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1844 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1848 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1850 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1851 FIXME("(%p)->(%p)\n", This
, p
);
1855 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1857 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1858 nsIDOMNodeList
*nsnode_list
;
1861 TRACE("(%p)->(%p)\n", This
, p
);
1863 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1864 if(NS_FAILED(nsres
)) {
1865 ERR("GetChildNodes failed: %08x\n", nsres
);
1869 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
, nsnode_list
);
1871 nsIDOMNodeList_Release(nsnode_list
);
1875 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1877 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1879 TRACE("(%p)->(%p)\n", This
, p
);
1881 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1885 static const IHTMLElementVtbl HTMLElementVtbl
= {
1886 HTMLElement_QueryInterface
,
1888 HTMLElement_Release
,
1889 HTMLElement_GetTypeInfoCount
,
1890 HTMLElement_GetTypeInfo
,
1891 HTMLElement_GetIDsOfNames
,
1893 HTMLElement_setAttribute
,
1894 HTMLElement_getAttribute
,
1895 HTMLElement_removeAttribute
,
1896 HTMLElement_put_className
,
1897 HTMLElement_get_className
,
1900 HTMLElement_get_tagName
,
1901 HTMLElement_get_parentElement
,
1902 HTMLElement_get_style
,
1903 HTMLElement_put_onhelp
,
1904 HTMLElement_get_onhelp
,
1905 HTMLElement_put_onclick
,
1906 HTMLElement_get_onclick
,
1907 HTMLElement_put_ondblclick
,
1908 HTMLElement_get_ondblclick
,
1909 HTMLElement_put_onkeydown
,
1910 HTMLElement_get_onkeydown
,
1911 HTMLElement_put_onkeyup
,
1912 HTMLElement_get_onkeyup
,
1913 HTMLElement_put_onkeypress
,
1914 HTMLElement_get_onkeypress
,
1915 HTMLElement_put_onmouseout
,
1916 HTMLElement_get_onmouseout
,
1917 HTMLElement_put_onmouseover
,
1918 HTMLElement_get_onmouseover
,
1919 HTMLElement_put_onmousemove
,
1920 HTMLElement_get_onmousemove
,
1921 HTMLElement_put_onmousedown
,
1922 HTMLElement_get_onmousedown
,
1923 HTMLElement_put_onmouseup
,
1924 HTMLElement_get_onmouseup
,
1925 HTMLElement_get_document
,
1926 HTMLElement_put_title
,
1927 HTMLElement_get_title
,
1928 HTMLElement_put_language
,
1929 HTMLElement_get_language
,
1930 HTMLElement_put_onselectstart
,
1931 HTMLElement_get_onselectstart
,
1932 HTMLElement_scrollIntoView
,
1933 HTMLElement_contains
,
1934 HTMLElement_get_sourceIndex
,
1935 HTMLElement_get_recordNumber
,
1936 HTMLElement_put_lang
,
1937 HTMLElement_get_lang
,
1938 HTMLElement_get_offsetLeft
,
1939 HTMLElement_get_offsetTop
,
1940 HTMLElement_get_offsetWidth
,
1941 HTMLElement_get_offsetHeight
,
1942 HTMLElement_get_offsetParent
,
1943 HTMLElement_put_innerHTML
,
1944 HTMLElement_get_innerHTML
,
1945 HTMLElement_put_innerText
,
1946 HTMLElement_get_innerText
,
1947 HTMLElement_put_outerHTML
,
1948 HTMLElement_get_outerHTML
,
1949 HTMLElement_put_outerText
,
1950 HTMLElement_get_outerText
,
1951 HTMLElement_insertAdjacentHTML
,
1952 HTMLElement_insertAdjacentText
,
1953 HTMLElement_get_parentTextEdit
,
1954 HTMLElement_get_isTextEdit
,
1956 HTMLElement_get_filters
,
1957 HTMLElement_put_ondragstart
,
1958 HTMLElement_get_ondragstart
,
1959 HTMLElement_toString
,
1960 HTMLElement_put_onbeforeupdate
,
1961 HTMLElement_get_onbeforeupdate
,
1962 HTMLElement_put_onafterupdate
,
1963 HTMLElement_get_onafterupdate
,
1964 HTMLElement_put_onerrorupdate
,
1965 HTMLElement_get_onerrorupdate
,
1966 HTMLElement_put_onrowexit
,
1967 HTMLElement_get_onrowexit
,
1968 HTMLElement_put_onrowenter
,
1969 HTMLElement_get_onrowenter
,
1970 HTMLElement_put_ondatasetchanged
,
1971 HTMLElement_get_ondatasetchanged
,
1972 HTMLElement_put_ondataavailable
,
1973 HTMLElement_get_ondataavailable
,
1974 HTMLElement_put_ondatasetcomplete
,
1975 HTMLElement_get_ondatasetcomplete
,
1976 HTMLElement_put_onfilterchange
,
1977 HTMLElement_get_onfilterchange
,
1978 HTMLElement_get_children
,
1982 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1984 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1987 static inline HTMLElement
*impl_from_IHTMLElement2(IHTMLElement2
*iface
)
1989 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement2_iface
);
1992 static HRESULT WINAPI
HTMLElement2_QueryInterface(IHTMLElement2
*iface
,
1993 REFIID riid
, void **ppv
)
1995 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1996 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
1999 static ULONG WINAPI
HTMLElement2_AddRef(IHTMLElement2
*iface
)
2001 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2002 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
2005 static ULONG WINAPI
HTMLElement2_Release(IHTMLElement2
*iface
)
2007 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2008 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
2011 static HRESULT WINAPI
HTMLElement2_GetTypeInfoCount(IHTMLElement2
*iface
, UINT
*pctinfo
)
2013 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2014 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
2017 static HRESULT WINAPI
HTMLElement2_GetTypeInfo(IHTMLElement2
*iface
, UINT iTInfo
,
2018 LCID lcid
, ITypeInfo
**ppTInfo
)
2020 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2021 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2024 static HRESULT WINAPI
HTMLElement2_GetIDsOfNames(IHTMLElement2
*iface
, REFIID riid
,
2025 LPOLESTR
*rgszNames
, UINT cNames
,
2026 LCID lcid
, DISPID
*rgDispId
)
2028 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2029 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2033 static HRESULT WINAPI
HTMLElement2_Invoke(IHTMLElement2
*iface
, DISPID dispIdMember
,
2034 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2035 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2037 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2038 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2039 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2042 static HRESULT WINAPI
HTMLElement2_get_scopeName(IHTMLElement2
*iface
, BSTR
*p
)
2044 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2045 FIXME("(%p)->(%p)\n", This
, p
);
2049 static HRESULT WINAPI
HTMLElement2_setCapture(IHTMLElement2
*iface
, VARIANT_BOOL containerCapture
)
2051 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2052 FIXME("(%p)->(%x)\n", This
, containerCapture
);
2056 static HRESULT WINAPI
HTMLElement2_releaseCapture(IHTMLElement2
*iface
)
2058 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2059 FIXME("(%p)\n", This
);
2063 static HRESULT WINAPI
HTMLElement2_put_onlosecapture(IHTMLElement2
*iface
, VARIANT v
)
2065 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2066 FIXME("(%p)->()\n", This
);
2070 static HRESULT WINAPI
HTMLElement2_get_onlosecapture(IHTMLElement2
*iface
, VARIANT
*p
)
2072 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2073 FIXME("(%p)->(%p)\n", This
, p
);
2077 static HRESULT WINAPI
HTMLElement2_componentFromPoint(IHTMLElement2
*iface
,
2078 LONG x
, LONG y
, BSTR
*component
)
2080 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2081 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, component
);
2085 static HRESULT WINAPI
HTMLElement2_doScroll(IHTMLElement2
*iface
, VARIANT component
)
2087 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2089 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&component
));
2091 if(!This
->node
.doc
->content_ready
2092 || !This
->node
.doc
->basedoc
.doc_obj
->in_place_active
)
2099 static HRESULT WINAPI
HTMLElement2_put_onscroll(IHTMLElement2
*iface
, VARIANT v
)
2101 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2102 FIXME("(%p)->()\n", This
);
2106 static HRESULT WINAPI
HTMLElement2_get_onscroll(IHTMLElement2
*iface
, VARIANT
*p
)
2108 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2109 FIXME("(%p)->(%p)\n", This
, p
);
2113 static HRESULT WINAPI
HTMLElement2_put_ondrag(IHTMLElement2
*iface
, VARIANT v
)
2115 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2117 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2119 return set_node_event(&This
->node
, EVENTID_DRAG
, &v
);
2122 static HRESULT WINAPI
HTMLElement2_get_ondrag(IHTMLElement2
*iface
, VARIANT
*p
)
2124 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2126 TRACE("(%p)->(%p)\n", This
, p
);
2128 return get_node_event(&This
->node
, EVENTID_DRAG
, p
);
2131 static HRESULT WINAPI
HTMLElement2_put_ondragend(IHTMLElement2
*iface
, VARIANT v
)
2133 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2134 FIXME("(%p)->()\n", This
);
2138 static HRESULT WINAPI
HTMLElement2_get_ondragend(IHTMLElement2
*iface
, VARIANT
*p
)
2140 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2141 FIXME("(%p)->(%p)\n", This
, p
);
2145 static HRESULT WINAPI
HTMLElement2_put_ondragenter(IHTMLElement2
*iface
, VARIANT v
)
2147 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2148 FIXME("(%p)->()\n", This
);
2152 static HRESULT WINAPI
HTMLElement2_get_ondragenter(IHTMLElement2
*iface
, VARIANT
*p
)
2154 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2155 FIXME("(%p)->(%p)\n", This
, p
);
2159 static HRESULT WINAPI
HTMLElement2_put_ondragover(IHTMLElement2
*iface
, VARIANT v
)
2161 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2162 FIXME("(%p)->()\n", This
);
2166 static HRESULT WINAPI
HTMLElement2_get_ondragover(IHTMLElement2
*iface
, VARIANT
*p
)
2168 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2169 FIXME("(%p)->(%p)\n", This
, p
);
2173 static HRESULT WINAPI
HTMLElement2_put_ondragleave(IHTMLElement2
*iface
, VARIANT v
)
2175 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2176 FIXME("(%p)->()\n", This
);
2180 static HRESULT WINAPI
HTMLElement2_get_ondragleave(IHTMLElement2
*iface
, VARIANT
*p
)
2182 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2183 FIXME("(%p)->(%p)\n", This
, p
);
2187 static HRESULT WINAPI
HTMLElement2_put_ondrop(IHTMLElement2
*iface
, VARIANT v
)
2189 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2190 FIXME("(%p)->()\n", This
);
2194 static HRESULT WINAPI
HTMLElement2_get_ondrop(IHTMLElement2
*iface
, VARIANT
*p
)
2196 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2197 FIXME("(%p)->(%p)\n", This
, p
);
2201 static HRESULT WINAPI
HTMLElement2_put_onbeforecut(IHTMLElement2
*iface
, VARIANT v
)
2203 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2204 FIXME("(%p)->()\n", This
);
2208 static HRESULT WINAPI
HTMLElement2_get_onbeforecut(IHTMLElement2
*iface
, VARIANT
*p
)
2210 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2211 FIXME("(%p)->(%p)\n", This
, p
);
2215 static HRESULT WINAPI
HTMLElement2_put_oncut(IHTMLElement2
*iface
, VARIANT v
)
2217 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2218 FIXME("(%p)->()\n", This
);
2222 static HRESULT WINAPI
HTMLElement2_get_oncut(IHTMLElement2
*iface
, VARIANT
*p
)
2224 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2225 FIXME("(%p)->(%p)\n", This
, p
);
2229 static HRESULT WINAPI
HTMLElement2_put_onbeforecopy(IHTMLElement2
*iface
, VARIANT v
)
2231 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2232 FIXME("(%p)->()\n", This
);
2236 static HRESULT WINAPI
HTMLElement2_get_onbeforecopy(IHTMLElement2
*iface
, VARIANT
*p
)
2238 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2239 FIXME("(%p)->(%p)\n", This
, p
);
2243 static HRESULT WINAPI
HTMLElement2_put_oncopy(IHTMLElement2
*iface
, VARIANT v
)
2245 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2246 FIXME("(%p)->()\n", This
);
2250 static HRESULT WINAPI
HTMLElement2_get_oncopy(IHTMLElement2
*iface
, VARIANT
*p
)
2252 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2253 FIXME("(%p)->(%p)\n", This
, p
);
2257 static HRESULT WINAPI
HTMLElement2_put_onbeforepaste(IHTMLElement2
*iface
, VARIANT v
)
2259 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2260 FIXME("(%p)->()\n", This
);
2264 static HRESULT WINAPI
HTMLElement2_get_onbeforepaste(IHTMLElement2
*iface
, VARIANT
*p
)
2266 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2267 FIXME("(%p)->(%p)\n", This
, p
);
2271 static HRESULT WINAPI
HTMLElement2_put_onpaste(IHTMLElement2
*iface
, VARIANT v
)
2273 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2275 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2277 return set_node_event(&This
->node
, EVENTID_PASTE
, &v
);
2280 static HRESULT WINAPI
HTMLElement2_get_onpaste(IHTMLElement2
*iface
, VARIANT
*p
)
2282 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2284 TRACE("(%p)->(%p)\n", This
, p
);
2286 return get_node_event(&This
->node
, EVENTID_PASTE
, p
);
2289 static HRESULT WINAPI
HTMLElement2_get_currentStyle(IHTMLElement2
*iface
, IHTMLCurrentStyle
**p
)
2291 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2293 TRACE("(%p)->(%p)\n", This
, p
);
2295 return HTMLCurrentStyle_Create(This
, p
);
2298 static HRESULT WINAPI
HTMLElement2_put_onpropertychange(IHTMLElement2
*iface
, VARIANT v
)
2300 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2301 FIXME("(%p)->()\n", This
);
2305 static HRESULT WINAPI
HTMLElement2_get_onpropertychange(IHTMLElement2
*iface
, VARIANT
*p
)
2307 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2308 FIXME("(%p)->(%p)\n", This
, p
);
2312 static HRESULT WINAPI
HTMLElement2_getClientRects(IHTMLElement2
*iface
, IHTMLRectCollection
**pRectCol
)
2314 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2315 FIXME("(%p)->(%p)\n", This
, pRectCol
);
2319 static HRESULT WINAPI
HTMLElement2_getBoundingClientRect(IHTMLElement2
*iface
, IHTMLRect
**pRect
)
2321 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2322 nsIDOMClientRect
*nsrect
;
2326 TRACE("(%p)->(%p)\n", This
, pRect
);
2328 nsres
= nsIDOMHTMLElement_GetBoundingClientRect(This
->nselem
, &nsrect
);
2329 if(NS_FAILED(nsres
) || !nsrect
) {
2330 ERR("GetBoindingClientRect failed: %08x\n", nsres
);
2334 hres
= create_html_rect(nsrect
, pRect
);
2336 nsIDOMClientRect_Release(nsrect
);
2340 static HRESULT WINAPI
HTMLElement2_setExpression(IHTMLElement2
*iface
, BSTR propname
,
2341 BSTR expression
, BSTR language
)
2343 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2344 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(propname
), debugstr_w(expression
),
2345 debugstr_w(language
));
2349 static HRESULT WINAPI
HTMLElement2_getExpression(IHTMLElement2
*iface
, BSTR propname
,
2350 VARIANT
*expression
)
2352 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2353 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), expression
);
2357 static HRESULT WINAPI
HTMLElement2_removeExpression(IHTMLElement2
*iface
, BSTR propname
,
2358 VARIANT_BOOL
*pfSuccess
)
2360 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2361 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), pfSuccess
);
2365 static HRESULT WINAPI
HTMLElement2_put_tabIndex(IHTMLElement2
*iface
, short v
)
2367 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2370 TRACE("(%p)->(%d)\n", This
, v
);
2372 nsres
= nsIDOMHTMLElement_SetTabIndex(This
->nselem
, v
);
2373 if(NS_FAILED(nsres
))
2374 ERR("GetTabIndex failed: %08x\n", nsres
);
2379 static HRESULT WINAPI
HTMLElement2_get_tabIndex(IHTMLElement2
*iface
, short *p
)
2381 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2385 TRACE("(%p)->(%p)\n", This
, p
);
2387 nsres
= nsIDOMHTMLElement_GetTabIndex(This
->nselem
, &index
);
2388 if(NS_FAILED(nsres
)) {
2389 ERR("GetTabIndex failed: %08x\n", nsres
);
2397 static HRESULT WINAPI
HTMLElement2_focus(IHTMLElement2
*iface
)
2399 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2402 TRACE("(%p)\n", This
);
2404 nsres
= nsIDOMHTMLElement_Focus(This
->nselem
);
2405 if(NS_FAILED(nsres
))
2406 ERR("Focus failed: %08x\n", nsres
);
2411 static HRESULT WINAPI
HTMLElement2_put_accessKey(IHTMLElement2
*iface
, BSTR v
)
2413 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2416 static WCHAR accessKeyW
[] = {'a','c','c','e','s','s','K','e','y',0};
2418 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2420 V_VT(&var
) = VT_BSTR
;
2422 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, accessKeyW
, var
, 0);
2425 static HRESULT WINAPI
HTMLElement2_get_accessKey(IHTMLElement2
*iface
, BSTR
*p
)
2427 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2428 FIXME("(%p)->(%p)\n", This
, p
);
2432 static HRESULT WINAPI
HTMLElement2_put_onblur(IHTMLElement2
*iface
, VARIANT v
)
2434 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2436 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2438 return set_node_event(&This
->node
, EVENTID_BLUR
, &v
);
2441 static HRESULT WINAPI
HTMLElement2_get_onblur(IHTMLElement2
*iface
, VARIANT
*p
)
2443 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2445 TRACE("(%p)->(%p)\n", This
, p
);
2447 return get_node_event(&This
->node
, EVENTID_BLUR
, p
);
2450 static HRESULT WINAPI
HTMLElement2_put_onfocus(IHTMLElement2
*iface
, VARIANT v
)
2452 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2454 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2456 return set_node_event(&This
->node
, EVENTID_FOCUS
, &v
);
2459 static HRESULT WINAPI
HTMLElement2_get_onfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2461 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2463 TRACE("(%p)->(%p)\n", This
, p
);
2465 return get_node_event(&This
->node
, EVENTID_FOCUS
, p
);
2468 static HRESULT WINAPI
HTMLElement2_put_onresize(IHTMLElement2
*iface
, VARIANT v
)
2470 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2471 FIXME("(%p)->()\n", This
);
2475 static HRESULT WINAPI
HTMLElement2_get_onresize(IHTMLElement2
*iface
, VARIANT
*p
)
2477 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2478 FIXME("(%p)->(%p)\n", This
, p
);
2482 static HRESULT WINAPI
HTMLElement2_blur(IHTMLElement2
*iface
)
2484 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2487 TRACE("(%p)\n", This
);
2489 nsres
= nsIDOMHTMLElement_Blur(This
->nselem
);
2490 if(NS_FAILED(nsres
)) {
2491 ERR("Blur failed: %08x\n", nsres
);
2498 static HRESULT WINAPI
HTMLElement2_addFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2500 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2501 FIXME("(%p)->(%p)\n", This
, pUnk
);
2505 static HRESULT WINAPI
HTMLElement2_removeFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2507 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2508 FIXME("(%p)->(%p)\n", This
, pUnk
);
2512 static HRESULT WINAPI
HTMLElement2_get_clientHeight(IHTMLElement2
*iface
, LONG
*p
)
2514 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2517 TRACE("(%p)->(%p)\n", This
, p
);
2519 nsres
= nsIDOMHTMLElement_GetClientHeight(This
->nselem
, p
);
2520 assert(nsres
== NS_OK
);
2524 static HRESULT WINAPI
HTMLElement2_get_clientWidth(IHTMLElement2
*iface
, LONG
*p
)
2526 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2529 TRACE("(%p)->(%p)\n", This
, p
);
2531 nsres
= nsIDOMHTMLElement_GetClientWidth(This
->nselem
, p
);
2532 assert(nsres
== NS_OK
);
2536 static HRESULT WINAPI
HTMLElement2_get_clientTop(IHTMLElement2
*iface
, LONG
*p
)
2538 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2541 TRACE("(%p)->(%p)\n", This
, p
);
2543 nsres
= nsIDOMHTMLElement_GetClientTop(This
->nselem
, p
);
2544 assert(nsres
== NS_OK
);
2546 TRACE("*p = %d\n", *p
);
2550 static HRESULT WINAPI
HTMLElement2_get_clientLeft(IHTMLElement2
*iface
, LONG
*p
)
2552 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2555 TRACE("(%p)->(%p)\n", This
, p
);
2557 nsres
= nsIDOMHTMLElement_GetClientLeft(This
->nselem
, p
);
2558 assert(nsres
== NS_OK
);
2560 TRACE("*p = %d\n", *p
);
2564 static HRESULT WINAPI
HTMLElement2_attachEvent(IHTMLElement2
*iface
, BSTR event
,
2565 IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
2567 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2569 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2571 return attach_event(&This
->node
.event_target
, event
, pDisp
, pfResult
);
2574 static HRESULT WINAPI
HTMLElement2_detachEvent(IHTMLElement2
*iface
, BSTR event
, IDispatch
*pDisp
)
2576 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2578 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2580 return detach_event(&This
->node
.event_target
, event
, pDisp
);
2583 static HRESULT WINAPI
HTMLElement2_get_readyState(IHTMLElement2
*iface
, VARIANT
*p
)
2585 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2588 TRACE("(%p)->(%p)\n", This
, p
);
2590 if(This
->node
.vtbl
->get_readystate
) {
2593 hres
= This
->node
.vtbl
->get_readystate(&This
->node
, &str
);
2597 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
2599 str
= SysAllocString(completeW
);
2601 return E_OUTOFMEMORY
;
2609 static HRESULT WINAPI
HTMLElement2_put_onreadystatechange(IHTMLElement2
*iface
, VARIANT v
)
2611 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2613 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2615 return set_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, &v
);
2618 static HRESULT WINAPI
HTMLElement2_get_onreadystatechange(IHTMLElement2
*iface
, VARIANT
*p
)
2620 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2622 TRACE("(%p)->(%p)\n", This
, p
);
2624 return get_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, p
);
2627 static HRESULT WINAPI
HTMLElement2_put_onrowsdelete(IHTMLElement2
*iface
, VARIANT v
)
2629 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2630 FIXME("(%p)->()\n", This
);
2634 static HRESULT WINAPI
HTMLElement2_get_onrowsdelete(IHTMLElement2
*iface
, VARIANT
*p
)
2636 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2637 FIXME("(%p)->(%p)\n", This
, p
);
2641 static HRESULT WINAPI
HTMLElement2_put_onrowsinserted(IHTMLElement2
*iface
, VARIANT v
)
2643 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2644 FIXME("(%p)->()\n", This
);
2648 static HRESULT WINAPI
HTMLElement2_get_onrowsinserted(IHTMLElement2
*iface
, VARIANT
*p
)
2650 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2651 FIXME("(%p)->(%p)\n", This
, p
);
2655 static HRESULT WINAPI
HTMLElement2_put_oncellchange(IHTMLElement2
*iface
, VARIANT v
)
2657 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2658 FIXME("(%p)->()\n", This
);
2662 static HRESULT WINAPI
HTMLElement2_get_oncellchange(IHTMLElement2
*iface
, VARIANT
*p
)
2664 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2665 FIXME("(%p)->(%p)\n", This
, p
);
2669 static HRESULT WINAPI
HTMLElement2_put_dir(IHTMLElement2
*iface
, BSTR v
)
2671 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2675 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2678 FIXME("Unsupported for comment nodes.\n");
2682 nsAString_InitDepend(&nsstr
, v
);
2683 nsres
= nsIDOMHTMLElement_SetDir(This
->nselem
, &nsstr
);
2684 nsAString_Finish(&nsstr
);
2685 if(NS_FAILED(nsres
)) {
2686 ERR("SetDir failed: %08x\n", nsres
);
2693 static HRESULT WINAPI
HTMLElement2_get_dir(IHTMLElement2
*iface
, BSTR
*p
)
2695 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2699 TRACE("(%p)->(%p)\n", This
, p
);
2706 nsAString_Init(&dir_str
, NULL
);
2707 nsres
= nsIDOMHTMLElement_GetDir(This
->nselem
, &dir_str
);
2708 return return_nsstr(nsres
, &dir_str
, p
);
2711 static HRESULT WINAPI
HTMLElement2_createControlRange(IHTMLElement2
*iface
, IDispatch
**range
)
2713 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2714 FIXME("(%p)->(%p)\n", This
, range
);
2718 static HRESULT WINAPI
HTMLElement2_get_scrollHeight(IHTMLElement2
*iface
, LONG
*p
)
2720 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2723 TRACE("(%p)->(%p)\n", This
, p
);
2725 nsres
= nsIDOMHTMLElement_GetScrollHeight(This
->nselem
, p
);
2726 assert(nsres
== NS_OK
);
2728 TRACE("*p = %d\n", *p
);
2732 static HRESULT WINAPI
HTMLElement2_get_scrollWidth(IHTMLElement2
*iface
, LONG
*p
)
2734 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2737 TRACE("(%p)->(%p)\n", This
, p
);
2739 nsres
= nsIDOMHTMLElement_GetScrollWidth(This
->nselem
, p
);
2740 assert(nsres
== NS_OK
);
2742 TRACE("*p = %d\n", *p
);
2746 static HRESULT WINAPI
HTMLElement2_put_scrollTop(IHTMLElement2
*iface
, LONG v
)
2748 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2750 TRACE("(%p)->(%d)\n", This
, v
);
2753 FIXME("NULL nselem\n");
2757 nsIDOMHTMLElement_SetScrollTop(This
->nselem
, v
);
2761 static HRESULT WINAPI
HTMLElement2_get_scrollTop(IHTMLElement2
*iface
, LONG
*p
)
2763 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2766 TRACE("(%p)->(%p)\n", This
, p
);
2768 nsres
= nsIDOMHTMLElement_GetScrollTop(This
->nselem
, p
);
2769 assert(nsres
== NS_OK
);
2771 TRACE("*p = %d\n", *p
);
2775 static HRESULT WINAPI
HTMLElement2_put_scrollLeft(IHTMLElement2
*iface
, LONG v
)
2777 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2779 TRACE("(%p)->(%d)\n", This
, v
);
2782 FIXME("NULL nselem\n");
2786 nsIDOMHTMLElement_SetScrollLeft(This
->nselem
, v
);
2790 static HRESULT WINAPI
HTMLElement2_get_scrollLeft(IHTMLElement2
*iface
, LONG
*p
)
2792 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2795 TRACE("(%p)->(%p)\n", This
, p
);
2798 return E_INVALIDARG
;
2802 FIXME("NULL nselem\n");
2806 nsres
= nsIDOMHTMLElement_GetScrollLeft(This
->nselem
, p
);
2807 assert(nsres
== NS_OK
);
2809 TRACE("*p = %d\n", *p
);
2813 static HRESULT WINAPI
HTMLElement2_clearAttributes(IHTMLElement2
*iface
)
2815 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2816 FIXME("(%p)\n", This
);
2820 static HRESULT WINAPI
HTMLElement2_mergeAttributes(IHTMLElement2
*iface
, IHTMLElement
*mergeThis
)
2822 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2823 FIXME("(%p)->(%p)\n", This
, mergeThis
);
2827 static HRESULT WINAPI
HTMLElement2_put_oncontextmenu(IHTMLElement2
*iface
, VARIANT v
)
2829 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2830 FIXME("(%p)->()\n", This
);
2834 static HRESULT WINAPI
HTMLElement2_get_oncontextmenu(IHTMLElement2
*iface
, VARIANT
*p
)
2836 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2837 FIXME("(%p)->(%p)\n", This
, p
);
2841 static HRESULT WINAPI
HTMLElement2_insertAdjacentElement(IHTMLElement2
*iface
, BSTR where
,
2842 IHTMLElement
*insertedElement
, IHTMLElement
**inserted
)
2844 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2845 HTMLDOMNode
*ret_node
;
2849 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(where
), insertedElement
, inserted
);
2851 elem
= unsafe_impl_from_IHTMLElement(insertedElement
);
2853 return E_INVALIDARG
;
2855 hres
= insert_adjacent_node(This
, where
, elem
->node
.nsnode
, &ret_node
);
2859 hres
= IHTMLDOMNode_QueryInterface(&ret_node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)inserted
);
2860 IHTMLDOMNode_Release(&ret_node
->IHTMLDOMNode_iface
);
2864 static HRESULT WINAPI
HTMLElement2_applyElement(IHTMLElement2
*iface
, IHTMLElement
*apply
,
2865 BSTR where
, IHTMLElement
**applied
)
2867 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2868 FIXME("(%p)->(%p %s %p)\n", This
, apply
, debugstr_w(where
), applied
);
2872 static HRESULT WINAPI
HTMLElement2_getAdjacentText(IHTMLElement2
*iface
, BSTR where
, BSTR
*text
)
2874 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2875 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(where
), text
);
2879 static HRESULT WINAPI
HTMLElement2_replaceAdjacentText(IHTMLElement2
*iface
, BSTR where
,
2880 BSTR newText
, BSTR
*oldText
)
2882 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2883 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(where
), debugstr_w(newText
), oldText
);
2887 static HRESULT WINAPI
HTMLElement2_get_canHandleChildren(IHTMLElement2
*iface
, VARIANT_BOOL
*p
)
2889 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2890 FIXME("(%p)->(%p)\n", This
, p
);
2894 static HRESULT WINAPI
HTMLElement2_addBehavior(IHTMLElement2
*iface
, BSTR bstrUrl
,
2895 VARIANT
*pvarFactory
, LONG
*pCookie
)
2897 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2898 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrUrl
), pvarFactory
, pCookie
);
2902 static HRESULT WINAPI
HTMLElement2_removeBehavior(IHTMLElement2
*iface
, LONG cookie
,
2903 VARIANT_BOOL
*pfResult
)
2905 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2906 FIXME("(%p)->(%d %p)\n", This
, cookie
, pfResult
);
2910 static HRESULT WINAPI
HTMLElement2_get_runtimeStyle(IHTMLElement2
*iface
, IHTMLStyle
**p
)
2912 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2914 FIXME("(%p)->(%p): hack\n", This
, p
);
2916 /* We can't implement correct behavior on top of Gecko (although we could
2917 try a bit harder). Making runtimeStyle behave like regular style is
2918 enough for most use cases. */
2919 if(!This
->runtime_style
) {
2922 hres
= HTMLStyle_Create(This
, &This
->runtime_style
);
2927 *p
= &This
->runtime_style
->IHTMLStyle_iface
;
2928 IHTMLStyle_AddRef(*p
);
2932 static HRESULT WINAPI
HTMLElement2_get_behaviorUrns(IHTMLElement2
*iface
, IDispatch
**p
)
2934 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2935 FIXME("(%p)->(%p)\n", This
, p
);
2939 static HRESULT WINAPI
HTMLElement2_put_tagUrn(IHTMLElement2
*iface
, BSTR v
)
2941 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2942 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2946 static HRESULT WINAPI
HTMLElement2_get_tagUrn(IHTMLElement2
*iface
, BSTR
*p
)
2948 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2949 FIXME("(%p)->(%p)\n", This
, p
);
2953 static HRESULT WINAPI
HTMLElement2_put_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT vv
)
2955 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2956 FIXME("(%p)->()\n", This
);
2960 static HRESULT WINAPI
HTMLElement2_get_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2962 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2963 FIXME("(%p)->(%p)\n", This
, p
);
2967 static HRESULT WINAPI
HTMLElement2_get_readyStateValue(IHTMLElement2
*iface
, LONG
*p
)
2969 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2970 FIXME("(%p)->(%p)\n", This
, p
);
2974 static HRESULT WINAPI
HTMLElement2_getElementsByTagName(IHTMLElement2
*iface
, BSTR v
,
2975 IHTMLElementCollection
**pelColl
)
2977 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2978 nsIDOMHTMLCollection
*nscol
;
2982 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2984 nsAString_InitDepend(&tag_str
, v
);
2985 nsres
= nsIDOMHTMLElement_GetElementsByTagName(This
->nselem
, &tag_str
, &nscol
);
2986 nsAString_Finish(&tag_str
);
2987 if(NS_FAILED(nsres
)) {
2988 ERR("GetElementByTagName failed: %08x\n", nsres
);
2992 *pelColl
= create_collection_from_htmlcol(This
->node
.doc
, nscol
);
2993 nsIDOMHTMLCollection_Release(nscol
);
2997 static const IHTMLElement2Vtbl HTMLElement2Vtbl
= {
2998 HTMLElement2_QueryInterface
,
2999 HTMLElement2_AddRef
,
3000 HTMLElement2_Release
,
3001 HTMLElement2_GetTypeInfoCount
,
3002 HTMLElement2_GetTypeInfo
,
3003 HTMLElement2_GetIDsOfNames
,
3004 HTMLElement2_Invoke
,
3005 HTMLElement2_get_scopeName
,
3006 HTMLElement2_setCapture
,
3007 HTMLElement2_releaseCapture
,
3008 HTMLElement2_put_onlosecapture
,
3009 HTMLElement2_get_onlosecapture
,
3010 HTMLElement2_componentFromPoint
,
3011 HTMLElement2_doScroll
,
3012 HTMLElement2_put_onscroll
,
3013 HTMLElement2_get_onscroll
,
3014 HTMLElement2_put_ondrag
,
3015 HTMLElement2_get_ondrag
,
3016 HTMLElement2_put_ondragend
,
3017 HTMLElement2_get_ondragend
,
3018 HTMLElement2_put_ondragenter
,
3019 HTMLElement2_get_ondragenter
,
3020 HTMLElement2_put_ondragover
,
3021 HTMLElement2_get_ondragover
,
3022 HTMLElement2_put_ondragleave
,
3023 HTMLElement2_get_ondragleave
,
3024 HTMLElement2_put_ondrop
,
3025 HTMLElement2_get_ondrop
,
3026 HTMLElement2_put_onbeforecut
,
3027 HTMLElement2_get_onbeforecut
,
3028 HTMLElement2_put_oncut
,
3029 HTMLElement2_get_oncut
,
3030 HTMLElement2_put_onbeforecopy
,
3031 HTMLElement2_get_onbeforecopy
,
3032 HTMLElement2_put_oncopy
,
3033 HTMLElement2_get_oncopy
,
3034 HTMLElement2_put_onbeforepaste
,
3035 HTMLElement2_get_onbeforepaste
,
3036 HTMLElement2_put_onpaste
,
3037 HTMLElement2_get_onpaste
,
3038 HTMLElement2_get_currentStyle
,
3039 HTMLElement2_put_onpropertychange
,
3040 HTMLElement2_get_onpropertychange
,
3041 HTMLElement2_getClientRects
,
3042 HTMLElement2_getBoundingClientRect
,
3043 HTMLElement2_setExpression
,
3044 HTMLElement2_getExpression
,
3045 HTMLElement2_removeExpression
,
3046 HTMLElement2_put_tabIndex
,
3047 HTMLElement2_get_tabIndex
,
3049 HTMLElement2_put_accessKey
,
3050 HTMLElement2_get_accessKey
,
3051 HTMLElement2_put_onblur
,
3052 HTMLElement2_get_onblur
,
3053 HTMLElement2_put_onfocus
,
3054 HTMLElement2_get_onfocus
,
3055 HTMLElement2_put_onresize
,
3056 HTMLElement2_get_onresize
,
3058 HTMLElement2_addFilter
,
3059 HTMLElement2_removeFilter
,
3060 HTMLElement2_get_clientHeight
,
3061 HTMLElement2_get_clientWidth
,
3062 HTMLElement2_get_clientTop
,
3063 HTMLElement2_get_clientLeft
,
3064 HTMLElement2_attachEvent
,
3065 HTMLElement2_detachEvent
,
3066 HTMLElement2_get_readyState
,
3067 HTMLElement2_put_onreadystatechange
,
3068 HTMLElement2_get_onreadystatechange
,
3069 HTMLElement2_put_onrowsdelete
,
3070 HTMLElement2_get_onrowsdelete
,
3071 HTMLElement2_put_onrowsinserted
,
3072 HTMLElement2_get_onrowsinserted
,
3073 HTMLElement2_put_oncellchange
,
3074 HTMLElement2_get_oncellchange
,
3075 HTMLElement2_put_dir
,
3076 HTMLElement2_get_dir
,
3077 HTMLElement2_createControlRange
,
3078 HTMLElement2_get_scrollHeight
,
3079 HTMLElement2_get_scrollWidth
,
3080 HTMLElement2_put_scrollTop
,
3081 HTMLElement2_get_scrollTop
,
3082 HTMLElement2_put_scrollLeft
,
3083 HTMLElement2_get_scrollLeft
,
3084 HTMLElement2_clearAttributes
,
3085 HTMLElement2_mergeAttributes
,
3086 HTMLElement2_put_oncontextmenu
,
3087 HTMLElement2_get_oncontextmenu
,
3088 HTMLElement2_insertAdjacentElement
,
3089 HTMLElement2_applyElement
,
3090 HTMLElement2_getAdjacentText
,
3091 HTMLElement2_replaceAdjacentText
,
3092 HTMLElement2_get_canHandleChildren
,
3093 HTMLElement2_addBehavior
,
3094 HTMLElement2_removeBehavior
,
3095 HTMLElement2_get_runtimeStyle
,
3096 HTMLElement2_get_behaviorUrns
,
3097 HTMLElement2_put_tagUrn
,
3098 HTMLElement2_get_tagUrn
,
3099 HTMLElement2_put_onbeforeeditfocus
,
3100 HTMLElement2_get_onbeforeeditfocus
,
3101 HTMLElement2_get_readyStateValue
,
3102 HTMLElement2_getElementsByTagName
,
3105 static inline HTMLElement
*impl_from_IHTMLElement3(IHTMLElement3
*iface
)
3107 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement3_iface
);
3110 static HRESULT WINAPI
HTMLElement3_QueryInterface(IHTMLElement3
*iface
,
3111 REFIID riid
, void **ppv
)
3113 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3114 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3117 static ULONG WINAPI
HTMLElement3_AddRef(IHTMLElement3
*iface
)
3119 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3120 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3123 static ULONG WINAPI
HTMLElement3_Release(IHTMLElement3
*iface
)
3125 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3126 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3129 static HRESULT WINAPI
HTMLElement3_GetTypeInfoCount(IHTMLElement3
*iface
, UINT
*pctinfo
)
3131 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3132 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
3135 static HRESULT WINAPI
HTMLElement3_GetTypeInfo(IHTMLElement3
*iface
, UINT iTInfo
,
3136 LCID lcid
, ITypeInfo
**ppTInfo
)
3138 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3139 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3142 static HRESULT WINAPI
HTMLElement3_GetIDsOfNames(IHTMLElement3
*iface
, REFIID riid
,
3143 LPOLESTR
*rgszNames
, UINT cNames
,
3144 LCID lcid
, DISPID
*rgDispId
)
3146 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3147 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3151 static HRESULT WINAPI
HTMLElement3_Invoke(IHTMLElement3
*iface
, DISPID dispIdMember
,
3152 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3153 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3155 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3156 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3157 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3160 static HRESULT WINAPI
HTMLElement3_mergeAttributes(IHTMLElement3
*iface
, IHTMLElement
*mergeThis
, VARIANT
*pvarFlags
)
3162 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3163 FIXME("(%p)->(%p %p)\n", This
, mergeThis
, pvarFlags
);
3167 static HRESULT WINAPI
HTMLElement3_get_isMultiLine(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3169 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3170 FIXME("(%p)->(%p)\n", This
, p
);
3174 static HRESULT WINAPI
HTMLElement3_get_canHaveHTML(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3176 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3177 FIXME("(%p)->(%p)\n", This
, p
);
3181 static HRESULT WINAPI
HTMLElement3_put_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT v
)
3183 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3184 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3188 static HRESULT WINAPI
HTMLElement3_get_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT
*p
)
3190 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3191 FIXME("(%p)->(%p)\n", This
, p
);
3195 static HRESULT WINAPI
HTMLElement3_put_onpage(IHTMLElement3
*iface
, VARIANT v
)
3197 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3198 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3202 static HRESULT WINAPI
HTMLElement3_get_onpage(IHTMLElement3
*iface
, VARIANT
*p
)
3204 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3205 FIXME("(%p)->(%p)\n", This
, p
);
3209 static HRESULT WINAPI
HTMLElement3_put_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3211 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3212 FIXME("(%p)->(%x)\n", This
, v
);
3216 static HRESULT WINAPI
HTMLElement3_get_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3218 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3219 FIXME("(%p)->(%p)\n", This
, p
);
3223 static HRESULT WINAPI
HTMLElement3_put_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT v
)
3225 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3226 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3230 static HRESULT WINAPI
HTMLElement3_get_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3232 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3233 FIXME("(%p)->(%p)\n", This
, p
);
3237 static HRESULT WINAPI
HTMLElement3_setActive(IHTMLElement3
*iface
)
3239 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3240 FIXME("(%p)\n", This
);
3244 static HRESULT WINAPI
HTMLElement3_put_contentEditable(IHTMLElement3
*iface
, BSTR v
)
3246 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3250 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3252 nsAString_InitDepend(&str
, v
);
3253 nsres
= nsIDOMHTMLElement_SetContentEditable(This
->nselem
, &str
);
3254 nsAString_Finish(&str
);
3256 if (NS_FAILED(nsres
)){
3257 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v
));
3264 static HRESULT WINAPI
HTMLElement3_get_contentEditable(IHTMLElement3
*iface
, BSTR
*p
)
3266 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3270 TRACE("(%p)->(%p)\n", This
, p
);
3272 nsAString_Init(&str
, NULL
);
3273 nsres
= nsIDOMHTMLElement_GetContentEditable(This
->nselem
, &str
);
3274 return return_nsstr(nsres
, &str
, p
);
3277 static HRESULT WINAPI
HTMLElement3_get_isContentEditable(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3279 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3280 FIXME("(%p)->(%p)\n", This
, p
);
3284 static HRESULT WINAPI
HTMLElement3_put_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3286 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3287 FIXME("(%p)->(%x)\n", This
, v
);
3291 static HRESULT WINAPI
HTMLElement3_get_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3293 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3294 FIXME("(%p)->(%p)\n", This
, p
);
3298 static const WCHAR disabledW
[] = {'d','i','s','a','b','l','e','d',0};
3300 static HRESULT WINAPI
HTMLElement3_put_disabled(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3302 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3306 TRACE("(%p)->(%x)\n", This
, v
);
3308 if(This
->node
.vtbl
->put_disabled
)
3309 return This
->node
.vtbl
->put_disabled(&This
->node
, v
);
3311 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, TRUE
, &var
);
3316 V_VT(var
) = VT_BOOL
;
3321 static HRESULT WINAPI
HTMLElement3_get_disabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3323 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3327 TRACE("(%p)->(%p)\n", This
, p
);
3329 if(This
->node
.vtbl
->get_disabled
)
3330 return This
->node
.vtbl
->get_disabled(&This
->node
, p
);
3332 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, FALSE
, &var
);
3333 if(hres
== DISP_E_UNKNOWNNAME
) {
3340 if(V_VT(var
) != VT_BOOL
) {
3341 FIXME("value is %s\n", debugstr_variant(var
));
3349 static HRESULT WINAPI
HTMLElement3_get_isDisabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3351 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3352 FIXME("(%p)->(%p)\n", This
, p
);
3356 static HRESULT WINAPI
HTMLElement3_put_onmove(IHTMLElement3
*iface
, VARIANT v
)
3358 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3359 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3363 static HRESULT WINAPI
HTMLElement3_get_onmove(IHTMLElement3
*iface
, VARIANT
*p
)
3365 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3366 FIXME("(%p)->(%p)\n", This
, p
);
3370 static HRESULT WINAPI
HTMLElement3_put_oncontrolselect(IHTMLElement3
*iface
, VARIANT v
)
3372 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3373 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3377 static HRESULT WINAPI
HTMLElement3_get_oncontrolselect(IHTMLElement3
*iface
, VARIANT
*p
)
3379 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3380 FIXME("(%p)->(%p)\n", This
, p
);
3384 static HRESULT WINAPI
HTMLElement3_fireEvent(IHTMLElement3
*iface
, BSTR bstrEventName
,
3385 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCancelled
)
3387 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3389 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrEventName
), debugstr_variant(pvarEventObject
),
3392 return dispatch_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCancelled
);
3395 static HRESULT WINAPI
HTMLElement3_put_onresizestart(IHTMLElement3
*iface
, VARIANT v
)
3397 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3398 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3402 static HRESULT WINAPI
HTMLElement3_get_onresizestart(IHTMLElement3
*iface
, VARIANT
*p
)
3404 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3405 FIXME("(%p)->(%p)\n", This
, p
);
3409 static HRESULT WINAPI
HTMLElement3_put_onresizeend(IHTMLElement3
*iface
, VARIANT v
)
3411 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3412 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3416 static HRESULT WINAPI
HTMLElement3_get_onresizeend(IHTMLElement3
*iface
, VARIANT
*p
)
3418 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3419 FIXME("(%p)->(%p)\n", This
, p
);
3423 static HRESULT WINAPI
HTMLElement3_put_onmovestart(IHTMLElement3
*iface
, VARIANT v
)
3425 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3426 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3430 static HRESULT WINAPI
HTMLElement3_get_onmovestart(IHTMLElement3
*iface
, VARIANT
*p
)
3432 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3433 FIXME("(%p)->(%p)\n", This
, p
);
3437 static HRESULT WINAPI
HTMLElement3_put_onmoveend(IHTMLElement3
*iface
, VARIANT v
)
3439 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3440 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3444 static HRESULT WINAPI
HTMLElement3_get_onmoveend(IHTMLElement3
*iface
, VARIANT
*p
)
3446 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3447 FIXME("(%p)->(%p)\n", This
, p
);
3451 static HRESULT WINAPI
HTMLElement3_put_onmousecenter(IHTMLElement3
*iface
, VARIANT v
)
3453 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3454 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3458 static HRESULT WINAPI
HTMLElement3_get_onmousecenter(IHTMLElement3
*iface
, VARIANT
*p
)
3460 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3461 FIXME("(%p)->(%p)\n", This
, p
);
3465 static HRESULT WINAPI
HTMLElement3_put_onmouseleave(IHTMLElement3
*iface
, VARIANT v
)
3467 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3468 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3472 static HRESULT WINAPI
HTMLElement3_get_onmouseleave(IHTMLElement3
*iface
, VARIANT
*p
)
3474 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3475 FIXME("(%p)->(%p)\n", This
, p
);
3479 static HRESULT WINAPI
HTMLElement3_put_onactivate(IHTMLElement3
*iface
, VARIANT v
)
3481 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3482 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3486 static HRESULT WINAPI
HTMLElement3_get_onactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3488 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3489 FIXME("(%p)->(%p)\n", This
, p
);
3493 static HRESULT WINAPI
HTMLElement3_put_ondeactivate(IHTMLElement3
*iface
, VARIANT v
)
3495 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3496 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3500 static HRESULT WINAPI
HTMLElement3_get_ondeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3502 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3503 FIXME("(%p)->(%p)\n", This
, p
);
3507 static HRESULT WINAPI
HTMLElement3_dragDrop(IHTMLElement3
*iface
, VARIANT_BOOL
*pfRet
)
3509 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3510 FIXME("(%p)->(%p)\n", This
, pfRet
);
3514 static HRESULT WINAPI
HTMLElement3_get_glyphMode(IHTMLElement3
*iface
, LONG
*p
)
3516 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3517 FIXME("(%p)->(%p)\n", This
, p
);
3521 static const IHTMLElement3Vtbl HTMLElement3Vtbl
= {
3522 HTMLElement3_QueryInterface
,
3523 HTMLElement3_AddRef
,
3524 HTMLElement3_Release
,
3525 HTMLElement3_GetTypeInfoCount
,
3526 HTMLElement3_GetTypeInfo
,
3527 HTMLElement3_GetIDsOfNames
,
3528 HTMLElement3_Invoke
,
3529 HTMLElement3_mergeAttributes
,
3530 HTMLElement3_get_isMultiLine
,
3531 HTMLElement3_get_canHaveHTML
,
3532 HTMLElement3_put_onlayoutcomplete
,
3533 HTMLElement3_get_onlayoutcomplete
,
3534 HTMLElement3_put_onpage
,
3535 HTMLElement3_get_onpage
,
3536 HTMLElement3_put_inflateBlock
,
3537 HTMLElement3_get_inflateBlock
,
3538 HTMLElement3_put_onbeforedeactivate
,
3539 HTMLElement3_get_onbeforedeactivate
,
3540 HTMLElement3_setActive
,
3541 HTMLElement3_put_contentEditable
,
3542 HTMLElement3_get_contentEditable
,
3543 HTMLElement3_get_isContentEditable
,
3544 HTMLElement3_put_hideFocus
,
3545 HTMLElement3_get_hideFocus
,
3546 HTMLElement3_put_disabled
,
3547 HTMLElement3_get_disabled
,
3548 HTMLElement3_get_isDisabled
,
3549 HTMLElement3_put_onmove
,
3550 HTMLElement3_get_onmove
,
3551 HTMLElement3_put_oncontrolselect
,
3552 HTMLElement3_get_oncontrolselect
,
3553 HTMLElement3_fireEvent
,
3554 HTMLElement3_put_onresizestart
,
3555 HTMLElement3_get_onresizestart
,
3556 HTMLElement3_put_onresizeend
,
3557 HTMLElement3_get_onresizeend
,
3558 HTMLElement3_put_onmovestart
,
3559 HTMLElement3_get_onmovestart
,
3560 HTMLElement3_put_onmoveend
,
3561 HTMLElement3_get_onmoveend
,
3562 HTMLElement3_put_onmousecenter
,
3563 HTMLElement3_get_onmousecenter
,
3564 HTMLElement3_put_onmouseleave
,
3565 HTMLElement3_get_onmouseleave
,
3566 HTMLElement3_put_onactivate
,
3567 HTMLElement3_get_onactivate
,
3568 HTMLElement3_put_ondeactivate
,
3569 HTMLElement3_get_ondeactivate
,
3570 HTMLElement3_dragDrop
,
3571 HTMLElement3_get_glyphMode
3574 static inline HTMLElement
*impl_from_IHTMLElement4(IHTMLElement4
*iface
)
3576 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement4_iface
);
3579 static HRESULT WINAPI
HTMLElement4_QueryInterface(IHTMLElement4
*iface
,
3580 REFIID riid
, void **ppv
)
3582 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3583 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3586 static ULONG WINAPI
HTMLElement4_AddRef(IHTMLElement4
*iface
)
3588 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3589 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3592 static ULONG WINAPI
HTMLElement4_Release(IHTMLElement4
*iface
)
3594 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3595 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3598 static HRESULT WINAPI
HTMLElement4_GetTypeInfoCount(IHTMLElement4
*iface
, UINT
*pctinfo
)
3600 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3601 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
3604 static HRESULT WINAPI
HTMLElement4_GetTypeInfo(IHTMLElement4
*iface
, UINT iTInfo
,
3605 LCID lcid
, ITypeInfo
**ppTInfo
)
3607 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3608 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3611 static HRESULT WINAPI
HTMLElement4_GetIDsOfNames(IHTMLElement4
*iface
, REFIID riid
,
3612 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3614 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3615 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3619 static HRESULT WINAPI
HTMLElement4_Invoke(IHTMLElement4
*iface
, DISPID dispIdMember
, REFIID riid
,
3620 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3622 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3623 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3624 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3627 static HRESULT WINAPI
HTMLElement4_put_onmousewheel(IHTMLElement4
*iface
, VARIANT v
)
3629 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3631 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3633 return set_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, &v
);
3636 static HRESULT WINAPI
HTMLElement4_get_onmousewheel(IHTMLElement4
*iface
, VARIANT
*p
)
3638 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3640 TRACE("(%p)->(%p)\n", This
, p
);
3642 return get_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, p
);
3645 static HRESULT WINAPI
HTMLElement4_normalize(IHTMLElement4
*iface
)
3647 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3648 FIXME("(%p)\n", This
);
3652 static HRESULT WINAPI
HTMLElement4_getAttributeNode(IHTMLElement4
*iface
, BSTR bstrname
, IHTMLDOMAttribute
**ppAttribute
)
3654 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3655 HTMLAttributeCollection
*attrs
;
3658 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrname
), ppAttribute
);
3660 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
3664 hres
= IHTMLAttributeCollection2_getNamedItem(&attrs
->IHTMLAttributeCollection2_iface
, bstrname
, ppAttribute
);
3665 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
3669 static HRESULT WINAPI
HTMLElement4_setAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3670 IHTMLDOMAttribute
**ppretAttribute
)
3672 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3673 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3677 static HRESULT WINAPI
HTMLElement4_removeAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3678 IHTMLDOMAttribute
**ppretAttribute
)
3680 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3681 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3685 static HRESULT WINAPI
HTMLElement4_put_onbeforeactivate(IHTMLElement4
*iface
, VARIANT v
)
3687 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3688 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3692 static HRESULT WINAPI
HTMLElement4_get_onbeforeactivate(IHTMLElement4
*iface
, VARIANT
*p
)
3694 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3695 FIXME("(%p)->(%p)\n", This
, p
);
3699 static HRESULT WINAPI
HTMLElement4_put_onfocusin(IHTMLElement4
*iface
, VARIANT v
)
3701 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3703 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3705 return set_node_event(&This
->node
, EVENTID_FOCUSIN
, &v
);
3708 static HRESULT WINAPI
HTMLElement4_get_onfocusin(IHTMLElement4
*iface
, VARIANT
*p
)
3710 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3712 TRACE("(%p)->(%p)\n", This
, p
);
3714 return get_node_event(&This
->node
, EVENTID_FOCUSIN
, p
);
3717 static HRESULT WINAPI
HTMLElement4_put_onfocusout(IHTMLElement4
*iface
, VARIANT v
)
3719 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3720 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3724 static HRESULT WINAPI
HTMLElement4_get_onfocusout(IHTMLElement4
*iface
, VARIANT
*p
)
3726 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3727 FIXME("(%p)->(%p)\n", This
, p
);
3731 static const IHTMLElement4Vtbl HTMLElement4Vtbl
= {
3732 HTMLElement4_QueryInterface
,
3733 HTMLElement4_AddRef
,
3734 HTMLElement4_Release
,
3735 HTMLElement4_GetTypeInfoCount
,
3736 HTMLElement4_GetTypeInfo
,
3737 HTMLElement4_GetIDsOfNames
,
3738 HTMLElement4_Invoke
,
3739 HTMLElement4_put_onmousewheel
,
3740 HTMLElement4_get_onmousewheel
,
3741 HTMLElement4_normalize
,
3742 HTMLElement4_getAttributeNode
,
3743 HTMLElement4_setAttributeNode
,
3744 HTMLElement4_removeAttributeNode
,
3745 HTMLElement4_put_onbeforeactivate
,
3746 HTMLElement4_get_onbeforeactivate
,
3747 HTMLElement4_put_onfocusin
,
3748 HTMLElement4_get_onfocusin
,
3749 HTMLElement4_put_onfocusout
,
3750 HTMLElement4_get_onfocusout
3753 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
3755 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
3758 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
3760 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3762 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
3763 *ppv
= &This
->IHTMLElement_iface
;
3764 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
3765 *ppv
= &This
->IHTMLElement_iface
;
3766 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
3767 *ppv
= &This
->IHTMLElement_iface
;
3768 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
3769 *ppv
= &This
->IHTMLElement2_iface
;
3770 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
3771 *ppv
= &This
->IHTMLElement3_iface
;
3772 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
3773 *ppv
= &This
->IHTMLElement4_iface
;
3774 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
3775 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
3777 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
3780 IUnknown_AddRef((IUnknown
*)*ppv
);
3784 void HTMLElement_destructor(HTMLDOMNode
*iface
)
3786 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3788 ConnectionPointContainer_Destroy(&This
->cp_container
);
3791 This
->style
->elem
= NULL
;
3792 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
3794 if(This
->runtime_style
) {
3795 This
->runtime_style
->elem
= NULL
;
3796 IHTMLStyle_Release(&This
->runtime_style
->IHTMLStyle_iface
);
3799 HTMLDOMAttribute
*attr
;
3801 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
3804 This
->attrs
->elem
= NULL
;
3805 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
3808 heap_free(This
->filter
);
3810 HTMLDOMNode_destructor(&This
->node
);
3813 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
3815 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3816 HTMLElement
*new_elem
;
3819 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
3824 new_elem
->filter
= heap_strdupW(This
->filter
);
3825 if(!new_elem
->filter
) {
3826 IHTMLElement_Release(&This
->IHTMLElement_iface
);
3827 return E_OUTOFMEMORY
;
3831 *ret
= &new_elem
->node
;
3835 HRESULT
HTMLElement_handle_event(HTMLDOMNode
*iface
, DWORD eid
, nsIDOMEvent
*event
, BOOL
*prevent_default
)
3837 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3840 case EVENTID_KEYDOWN
: {
3841 nsIDOMKeyEvent
*key_event
;
3844 nsres
= nsIDOMEvent_QueryInterface(event
, &IID_nsIDOMKeyEvent
, (void**)&key_event
);
3845 if(NS_SUCCEEDED(nsres
)) {
3848 nsIDOMKeyEvent_GetKeyCode(key_event
, &code
);
3851 case VK_F1
: /* DOM_VK_F1 */
3852 TRACE("F1 pressed\n");
3853 fire_event(This
->node
.doc
, EVENTID_HELP
, TRUE
, This
->node
.nsnode
, NULL
, NULL
);
3854 *prevent_default
= TRUE
;
3857 nsIDOMKeyEvent_Release(key_event
);
3865 cp_static_data_t HTMLElementEvents2_data
= { HTMLElementEvents2_tid
, NULL
/* FIXME */, TRUE
};
3867 const cpc_entry_t HTMLElement_cpc
[] = {
3872 static const NodeImplVtbl HTMLElementImplVtbl
= {
3874 HTMLElement_destructor
,
3877 HTMLElement_handle_event
,
3878 HTMLElement_get_attr_col
3881 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
3883 return CONTAINING_RECORD(iface
, HTMLElement
, node
.event_target
.dispex
);
3886 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
3887 DWORD grfdex
, DISPID
*pid
)
3889 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3891 if(This
->node
.vtbl
->get_dispid
)
3892 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
3894 return DISP_E_UNKNOWNNAME
;
3897 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
3898 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
3899 IServiceProvider
*caller
)
3901 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3903 if(This
->node
.vtbl
->invoke
)
3904 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
3905 params
, res
, ei
, caller
);
3907 ERR("(%p): element has no invoke method\n", This
);
3911 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
3913 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3914 nsIDOMMozNamedAttrMap
*attrs
;
3917 const PRUnichar
*str
;
3929 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
3930 if(NS_FAILED(nsres
))
3933 nsres
= nsIDOMMozNamedAttrMap_GetLength(attrs
, &len
);
3934 if(NS_FAILED(nsres
)) {
3935 nsIDOMMozNamedAttrMap_Release(attrs
);
3939 nsAString_Init(&nsstr
, NULL
);
3940 for(i
=0; i
<len
; i
++) {
3941 nsres
= nsIDOMMozNamedAttrMap_Item(attrs
, i
, &attr
);
3942 if(NS_FAILED(nsres
))
3945 nsres
= nsIDOMAttr_GetNodeName(attr
, &nsstr
);
3946 if(NS_FAILED(nsres
)) {
3947 nsIDOMAttr_Release(attr
);
3951 nsAString_GetData(&nsstr
, &str
);
3952 name
= SysAllocString(str
);
3954 nsIDOMAttr_Release(attr
);
3958 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
3959 if(hres
!= DISP_E_UNKNOWNNAME
) {
3960 nsIDOMAttr_Release(attr
);
3961 SysFreeString(name
);
3965 nsres
= nsIDOMAttr_GetNodeValue(attr
, &nsstr
);
3966 nsIDOMAttr_Release(attr
);
3967 if(NS_FAILED(nsres
)) {
3968 SysFreeString(name
);
3972 nsAString_GetData(&nsstr
, &str
);
3973 V_VT(&value
) = VT_BSTR
;
3975 V_BSTR(&value
) = SysAllocString(str
);
3976 if(!V_BSTR(&value
)) {
3977 SysFreeString(name
);
3981 V_BSTR(&value
) = NULL
;
3983 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
3984 SysFreeString(name
);
3985 VariantClear(&value
);
3987 nsAString_Finish(&nsstr
);
3989 nsIDOMMozNamedAttrMap_Release(attrs
);
3993 static event_target_t
**HTMLElement_get_event_target_ptr(DispatchEx
*dispex
)
3995 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3996 return This
->node
.vtbl
->get_event_target_ptr
3997 ? This
->node
.vtbl
->get_event_target_ptr(&This
->node
)
3998 : &This
->node
.event_target
.ptr
;
4001 static void HTMLElement_bind_event(DispatchEx
*dispex
, int eid
)
4003 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
4004 This
->node
.doc
->node
.event_target
.dispex
.data
->vtbl
->bind_event(&This
->node
.doc
->node
.event_target
.dispex
, eid
);
4007 static const tid_t HTMLElement_iface_tids
[] = {
4012 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
4014 HTMLElement_get_dispid
,
4016 HTMLElement_populate_props
,
4017 HTMLElement_get_event_target_ptr
,
4018 HTMLElement_bind_event
4021 static dispex_static_data_t HTMLElement_dispex
= {
4022 &HTMLElement_dispex_vtbl
,
4023 DispHTMLUnknownElement_tid
,
4025 HTMLElement_iface_tids
4028 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
4030 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
4031 This
->IHTMLElement2_iface
.lpVtbl
= &HTMLElement2Vtbl
;
4032 This
->IHTMLElement3_iface
.lpVtbl
= &HTMLElement3Vtbl
;
4033 This
->IHTMLElement4_iface
.lpVtbl
= &HTMLElement4Vtbl
;
4035 if(dispex_data
&& !dispex_data
->vtbl
)
4036 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
4037 init_dispex(&This
->node
.event_target
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
4038 dispex_data
? dispex_data
: &HTMLElement_dispex
);
4041 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
4043 /* No AddRef, share reference with HTMLDOMNode */
4044 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
4045 This
->nselem
= nselem
;
4048 This
->node
.cp_container
= &This
->cp_container
;
4049 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
, This
->node
.vtbl
->cpc_entries
);
4052 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
4054 nsIDOMHTMLElement
*nselem
;
4055 nsAString class_name_str
;
4056 const PRUnichar
*class_name
;
4057 const tag_desc_t
*tag
;
4062 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
4063 if(NS_FAILED(nsres
))
4066 nsAString_Init(&class_name_str
, NULL
);
4067 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
4069 nsAString_GetData(&class_name_str
, &class_name
);
4071 tag
= get_tag_desc(class_name
);
4073 hres
= tag
->constructor(doc
, nselem
, &elem
);
4074 }else if(use_generic
) {
4075 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
4077 elem
= heap_alloc_zero(sizeof(HTMLElement
));
4079 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
4080 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
4083 hres
= E_OUTOFMEMORY
;
4087 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
4089 nsIDOMHTMLElement_Release(nselem
);
4090 nsAString_Finish(&class_name_str
);
4098 HRESULT
get_elem(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**ret
)
4103 hres
= get_node(doc
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
4107 *ret
= impl_from_HTMLDOMNode(node
);
4111 /* interface IHTMLFiltersCollection */
4112 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
4114 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4116 TRACE("%p %s %p\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4118 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4119 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4120 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
4121 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
4122 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4123 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4124 return *ppv
? S_OK
: E_NOINTERFACE
;
4127 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4128 return E_NOINTERFACE
;
4131 IUnknown_AddRef((IUnknown
*)*ppv
);
4135 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
4137 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4138 LONG ref
= InterlockedIncrement(&This
->ref
);
4140 TRACE("(%p) ref=%d\n", This
, ref
);
4145 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
4147 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4148 LONG ref
= InterlockedDecrement(&This
->ref
);
4150 TRACE("(%p) ref=%d\n", This
, ref
);
4160 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
4162 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4163 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4166 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
4167 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
4169 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4170 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4173 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
4174 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
4175 LCID lcid
, DISPID
*rgDispId
)
4177 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4178 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4182 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
4183 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
4184 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4186 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4187 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4188 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4191 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
4193 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4198 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
4204 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
4206 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4207 FIXME("(%p)->(%p)\n", This
, p
);
4211 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
4213 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4214 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
4218 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
4219 HTMLFiltersCollection_QueryInterface
,
4220 HTMLFiltersCollection_AddRef
,
4221 HTMLFiltersCollection_Release
,
4222 HTMLFiltersCollection_GetTypeInfoCount
,
4223 HTMLFiltersCollection_GetTypeInfo
,
4224 HTMLFiltersCollection_GetIDsOfNames
,
4225 HTMLFiltersCollection_Invoke
,
4226 HTMLFiltersCollection_get_length
,
4227 HTMLFiltersCollection_get__newEnum
,
4228 HTMLFiltersCollection_item
4231 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4236 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
4237 idx
= idx
*10 + (*ptr
-'0');
4239 return DISP_E_UNKNOWNNAME
;
4241 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
4242 TRACE("ret %x\n", *dispid
);
4246 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4247 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4249 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
4251 V_VT(res
) = VT_DISPATCH
;
4252 V_DISPATCH(res
) = NULL
;
4254 FIXME("always returning NULL\n");
4259 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
4261 HTMLFiltersCollection_get_dispid
,
4262 HTMLFiltersCollection_invoke
,
4266 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
4267 IHTMLFiltersCollection_tid
,
4270 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
4271 &HTMLFiltersCollection_dispex_vtbl
,
4272 IHTMLFiltersCollection_tid
,
4274 HTMLFiltersCollection_iface_tids
4277 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
4279 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
4281 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
4284 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
4285 &HTMLFiltersCollection_dispex
);
4287 return &ret
->IHTMLFiltersCollection_iface
;
4290 /* interface IHTMLAttributeCollection */
4291 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
4293 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
4296 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
4298 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4300 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4302 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4303 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4304 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
4305 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4306 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
4307 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
4308 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
4309 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
4310 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4311 return *ppv
? S_OK
: E_NOINTERFACE
;
4314 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4315 return E_NOINTERFACE
;
4318 IUnknown_AddRef((IUnknown
*)*ppv
);
4322 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
4324 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4325 LONG ref
= InterlockedIncrement(&This
->ref
);
4327 TRACE("(%p) ref=%d\n", This
, ref
);
4332 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
4334 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4335 LONG ref
= InterlockedDecrement(&This
->ref
);
4337 TRACE("(%p) ref=%d\n", This
, ref
);
4340 while(!list_empty(&This
->attrs
)) {
4341 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
4343 list_remove(&attr
->entry
);
4345 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4354 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
4356 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4357 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4360 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
4361 LCID lcid
, ITypeInfo
**ppTInfo
)
4363 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4364 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4367 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
4368 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4370 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4371 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4375 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
4376 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4377 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4379 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4380 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4381 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4384 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
4386 IDispatchEx
*dispex
= &This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
;
4387 DISPID id
= DISPID_STARTENUM
;
4391 FIXME("filter non-enumerable attributes out\n");
4394 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
4397 else if(hres
== S_FALSE
)
4407 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
4414 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
4418 if(name
[0]>='0' && name
[0]<='9') {
4422 idx
= strtoulW(name
, &end_ptr
, 10);
4424 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
4431 WARN("NULL elem\n");
4432 return E_UNEXPECTED
;
4435 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
,
4436 name
, fdexNameCaseInsensitive
, id
);
4440 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
4442 HTMLDOMAttribute
*iter
;
4447 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4448 if(iter
->dispid
== id
) {
4457 WARN("NULL elem\n");
4458 return E_UNEXPECTED
;
4461 hres
= HTMLDOMAttribute_Create(NULL
, This
->elem
, id
, attr
);
4466 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
4472 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
4474 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4477 TRACE("(%p)->(%p)\n", This
, p
);
4480 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
4484 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
4486 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4487 FIXME("(%p)->(%p)\n", This
, p
);
4491 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
4493 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4494 HTMLDOMAttribute
*attr
;
4498 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
4500 switch(V_VT(name
)) {
4502 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
4505 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
4508 FIXME("unsupported name %s\n", debugstr_variant(name
));
4511 if(hres
== DISP_E_UNKNOWNNAME
)
4512 return E_INVALIDARG
;
4516 hres
= get_domattr(This
, id
, NULL
, &attr
);
4520 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
4524 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
4525 HTMLAttributeCollection_QueryInterface
,
4526 HTMLAttributeCollection_AddRef
,
4527 HTMLAttributeCollection_Release
,
4528 HTMLAttributeCollection_GetTypeInfoCount
,
4529 HTMLAttributeCollection_GetTypeInfo
,
4530 HTMLAttributeCollection_GetIDsOfNames
,
4531 HTMLAttributeCollection_Invoke
,
4532 HTMLAttributeCollection_get_length
,
4533 HTMLAttributeCollection__newEnum
,
4534 HTMLAttributeCollection_item
4537 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
4539 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
4542 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
4544 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4545 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4548 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
4550 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4551 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4554 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
4556 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4557 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4560 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
4562 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4563 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4566 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
4567 LCID lcid
, ITypeInfo
**ppTInfo
)
4569 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4570 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4573 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
4574 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4576 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4577 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4581 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
4582 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4583 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4585 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4586 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4587 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4590 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
4591 IHTMLDOMAttribute
**newretNode
)
4593 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4594 HTMLDOMAttribute
*attr
;
4598 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4600 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
4601 if(hres
== DISP_E_UNKNOWNNAME
) {
4604 } else if(FAILED(hres
)) {
4608 hres
= get_domattr(This
, id
, NULL
, &attr
);
4612 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
4616 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
4617 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
4619 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4620 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
4624 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
4625 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
4627 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4628 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4632 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
4633 HTMLAttributeCollection2_QueryInterface
,
4634 HTMLAttributeCollection2_AddRef
,
4635 HTMLAttributeCollection2_Release
,
4636 HTMLAttributeCollection2_GetTypeInfoCount
,
4637 HTMLAttributeCollection2_GetTypeInfo
,
4638 HTMLAttributeCollection2_GetIDsOfNames
,
4639 HTMLAttributeCollection2_Invoke
,
4640 HTMLAttributeCollection2_getNamedItem
,
4641 HTMLAttributeCollection2_setNamedItem
,
4642 HTMLAttributeCollection2_removeNamedItem
4645 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
4647 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
4650 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
4652 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4653 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4656 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
4658 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4659 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4662 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
4664 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4665 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4668 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
4670 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4671 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4674 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
4675 LCID lcid
, ITypeInfo
**ppTInfo
)
4677 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4678 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4681 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
4682 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4684 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4685 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4689 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
4690 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4691 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4693 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4694 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4695 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4698 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
4699 IHTMLDOMAttribute
**ppNodeOut
)
4701 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4702 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
4705 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
4706 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
4708 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4709 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
4713 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
4714 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
4716 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4717 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
4721 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
4723 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4724 HTMLDOMAttribute
*attr
;
4728 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
4730 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
4731 if(hres
== DISP_E_UNKNOWNNAME
)
4732 return E_INVALIDARG
;
4736 hres
= get_domattr(This
, id
, NULL
, &attr
);
4740 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
4744 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
4746 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4747 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
4750 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
4751 HTMLAttributeCollection3_QueryInterface
,
4752 HTMLAttributeCollection3_AddRef
,
4753 HTMLAttributeCollection3_Release
,
4754 HTMLAttributeCollection3_GetTypeInfoCount
,
4755 HTMLAttributeCollection3_GetTypeInfo
,
4756 HTMLAttributeCollection3_GetIDsOfNames
,
4757 HTMLAttributeCollection3_Invoke
,
4758 HTMLAttributeCollection3_getNamedItem
,
4759 HTMLAttributeCollection3_setNamedItem
,
4760 HTMLAttributeCollection3_removeNamedItem
,
4761 HTMLAttributeCollection3_item
,
4762 HTMLAttributeCollection3_get_length
4765 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
4767 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
4770 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4772 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4773 HTMLDOMAttribute
*attr
;
4777 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
4779 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
4783 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
4786 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4788 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
4792 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
4793 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4795 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4797 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
4800 case DISPATCH_PROPERTYGET
: {
4801 HTMLDOMAttribute
*iter
;
4804 pos
= id
-MSHTML_DISPID_CUSTOM_MIN
;
4806 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4808 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
4809 V_VT(res
) = VT_DISPATCH
;
4810 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
4816 WARN("invalid arg\n");
4817 return E_INVALIDARG
;
4821 FIXME("unimplemented flags %x\n", flags
);
4826 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
4828 HTMLAttributeCollection_get_dispid
,
4829 HTMLAttributeCollection_invoke
,
4833 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
4834 IHTMLAttributeCollection_tid
,
4835 IHTMLAttributeCollection2_tid
,
4836 IHTMLAttributeCollection3_tid
,
4840 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
4841 &HTMLAttributeCollection_dispex_vtbl
,
4842 DispHTMLAttributeCollection_tid
,
4844 HTMLAttributeCollection_iface_tids
4847 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
4849 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
4852 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
4857 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
4859 return E_OUTOFMEMORY
;
4861 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
4862 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
4863 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
4864 This
->attrs
->ref
= 2;
4866 This
->attrs
->elem
= This
;
4867 list_init(&This
->attrs
->attrs
);
4868 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
4869 &HTMLAttributeCollection_dispex
);