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 htmlW
[] = {'H','T','M','L',0};
50 static const WCHAR iframeW
[] = {'I','F','R','A','M','E',0};
51 static const WCHAR imgW
[] = {'I','M','G',0};
52 static const WCHAR inputW
[] = {'I','N','P','U','T',0};
53 static const WCHAR labelW
[] = {'L','A','B','E','L',0};
54 static const WCHAR linkW
[] = {'L','I','N','K',0};
55 static const WCHAR metaW
[] = {'M','E','T','A',0};
56 static const WCHAR objectW
[] = {'O','B','J','E','C','T',0};
57 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
58 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
59 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
60 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
61 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
62 static const WCHAR tdW
[] = {'T','D',0};
63 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
64 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
65 static const WCHAR trW
[] = {'T','R',0};
67 #define ATTRFLAG_CASESENSITIVE 0x0001
68 #define ATTRFLAG_ASSTRING 0x0002
69 #define ATTRFLAG_EXPANDURL 0x0004
73 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
76 static const tag_desc_t tag_descs
[] = {
77 {aW
, HTMLAnchorElement_Create
},
78 {areaW
, HTMLAreaElement_Create
},
79 {bodyW
, HTMLBodyElement_Create
},
80 {buttonW
, HTMLButtonElement_Create
},
81 {embedW
, HTMLEmbedElement_Create
},
82 {formW
, HTMLFormElement_Create
},
83 {frameW
, HTMLFrameElement_Create
},
84 {headW
, HTMLHeadElement_Create
},
85 {htmlW
, HTMLHtmlElement_Create
},
86 {iframeW
, HTMLIFrame_Create
},
87 {imgW
, HTMLImgElement_Create
},
88 {inputW
, HTMLInputElement_Create
},
89 {labelW
, HTMLLabelElement_Create
},
90 {linkW
, HTMLLinkElement_Create
},
91 {metaW
, HTMLMetaElement_Create
},
92 {objectW
, HTMLObjectElement_Create
},
93 {optionW
, HTMLOptionElement_Create
},
94 {scriptW
, HTMLScriptElement_Create
},
95 {selectW
, HTMLSelectElement_Create
},
96 {styleW
, HTMLStyleElement_Create
},
97 {tableW
, HTMLTable_Create
},
98 {tdW
, HTMLTableCell_Create
},
99 {textareaW
, HTMLTextAreaElement_Create
},
100 {title_tagW
, HTMLTitleElement_Create
},
101 {trW
, HTMLTableRow_Create
}
104 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
106 DWORD min
=0, max
=ARRAY_SIZE(tag_descs
)-1, i
;
111 r
= wcscmp(tag_name
, tag_descs
[i
].name
);
124 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
126 nsIDOMDocumentFragment
*nsfragment
;
127 nsIDOMNode
*nsparent
;
133 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
134 if(NS_FAILED(nsres
)) {
135 ERR("CreateRange failed: %08x\n", nsres
);
139 nsAString_InitDepend(&html_str
, html
);
140 nsIDOMRange_CreateContextualFragment(range
, &html_str
, &nsfragment
);
141 nsIDOMRange_Release(range
);
142 nsAString_Finish(&html_str
);
143 if(NS_FAILED(nsres
)) {
144 ERR("CreateContextualFragment failed: %08x\n", nsres
);
148 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
149 if(NS_SUCCEEDED(nsres
) && nsparent
) {
152 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
153 nsIDOMNode_Release(nsparent
);
154 if(NS_FAILED(nsres
)) {
155 ERR("ReplaceChild failed: %08x\n", nsres
);
158 nsIDOMNode_Release(nstmp
);
161 ERR("GetParentNode failed: %08x\n", nsres
);
165 nsIDOMDocumentFragment_Release(nsfragment
);
169 nsresult
get_elem_attr_value(nsIDOMElement
*nselem
, const WCHAR
*name
, nsAString
*val_str
, const PRUnichar
**val
)
174 nsAString_InitDepend(&name_str
, name
);
175 nsAString_Init(val_str
, NULL
);
176 nsres
= nsIDOMElement_GetAttribute(nselem
, &name_str
, val_str
);
177 nsAString_Finish(&name_str
);
178 if(NS_FAILED(nsres
)) {
179 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name
), nsres
);
180 nsAString_Finish(val_str
);
184 nsAString_GetData(val_str
, val
);
188 HRESULT
elem_string_attr_getter(HTMLElement
*elem
, const WCHAR
*name
, BOOL use_null
, BSTR
*p
)
190 const PRUnichar
*val
;
195 nsres
= get_elem_attr_value(elem
->dom_element
, name
, &val_str
, &val
);
199 TRACE("%s: returning %s\n", debugstr_w(name
), debugstr_w(val
));
201 if(*val
|| !use_null
) {
202 *p
= SysAllocString(val
);
204 hres
= E_OUTOFMEMORY
;
208 nsAString_Finish(&val_str
);
212 HRESULT
elem_string_attr_setter(HTMLElement
*elem
, const WCHAR
*name
, const WCHAR
*value
)
214 nsAString name_str
, val_str
;
217 nsAString_InitDepend(&name_str
, name
);
218 nsAString_InitDepend(&val_str
, value
);
219 nsres
= nsIDOMElement_SetAttribute(elem
->dom_element
, &name_str
, &val_str
);
220 nsAString_Finish(&name_str
);
221 nsAString_Finish(&val_str
);
223 if(NS_FAILED(nsres
)) {
224 WARN("SetAttribute failed: %08x\n", nsres
);
231 HRESULT
get_readystate_string(READYSTATE readystate
, BSTR
*p
)
233 static const WCHAR uninitializedW
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
234 static const WCHAR loadingW
[] = {'l','o','a','d','i','n','g',0};
235 static const WCHAR loadedW
[] = {'l','o','a','d','e','d',0};
236 static const WCHAR interactiveW
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
237 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
239 static const LPCWSTR readystate_strs
[] = {
247 assert(readystate
<= READYSTATE_COMPLETE
);
248 *p
= SysAllocString(readystate_strs
[readystate
]);
249 return *p
? S_OK
: E_OUTOFMEMORY
;
255 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
258 } HTMLFiltersCollection
;
260 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
262 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
265 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
267 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
269 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
272 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMElement
**ret
)
278 WARN("NULL nsdoc\n");
282 nsAString_InitDepend(&tag_str
, tag
);
283 nsres
= nsIDOMHTMLDocument_CreateElement(doc
->nsdoc
, &tag_str
, ret
);
284 nsAString_Finish(&tag_str
);
285 if(NS_FAILED(nsres
)) {
286 ERR("CreateElement failed: %08x\n", nsres
);
293 HRESULT
create_element(HTMLDocumentNode
*doc
, const WCHAR
*tag
, HTMLElement
**ret
)
295 nsIDOMElement
*nselem
;
298 /* Use owner doc if called on document fragment */
302 hres
= create_nselem(doc
, tag
, &nselem
);
306 hres
= HTMLElement_Create(doc
, (nsIDOMNode
*)nselem
, TRUE
, ret
);
307 nsIDOMElement_Release(nselem
);
313 IHTMLRect IHTMLRect_iface
;
317 nsIDOMClientRect
*nsrect
;
320 static inline HTMLRect
*impl_from_IHTMLRect(IHTMLRect
*iface
)
322 return CONTAINING_RECORD(iface
, HTMLRect
, IHTMLRect_iface
);
325 static HRESULT WINAPI
HTMLRect_QueryInterface(IHTMLRect
*iface
, REFIID riid
, void **ppv
)
327 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
329 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
331 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
332 *ppv
= &This
->IHTMLRect_iface
;
333 }else if(IsEqualGUID(&IID_IHTMLRect
, riid
)) {
334 *ppv
= &This
->IHTMLRect_iface
;
335 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
336 return *ppv
? S_OK
: E_NOINTERFACE
;
338 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
340 return E_NOINTERFACE
;
343 IUnknown_AddRef((IUnknown
*)*ppv
);
347 static ULONG WINAPI
HTMLRect_AddRef(IHTMLRect
*iface
)
349 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
350 LONG ref
= InterlockedIncrement(&This
->ref
);
352 TRACE("(%p) ref=%d\n", This
, ref
);
357 static ULONG WINAPI
HTMLRect_Release(IHTMLRect
*iface
)
359 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
360 LONG ref
= InterlockedDecrement(&This
->ref
);
362 TRACE("(%p) ref=%d\n", This
, ref
);
366 nsIDOMClientRect_Release(This
->nsrect
);
367 release_dispex(&This
->dispex
);
374 static HRESULT WINAPI
HTMLRect_GetTypeInfoCount(IHTMLRect
*iface
, UINT
*pctinfo
)
376 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
377 FIXME("(%p)->(%p)\n", This
, pctinfo
);
381 static HRESULT WINAPI
HTMLRect_GetTypeInfo(IHTMLRect
*iface
, UINT iTInfo
,
382 LCID lcid
, ITypeInfo
**ppTInfo
)
384 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
386 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
389 static HRESULT WINAPI
HTMLRect_GetIDsOfNames(IHTMLRect
*iface
, REFIID riid
,
390 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
392 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
394 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
398 static HRESULT WINAPI
HTMLRect_Invoke(IHTMLRect
*iface
, DISPID dispIdMember
,
399 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
400 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
402 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
404 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
405 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
408 static HRESULT WINAPI
HTMLRect_put_left(IHTMLRect
*iface
, LONG v
)
410 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
411 FIXME("(%p)->(%d)\n", This
, v
);
415 static HRESULT WINAPI
HTMLRect_get_left(IHTMLRect
*iface
, LONG
*p
)
417 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
421 TRACE("(%p)->(%p)\n", This
, p
);
423 nsres
= nsIDOMClientRect_GetLeft(This
->nsrect
, &left
);
424 if(NS_FAILED(nsres
)) {
425 ERR("GetLeft failed: %08x\n", nsres
);
429 *p
= floor(left
+0.5);
433 static HRESULT WINAPI
HTMLRect_put_top(IHTMLRect
*iface
, LONG v
)
435 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
436 FIXME("(%p)->(%d)\n", This
, v
);
440 static HRESULT WINAPI
HTMLRect_get_top(IHTMLRect
*iface
, LONG
*p
)
442 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
446 TRACE("(%p)->(%p)\n", This
, p
);
448 nsres
= nsIDOMClientRect_GetTop(This
->nsrect
, &top
);
449 if(NS_FAILED(nsres
)) {
450 ERR("GetTop failed: %08x\n", nsres
);
458 static HRESULT WINAPI
HTMLRect_put_right(IHTMLRect
*iface
, LONG v
)
460 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
461 FIXME("(%p)->(%d)\n", This
, v
);
465 static HRESULT WINAPI
HTMLRect_get_right(IHTMLRect
*iface
, LONG
*p
)
467 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
471 TRACE("(%p)->(%p)\n", This
, p
);
473 nsres
= nsIDOMClientRect_GetRight(This
->nsrect
, &right
);
474 if(NS_FAILED(nsres
)) {
475 ERR("GetRight failed: %08x\n", nsres
);
479 *p
= floor(right
+0.5);
483 static HRESULT WINAPI
HTMLRect_put_bottom(IHTMLRect
*iface
, LONG v
)
485 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
486 FIXME("(%p)->(%d)\n", This
, v
);
490 static HRESULT WINAPI
HTMLRect_get_bottom(IHTMLRect
*iface
, LONG
*p
)
492 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
496 TRACE("(%p)->(%p)\n", This
, p
);
498 nsres
= nsIDOMClientRect_GetBottom(This
->nsrect
, &bottom
);
499 if(NS_FAILED(nsres
)) {
500 ERR("GetBottom failed: %08x\n", nsres
);
504 *p
= floor(bottom
+0.5);
508 static const IHTMLRectVtbl HTMLRectVtbl
= {
509 HTMLRect_QueryInterface
,
512 HTMLRect_GetTypeInfoCount
,
513 HTMLRect_GetTypeInfo
,
514 HTMLRect_GetIDsOfNames
,
526 static const tid_t HTMLRect_iface_tids
[] = {
530 static dispex_static_data_t HTMLRect_dispex
= {
536 static HRESULT
create_html_rect(nsIDOMClientRect
*nsrect
, IHTMLRect
**ret
)
540 rect
= heap_alloc_zero(sizeof(HTMLRect
));
542 return E_OUTOFMEMORY
;
544 rect
->IHTMLRect_iface
.lpVtbl
= &HTMLRectVtbl
;
547 init_dispex(&rect
->dispex
, (IUnknown
*)&rect
->IHTMLRect_iface
, &HTMLRect_dispex
);
549 nsIDOMClientRect_AddRef(nsrect
);
550 rect
->nsrect
= nsrect
;
552 *ret
= &rect
->IHTMLRect_iface
;
558 IHTMLRectCollection IHTMLRectCollection_iface
;
562 nsIDOMClientRectList
*rect_list
;
563 } HTMLRectCollection
;
565 static inline HTMLRectCollection
*impl_from_IHTMLRectCollection(IHTMLRectCollection
*iface
)
567 return CONTAINING_RECORD(iface
, HTMLRectCollection
, IHTMLRectCollection_iface
);
570 static HRESULT WINAPI
HTMLRectCollection_QueryInterface(IHTMLRectCollection
*iface
, REFIID riid
, void **ppv
)
572 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
574 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
576 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
577 *ppv
= &This
->IHTMLRectCollection_iface
;
578 }else if(IsEqualGUID(&IID_IHTMLRectCollection
, riid
)) {
579 *ppv
= &This
->IHTMLRectCollection_iface
;
580 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
581 return *ppv
? S_OK
: E_NOINTERFACE
;
583 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
585 return E_NOINTERFACE
;
588 IUnknown_AddRef((IUnknown
*)*ppv
);
592 static ULONG WINAPI
HTMLRectCollection_AddRef(IHTMLRectCollection
*iface
)
594 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
595 LONG ref
= InterlockedIncrement(&This
->ref
);
597 TRACE("(%p) ref=%d\n", This
, ref
);
602 static ULONG WINAPI
HTMLRectCollection_Release(IHTMLRectCollection
*iface
)
604 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
605 LONG ref
= InterlockedDecrement(&This
->ref
);
607 TRACE("(%p) ref=%d\n", This
, ref
);
611 nsIDOMClientRectList_Release(This
->rect_list
);
612 release_dispex(&This
->dispex
);
619 static HRESULT WINAPI
HTMLRectCollection_GetTypeInfoCount(IHTMLRectCollection
*iface
, UINT
*pctinfo
)
621 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
622 FIXME("(%p)->(%p)\n", This
, pctinfo
);
626 static HRESULT WINAPI
HTMLRectCollection_GetTypeInfo(IHTMLRectCollection
*iface
, UINT iTInfo
,
627 LCID lcid
, ITypeInfo
**ppTInfo
)
629 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
630 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
633 static HRESULT WINAPI
HTMLRectCollection_GetIDsOfNames(IHTMLRectCollection
*iface
, REFIID riid
,
634 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
636 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
637 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
641 static HRESULT WINAPI
HTMLRectCollection_Invoke(IHTMLRectCollection
*iface
, DISPID dispIdMember
,
642 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
643 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
645 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
646 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
647 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
650 static HRESULT WINAPI
HTMLRectCollection_get_length(IHTMLRectCollection
*iface
, LONG
*p
)
652 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
656 TRACE("(%p)->(%p)\n", This
, p
);
658 nsres
= nsIDOMClientRectList_GetLength(This
->rect_list
, &length
);
659 assert(nsres
== NS_OK
);
664 static HRESULT WINAPI
HTMLRectCollection_get__newEnum(IHTMLRectCollection
*iface
, IUnknown
**p
)
666 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
667 FIXME("(%p)->(%p)\n", This
, p
);
671 static HRESULT WINAPI
HTMLRectCollection_item(IHTMLRectCollection
*iface
, VARIANT
*index
, VARIANT
*result
)
673 HTMLRectCollection
*This
= impl_from_IHTMLRectCollection(iface
);
674 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(index
), result
);
678 static const IHTMLRectCollectionVtbl HTMLRectCollectionVtbl
= {
679 HTMLRectCollection_QueryInterface
,
680 HTMLRectCollection_AddRef
,
681 HTMLRectCollection_Release
,
682 HTMLRectCollection_GetTypeInfoCount
,
683 HTMLRectCollection_GetTypeInfo
,
684 HTMLRectCollection_GetIDsOfNames
,
685 HTMLRectCollection_Invoke
,
686 HTMLRectCollection_get_length
,
687 HTMLRectCollection_get__newEnum
,
688 HTMLRectCollection_item
691 static inline HTMLRectCollection
*HTMLRectCollection_from_DispatchEx(DispatchEx
*iface
)
693 return CONTAINING_RECORD(iface
, HTMLRectCollection
, dispex
);
696 static HRESULT
HTMLRectCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
698 HTMLRectCollection
*This
= HTMLRectCollection_from_DispatchEx(dispex
);
703 for(ptr
= name
; *ptr
&& iswdigit(*ptr
); ptr
++)
704 idx
= idx
*10 + (*ptr
-'0');
706 return DISP_E_UNKNOWNNAME
;
708 nsIDOMClientRectList_GetLength(This
->rect_list
, &len
);
710 return DISP_E_UNKNOWNNAME
;
712 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
713 TRACE("ret %x\n", *dispid
);
717 static HRESULT
HTMLRectCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
718 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
720 HTMLRectCollection
*This
= HTMLRectCollection_from_DispatchEx(dispex
);
722 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
725 case DISPATCH_PROPERTYGET
: {
726 nsIDOMClientRect
*rect
;
727 IHTMLRect
*html_rect
;
731 nsres
= nsIDOMClientRectList_Item(This
->rect_list
, id
- MSHTML_DISPID_CUSTOM_MIN
, &rect
);
732 if(NS_FAILED(nsres
) || !rect
) {
733 WARN("Unknown item\n");
734 return DISP_E_UNKNOWNNAME
;
737 hres
= create_html_rect(rect
, &html_rect
);
738 nsIDOMClientRect_Release(rect
);
742 V_VT(res
) = VT_DISPATCH
;
743 V_DISPATCH(res
) = (IDispatch
*)html_rect
;
748 FIXME("unimplemented flags %x\n", flags
);
755 static const dispex_static_data_vtbl_t HTMLRectCollection_dispex_vtbl
= {
757 HTMLRectCollection_get_dispid
,
758 HTMLRectCollection_invoke
,
761 static const tid_t HTMLRectCollection_iface_tids
[] = {
762 IHTMLRectCollection_tid
,
765 static dispex_static_data_t HTMLRectCollection_dispex
= {
766 &HTMLRectCollection_dispex_vtbl
,
767 IHTMLRectCollection_tid
,
768 HTMLRectCollection_iface_tids
771 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
772 REFIID riid
, void **ppv
)
774 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
776 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
779 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
781 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
783 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
786 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
788 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
790 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
793 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
795 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
796 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
799 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
800 LCID lcid
, ITypeInfo
**ppTInfo
)
802 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
803 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
806 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
807 LPOLESTR
*rgszNames
, UINT cNames
,
808 LCID lcid
, DISPID
*rgDispId
)
810 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
811 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
815 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
816 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
817 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
819 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
820 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
821 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
824 static HRESULT
set_elem_attr_value_by_dispid(HTMLElement
*elem
, DISPID dispid
, VARIANT
*v
)
826 DISPID propput_dispid
= DISPID_PROPERTYPUT
;
827 DISPPARAMS dp
= {v
, &propput_dispid
, 1, 1};
830 if(dispid
== DISPID_IHTMLELEMENT_STYLE
) {
831 TRACE("Ignoring call on style attribute\n");
835 return IDispatchEx_InvokeEx(&elem
->node
.event_target
.dispex
.IDispatchEx_iface
, dispid
,
836 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dp
, NULL
, &ei
, NULL
);
839 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
840 VARIANT AttributeValue
, LONG lFlags
)
842 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
846 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
), debugstr_variant(&AttributeValue
), lFlags
);
848 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
849 (lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
) | fdexNameEnsure
, &dispid
);
853 return set_elem_attr_value_by_dispid(This
, dispid
, &AttributeValue
);
856 HRESULT
get_elem_attr_value_by_dispid(HTMLElement
*elem
, DISPID dispid
, VARIANT
*ret
)
858 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
861 return IDispatchEx_InvokeEx(&elem
->node
.event_target
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
862 DISPATCH_PROPERTYGET
, &dispParams
, ret
, &excep
, NULL
);
865 HRESULT
attr_value_to_string(VARIANT
*v
)
869 static const WCHAR nullW
[] = {'n','u','l','l',0};
875 V_BSTR(v
) = SysAllocString(nullW
);
877 return E_OUTOFMEMORY
;
881 IDispatch_Release(V_DISPATCH(v
));
883 V_BSTR(v
) = SysAllocString(NULL
);
886 hres
= VariantChangeType(v
, v
, 0, VT_BSTR
);
894 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
895 LONG lFlags
, VARIANT
*AttributeValue
)
897 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
901 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
903 if(lFlags
& ~(ATTRFLAG_CASESENSITIVE
|ATTRFLAG_ASSTRING
))
904 FIXME("Unsupported flags %x\n", lFlags
);
906 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
907 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
908 if(hres
== DISP_E_UNKNOWNNAME
) {
909 V_VT(AttributeValue
) = VT_NULL
;
914 V_VT(AttributeValue
) = VT_NULL
;
918 hres
= get_elem_attr_value_by_dispid(This
, dispid
, AttributeValue
);
919 if(SUCCEEDED(hres
) && (lFlags
& ATTRFLAG_ASSTRING
))
920 hres
= attr_value_to_string(AttributeValue
);
924 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
925 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
927 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
931 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
933 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, strAttributeName
,
934 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &id
);
935 if(hres
== DISP_E_UNKNOWNNAME
) {
936 *pfSuccess
= VARIANT_FALSE
;
942 if(id
== DISPID_IHTMLELEMENT_STYLE
) {
945 TRACE("Special case: style\n");
947 hres
= IHTMLElement_get_style(&This
->IHTMLElement_iface
, &style
);
951 hres
= IHTMLStyle_put_cssText(style
, NULL
);
952 IHTMLStyle_Release(style
);
956 *pfSuccess
= VARIANT_TRUE
;
960 return remove_attribute(&This
->node
.event_target
.dispex
, id
, pfSuccess
);
963 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
965 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
966 nsAString classname_str
;
969 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
971 if(!This
->dom_element
) {
972 FIXME("comment element\n");
976 nsAString_InitDepend(&classname_str
, v
);
977 nsres
= nsIDOMElement_SetClassName(This
->dom_element
, &classname_str
);
978 nsAString_Finish(&classname_str
);
980 ERR("SetClassName failed: %08x\n", nsres
);
985 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
987 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
991 TRACE("(%p)->(%p)\n", This
, p
);
993 if(!This
->dom_element
) {
994 FIXME("comment element\n");
998 nsAString_Init(&class_str
, NULL
);
999 nsres
= nsIDOMElement_GetClassName(This
->dom_element
, &class_str
);
1000 return return_nsstr(nsres
, &class_str
, p
);
1003 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
1005 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1009 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1011 if(!This
->dom_element
) {
1012 FIXME("comment element\n");
1016 nsAString_InitDepend(&id_str
, v
);
1017 nsres
= nsIDOMElement_SetId(This
->dom_element
, &id_str
);
1018 nsAString_Finish(&id_str
);
1019 if(NS_FAILED(nsres
))
1020 ERR("SetId failed: %08x\n", nsres
);
1025 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
1027 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1031 TRACE("(%p)->(%p)\n", This
, p
);
1033 if(!This
->dom_element
) {
1038 nsAString_Init(&id_str
, NULL
);
1039 nsres
= nsIDOMElement_GetId(This
->dom_element
, &id_str
);
1040 return return_nsstr(nsres
, &id_str
, p
);
1043 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
1045 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1049 TRACE("(%p)->(%p)\n", This
, p
);
1051 if(!This
->dom_element
) {
1052 static const WCHAR comment_tagW
[] = {'!',0};
1054 TRACE("comment element\n");
1055 *p
= SysAllocString(comment_tagW
);
1056 return *p
? S_OK
: E_OUTOFMEMORY
;
1059 nsAString_Init(&tag_str
, NULL
);
1060 nsres
= nsIDOMElement_GetTagName(This
->dom_element
, &tag_str
);
1061 return return_nsstr(nsres
, &tag_str
, p
);
1064 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
1066 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1070 TRACE("(%p)->(%p)\n", This
, p
);
1072 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
1081 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
1082 IHTMLDOMNode_Release(node
);
1089 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
1091 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1093 TRACE("(%p)->(%p)\n", This
, p
);
1098 hres
= HTMLStyle_Create(This
, &This
->style
);
1103 *p
= &This
->style
->IHTMLStyle_iface
;
1104 IHTMLStyle_AddRef(*p
);
1108 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
1110 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1112 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1114 return set_node_event(&This
->node
, EVENTID_HELP
, &v
);
1117 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
1119 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1121 TRACE("(%p)->(%p)\n", This
, p
);
1123 return get_node_event(&This
->node
, EVENTID_HELP
, p
);
1126 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
1128 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1130 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1132 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
1135 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
1137 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1139 TRACE("(%p)->(%p)\n", This
, p
);
1141 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
1144 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
1146 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1148 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1150 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
1153 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
1155 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1157 TRACE("(%p)->(%p)\n", This
, p
);
1159 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
1162 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
1164 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1166 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1168 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
1171 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
1173 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1175 TRACE("(%p)->(%p)\n", This
, p
);
1177 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
1180 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
1182 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1184 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1186 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
1189 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
1191 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1193 TRACE("(%p)->(%p)\n", This
, p
);
1195 return get_node_event(&This
->node
, EVENTID_KEYUP
, p
);
1198 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
1200 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1202 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1204 return set_node_event(&This
->node
, EVENTID_KEYPRESS
, &v
);
1207 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
1209 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1211 TRACE("(%p)->(%p)\n", This
, p
);
1213 return get_node_event(&This
->node
, EVENTID_KEYPRESS
, p
);
1216 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
1218 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1220 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1222 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
1225 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
1227 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1229 TRACE("(%p)->(%p)\n", This
, p
);
1231 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
1234 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
1236 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1238 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1240 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
1243 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
1245 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1247 TRACE("(%p)->(%p)\n", This
, p
);
1249 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
1252 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
1254 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1256 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1258 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
1261 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
1263 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1265 TRACE("(%p)->(%p)\n", This
, p
);
1267 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
1270 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
1272 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1274 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1276 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
1279 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
1281 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1283 TRACE("(%p)->(%p)\n", This
, p
);
1285 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
1288 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
1290 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1292 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1294 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
1297 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
1299 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1301 TRACE("(%p)->(%p)\n", This
, p
);
1303 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
1306 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
1308 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1310 TRACE("(%p)->(%p)\n", This
, p
);
1315 if(This
->node
.vtbl
->get_document
)
1316 return This
->node
.vtbl
->get_document(&This
->node
, p
);
1318 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
1319 IDispatch_AddRef(*p
);
1323 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
1325 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
1327 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1328 nsAString title_str
;
1331 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1333 if(!This
->html_element
) {
1337 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, TRUE
, &var
);
1342 V_VT(var
) = VT_BSTR
;
1343 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
1347 nsAString_InitDepend(&title_str
, v
);
1348 nsres
= nsIDOMHTMLElement_SetTitle(This
->html_element
, &title_str
);
1349 nsAString_Finish(&title_str
);
1350 if(NS_FAILED(nsres
))
1351 ERR("SetTitle failed: %08x\n", nsres
);
1356 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
1358 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1359 nsAString title_str
;
1362 TRACE("(%p)->(%p)\n", This
, p
);
1364 if(!This
->html_element
) {
1368 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, titleW
, FALSE
, &var
);
1369 if(hres
== DISP_E_UNKNOWNNAME
) {
1371 }else if(V_VT(var
) != VT_BSTR
) {
1372 FIXME("title = %s\n", debugstr_variant(var
));
1375 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
1381 nsAString_Init(&title_str
, NULL
);
1382 nsres
= nsIDOMHTMLElement_GetTitle(This
->html_element
, &title_str
);
1383 return return_nsstr(nsres
, &title_str
, p
);
1386 static const WCHAR languageW
[] = {'l','a','n','g','u','a','g','e',0};
1388 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
1390 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1392 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1394 return elem_string_attr_setter(This
, languageW
, v
);
1397 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
1399 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1401 TRACE("(%p)->(%p)\n", This
, p
);
1403 return elem_string_attr_getter(This
, languageW
, TRUE
, p
);
1406 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
1408 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1410 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1412 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
1415 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
1417 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1419 TRACE("(%p)->(%p)\n", This
, p
);
1421 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
1424 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
1426 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1427 cpp_bool start
= TRUE
;
1430 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
1432 switch(V_VT(&varargStart
)) {
1437 start
= V_BOOL(&varargStart
) != VARIANT_FALSE
;
1440 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart
));
1443 if(!This
->html_element
) {
1444 FIXME("non-HTML elements\n");
1448 nsres
= nsIDOMHTMLElement_ScrollIntoView(This
->html_element
, start
, 1);
1449 assert(nsres
== NS_OK
);
1454 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
1455 VARIANT_BOOL
*pfResult
)
1457 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1458 cpp_bool result
= FALSE
;
1460 TRACE("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
1466 child
= unsafe_impl_from_IHTMLElement(pChild
);
1468 ERR("not our element\n");
1472 nsres
= nsIDOMNode_Contains(This
->node
.nsnode
, child
->node
.nsnode
, &result
);
1473 assert(nsres
== NS_OK
);
1476 *pfResult
= variant_bool(result
);
1480 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
1482 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1484 TRACE("(%p)->(%p)\n", This
, p
);
1486 return get_elem_source_index(This
, p
);
1489 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
1491 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1492 FIXME("(%p)->(%p)\n", This
, p
);
1496 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
1498 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1502 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1504 if(!This
->html_element
) {
1505 FIXME("non-HTML element\n");
1509 nsAString_InitDepend(&nsstr
, v
);
1510 nsres
= nsIDOMHTMLElement_SetLang(This
->html_element
, &nsstr
);
1511 nsAString_Finish(&nsstr
);
1512 if(NS_FAILED(nsres
)) {
1513 ERR("SetLang failed: %08x\n", nsres
);
1520 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
1522 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1526 TRACE("(%p)->(%p)\n", This
, p
);
1528 if(!This
->html_element
) {
1529 FIXME("non-HTML element\n");
1533 nsAString_Init(&nsstr
, NULL
);
1534 nsres
= nsIDOMHTMLElement_GetLang(This
->html_element
, &nsstr
);
1535 return return_nsstr(nsres
, &nsstr
, p
);
1538 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
1540 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1543 TRACE("(%p)->(%p)\n", This
, p
);
1545 if(!This
->html_element
) {
1546 FIXME("non-HTML element\n");
1550 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->html_element
, p
);
1551 if(NS_FAILED(nsres
)) {
1552 ERR("GetOffsetLeft failed: %08x\n", nsres
);
1559 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
1561 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1564 TRACE("(%p)->(%p)\n", This
, p
);
1566 if(!This
->html_element
) {
1567 FIXME("non-HTML element\n");
1571 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->html_element
, p
);
1572 if(NS_FAILED(nsres
)) {
1573 ERR("GetOffsetTop failed: %08x\n", nsres
);
1580 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
1582 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1585 TRACE("(%p)->(%p)\n", This
, p
);
1587 if(!This
->html_element
) {
1588 FIXME("non-HTML element\n");
1592 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->html_element
, p
);
1593 if(NS_FAILED(nsres
)) {
1594 ERR("GetOffsetWidth failed: %08x\n", nsres
);
1601 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
1603 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1606 TRACE("(%p)->(%p)\n", This
, p
);
1608 if(!This
->html_element
) {
1609 FIXME("non-HTML element\n");
1613 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->html_element
, p
);
1614 if(NS_FAILED(nsres
)) {
1615 ERR("GetOffsetHeight failed: %08x\n", nsres
);
1622 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
1624 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1625 nsIDOMElement
*nsparent
;
1626 HTMLElement
*parent
;
1630 TRACE("(%p)->(%p)\n", This
, p
);
1632 if(!This
->html_element
) {
1633 FIXME("non-HTML element\n");
1637 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->html_element
, &nsparent
);
1638 if(NS_FAILED(nsres
)) {
1639 ERR("GetOffsetParent failed: %08x\n", nsres
);
1648 hres
= get_element(nsparent
, &parent
);
1649 nsIDOMElement_Release(nsparent
);
1653 *p
= &parent
->IHTMLElement_iface
;
1657 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
1659 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1663 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1665 if(!This
->html_element
) {
1666 FIXME("non-HTML element\n");
1670 nsAString_InitDepend(&html_str
, v
);
1671 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->html_element
, &html_str
);
1672 nsAString_Finish(&html_str
);
1673 if(NS_FAILED(nsres
)) {
1674 FIXME("SetInnerHtml failed %08x\n", nsres
);
1681 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1683 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1687 TRACE("(%p)->(%p)\n", This
, p
);
1689 if(!This
->html_element
) {
1690 FIXME("non-HTML element\n");
1694 nsAString_Init(&html_str
, NULL
);
1695 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->html_element
, &html_str
);
1696 return return_nsstr(nsres
, &html_str
, p
);
1699 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1701 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1702 nsIDOMNode
*nschild
, *tmp
;
1703 nsIDOMText
*text_node
;
1707 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1710 nsres
= nsIDOMElement_GetLastChild(This
->dom_element
, &nschild
);
1711 if(NS_FAILED(nsres
)) {
1712 ERR("GetLastChild failed: %08x\n", nsres
);
1718 nsres
= nsIDOMElement_RemoveChild(This
->dom_element
, nschild
, &tmp
);
1719 nsIDOMNode_Release(nschild
);
1720 if(NS_FAILED(nsres
)) {
1721 ERR("RemoveChild failed: %08x\n", nsres
);
1724 nsIDOMNode_Release(tmp
);
1727 nsAString_InitDepend(&text_str
, v
);
1728 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1729 nsAString_Finish(&text_str
);
1730 if(NS_FAILED(nsres
)) {
1731 ERR("CreateTextNode failed: %08x\n", nsres
);
1735 nsres
= nsIDOMElement_AppendChild(This
->dom_element
, (nsIDOMNode
*)text_node
, &tmp
);
1736 if(NS_FAILED(nsres
)) {
1737 ERR("AppendChild failed: %08x\n", nsres
);
1741 nsIDOMNode_Release(tmp
);
1745 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1747 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1749 TRACE("(%p)->(%p)\n", This
, p
);
1751 return get_node_text(&This
->node
, p
);
1754 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1756 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1758 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1760 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1763 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1765 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1769 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1771 nsAString_Init(&html_str
, NULL
);
1772 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1773 if(SUCCEEDED(hres
)) {
1774 const PRUnichar
*html
;
1776 nsAString_GetData(&html_str
, &html
);
1777 *p
= SysAllocString(html
);
1779 hres
= E_OUTOFMEMORY
;
1782 nsAString_Finish(&html_str
);
1784 TRACE("ret %s\n", debugstr_w(*p
));
1788 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1790 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1791 nsIDOMText
*text_node
;
1796 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1798 if(This
->node
.vtbl
->is_settable
&& !This
->node
.vtbl
->is_settable(&This
->node
, DISPID_IHTMLELEMENT_OUTERTEXT
)) {
1799 WARN("Called on element that does not support setting the property.\n");
1800 return 0x800a0258; /* undocumented error code */
1803 if(!This
->node
.doc
->nsdoc
) {
1804 FIXME("NULL nsdoc\n");
1808 nsAString_InitDepend(&nsstr
, v
);
1809 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &nsstr
, &text_node
);
1810 nsAString_Finish(&nsstr
);
1811 if(NS_FAILED(nsres
)) {
1812 ERR("CreateTextNode failed\n");
1816 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1817 if(NS_SUCCEEDED(nsres
)) {
1818 nsres
= nsIDOMRange_SelectNode(range
, This
->node
.nsnode
);
1819 if(NS_SUCCEEDED(nsres
))
1820 nsres
= nsIDOMRange_DeleteContents(range
);
1821 if(NS_SUCCEEDED(nsres
))
1822 nsres
= nsIDOMRange_InsertNode(range
, (nsIDOMNode
*)text_node
);
1823 if(NS_SUCCEEDED(nsres
))
1824 nsres
= nsIDOMRange_SelectNodeContents(range
, This
->node
.nsnode
);
1825 if(NS_SUCCEEDED(nsres
))
1826 nsres
= nsIDOMRange_DeleteContents(range
);
1827 nsIDOMRange_Release(range
);
1829 nsIDOMText_Release(text_node
);
1830 if(NS_FAILED(nsres
)) {
1831 ERR("failed to set text: %08x\n", nsres
);
1838 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1840 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1842 TRACE("(%p)->(%p)\n", This
, p
);
1844 /* getter is the same as innerText */
1845 return IHTMLElement_get_innerText(&This
->IHTMLElement_iface
, p
);
1848 static HRESULT
insert_adjacent_node(HTMLElement
*This
, const WCHAR
*where
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret_node
)
1850 nsIDOMNode
*ret_nsnode
;
1852 HRESULT hres
= S_OK
;
1854 static const WCHAR beforebeginW
[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
1855 static const WCHAR afterbeginW
[] = {'a','f','t','e','r','b','e','g','i','n',0};
1856 static const WCHAR beforeendW
[] = {'b','e','f','o','r','e','e','n','d',0};
1857 static const WCHAR afterendW
[] = {'a','f','t','e','r','e','n','d',0};
1859 if (!wcsicmp(where
, beforebeginW
)) {
1862 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1863 if(NS_FAILED(nsres
))
1867 return E_INVALIDARG
;
1869 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &ret_nsnode
);
1870 nsIDOMNode_Release(parent
);
1871 }else if(!wcsicmp(where
, afterbeginW
)) {
1872 nsIDOMNode
*first_child
;
1874 nsres
= nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1875 if(NS_FAILED(nsres
))
1878 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &ret_nsnode
);
1879 if(NS_FAILED(nsres
))
1883 nsIDOMNode_Release(first_child
);
1884 }else if (!wcsicmp(where
, beforeendW
)) {
1885 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &ret_nsnode
);
1886 }else if (!wcsicmp(where
, afterendW
)) {
1887 nsIDOMNode
*next_sibling
, *parent
;
1889 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1890 if(NS_FAILED(nsres
))
1893 return E_INVALIDARG
;
1895 nsres
= nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1896 if(NS_SUCCEEDED(nsres
)) {
1898 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &ret_nsnode
);
1899 nsIDOMNode_Release(next_sibling
);
1901 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &ret_nsnode
);
1905 nsIDOMNode_Release(parent
);
1907 ERR("invalid where: %s\n", debugstr_w(where
));
1908 return E_INVALIDARG
;
1911 if (NS_FAILED(nsres
))
1915 hres
= get_node(ret_nsnode
, TRUE
, ret_node
);
1916 nsIDOMNode_Release(ret_nsnode
);
1920 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1923 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1930 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1932 if(!This
->node
.doc
->nsdoc
) {
1933 WARN("NULL nsdoc\n");
1934 return E_UNEXPECTED
;
1937 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1938 if(NS_FAILED(nsres
))
1940 ERR("CreateRange failed: %08x\n", nsres
);
1944 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1946 nsAString_InitDepend(&ns_html
, html
);
1947 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1948 nsAString_Finish(&ns_html
);
1949 nsIDOMRange_Release(range
);
1951 if(NS_FAILED(nsres
) || !nsnode
)
1953 ERR("CreateTextNode failed: %08x\n", nsres
);
1957 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1958 nsIDOMNode_Release(nsnode
);
1962 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1965 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1971 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1973 if(!This
->node
.doc
->nsdoc
) {
1974 WARN("NULL nsdoc\n");
1975 return E_UNEXPECTED
;
1979 nsAString_InitDepend(&ns_text
, text
);
1980 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1981 nsAString_Finish(&ns_text
);
1983 if(NS_FAILED(nsres
) || !nsnode
)
1985 ERR("CreateTextNode failed: %08x\n", nsres
);
1989 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1990 nsIDOMNode_Release(nsnode
);
1995 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1997 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1998 FIXME("(%p)->(%p)\n", This
, p
);
2002 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
2004 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2006 TRACE("(%p)->(%p)\n", This
, p
);
2008 *p
= variant_bool(This
->node
.vtbl
->is_text_edit
&& This
->node
.vtbl
->is_text_edit(&This
->node
));
2012 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
2014 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2017 TRACE("(%p)\n", This
);
2019 if(!This
->html_element
) {
2020 FIXME("non-HTML element\n");
2024 nsres
= nsIDOMHTMLElement_Click(This
->html_element
);
2025 if(NS_FAILED(nsres
)) {
2026 ERR("Click failed: %08x\n", nsres
);
2033 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
2034 IHTMLFiltersCollection
**p
)
2036 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2037 TRACE("(%p)->(%p)\n", This
, p
);
2042 *p
= HTMLFiltersCollection_Create();
2047 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
2049 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2051 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2053 return set_node_event(&This
->node
, EVENTID_DRAGSTART
, &v
);
2056 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
2058 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2060 TRACE("(%p)->(%p)\n", This
, p
);
2062 return get_node_event(&This
->node
, EVENTID_DRAGSTART
, p
);
2065 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
2067 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2068 FIXME("(%p)->(%p)\n", This
, String
);
2072 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
2074 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2075 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2079 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
2081 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2082 FIXME("(%p)->(%p)\n", This
, p
);
2086 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
2088 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2089 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2093 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
2095 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2096 FIXME("(%p)->(%p)\n", This
, p
);
2100 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
2102 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2103 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2107 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
2109 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2110 FIXME("(%p)->(%p)\n", This
, p
);
2114 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
2116 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2117 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2121 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
2123 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2124 FIXME("(%p)->(%p)\n", This
, p
);
2128 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
2130 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2131 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2135 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
2137 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2138 FIXME("(%p)->(%p)\n", This
, p
);
2142 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
2144 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2145 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2149 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
2151 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2152 FIXME("(%p)->(%p)\n", This
, p
);
2156 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
2158 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2160 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
2162 return set_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, &v
);
2165 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
2167 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2169 TRACE("(%p)->(%p)\n", This
, p
);
2171 return get_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, p
);
2174 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
2176 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2177 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2181 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
2183 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2184 FIXME("(%p)->(%p)\n", This
, p
);
2188 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
2190 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2191 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2195 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
2197 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2198 FIXME("(%p)->(%p)\n", This
, p
);
2202 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
2204 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2205 nsIDOMNodeList
*nsnode_list
;
2208 TRACE("(%p)->(%p)\n", This
, p
);
2210 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
2211 if(NS_FAILED(nsres
)) {
2212 ERR("GetChildNodes failed: %08x\n", nsres
);
2216 *p
= (IDispatch
*)create_collection_from_nodelist(nsnode_list
, This
->node
.doc
->document_mode
);
2218 nsIDOMNodeList_Release(nsnode_list
);
2222 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
2224 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
2226 TRACE("(%p)->(%p)\n", This
, p
);
2228 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
2232 static const IHTMLElementVtbl HTMLElementVtbl
= {
2233 HTMLElement_QueryInterface
,
2235 HTMLElement_Release
,
2236 HTMLElement_GetTypeInfoCount
,
2237 HTMLElement_GetTypeInfo
,
2238 HTMLElement_GetIDsOfNames
,
2240 HTMLElement_setAttribute
,
2241 HTMLElement_getAttribute
,
2242 HTMLElement_removeAttribute
,
2243 HTMLElement_put_className
,
2244 HTMLElement_get_className
,
2247 HTMLElement_get_tagName
,
2248 HTMLElement_get_parentElement
,
2249 HTMLElement_get_style
,
2250 HTMLElement_put_onhelp
,
2251 HTMLElement_get_onhelp
,
2252 HTMLElement_put_onclick
,
2253 HTMLElement_get_onclick
,
2254 HTMLElement_put_ondblclick
,
2255 HTMLElement_get_ondblclick
,
2256 HTMLElement_put_onkeydown
,
2257 HTMLElement_get_onkeydown
,
2258 HTMLElement_put_onkeyup
,
2259 HTMLElement_get_onkeyup
,
2260 HTMLElement_put_onkeypress
,
2261 HTMLElement_get_onkeypress
,
2262 HTMLElement_put_onmouseout
,
2263 HTMLElement_get_onmouseout
,
2264 HTMLElement_put_onmouseover
,
2265 HTMLElement_get_onmouseover
,
2266 HTMLElement_put_onmousemove
,
2267 HTMLElement_get_onmousemove
,
2268 HTMLElement_put_onmousedown
,
2269 HTMLElement_get_onmousedown
,
2270 HTMLElement_put_onmouseup
,
2271 HTMLElement_get_onmouseup
,
2272 HTMLElement_get_document
,
2273 HTMLElement_put_title
,
2274 HTMLElement_get_title
,
2275 HTMLElement_put_language
,
2276 HTMLElement_get_language
,
2277 HTMLElement_put_onselectstart
,
2278 HTMLElement_get_onselectstart
,
2279 HTMLElement_scrollIntoView
,
2280 HTMLElement_contains
,
2281 HTMLElement_get_sourceIndex
,
2282 HTMLElement_get_recordNumber
,
2283 HTMLElement_put_lang
,
2284 HTMLElement_get_lang
,
2285 HTMLElement_get_offsetLeft
,
2286 HTMLElement_get_offsetTop
,
2287 HTMLElement_get_offsetWidth
,
2288 HTMLElement_get_offsetHeight
,
2289 HTMLElement_get_offsetParent
,
2290 HTMLElement_put_innerHTML
,
2291 HTMLElement_get_innerHTML
,
2292 HTMLElement_put_innerText
,
2293 HTMLElement_get_innerText
,
2294 HTMLElement_put_outerHTML
,
2295 HTMLElement_get_outerHTML
,
2296 HTMLElement_put_outerText
,
2297 HTMLElement_get_outerText
,
2298 HTMLElement_insertAdjacentHTML
,
2299 HTMLElement_insertAdjacentText
,
2300 HTMLElement_get_parentTextEdit
,
2301 HTMLElement_get_isTextEdit
,
2303 HTMLElement_get_filters
,
2304 HTMLElement_put_ondragstart
,
2305 HTMLElement_get_ondragstart
,
2306 HTMLElement_toString
,
2307 HTMLElement_put_onbeforeupdate
,
2308 HTMLElement_get_onbeforeupdate
,
2309 HTMLElement_put_onafterupdate
,
2310 HTMLElement_get_onafterupdate
,
2311 HTMLElement_put_onerrorupdate
,
2312 HTMLElement_get_onerrorupdate
,
2313 HTMLElement_put_onrowexit
,
2314 HTMLElement_get_onrowexit
,
2315 HTMLElement_put_onrowenter
,
2316 HTMLElement_get_onrowenter
,
2317 HTMLElement_put_ondatasetchanged
,
2318 HTMLElement_get_ondatasetchanged
,
2319 HTMLElement_put_ondataavailable
,
2320 HTMLElement_get_ondataavailable
,
2321 HTMLElement_put_ondatasetcomplete
,
2322 HTMLElement_get_ondatasetcomplete
,
2323 HTMLElement_put_onfilterchange
,
2324 HTMLElement_get_onfilterchange
,
2325 HTMLElement_get_children
,
2329 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
2331 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
2334 static inline HTMLElement
*impl_from_IHTMLElement2(IHTMLElement2
*iface
)
2336 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement2_iface
);
2339 static HRESULT WINAPI
HTMLElement2_QueryInterface(IHTMLElement2
*iface
,
2340 REFIID riid
, void **ppv
)
2342 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2343 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
2346 static ULONG WINAPI
HTMLElement2_AddRef(IHTMLElement2
*iface
)
2348 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2349 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
2352 static ULONG WINAPI
HTMLElement2_Release(IHTMLElement2
*iface
)
2354 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2355 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
2358 static HRESULT WINAPI
HTMLElement2_GetTypeInfoCount(IHTMLElement2
*iface
, UINT
*pctinfo
)
2360 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2361 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
2364 static HRESULT WINAPI
HTMLElement2_GetTypeInfo(IHTMLElement2
*iface
, UINT iTInfo
,
2365 LCID lcid
, ITypeInfo
**ppTInfo
)
2367 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2368 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2371 static HRESULT WINAPI
HTMLElement2_GetIDsOfNames(IHTMLElement2
*iface
, REFIID riid
,
2372 LPOLESTR
*rgszNames
, UINT cNames
,
2373 LCID lcid
, DISPID
*rgDispId
)
2375 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2376 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2380 static HRESULT WINAPI
HTMLElement2_Invoke(IHTMLElement2
*iface
, DISPID dispIdMember
,
2381 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2382 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2384 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2385 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2386 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2389 static HRESULT WINAPI
HTMLElement2_get_scopeName(IHTMLElement2
*iface
, BSTR
*p
)
2391 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2392 FIXME("(%p)->(%p)\n", This
, p
);
2396 static HRESULT WINAPI
HTMLElement2_setCapture(IHTMLElement2
*iface
, VARIANT_BOOL containerCapture
)
2398 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2399 FIXME("(%p)->(%x)\n", This
, containerCapture
);
2403 static HRESULT WINAPI
HTMLElement2_releaseCapture(IHTMLElement2
*iface
)
2405 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2406 FIXME("(%p)\n", This
);
2410 static HRESULT WINAPI
HTMLElement2_put_onlosecapture(IHTMLElement2
*iface
, VARIANT v
)
2412 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2413 FIXME("(%p)->()\n", This
);
2417 static HRESULT WINAPI
HTMLElement2_get_onlosecapture(IHTMLElement2
*iface
, VARIANT
*p
)
2419 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2420 FIXME("(%p)->(%p)\n", This
, p
);
2424 static HRESULT WINAPI
HTMLElement2_componentFromPoint(IHTMLElement2
*iface
,
2425 LONG x
, LONG y
, BSTR
*component
)
2427 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2428 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, component
);
2432 static HRESULT WINAPI
HTMLElement2_doScroll(IHTMLElement2
*iface
, VARIANT component
)
2434 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2436 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&component
));
2438 if(!This
->node
.doc
->content_ready
2439 || !This
->node
.doc
->basedoc
.doc_obj
->in_place_active
)
2446 static HRESULT WINAPI
HTMLElement2_put_onscroll(IHTMLElement2
*iface
, VARIANT v
)
2448 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2450 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2452 return set_node_event(&This
->node
, EVENTID_SCROLL
, &v
);
2455 static HRESULT WINAPI
HTMLElement2_get_onscroll(IHTMLElement2
*iface
, VARIANT
*p
)
2457 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2459 TRACE("(%p)->(%p)\n", This
, p
);
2461 return get_node_event(&This
->node
, EVENTID_SCROLL
, p
);
2464 static HRESULT WINAPI
HTMLElement2_put_ondrag(IHTMLElement2
*iface
, VARIANT v
)
2466 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2468 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2470 return set_node_event(&This
->node
, EVENTID_DRAG
, &v
);
2473 static HRESULT WINAPI
HTMLElement2_get_ondrag(IHTMLElement2
*iface
, VARIANT
*p
)
2475 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2477 TRACE("(%p)->(%p)\n", This
, p
);
2479 return get_node_event(&This
->node
, EVENTID_DRAG
, p
);
2482 static HRESULT WINAPI
HTMLElement2_put_ondragend(IHTMLElement2
*iface
, VARIANT v
)
2484 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2485 FIXME("(%p)->()\n", This
);
2489 static HRESULT WINAPI
HTMLElement2_get_ondragend(IHTMLElement2
*iface
, VARIANT
*p
)
2491 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2492 FIXME("(%p)->(%p)\n", This
, p
);
2496 static HRESULT WINAPI
HTMLElement2_put_ondragenter(IHTMLElement2
*iface
, VARIANT v
)
2498 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2499 FIXME("(%p)->()\n", This
);
2503 static HRESULT WINAPI
HTMLElement2_get_ondragenter(IHTMLElement2
*iface
, VARIANT
*p
)
2505 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2506 FIXME("(%p)->(%p)\n", This
, p
);
2510 static HRESULT WINAPI
HTMLElement2_put_ondragover(IHTMLElement2
*iface
, VARIANT v
)
2512 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2513 FIXME("(%p)->()\n", This
);
2517 static HRESULT WINAPI
HTMLElement2_get_ondragover(IHTMLElement2
*iface
, VARIANT
*p
)
2519 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2520 FIXME("(%p)->(%p)\n", This
, p
);
2524 static HRESULT WINAPI
HTMLElement2_put_ondragleave(IHTMLElement2
*iface
, VARIANT v
)
2526 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2527 FIXME("(%p)->()\n", This
);
2531 static HRESULT WINAPI
HTMLElement2_get_ondragleave(IHTMLElement2
*iface
, VARIANT
*p
)
2533 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2534 FIXME("(%p)->(%p)\n", This
, p
);
2538 static HRESULT WINAPI
HTMLElement2_put_ondrop(IHTMLElement2
*iface
, VARIANT v
)
2540 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2541 FIXME("(%p)->()\n", This
);
2545 static HRESULT WINAPI
HTMLElement2_get_ondrop(IHTMLElement2
*iface
, VARIANT
*p
)
2547 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2548 FIXME("(%p)->(%p)\n", This
, p
);
2552 static HRESULT WINAPI
HTMLElement2_put_onbeforecut(IHTMLElement2
*iface
, VARIANT v
)
2554 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2555 FIXME("(%p)->()\n", This
);
2559 static HRESULT WINAPI
HTMLElement2_get_onbeforecut(IHTMLElement2
*iface
, VARIANT
*p
)
2561 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2562 FIXME("(%p)->(%p)\n", This
, p
);
2566 static HRESULT WINAPI
HTMLElement2_put_oncut(IHTMLElement2
*iface
, VARIANT v
)
2568 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2569 FIXME("(%p)->()\n", This
);
2573 static HRESULT WINAPI
HTMLElement2_get_oncut(IHTMLElement2
*iface
, VARIANT
*p
)
2575 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2576 FIXME("(%p)->(%p)\n", This
, p
);
2580 static HRESULT WINAPI
HTMLElement2_put_onbeforecopy(IHTMLElement2
*iface
, VARIANT v
)
2582 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2583 FIXME("(%p)->()\n", This
);
2587 static HRESULT WINAPI
HTMLElement2_get_onbeforecopy(IHTMLElement2
*iface
, VARIANT
*p
)
2589 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2590 FIXME("(%p)->(%p)\n", This
, p
);
2594 static HRESULT WINAPI
HTMLElement2_put_oncopy(IHTMLElement2
*iface
, VARIANT v
)
2596 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2597 FIXME("(%p)->()\n", This
);
2601 static HRESULT WINAPI
HTMLElement2_get_oncopy(IHTMLElement2
*iface
, VARIANT
*p
)
2603 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2604 FIXME("(%p)->(%p)\n", This
, p
);
2608 static HRESULT WINAPI
HTMLElement2_put_onbeforepaste(IHTMLElement2
*iface
, VARIANT v
)
2610 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2611 FIXME("(%p)->()\n", This
);
2615 static HRESULT WINAPI
HTMLElement2_get_onbeforepaste(IHTMLElement2
*iface
, VARIANT
*p
)
2617 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2618 FIXME("(%p)->(%p)\n", This
, p
);
2622 static HRESULT WINAPI
HTMLElement2_put_onpaste(IHTMLElement2
*iface
, VARIANT v
)
2624 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2626 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2628 return set_node_event(&This
->node
, EVENTID_PASTE
, &v
);
2631 static HRESULT WINAPI
HTMLElement2_get_onpaste(IHTMLElement2
*iface
, VARIANT
*p
)
2633 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2635 TRACE("(%p)->(%p)\n", This
, p
);
2637 return get_node_event(&This
->node
, EVENTID_PASTE
, p
);
2640 static HRESULT WINAPI
HTMLElement2_get_currentStyle(IHTMLElement2
*iface
, IHTMLCurrentStyle
**p
)
2642 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2644 TRACE("(%p)->(%p)\n", This
, p
);
2646 return HTMLCurrentStyle_Create(This
, p
);
2649 static HRESULT WINAPI
HTMLElement2_put_onpropertychange(IHTMLElement2
*iface
, VARIANT v
)
2651 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2652 FIXME("(%p)->()\n", This
);
2656 static HRESULT WINAPI
HTMLElement2_get_onpropertychange(IHTMLElement2
*iface
, VARIANT
*p
)
2658 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2659 FIXME("(%p)->(%p)\n", This
, p
);
2663 static HRESULT WINAPI
HTMLElement2_getClientRects(IHTMLElement2
*iface
, IHTMLRectCollection
**pRectCol
)
2665 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2666 nsIDOMClientRectList
*rect_list
;
2667 HTMLRectCollection
*rects
;
2670 TRACE("(%p)->(%p)\n", This
, pRectCol
);
2672 if(!This
->dom_element
) {
2673 FIXME("comment element\n");
2677 nsres
= nsIDOMElement_GetClientRects(This
->dom_element
, &rect_list
);
2678 if(NS_FAILED(nsres
)) {
2679 WARN("GetClientRects failed: %08x\n", nsres
);
2680 return map_nsresult(nsres
);
2683 rects
= heap_alloc_zero(sizeof(*rects
));
2685 nsIDOMClientRectList_Release(rect_list
);
2686 return E_OUTOFMEMORY
;
2689 rects
->IHTMLRectCollection_iface
.lpVtbl
= &HTMLRectCollectionVtbl
;
2691 rects
->rect_list
= rect_list
;
2692 init_dispex(&rects
->dispex
, (IUnknown
*)&rects
->IHTMLRectCollection_iface
, &HTMLRectCollection_dispex
);
2694 *pRectCol
= &rects
->IHTMLRectCollection_iface
;
2698 static HRESULT WINAPI
HTMLElement2_getBoundingClientRect(IHTMLElement2
*iface
, IHTMLRect
**pRect
)
2700 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2701 nsIDOMClientRect
*nsrect
;
2705 TRACE("(%p)->(%p)\n", This
, pRect
);
2707 if(!This
->dom_element
) {
2708 FIXME("comment element\n");
2712 nsres
= nsIDOMElement_GetBoundingClientRect(This
->dom_element
, &nsrect
);
2713 if(NS_FAILED(nsres
) || !nsrect
) {
2714 ERR("GetBoindingClientRect failed: %08x\n", nsres
);
2718 hres
= create_html_rect(nsrect
, pRect
);
2720 nsIDOMClientRect_Release(nsrect
);
2724 static HRESULT WINAPI
HTMLElement2_setExpression(IHTMLElement2
*iface
, BSTR propname
,
2725 BSTR expression
, BSTR language
)
2727 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2728 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(propname
), debugstr_w(expression
),
2729 debugstr_w(language
));
2733 static HRESULT WINAPI
HTMLElement2_getExpression(IHTMLElement2
*iface
, BSTR propname
,
2734 VARIANT
*expression
)
2736 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2737 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), expression
);
2741 static HRESULT WINAPI
HTMLElement2_removeExpression(IHTMLElement2
*iface
, BSTR propname
,
2742 VARIANT_BOOL
*pfSuccess
)
2744 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2745 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), pfSuccess
);
2749 static HRESULT WINAPI
HTMLElement2_put_tabIndex(IHTMLElement2
*iface
, short v
)
2751 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2754 TRACE("(%p)->(%d)\n", This
, v
);
2756 if(!This
->html_element
) {
2757 FIXME("non-HTML element\n");
2761 nsres
= nsIDOMHTMLElement_SetTabIndex(This
->html_element
, v
);
2762 if(NS_FAILED(nsres
))
2763 ERR("GetTabIndex failed: %08x\n", nsres
);
2768 static HRESULT WINAPI
HTMLElement2_get_tabIndex(IHTMLElement2
*iface
, short *p
)
2770 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2774 TRACE("(%p)->(%p)\n", This
, p
);
2776 if(!This
->html_element
) {
2777 FIXME("non-HTML element\n");
2781 nsres
= nsIDOMHTMLElement_GetTabIndex(This
->html_element
, &index
);
2782 if(NS_FAILED(nsres
)) {
2783 ERR("GetTabIndex failed: %08x\n", nsres
);
2791 static HRESULT WINAPI
HTMLElement2_focus(IHTMLElement2
*iface
)
2793 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2796 TRACE("(%p)\n", This
);
2798 if(!This
->html_element
) {
2799 FIXME("non-HTML element\n");
2803 nsres
= nsIDOMHTMLElement_Focus(This
->html_element
);
2804 if(NS_FAILED(nsres
))
2805 ERR("Focus failed: %08x\n", nsres
);
2810 static HRESULT WINAPI
HTMLElement2_put_accessKey(IHTMLElement2
*iface
, BSTR v
)
2812 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2815 static WCHAR accessKeyW
[] = {'a','c','c','e','s','s','K','e','y',0};
2817 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2819 V_VT(&var
) = VT_BSTR
;
2821 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, accessKeyW
, var
, 0);
2824 static HRESULT WINAPI
HTMLElement2_get_accessKey(IHTMLElement2
*iface
, BSTR
*p
)
2826 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2827 FIXME("(%p)->(%p)\n", This
, p
);
2831 static HRESULT WINAPI
HTMLElement2_put_onblur(IHTMLElement2
*iface
, VARIANT v
)
2833 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2835 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2837 return set_node_event(&This
->node
, EVENTID_BLUR
, &v
);
2840 static HRESULT WINAPI
HTMLElement2_get_onblur(IHTMLElement2
*iface
, VARIANT
*p
)
2842 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2844 TRACE("(%p)->(%p)\n", This
, p
);
2846 return get_node_event(&This
->node
, EVENTID_BLUR
, p
);
2849 static HRESULT WINAPI
HTMLElement2_put_onfocus(IHTMLElement2
*iface
, VARIANT v
)
2851 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2853 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2855 return set_node_event(&This
->node
, EVENTID_FOCUS
, &v
);
2858 static HRESULT WINAPI
HTMLElement2_get_onfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2860 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2862 TRACE("(%p)->(%p)\n", This
, p
);
2864 return get_node_event(&This
->node
, EVENTID_FOCUS
, p
);
2867 static HRESULT WINAPI
HTMLElement2_put_onresize(IHTMLElement2
*iface
, VARIANT v
)
2869 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2871 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2873 return set_node_event(&This
->node
, EVENTID_RESIZE
, &v
);
2876 static HRESULT WINAPI
HTMLElement2_get_onresize(IHTMLElement2
*iface
, VARIANT
*p
)
2878 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2880 TRACE("(%p)->(%p)\n", This
, p
);
2882 return get_node_event(&This
->node
, EVENTID_RESIZE
, p
);
2885 static HRESULT WINAPI
HTMLElement2_blur(IHTMLElement2
*iface
)
2887 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2890 TRACE("(%p)\n", This
);
2892 if(!This
->html_element
) {
2893 FIXME("non-HTML element\n");
2897 nsres
= nsIDOMHTMLElement_Blur(This
->html_element
);
2898 if(NS_FAILED(nsres
)) {
2899 ERR("Blur failed: %08x\n", nsres
);
2906 static HRESULT WINAPI
HTMLElement2_addFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2908 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2909 FIXME("(%p)->(%p)\n", This
, pUnk
);
2913 static HRESULT WINAPI
HTMLElement2_removeFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2915 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2916 FIXME("(%p)->(%p)\n", This
, pUnk
);
2920 static HRESULT WINAPI
HTMLElement2_get_clientHeight(IHTMLElement2
*iface
, LONG
*p
)
2922 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2925 TRACE("(%p)->(%p)\n", This
, p
);
2927 if(!This
->dom_element
) {
2928 FIXME("Unimplemented for comment element\n");
2932 nsres
= nsIDOMElement_GetClientHeight(This
->dom_element
, p
);
2933 assert(nsres
== NS_OK
);
2937 static HRESULT WINAPI
HTMLElement2_get_clientWidth(IHTMLElement2
*iface
, LONG
*p
)
2939 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2942 TRACE("(%p)->(%p)\n", This
, p
);
2944 if(!This
->dom_element
) {
2945 FIXME("comment element\n");
2949 nsres
= nsIDOMElement_GetClientWidth(This
->dom_element
, p
);
2950 assert(nsres
== NS_OK
);
2954 static HRESULT WINAPI
HTMLElement2_get_clientTop(IHTMLElement2
*iface
, LONG
*p
)
2956 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2959 TRACE("(%p)->(%p)\n", This
, p
);
2961 if(!This
->dom_element
) {
2962 FIXME("comment element\n");
2966 nsres
= nsIDOMElement_GetClientTop(This
->dom_element
, p
);
2967 assert(nsres
== NS_OK
);
2969 TRACE("*p = %d\n", *p
);
2973 static HRESULT WINAPI
HTMLElement2_get_clientLeft(IHTMLElement2
*iface
, LONG
*p
)
2975 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2978 TRACE("(%p)->(%p)\n", This
, p
);
2980 if(!This
->dom_element
) {
2981 FIXME("comment element\n");
2985 nsres
= nsIDOMElement_GetClientLeft(This
->dom_element
, p
);
2986 assert(nsres
== NS_OK
);
2988 TRACE("*p = %d\n", *p
);
2992 static HRESULT WINAPI
HTMLElement2_attachEvent(IHTMLElement2
*iface
, BSTR event
,
2993 IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
2995 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2997 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2999 return attach_event(&This
->node
.event_target
, event
, pDisp
, pfResult
);
3002 static HRESULT WINAPI
HTMLElement2_detachEvent(IHTMLElement2
*iface
, BSTR event
, IDispatch
*pDisp
)
3004 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3006 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
3008 return detach_event(&This
->node
.event_target
, event
, pDisp
);
3011 static HRESULT WINAPI
HTMLElement2_get_readyState(IHTMLElement2
*iface
, VARIANT
*p
)
3013 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3016 TRACE("(%p)->(%p)\n", This
, p
);
3018 if(This
->node
.vtbl
->get_readystate
) {
3021 hres
= This
->node
.vtbl
->get_readystate(&This
->node
, &str
);
3025 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
3027 str
= SysAllocString(completeW
);
3029 return E_OUTOFMEMORY
;
3037 static HRESULT WINAPI
HTMLElement2_put_onreadystatechange(IHTMLElement2
*iface
, VARIANT v
)
3039 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3041 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3043 return set_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, &v
);
3046 static HRESULT WINAPI
HTMLElement2_get_onreadystatechange(IHTMLElement2
*iface
, VARIANT
*p
)
3048 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3050 TRACE("(%p)->(%p)\n", This
, p
);
3052 return get_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, p
);
3055 static HRESULT WINAPI
HTMLElement2_put_onrowsdelete(IHTMLElement2
*iface
, VARIANT v
)
3057 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3058 FIXME("(%p)->()\n", This
);
3062 static HRESULT WINAPI
HTMLElement2_get_onrowsdelete(IHTMLElement2
*iface
, VARIANT
*p
)
3064 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3065 FIXME("(%p)->(%p)\n", This
, p
);
3069 static HRESULT WINAPI
HTMLElement2_put_onrowsinserted(IHTMLElement2
*iface
, VARIANT v
)
3071 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3072 FIXME("(%p)->()\n", This
);
3076 static HRESULT WINAPI
HTMLElement2_get_onrowsinserted(IHTMLElement2
*iface
, VARIANT
*p
)
3078 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3079 FIXME("(%p)->(%p)\n", This
, p
);
3083 static HRESULT WINAPI
HTMLElement2_put_oncellchange(IHTMLElement2
*iface
, VARIANT v
)
3085 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3086 FIXME("(%p)->()\n", This
);
3090 static HRESULT WINAPI
HTMLElement2_get_oncellchange(IHTMLElement2
*iface
, VARIANT
*p
)
3092 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3093 FIXME("(%p)->(%p)\n", This
, p
);
3097 static HRESULT WINAPI
HTMLElement2_put_dir(IHTMLElement2
*iface
, BSTR v
)
3099 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3103 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3105 if(!This
->html_element
) {
3106 FIXME("non-HTML element\n");
3110 nsAString_InitDepend(&nsstr
, v
);
3111 nsres
= nsIDOMHTMLElement_SetDir(This
->html_element
, &nsstr
);
3112 nsAString_Finish(&nsstr
);
3113 if(NS_FAILED(nsres
)) {
3114 ERR("SetDir failed: %08x\n", nsres
);
3121 static HRESULT WINAPI
HTMLElement2_get_dir(IHTMLElement2
*iface
, BSTR
*p
)
3123 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3127 TRACE("(%p)->(%p)\n", This
, p
);
3129 if(!This
->html_element
) {
3130 if(This
->dom_element
)
3131 FIXME("non-HTML element\n");
3136 nsAString_Init(&dir_str
, NULL
);
3137 nsres
= nsIDOMHTMLElement_GetDir(This
->html_element
, &dir_str
);
3138 return return_nsstr(nsres
, &dir_str
, p
);
3141 static HRESULT WINAPI
HTMLElement2_createControlRange(IHTMLElement2
*iface
, IDispatch
**range
)
3143 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3144 FIXME("(%p)->(%p)\n", This
, range
);
3148 static HRESULT WINAPI
HTMLElement2_get_scrollHeight(IHTMLElement2
*iface
, LONG
*p
)
3150 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3153 TRACE("(%p)->(%p)\n", This
, p
);
3155 if(!This
->dom_element
) {
3156 FIXME("comment element\n");
3160 nsres
= nsIDOMElement_GetScrollHeight(This
->dom_element
, p
);
3161 assert(nsres
== NS_OK
);
3162 TRACE("*p = %d\n", *p
);
3166 static HRESULT WINAPI
HTMLElement2_get_scrollWidth(IHTMLElement2
*iface
, LONG
*p
)
3168 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3171 TRACE("(%p)->(%p)\n", This
, p
);
3173 if(!This
->dom_element
) {
3174 FIXME("comment element\n");
3178 nsres
= nsIDOMElement_GetScrollWidth(This
->dom_element
, p
);
3179 assert(nsres
== NS_OK
);
3181 TRACE("*p = %d\n", *p
);
3185 static HRESULT WINAPI
HTMLElement2_put_scrollTop(IHTMLElement2
*iface
, LONG v
)
3187 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3189 TRACE("(%p)->(%d)\n", This
, v
);
3191 if(!This
->dom_element
) {
3192 FIXME("comment element\n");
3196 nsIDOMElement_SetScrollTop(This
->dom_element
, v
);
3200 static HRESULT WINAPI
HTMLElement2_get_scrollTop(IHTMLElement2
*iface
, LONG
*p
)
3202 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3205 TRACE("(%p)->(%p)\n", This
, p
);
3207 if(!This
->dom_element
) {
3208 FIXME("comment element\n");
3212 nsres
= nsIDOMElement_GetScrollTop(This
->dom_element
, p
);
3213 assert(nsres
== NS_OK
);
3215 TRACE("*p = %d\n", *p
);
3219 static HRESULT WINAPI
HTMLElement2_put_scrollLeft(IHTMLElement2
*iface
, LONG v
)
3221 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3223 TRACE("(%p)->(%d)\n", This
, v
);
3225 if(!This
->dom_element
) {
3226 FIXME("comment element\n");
3230 nsIDOMElement_SetScrollLeft(This
->dom_element
, v
);
3234 static HRESULT WINAPI
HTMLElement2_get_scrollLeft(IHTMLElement2
*iface
, LONG
*p
)
3236 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3239 TRACE("(%p)->(%p)\n", This
, p
);
3242 return E_INVALIDARG
;
3244 if(!This
->dom_element
) {
3245 FIXME("comment element\n");
3249 nsres
= nsIDOMElement_GetScrollLeft(This
->dom_element
, p
);
3250 assert(nsres
== NS_OK
);
3251 TRACE("*p = %d\n", *p
);
3255 static HRESULT WINAPI
HTMLElement2_clearAttributes(IHTMLElement2
*iface
)
3257 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3258 FIXME("(%p)\n", This
);
3262 static HRESULT WINAPI
HTMLElement2_mergeAttributes(IHTMLElement2
*iface
, IHTMLElement
*mergeThis
)
3264 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3265 FIXME("(%p)->(%p)\n", This
, mergeThis
);
3269 static HRESULT WINAPI
HTMLElement2_put_oncontextmenu(IHTMLElement2
*iface
, VARIANT v
)
3271 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3273 TRACE("(%p)->()\n", This
);
3275 return set_node_event(&This
->node
, EVENTID_CONTEXTMENU
, &v
);
3278 static HRESULT WINAPI
HTMLElement2_get_oncontextmenu(IHTMLElement2
*iface
, VARIANT
*p
)
3280 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3282 TRACE("(%p)->(%p)\n", This
, p
);
3284 return get_node_event(&This
->node
, EVENTID_CONTEXTMENU
, p
);
3287 static HRESULT WINAPI
HTMLElement2_insertAdjacentElement(IHTMLElement2
*iface
, BSTR where
,
3288 IHTMLElement
*insertedElement
, IHTMLElement
**inserted
)
3290 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3291 HTMLDOMNode
*ret_node
;
3295 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(where
), insertedElement
, inserted
);
3297 elem
= unsafe_impl_from_IHTMLElement(insertedElement
);
3299 return E_INVALIDARG
;
3301 hres
= insert_adjacent_node(This
, where
, elem
->node
.nsnode
, &ret_node
);
3305 hres
= IHTMLDOMNode_QueryInterface(&ret_node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)inserted
);
3306 IHTMLDOMNode_Release(&ret_node
->IHTMLDOMNode_iface
);
3310 static HRESULT WINAPI
HTMLElement2_applyElement(IHTMLElement2
*iface
, IHTMLElement
*apply
,
3311 BSTR where
, IHTMLElement
**applied
)
3313 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3314 FIXME("(%p)->(%p %s %p)\n", This
, apply
, debugstr_w(where
), applied
);
3318 static HRESULT WINAPI
HTMLElement2_getAdjacentText(IHTMLElement2
*iface
, BSTR where
, BSTR
*text
)
3320 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3321 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(where
), text
);
3325 static HRESULT WINAPI
HTMLElement2_replaceAdjacentText(IHTMLElement2
*iface
, BSTR where
,
3326 BSTR newText
, BSTR
*oldText
)
3328 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3329 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(where
), debugstr_w(newText
), oldText
);
3333 static HRESULT WINAPI
HTMLElement2_get_canHandleChildren(IHTMLElement2
*iface
, VARIANT_BOOL
*p
)
3335 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3336 FIXME("(%p)->(%p)\n", This
, p
);
3340 static HRESULT WINAPI
HTMLElement2_addBehavior(IHTMLElement2
*iface
, BSTR bstrUrl
,
3341 VARIANT
*pvarFactory
, LONG
*pCookie
)
3343 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3344 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrUrl
), pvarFactory
, pCookie
);
3348 static HRESULT WINAPI
HTMLElement2_removeBehavior(IHTMLElement2
*iface
, LONG cookie
,
3349 VARIANT_BOOL
*pfResult
)
3351 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3352 FIXME("(%p)->(%d %p)\n", This
, cookie
, pfResult
);
3356 static HRESULT WINAPI
HTMLElement2_get_runtimeStyle(IHTMLElement2
*iface
, IHTMLStyle
**p
)
3358 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3360 FIXME("(%p)->(%p): hack\n", This
, p
);
3362 /* We can't implement correct behavior on top of Gecko (although we could
3363 try a bit harder). Making runtimeStyle behave like regular style is
3364 enough for most use cases. */
3365 if(!This
->runtime_style
) {
3368 hres
= HTMLStyle_Create(This
, &This
->runtime_style
);
3373 *p
= &This
->runtime_style
->IHTMLStyle_iface
;
3374 IHTMLStyle_AddRef(*p
);
3378 static HRESULT WINAPI
HTMLElement2_get_behaviorUrns(IHTMLElement2
*iface
, IDispatch
**p
)
3380 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3381 FIXME("(%p)->(%p)\n", This
, p
);
3385 static HRESULT WINAPI
HTMLElement2_put_tagUrn(IHTMLElement2
*iface
, BSTR v
)
3387 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3388 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3392 static HRESULT WINAPI
HTMLElement2_get_tagUrn(IHTMLElement2
*iface
, BSTR
*p
)
3394 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3395 FIXME("(%p)->(%p)\n", This
, p
);
3399 static HRESULT WINAPI
HTMLElement2_put_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT vv
)
3401 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3402 FIXME("(%p)->()\n", This
);
3406 static HRESULT WINAPI
HTMLElement2_get_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT
*p
)
3408 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3409 FIXME("(%p)->(%p)\n", This
, p
);
3413 static HRESULT WINAPI
HTMLElement2_get_readyStateValue(IHTMLElement2
*iface
, LONG
*p
)
3415 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3416 FIXME("(%p)->(%p)\n", This
, p
);
3420 static HRESULT WINAPI
HTMLElement2_getElementsByTagName(IHTMLElement2
*iface
, BSTR v
,
3421 IHTMLElementCollection
**pelColl
)
3423 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
3424 nsIDOMHTMLCollection
*nscol
;
3428 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
3430 if(!This
->dom_element
) {
3431 *pelColl
= create_collection_from_htmlcol(NULL
, This
->node
.doc
->document_mode
);
3435 nsAString_InitDepend(&tag_str
, v
);
3436 nsres
= nsIDOMElement_GetElementsByTagName(This
->dom_element
, &tag_str
, &nscol
);
3437 nsAString_Finish(&tag_str
);
3438 if(NS_FAILED(nsres
)) {
3439 ERR("GetElementByTagName failed: %08x\n", nsres
);
3443 *pelColl
= create_collection_from_htmlcol(nscol
, dispex_compat_mode(&This
->node
.event_target
.dispex
));
3444 nsIDOMHTMLCollection_Release(nscol
);
3448 static const IHTMLElement2Vtbl HTMLElement2Vtbl
= {
3449 HTMLElement2_QueryInterface
,
3450 HTMLElement2_AddRef
,
3451 HTMLElement2_Release
,
3452 HTMLElement2_GetTypeInfoCount
,
3453 HTMLElement2_GetTypeInfo
,
3454 HTMLElement2_GetIDsOfNames
,
3455 HTMLElement2_Invoke
,
3456 HTMLElement2_get_scopeName
,
3457 HTMLElement2_setCapture
,
3458 HTMLElement2_releaseCapture
,
3459 HTMLElement2_put_onlosecapture
,
3460 HTMLElement2_get_onlosecapture
,
3461 HTMLElement2_componentFromPoint
,
3462 HTMLElement2_doScroll
,
3463 HTMLElement2_put_onscroll
,
3464 HTMLElement2_get_onscroll
,
3465 HTMLElement2_put_ondrag
,
3466 HTMLElement2_get_ondrag
,
3467 HTMLElement2_put_ondragend
,
3468 HTMLElement2_get_ondragend
,
3469 HTMLElement2_put_ondragenter
,
3470 HTMLElement2_get_ondragenter
,
3471 HTMLElement2_put_ondragover
,
3472 HTMLElement2_get_ondragover
,
3473 HTMLElement2_put_ondragleave
,
3474 HTMLElement2_get_ondragleave
,
3475 HTMLElement2_put_ondrop
,
3476 HTMLElement2_get_ondrop
,
3477 HTMLElement2_put_onbeforecut
,
3478 HTMLElement2_get_onbeforecut
,
3479 HTMLElement2_put_oncut
,
3480 HTMLElement2_get_oncut
,
3481 HTMLElement2_put_onbeforecopy
,
3482 HTMLElement2_get_onbeforecopy
,
3483 HTMLElement2_put_oncopy
,
3484 HTMLElement2_get_oncopy
,
3485 HTMLElement2_put_onbeforepaste
,
3486 HTMLElement2_get_onbeforepaste
,
3487 HTMLElement2_put_onpaste
,
3488 HTMLElement2_get_onpaste
,
3489 HTMLElement2_get_currentStyle
,
3490 HTMLElement2_put_onpropertychange
,
3491 HTMLElement2_get_onpropertychange
,
3492 HTMLElement2_getClientRects
,
3493 HTMLElement2_getBoundingClientRect
,
3494 HTMLElement2_setExpression
,
3495 HTMLElement2_getExpression
,
3496 HTMLElement2_removeExpression
,
3497 HTMLElement2_put_tabIndex
,
3498 HTMLElement2_get_tabIndex
,
3500 HTMLElement2_put_accessKey
,
3501 HTMLElement2_get_accessKey
,
3502 HTMLElement2_put_onblur
,
3503 HTMLElement2_get_onblur
,
3504 HTMLElement2_put_onfocus
,
3505 HTMLElement2_get_onfocus
,
3506 HTMLElement2_put_onresize
,
3507 HTMLElement2_get_onresize
,
3509 HTMLElement2_addFilter
,
3510 HTMLElement2_removeFilter
,
3511 HTMLElement2_get_clientHeight
,
3512 HTMLElement2_get_clientWidth
,
3513 HTMLElement2_get_clientTop
,
3514 HTMLElement2_get_clientLeft
,
3515 HTMLElement2_attachEvent
,
3516 HTMLElement2_detachEvent
,
3517 HTMLElement2_get_readyState
,
3518 HTMLElement2_put_onreadystatechange
,
3519 HTMLElement2_get_onreadystatechange
,
3520 HTMLElement2_put_onrowsdelete
,
3521 HTMLElement2_get_onrowsdelete
,
3522 HTMLElement2_put_onrowsinserted
,
3523 HTMLElement2_get_onrowsinserted
,
3524 HTMLElement2_put_oncellchange
,
3525 HTMLElement2_get_oncellchange
,
3526 HTMLElement2_put_dir
,
3527 HTMLElement2_get_dir
,
3528 HTMLElement2_createControlRange
,
3529 HTMLElement2_get_scrollHeight
,
3530 HTMLElement2_get_scrollWidth
,
3531 HTMLElement2_put_scrollTop
,
3532 HTMLElement2_get_scrollTop
,
3533 HTMLElement2_put_scrollLeft
,
3534 HTMLElement2_get_scrollLeft
,
3535 HTMLElement2_clearAttributes
,
3536 HTMLElement2_mergeAttributes
,
3537 HTMLElement2_put_oncontextmenu
,
3538 HTMLElement2_get_oncontextmenu
,
3539 HTMLElement2_insertAdjacentElement
,
3540 HTMLElement2_applyElement
,
3541 HTMLElement2_getAdjacentText
,
3542 HTMLElement2_replaceAdjacentText
,
3543 HTMLElement2_get_canHandleChildren
,
3544 HTMLElement2_addBehavior
,
3545 HTMLElement2_removeBehavior
,
3546 HTMLElement2_get_runtimeStyle
,
3547 HTMLElement2_get_behaviorUrns
,
3548 HTMLElement2_put_tagUrn
,
3549 HTMLElement2_get_tagUrn
,
3550 HTMLElement2_put_onbeforeeditfocus
,
3551 HTMLElement2_get_onbeforeeditfocus
,
3552 HTMLElement2_get_readyStateValue
,
3553 HTMLElement2_getElementsByTagName
,
3556 static inline HTMLElement
*impl_from_IHTMLElement3(IHTMLElement3
*iface
)
3558 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement3_iface
);
3561 static HRESULT WINAPI
HTMLElement3_QueryInterface(IHTMLElement3
*iface
,
3562 REFIID riid
, void **ppv
)
3564 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3565 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3568 static ULONG WINAPI
HTMLElement3_AddRef(IHTMLElement3
*iface
)
3570 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3571 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3574 static ULONG WINAPI
HTMLElement3_Release(IHTMLElement3
*iface
)
3576 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3577 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3580 static HRESULT WINAPI
HTMLElement3_GetTypeInfoCount(IHTMLElement3
*iface
, UINT
*pctinfo
)
3582 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3583 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
3586 static HRESULT WINAPI
HTMLElement3_GetTypeInfo(IHTMLElement3
*iface
, UINT iTInfo
,
3587 LCID lcid
, ITypeInfo
**ppTInfo
)
3589 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3590 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3593 static HRESULT WINAPI
HTMLElement3_GetIDsOfNames(IHTMLElement3
*iface
, REFIID riid
,
3594 LPOLESTR
*rgszNames
, UINT cNames
,
3595 LCID lcid
, DISPID
*rgDispId
)
3597 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3598 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3602 static HRESULT WINAPI
HTMLElement3_Invoke(IHTMLElement3
*iface
, DISPID dispIdMember
,
3603 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3604 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3606 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3607 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3608 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3611 static HRESULT WINAPI
HTMLElement3_mergeAttributes(IHTMLElement3
*iface
, IHTMLElement
*mergeThis
, VARIANT
*pvarFlags
)
3613 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3614 FIXME("(%p)->(%p %p)\n", This
, mergeThis
, pvarFlags
);
3618 static HRESULT WINAPI
HTMLElement3_get_isMultiLine(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3620 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3621 FIXME("(%p)->(%p)\n", This
, p
);
3625 static HRESULT WINAPI
HTMLElement3_get_canHaveHTML(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3627 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3628 FIXME("(%p)->(%p)\n", This
, p
);
3632 static HRESULT WINAPI
HTMLElement3_put_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT v
)
3634 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3635 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3639 static HRESULT WINAPI
HTMLElement3_get_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT
*p
)
3641 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3642 FIXME("(%p)->(%p)\n", This
, p
);
3646 static HRESULT WINAPI
HTMLElement3_put_onpage(IHTMLElement3
*iface
, VARIANT v
)
3648 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3649 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3653 static HRESULT WINAPI
HTMLElement3_get_onpage(IHTMLElement3
*iface
, VARIANT
*p
)
3655 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3656 FIXME("(%p)->(%p)\n", This
, p
);
3660 static HRESULT WINAPI
HTMLElement3_put_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3662 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3663 FIXME("(%p)->(%x)\n", This
, v
);
3667 static HRESULT WINAPI
HTMLElement3_get_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3669 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3670 FIXME("(%p)->(%p)\n", This
, p
);
3674 static HRESULT WINAPI
HTMLElement3_put_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT v
)
3676 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3677 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3681 static HRESULT WINAPI
HTMLElement3_get_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3683 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3684 FIXME("(%p)->(%p)\n", This
, p
);
3688 static HRESULT WINAPI
HTMLElement3_setActive(IHTMLElement3
*iface
)
3690 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3691 FIXME("(%p)\n", This
);
3695 static HRESULT WINAPI
HTMLElement3_put_contentEditable(IHTMLElement3
*iface
, BSTR v
)
3697 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3701 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3703 if(!This
->html_element
) {
3704 FIXME("non-HTML element\n");
3708 nsAString_InitDepend(&str
, v
);
3709 nsres
= nsIDOMHTMLElement_SetContentEditable(This
->html_element
, &str
);
3710 nsAString_Finish(&str
);
3712 if (NS_FAILED(nsres
)){
3713 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v
));
3720 static HRESULT WINAPI
HTMLElement3_get_contentEditable(IHTMLElement3
*iface
, BSTR
*p
)
3722 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3726 TRACE("(%p)->(%p)\n", This
, p
);
3728 if(!This
->html_element
) {
3729 FIXME("non-HTML element\n");
3733 nsAString_Init(&str
, NULL
);
3734 nsres
= nsIDOMHTMLElement_GetContentEditable(This
->html_element
, &str
);
3735 return return_nsstr(nsres
, &str
, p
);
3738 static HRESULT WINAPI
HTMLElement3_get_isContentEditable(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3740 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3741 FIXME("(%p)->(%p)\n", This
, p
);
3745 static HRESULT WINAPI
HTMLElement3_put_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3747 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3748 FIXME("(%p)->(%x)\n", This
, v
);
3752 static HRESULT WINAPI
HTMLElement3_get_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3754 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3755 FIXME("(%p)->(%p)\n", This
, p
);
3759 static const WCHAR disabledW
[] = {'d','i','s','a','b','l','e','d',0};
3761 static HRESULT WINAPI
HTMLElement3_put_disabled(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3763 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3767 TRACE("(%p)->(%x)\n", This
, v
);
3769 if(This
->node
.vtbl
->put_disabled
)
3770 return This
->node
.vtbl
->put_disabled(&This
->node
, v
);
3772 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, TRUE
, &var
);
3777 V_VT(var
) = VT_BOOL
;
3782 static HRESULT WINAPI
HTMLElement3_get_disabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3784 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3788 TRACE("(%p)->(%p)\n", This
, p
);
3790 if(This
->node
.vtbl
->get_disabled
)
3791 return This
->node
.vtbl
->get_disabled(&This
->node
, p
);
3793 hres
= dispex_get_dprop_ref(&This
->node
.event_target
.dispex
, disabledW
, FALSE
, &var
);
3794 if(hres
== DISP_E_UNKNOWNNAME
) {
3801 if(V_VT(var
) != VT_BOOL
) {
3802 FIXME("value is %s\n", debugstr_variant(var
));
3810 static HRESULT WINAPI
HTMLElement3_get_isDisabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3812 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3813 FIXME("(%p)->(%p)\n", This
, p
);
3817 static HRESULT WINAPI
HTMLElement3_put_onmove(IHTMLElement3
*iface
, VARIANT v
)
3819 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3820 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3824 static HRESULT WINAPI
HTMLElement3_get_onmove(IHTMLElement3
*iface
, VARIANT
*p
)
3826 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3827 FIXME("(%p)->(%p)\n", This
, p
);
3831 static HRESULT WINAPI
HTMLElement3_put_oncontrolselect(IHTMLElement3
*iface
, VARIANT v
)
3833 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3834 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3838 static HRESULT WINAPI
HTMLElement3_get_oncontrolselect(IHTMLElement3
*iface
, VARIANT
*p
)
3840 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3841 FIXME("(%p)->(%p)\n", This
, p
);
3845 static HRESULT WINAPI
HTMLElement3_fireEvent(IHTMLElement3
*iface
, BSTR bstrEventName
,
3846 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCancelled
)
3848 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3850 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrEventName
), debugstr_variant(pvarEventObject
),
3853 return fire_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCancelled
);
3856 static HRESULT WINAPI
HTMLElement3_put_onresizestart(IHTMLElement3
*iface
, VARIANT v
)
3858 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3859 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3863 static HRESULT WINAPI
HTMLElement3_get_onresizestart(IHTMLElement3
*iface
, VARIANT
*p
)
3865 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3866 FIXME("(%p)->(%p)\n", This
, p
);
3870 static HRESULT WINAPI
HTMLElement3_put_onresizeend(IHTMLElement3
*iface
, VARIANT v
)
3872 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3873 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3877 static HRESULT WINAPI
HTMLElement3_get_onresizeend(IHTMLElement3
*iface
, VARIANT
*p
)
3879 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3880 FIXME("(%p)->(%p)\n", This
, p
);
3884 static HRESULT WINAPI
HTMLElement3_put_onmovestart(IHTMLElement3
*iface
, VARIANT v
)
3886 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3887 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3891 static HRESULT WINAPI
HTMLElement3_get_onmovestart(IHTMLElement3
*iface
, VARIANT
*p
)
3893 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3894 FIXME("(%p)->(%p)\n", This
, p
);
3898 static HRESULT WINAPI
HTMLElement3_put_onmoveend(IHTMLElement3
*iface
, VARIANT v
)
3900 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3901 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3905 static HRESULT WINAPI
HTMLElement3_get_onmoveend(IHTMLElement3
*iface
, VARIANT
*p
)
3907 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3908 FIXME("(%p)->(%p)\n", This
, p
);
3912 static HRESULT WINAPI
HTMLElement3_put_onmousecenter(IHTMLElement3
*iface
, VARIANT v
)
3914 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3915 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3919 static HRESULT WINAPI
HTMLElement3_get_onmousecenter(IHTMLElement3
*iface
, VARIANT
*p
)
3921 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3922 FIXME("(%p)->(%p)\n", This
, p
);
3926 static HRESULT WINAPI
HTMLElement3_put_onmouseleave(IHTMLElement3
*iface
, VARIANT v
)
3928 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3929 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3933 static HRESULT WINAPI
HTMLElement3_get_onmouseleave(IHTMLElement3
*iface
, VARIANT
*p
)
3935 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3936 FIXME("(%p)->(%p)\n", This
, p
);
3940 static HRESULT WINAPI
HTMLElement3_put_onactivate(IHTMLElement3
*iface
, VARIANT v
)
3942 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3943 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3947 static HRESULT WINAPI
HTMLElement3_get_onactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3949 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3950 FIXME("(%p)->(%p)\n", This
, p
);
3954 static HRESULT WINAPI
HTMLElement3_put_ondeactivate(IHTMLElement3
*iface
, VARIANT v
)
3956 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3957 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3961 static HRESULT WINAPI
HTMLElement3_get_ondeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3963 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3964 FIXME("(%p)->(%p)\n", This
, p
);
3968 static HRESULT WINAPI
HTMLElement3_dragDrop(IHTMLElement3
*iface
, VARIANT_BOOL
*pfRet
)
3970 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3971 FIXME("(%p)->(%p)\n", This
, pfRet
);
3975 static HRESULT WINAPI
HTMLElement3_get_glyphMode(IHTMLElement3
*iface
, LONG
*p
)
3977 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3978 FIXME("(%p)->(%p)\n", This
, p
);
3982 static const IHTMLElement3Vtbl HTMLElement3Vtbl
= {
3983 HTMLElement3_QueryInterface
,
3984 HTMLElement3_AddRef
,
3985 HTMLElement3_Release
,
3986 HTMLElement3_GetTypeInfoCount
,
3987 HTMLElement3_GetTypeInfo
,
3988 HTMLElement3_GetIDsOfNames
,
3989 HTMLElement3_Invoke
,
3990 HTMLElement3_mergeAttributes
,
3991 HTMLElement3_get_isMultiLine
,
3992 HTMLElement3_get_canHaveHTML
,
3993 HTMLElement3_put_onlayoutcomplete
,
3994 HTMLElement3_get_onlayoutcomplete
,
3995 HTMLElement3_put_onpage
,
3996 HTMLElement3_get_onpage
,
3997 HTMLElement3_put_inflateBlock
,
3998 HTMLElement3_get_inflateBlock
,
3999 HTMLElement3_put_onbeforedeactivate
,
4000 HTMLElement3_get_onbeforedeactivate
,
4001 HTMLElement3_setActive
,
4002 HTMLElement3_put_contentEditable
,
4003 HTMLElement3_get_contentEditable
,
4004 HTMLElement3_get_isContentEditable
,
4005 HTMLElement3_put_hideFocus
,
4006 HTMLElement3_get_hideFocus
,
4007 HTMLElement3_put_disabled
,
4008 HTMLElement3_get_disabled
,
4009 HTMLElement3_get_isDisabled
,
4010 HTMLElement3_put_onmove
,
4011 HTMLElement3_get_onmove
,
4012 HTMLElement3_put_oncontrolselect
,
4013 HTMLElement3_get_oncontrolselect
,
4014 HTMLElement3_fireEvent
,
4015 HTMLElement3_put_onresizestart
,
4016 HTMLElement3_get_onresizestart
,
4017 HTMLElement3_put_onresizeend
,
4018 HTMLElement3_get_onresizeend
,
4019 HTMLElement3_put_onmovestart
,
4020 HTMLElement3_get_onmovestart
,
4021 HTMLElement3_put_onmoveend
,
4022 HTMLElement3_get_onmoveend
,
4023 HTMLElement3_put_onmousecenter
,
4024 HTMLElement3_get_onmousecenter
,
4025 HTMLElement3_put_onmouseleave
,
4026 HTMLElement3_get_onmouseleave
,
4027 HTMLElement3_put_onactivate
,
4028 HTMLElement3_get_onactivate
,
4029 HTMLElement3_put_ondeactivate
,
4030 HTMLElement3_get_ondeactivate
,
4031 HTMLElement3_dragDrop
,
4032 HTMLElement3_get_glyphMode
4035 static inline HTMLElement
*impl_from_IHTMLElement4(IHTMLElement4
*iface
)
4037 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement4_iface
);
4040 static HRESULT WINAPI
HTMLElement4_QueryInterface(IHTMLElement4
*iface
,
4041 REFIID riid
, void **ppv
)
4043 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4044 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
4047 static ULONG WINAPI
HTMLElement4_AddRef(IHTMLElement4
*iface
)
4049 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4050 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
4053 static ULONG WINAPI
HTMLElement4_Release(IHTMLElement4
*iface
)
4055 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4056 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
4059 static HRESULT WINAPI
HTMLElement4_GetTypeInfoCount(IHTMLElement4
*iface
, UINT
*pctinfo
)
4061 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4062 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
4065 static HRESULT WINAPI
HTMLElement4_GetTypeInfo(IHTMLElement4
*iface
, UINT iTInfo
,
4066 LCID lcid
, ITypeInfo
**ppTInfo
)
4068 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4069 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4072 static HRESULT WINAPI
HTMLElement4_GetIDsOfNames(IHTMLElement4
*iface
, REFIID riid
,
4073 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4075 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4076 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4080 static HRESULT WINAPI
HTMLElement4_Invoke(IHTMLElement4
*iface
, DISPID dispIdMember
, REFIID riid
,
4081 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4083 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4084 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4085 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4088 static HRESULT WINAPI
HTMLElement4_put_onmousewheel(IHTMLElement4
*iface
, VARIANT v
)
4090 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4092 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4094 return set_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, &v
);
4097 static HRESULT WINAPI
HTMLElement4_get_onmousewheel(IHTMLElement4
*iface
, VARIANT
*p
)
4099 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4101 TRACE("(%p)->(%p)\n", This
, p
);
4103 return get_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, p
);
4106 static HRESULT WINAPI
HTMLElement4_normalize(IHTMLElement4
*iface
)
4108 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4109 FIXME("(%p)\n", This
);
4113 static HRESULT WINAPI
HTMLElement4_getAttributeNode(IHTMLElement4
*iface
, BSTR bstrname
, IHTMLDOMAttribute
**ppAttribute
)
4115 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4116 HTMLAttributeCollection
*attrs
;
4119 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrname
), ppAttribute
);
4121 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
4125 hres
= IHTMLAttributeCollection2_getNamedItem(&attrs
->IHTMLAttributeCollection2_iface
, bstrname
, ppAttribute
);
4126 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
4130 static HRESULT WINAPI
HTMLElement4_setAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
4131 IHTMLDOMAttribute
**ppretAttribute
)
4133 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4134 HTMLDOMAttribute
*attr
, *iter
, *replace
= NULL
;
4135 HTMLAttributeCollection
*attrs
;
4139 TRACE("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
4141 attr
= unsafe_impl_from_IHTMLDOMAttribute(pattr
);
4143 return E_INVALIDARG
;
4146 WARN("Tried to set already attached attribute.\n");
4147 return E_INVALIDARG
;
4150 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
,
4151 attr
->name
, fdexNameCaseInsensitive
|fdexNameEnsure
, &dispid
);
4155 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
4159 LIST_FOR_EACH_ENTRY(iter
, &attrs
->attrs
, HTMLDOMAttribute
, entry
) {
4160 if(iter
->dispid
== dispid
) {
4167 hres
= get_elem_attr_value_by_dispid(This
, dispid
, &replace
->value
);
4169 WARN("could not get attr value: %08x\n", hres
);
4170 V_VT(&replace
->value
) = VT_EMPTY
;
4172 if(!replace
->name
) {
4173 replace
->name
= attr
->name
;
4176 list_add_head(&replace
->entry
, &attr
->entry
);
4177 list_remove(&replace
->entry
);
4178 replace
->elem
= NULL
;
4180 list_add_tail(&attrs
->attrs
, &attr
->entry
);
4183 IHTMLDOMAttribute_AddRef(&attr
->IHTMLDOMAttribute_iface
);
4185 attr
->dispid
= dispid
;
4187 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
4189 hres
= set_elem_attr_value_by_dispid(This
, dispid
, &attr
->value
);
4191 WARN("Could not set attribute value: %08x\n", hres
);
4192 VariantClear(&attr
->value
);
4194 *ppretAttribute
= replace
? &replace
->IHTMLDOMAttribute_iface
: NULL
;
4198 static HRESULT WINAPI
HTMLElement4_removeAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
4199 IHTMLDOMAttribute
**ppretAttribute
)
4201 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4202 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
4206 static HRESULT WINAPI
HTMLElement4_put_onbeforeactivate(IHTMLElement4
*iface
, VARIANT v
)
4208 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4210 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4212 return set_node_event(&This
->node
, EVENTID_BEFOREACTIVATE
, &v
);
4215 static HRESULT WINAPI
HTMLElement4_get_onbeforeactivate(IHTMLElement4
*iface
, VARIANT
*p
)
4217 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4219 TRACE("(%p)->(%p)\n", This
, p
);
4221 return get_node_event(&This
->node
, EVENTID_BEFOREACTIVATE
, p
);
4224 static HRESULT WINAPI
HTMLElement4_put_onfocusin(IHTMLElement4
*iface
, VARIANT v
)
4226 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4228 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4230 return set_node_event(&This
->node
, EVENTID_FOCUSIN
, &v
);
4233 static HRESULT WINAPI
HTMLElement4_get_onfocusin(IHTMLElement4
*iface
, VARIANT
*p
)
4235 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4237 TRACE("(%p)->(%p)\n", This
, p
);
4239 return get_node_event(&This
->node
, EVENTID_FOCUSIN
, p
);
4242 static HRESULT WINAPI
HTMLElement4_put_onfocusout(IHTMLElement4
*iface
, VARIANT v
)
4244 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4246 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4248 return set_node_event(&This
->node
, EVENTID_FOCUSOUT
, &v
);
4251 static HRESULT WINAPI
HTMLElement4_get_onfocusout(IHTMLElement4
*iface
, VARIANT
*p
)
4253 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
4255 TRACE("(%p)->(%p)\n", This
, p
);
4257 return get_node_event(&This
->node
, EVENTID_FOCUSOUT
, p
);
4260 static const IHTMLElement4Vtbl HTMLElement4Vtbl
= {
4261 HTMLElement4_QueryInterface
,
4262 HTMLElement4_AddRef
,
4263 HTMLElement4_Release
,
4264 HTMLElement4_GetTypeInfoCount
,
4265 HTMLElement4_GetTypeInfo
,
4266 HTMLElement4_GetIDsOfNames
,
4267 HTMLElement4_Invoke
,
4268 HTMLElement4_put_onmousewheel
,
4269 HTMLElement4_get_onmousewheel
,
4270 HTMLElement4_normalize
,
4271 HTMLElement4_getAttributeNode
,
4272 HTMLElement4_setAttributeNode
,
4273 HTMLElement4_removeAttributeNode
,
4274 HTMLElement4_put_onbeforeactivate
,
4275 HTMLElement4_get_onbeforeactivate
,
4276 HTMLElement4_put_onfocusin
,
4277 HTMLElement4_get_onfocusin
,
4278 HTMLElement4_put_onfocusout
,
4279 HTMLElement4_get_onfocusout
4282 static inline HTMLElement
*impl_from_IHTMLElement6(IHTMLElement6
*iface
)
4284 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement6_iface
);
4287 static HRESULT WINAPI
HTMLElement6_QueryInterface(IHTMLElement6
*iface
,
4288 REFIID riid
, void **ppv
)
4290 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4291 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
4294 static ULONG WINAPI
HTMLElement6_AddRef(IHTMLElement6
*iface
)
4296 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4297 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
4300 static ULONG WINAPI
HTMLElement6_Release(IHTMLElement6
*iface
)
4302 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4303 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
4306 static HRESULT WINAPI
HTMLElement6_GetTypeInfoCount(IHTMLElement6
*iface
, UINT
*pctinfo
)
4308 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4309 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
4312 static HRESULT WINAPI
HTMLElement6_GetTypeInfo(IHTMLElement6
*iface
, UINT iTInfo
,
4313 LCID lcid
, ITypeInfo
**ppTInfo
)
4315 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4316 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4319 static HRESULT WINAPI
HTMLElement6_GetIDsOfNames(IHTMLElement6
*iface
, REFIID riid
,
4320 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4322 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4323 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4327 static HRESULT WINAPI
HTMLElement6_Invoke(IHTMLElement6
*iface
, DISPID dispIdMember
, REFIID riid
,
4328 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4330 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4331 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4332 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4335 static HRESULT WINAPI
HTMLElement6_getAttributeNS(IHTMLElement6
*iface
, VARIANT
*pvarNS
, BSTR strAttributeName
, VARIANT
*AttributeValue
)
4337 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4338 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(strAttributeName
), AttributeValue
);
4342 static HRESULT WINAPI
HTMLElement6_setAttributeNS(IHTMLElement6
*iface
, VARIANT
*pvarNS
, BSTR strAttributeName
, VARIANT
*pvarAttributeValue
)
4344 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4345 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_variant(pvarNS
), debugstr_w(strAttributeName
), debugstr_variant(pvarAttributeValue
));
4349 static HRESULT WINAPI
HTMLElement6_removeAttributeNS(IHTMLElement6
*iface
, VARIANT
*pvarNS
, BSTR strAttributeName
)
4351 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4352 FIXME("(%p)->(%s %s)\n", This
, debugstr_variant(pvarNS
), debugstr_w(strAttributeName
));
4356 static HRESULT WINAPI
HTMLElement6_getAttributeNodeNS(IHTMLElement6
*iface
, VARIANT
*pvarNS
, BSTR name
, IHTMLDOMAttribute2
**ppretAttribute
)
4358 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4359 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(name
), ppretAttribute
);
4363 static HRESULT WINAPI
HTMLElement6_setAttributeNodeNS(IHTMLElement6
*iface
, IHTMLDOMAttribute2
*pattr
, IHTMLDOMAttribute2
**ppretAttribute
)
4365 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4366 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
4370 static HRESULT WINAPI
HTMLElement6_hasAttributeNS(IHTMLElement6
*iface
, VARIANT
*pvarNS
, BSTR name
, VARIANT_BOOL
*pfHasAttribute
)
4372 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4373 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(name
), pfHasAttribute
);
4377 static HRESULT WINAPI
HTMLElement6_getAttribute(IHTMLElement6
*iface
, BSTR strAttributeName
, VARIANT
*AttributeValue
)
4379 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4381 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This
, debugstr_w(strAttributeName
), AttributeValue
);
4383 return IHTMLElement_getAttribute(&This
->IHTMLElement_iface
, strAttributeName
, 0, AttributeValue
);
4386 static HRESULT WINAPI
HTMLElement6_setAttribute(IHTMLElement6
*iface
, BSTR strAttributeName
, VARIANT
*pvarAttributeValue
)
4388 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4390 WARN("(%p)->(%s %p) forwarding to IHTMLElement\n", This
, debugstr_w(strAttributeName
), pvarAttributeValue
);
4392 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, strAttributeName
, *pvarAttributeValue
, 0);
4395 static HRESULT WINAPI
HTMLElement6_removeAttribute(IHTMLElement6
*iface
, BSTR strAttributeName
)
4397 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4398 VARIANT_BOOL success
;
4400 WARN("(%p)->(%s) forwarding to IHTMLElement\n", This
, debugstr_w(strAttributeName
));
4402 return IHTMLElement_removeAttribute(&This
->IHTMLElement_iface
, strAttributeName
, 0, &success
);
4405 static HRESULT WINAPI
HTMLElement6_getAttributeNode(IHTMLElement6
*iface
, BSTR strAttributeName
, IHTMLDOMAttribute2
**ppretAttribute
)
4407 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4408 IHTMLDOMAttribute
*attr
;
4411 WARN("(%p)->(%s %p) forwarding to IHTMLElement4\n", This
, debugstr_w(strAttributeName
), ppretAttribute
);
4413 hres
= IHTMLElement4_getAttributeNode(&This
->IHTMLElement4_iface
, strAttributeName
, &attr
);
4418 hres
= IHTMLDOMAttribute_QueryInterface(attr
, &IID_IHTMLDOMAttribute2
, (void**)ppretAttribute
);
4419 IHTMLDOMAttribute_Release(attr
);
4421 *ppretAttribute
= NULL
;
4426 static HRESULT WINAPI
HTMLElement6_setAttributeNode(IHTMLElement6
*iface
, IHTMLDOMAttribute2
*pattr
, IHTMLDOMAttribute2
**ppretAttribute
)
4428 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4429 IHTMLDOMAttribute
*attr
, *ret_attr
;
4432 WARN("(%p)->(%p %p) forwarding to IHTMLElement4\n", This
, pattr
, ppretAttribute
);
4434 hres
= IHTMLDOMAttribute2_QueryInterface(pattr
, &IID_IHTMLDOMAttribute
, (void**)&attr
);
4438 hres
= IHTMLElement4_setAttributeNode(&This
->IHTMLElement4_iface
, attr
, &ret_attr
);
4443 hres
= IHTMLDOMAttribute_QueryInterface(ret_attr
, &IID_IHTMLDOMAttribute2
, (void**)ppretAttribute
);
4444 IHTMLDOMAttribute_Release(ret_attr
);
4446 *ppretAttribute
= NULL
;
4451 static HRESULT WINAPI
HTMLElement6_removeAttributeNode(IHTMLElement6
*iface
, IHTMLDOMAttribute2
*pattr
, IHTMLDOMAttribute2
**ppretAttribute
)
4453 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4454 FIXME("(%p)->()\n", This
);
4458 static HRESULT WINAPI
HTMLElement6_hasAttribute(IHTMLElement6
*iface
, BSTR name
, VARIANT_BOOL
*pfHasAttribute
)
4460 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4461 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), pfHasAttribute
);
4465 static HRESULT WINAPI
HTMLElement6_getElementsByTagNameNS(IHTMLElement6
*iface
, VARIANT
*varNS
, BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
4467 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4468 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(varNS
), debugstr_w(bstrLocalName
), pelColl
);
4472 static HRESULT WINAPI
HTMLElement6_get_tagName(IHTMLElement6
*iface
, BSTR
*p
)
4474 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4476 TRACE("(%p)->(%p)\n", This
, p
);
4478 return IHTMLElement_get_tagName(&This
->IHTMLElement_iface
, p
);
4481 static HRESULT WINAPI
HTMLElement6_get_nodeName(IHTMLElement6
*iface
, BSTR
*p
)
4483 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4485 TRACE("(%p)->(%p)\n", This
, p
);
4487 return IHTMLDOMNode_get_nodeName(&This
->node
.IHTMLDOMNode_iface
, p
);
4490 static HRESULT WINAPI
HTMLElement6_getElementsByClassName(IHTMLElement6
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
4492 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4493 nsIDOMHTMLCollection
*nscol
= NULL
;
4497 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4499 if(This
->dom_element
) {
4500 nsAString_InitDepend(&nsstr
, v
);
4501 nsres
= nsIDOMElement_GetElementsByClassName(This
->dom_element
, &nsstr
, &nscol
);
4502 nsAString_Finish(&nsstr
);
4503 if(NS_FAILED(nsres
)) {
4504 ERR("GetElementsByClassName failed: %08x\n", nsres
);
4509 *pel
= create_collection_from_htmlcol(nscol
, dispex_compat_mode(&This
->node
.event_target
.dispex
));
4510 nsIDOMHTMLCollection_Release(nscol
);
4514 static HRESULT WINAPI
HTMLElement6_msMatchesSelector(IHTMLElement6
*iface
, BSTR v
, VARIANT_BOOL
*pfMatches
)
4516 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4521 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pfMatches
);
4523 if(!This
->dom_element
) {
4524 FIXME("No dom element\n");
4525 return E_UNEXPECTED
;
4528 nsAString_InitDepend(&nsstr
, v
);
4529 nsres
= nsIDOMElement_MozMatchesSelector(This
->dom_element
, &nsstr
, &b
);
4530 nsAString_Finish(&nsstr
);
4531 if(NS_FAILED(nsres
)) {
4532 WARN("MozMatchesSelector failed: %08x\n", nsres
);
4533 return map_nsresult(nsres
);
4540 static HRESULT WINAPI
HTMLElement6_put_onabort(IHTMLElement6
*iface
, VARIANT v
)
4542 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4544 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4546 return set_node_event(&This
->node
, EVENTID_ABORT
, &v
);
4549 static HRESULT WINAPI
HTMLElement6_get_onabort(IHTMLElement6
*iface
, VARIANT
*p
)
4551 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4553 TRACE("(%p)->(%p)\n", This
, p
);
4555 return get_node_event(&This
->node
, EVENTID_ABORT
, p
);
4558 static HRESULT WINAPI
HTMLElement6_put_oncanplay(IHTMLElement6
*iface
, VARIANT v
)
4560 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4561 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4565 static HRESULT WINAPI
HTMLElement6_get_oncanplay(IHTMLElement6
*iface
, VARIANT
*p
)
4567 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4568 FIXME("(%p)->(%p)\n", This
, p
);
4572 static HRESULT WINAPI
HTMLElement6_put_oncanplaythrough(IHTMLElement6
*iface
, VARIANT v
)
4574 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4575 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4579 static HRESULT WINAPI
HTMLElement6_get_oncanplaythrough(IHTMLElement6
*iface
, VARIANT
*p
)
4581 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4582 FIXME("(%p)->(%p)\n", This
, p
);
4586 static HRESULT WINAPI
HTMLElement6_put_onchange(IHTMLElement6
*iface
, VARIANT v
)
4588 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4590 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4592 return set_node_event(&This
->node
, EVENTID_CHANGE
, &v
);
4595 static HRESULT WINAPI
HTMLElement6_get_onchange(IHTMLElement6
*iface
, VARIANT
*p
)
4597 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4599 TRACE("(%p)->(%p)\n", This
, p
);
4601 return get_node_event(&This
->node
, EVENTID_CHANGE
, p
);
4604 static HRESULT WINAPI
HTMLElement6_put_ondurationchange(IHTMLElement6
*iface
, VARIANT v
)
4606 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4607 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4611 static HRESULT WINAPI
HTMLElement6_get_ondurationchange(IHTMLElement6
*iface
, VARIANT
*p
)
4613 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4614 FIXME("(%p)->(%p)\n", This
, p
);
4618 static HRESULT WINAPI
HTMLElement6_put_onemptied(IHTMLElement6
*iface
, VARIANT v
)
4620 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4621 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4625 static HRESULT WINAPI
HTMLElement6_get_onemptied(IHTMLElement6
*iface
, VARIANT
*p
)
4627 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4628 FIXME("(%p)->(%p)\n", This
, p
);
4632 static HRESULT WINAPI
HTMLElement6_put_onended(IHTMLElement6
*iface
, VARIANT v
)
4634 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4635 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4639 static HRESULT WINAPI
HTMLElement6_get_onended(IHTMLElement6
*iface
, VARIANT
*p
)
4641 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4642 FIXME("(%p)->(%p)\n", This
, p
);
4646 static HRESULT WINAPI
HTMLElement6_put_onerror(IHTMLElement6
*iface
, VARIANT v
)
4648 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4650 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4652 return set_node_event(&This
->node
, EVENTID_ERROR
, &v
);
4655 static HRESULT WINAPI
HTMLElement6_get_onerror(IHTMLElement6
*iface
, VARIANT
*p
)
4657 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4659 TRACE("(%p)->(%p)\n", This
, p
);
4661 return get_node_event(&This
->node
, EVENTID_ERROR
, p
);
4664 static HRESULT WINAPI
HTMLElement6_put_oninput(IHTMLElement6
*iface
, VARIANT v
)
4666 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4668 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4670 return set_node_event(&This
->node
, EVENTID_INPUT
, &v
);
4673 static HRESULT WINAPI
HTMLElement6_get_oninput(IHTMLElement6
*iface
, VARIANT
*p
)
4675 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4677 TRACE("(%p)->(%p)\n", This
, p
);
4679 return get_node_event(&This
->node
, EVENTID_INPUT
, p
);
4682 static HRESULT WINAPI
HTMLElement6_put_onload(IHTMLElement6
*iface
, VARIANT v
)
4684 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4686 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4688 return set_node_event(&This
->node
, EVENTID_LOAD
, &v
);
4691 static HRESULT WINAPI
HTMLElement6_get_onload(IHTMLElement6
*iface
, VARIANT
*p
)
4693 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4695 TRACE("(%p)->(%p)\n", This
, p
);
4697 return get_node_event(&This
->node
, EVENTID_LOAD
, p
);
4700 static HRESULT WINAPI
HTMLElement6_put_onloadeddata(IHTMLElement6
*iface
, VARIANT v
)
4702 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4703 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4707 static HRESULT WINAPI
HTMLElement6_get_onloadeddata(IHTMLElement6
*iface
, VARIANT
*p
)
4709 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4710 FIXME("(%p)->(%p)\n", This
, p
);
4714 static HRESULT WINAPI
HTMLElement6_put_onloadedmetadata(IHTMLElement6
*iface
, VARIANT v
)
4716 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4717 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4721 static HRESULT WINAPI
HTMLElement6_get_onloadedmetadata(IHTMLElement6
*iface
, VARIANT
*p
)
4723 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4724 FIXME("(%p)->(%p)\n", This
, p
);
4728 static HRESULT WINAPI
HTMLElement6_put_onloadstart(IHTMLElement6
*iface
, VARIANT v
)
4730 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4731 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4735 static HRESULT WINAPI
HTMLElement6_get_onloadstart(IHTMLElement6
*iface
, VARIANT
*p
)
4737 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4738 FIXME("(%p)->(%p)\n", This
, p
);
4742 static HRESULT WINAPI
HTMLElement6_put_onpause(IHTMLElement6
*iface
, VARIANT v
)
4744 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4745 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4749 static HRESULT WINAPI
HTMLElement6_get_onpause(IHTMLElement6
*iface
, VARIANT
*p
)
4751 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4752 FIXME("(%p)->(%p)\n", This
, p
);
4756 static HRESULT WINAPI
HTMLElement6_put_onplay(IHTMLElement6
*iface
, VARIANT v
)
4758 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4759 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4763 static HRESULT WINAPI
HTMLElement6_get_onplay(IHTMLElement6
*iface
, VARIANT
*p
)
4765 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4766 FIXME("(%p)->(%p)\n", This
, p
);
4770 static HRESULT WINAPI
HTMLElement6_put_onplaying(IHTMLElement6
*iface
, VARIANT v
)
4772 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4773 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4777 static HRESULT WINAPI
HTMLElement6_get_onplaying(IHTMLElement6
*iface
, VARIANT
*p
)
4779 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4780 FIXME("(%p)->(%p)\n", This
, p
);
4784 static HRESULT WINAPI
HTMLElement6_put_onprogress(IHTMLElement6
*iface
, VARIANT v
)
4786 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4787 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4791 static HRESULT WINAPI
HTMLElement6_get_onprogress(IHTMLElement6
*iface
, VARIANT
*p
)
4793 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4794 FIXME("(%p)->(%p)\n", This
, p
);
4798 static HRESULT WINAPI
HTMLElement6_put_onratechange(IHTMLElement6
*iface
, VARIANT v
)
4800 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4801 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4805 static HRESULT WINAPI
HTMLElement6_get_onratechange(IHTMLElement6
*iface
, VARIANT
*p
)
4807 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4808 FIXME("(%p)->(%p)\n", This
, p
);
4812 static HRESULT WINAPI
HTMLElement6_put_onreset(IHTMLElement6
*iface
, VARIANT v
)
4814 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4815 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4819 static HRESULT WINAPI
HTMLElement6_get_onreset(IHTMLElement6
*iface
, VARIANT
*p
)
4821 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4822 FIXME("(%p)->(%p)\n", This
, p
);
4826 static HRESULT WINAPI
HTMLElement6_put_onseeked(IHTMLElement6
*iface
, VARIANT v
)
4828 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4829 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4833 static HRESULT WINAPI
HTMLElement6_get_onseeked(IHTMLElement6
*iface
, VARIANT
*p
)
4835 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4836 FIXME("(%p)->(%p)\n", This
, p
);
4840 static HRESULT WINAPI
HTMLElement6_put_onseeking(IHTMLElement6
*iface
, VARIANT v
)
4842 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4843 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4847 static HRESULT WINAPI
HTMLElement6_get_onseeking(IHTMLElement6
*iface
, VARIANT
*p
)
4849 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4850 FIXME("(%p)->(%p)\n", This
, p
);
4854 static HRESULT WINAPI
HTMLElement6_put_onselect(IHTMLElement6
*iface
, VARIANT v
)
4856 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4857 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4861 static HRESULT WINAPI
HTMLElement6_get_onselect(IHTMLElement6
*iface
, VARIANT
*p
)
4863 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4864 FIXME("(%p)->(%p)\n", This
, p
);
4868 static HRESULT WINAPI
HTMLElement6_put_onstalled(IHTMLElement6
*iface
, VARIANT v
)
4870 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4871 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4875 static HRESULT WINAPI
HTMLElement6_get_onstalled(IHTMLElement6
*iface
, VARIANT
*p
)
4877 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4878 FIXME("(%p)->(%p)\n", This
, p
);
4882 static HRESULT WINAPI
HTMLElement6_put_onsubmit(IHTMLElement6
*iface
, VARIANT v
)
4884 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4886 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4888 return set_node_event(&This
->node
, EVENTID_SUBMIT
, &v
);
4891 static HRESULT WINAPI
HTMLElement6_get_onsubmit(IHTMLElement6
*iface
, VARIANT
*p
)
4893 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4895 TRACE("(%p)->(%p)\n", This
, p
);
4897 return get_node_event(&This
->node
, EVENTID_SUBMIT
, p
);
4900 static HRESULT WINAPI
HTMLElement6_put_onsuspend(IHTMLElement6
*iface
, VARIANT v
)
4902 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4903 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4907 static HRESULT WINAPI
HTMLElement6_get_onsuspend(IHTMLElement6
*iface
, VARIANT
*p
)
4909 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4910 FIXME("(%p)->(%p)\n", This
, p
);
4914 static HRESULT WINAPI
HTMLElement6_put_ontimeupdate(IHTMLElement6
*iface
, VARIANT v
)
4916 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4917 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4921 static HRESULT WINAPI
HTMLElement6_get_ontimeupdate(IHTMLElement6
*iface
, VARIANT
*p
)
4923 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4924 FIXME("(%p)->(%p)\n", This
, p
);
4928 static HRESULT WINAPI
HTMLElement6_put_onvolumechange(IHTMLElement6
*iface
, VARIANT v
)
4930 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4931 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4935 static HRESULT WINAPI
HTMLElement6_get_onvolumechange(IHTMLElement6
*iface
, VARIANT
*p
)
4937 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4938 FIXME("(%p)->(%p)\n", This
, p
);
4942 static HRESULT WINAPI
HTMLElement6_put_onwaiting(IHTMLElement6
*iface
, VARIANT v
)
4944 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4945 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4949 static HRESULT WINAPI
HTMLElement6_get_onwaiting(IHTMLElement6
*iface
, VARIANT
*p
)
4951 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4952 FIXME("(%p)->(%p)\n", This
, p
);
4956 static HRESULT WINAPI
HTMLElement6_hasAttributes(IHTMLElement6
*iface
, VARIANT_BOOL
*pfHasAttributes
)
4958 HTMLElement
*This
= impl_from_IHTMLElement6(iface
);
4959 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
4963 static const IHTMLElement6Vtbl HTMLElement6Vtbl
= {
4964 HTMLElement6_QueryInterface
,
4965 HTMLElement6_AddRef
,
4966 HTMLElement6_Release
,
4967 HTMLElement6_GetTypeInfoCount
,
4968 HTMLElement6_GetTypeInfo
,
4969 HTMLElement6_GetIDsOfNames
,
4970 HTMLElement6_Invoke
,
4971 HTMLElement6_getAttributeNS
,
4972 HTMLElement6_setAttributeNS
,
4973 HTMLElement6_removeAttributeNS
,
4974 HTMLElement6_getAttributeNodeNS
,
4975 HTMLElement6_setAttributeNodeNS
,
4976 HTMLElement6_hasAttributeNS
,
4977 HTMLElement6_getAttribute
,
4978 HTMLElement6_setAttribute
,
4979 HTMLElement6_removeAttribute
,
4980 HTMLElement6_getAttributeNode
,
4981 HTMLElement6_setAttributeNode
,
4982 HTMLElement6_removeAttributeNode
,
4983 HTMLElement6_hasAttribute
,
4984 HTMLElement6_getElementsByTagNameNS
,
4985 HTMLElement6_get_tagName
,
4986 HTMLElement6_get_nodeName
,
4987 HTMLElement6_getElementsByClassName
,
4988 HTMLElement6_msMatchesSelector
,
4989 HTMLElement6_put_onabort
,
4990 HTMLElement6_get_onabort
,
4991 HTMLElement6_put_oncanplay
,
4992 HTMLElement6_get_oncanplay
,
4993 HTMLElement6_put_oncanplaythrough
,
4994 HTMLElement6_get_oncanplaythrough
,
4995 HTMLElement6_put_onchange
,
4996 HTMLElement6_get_onchange
,
4997 HTMLElement6_put_ondurationchange
,
4998 HTMLElement6_get_ondurationchange
,
4999 HTMLElement6_put_onemptied
,
5000 HTMLElement6_get_onemptied
,
5001 HTMLElement6_put_onended
,
5002 HTMLElement6_get_onended
,
5003 HTMLElement6_put_onerror
,
5004 HTMLElement6_get_onerror
,
5005 HTMLElement6_put_oninput
,
5006 HTMLElement6_get_oninput
,
5007 HTMLElement6_put_onload
,
5008 HTMLElement6_get_onload
,
5009 HTMLElement6_put_onloadeddata
,
5010 HTMLElement6_get_onloadeddata
,
5011 HTMLElement6_put_onloadedmetadata
,
5012 HTMLElement6_get_onloadedmetadata
,
5013 HTMLElement6_put_onloadstart
,
5014 HTMLElement6_get_onloadstart
,
5015 HTMLElement6_put_onpause
,
5016 HTMLElement6_get_onpause
,
5017 HTMLElement6_put_onplay
,
5018 HTMLElement6_get_onplay
,
5019 HTMLElement6_put_onplaying
,
5020 HTMLElement6_get_onplaying
,
5021 HTMLElement6_put_onprogress
,
5022 HTMLElement6_get_onprogress
,
5023 HTMLElement6_put_onratechange
,
5024 HTMLElement6_get_onratechange
,
5025 HTMLElement6_put_onreset
,
5026 HTMLElement6_get_onreset
,
5027 HTMLElement6_put_onseeked
,
5028 HTMLElement6_get_onseeked
,
5029 HTMLElement6_put_onseeking
,
5030 HTMLElement6_get_onseeking
,
5031 HTMLElement6_put_onselect
,
5032 HTMLElement6_get_onselect
,
5033 HTMLElement6_put_onstalled
,
5034 HTMLElement6_get_onstalled
,
5035 HTMLElement6_put_onsubmit
,
5036 HTMLElement6_get_onsubmit
,
5037 HTMLElement6_put_onsuspend
,
5038 HTMLElement6_get_onsuspend
,
5039 HTMLElement6_put_ontimeupdate
,
5040 HTMLElement6_get_ontimeupdate
,
5041 HTMLElement6_put_onvolumechange
,
5042 HTMLElement6_get_onvolumechange
,
5043 HTMLElement6_put_onwaiting
,
5044 HTMLElement6_get_onwaiting
,
5045 HTMLElement6_hasAttributes
5048 static inline HTMLElement
*impl_from_IHTMLUniqueName(IHTMLUniqueName
*iface
)
5050 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLUniqueName_iface
);
5053 static HRESULT WINAPI
HTMLUniqueName_QueryInterface(IHTMLUniqueName
*iface
, REFIID riid
, void **ppv
)
5055 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5056 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
5059 static ULONG WINAPI
HTMLUniqueName_AddRef(IHTMLUniqueName
*iface
)
5061 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5062 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
5065 static ULONG WINAPI
HTMLUniqueName_Release(IHTMLUniqueName
*iface
)
5067 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5068 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
5071 static HRESULT WINAPI
HTMLUniqueName_GetTypeInfoCount(IHTMLUniqueName
*iface
, UINT
*pctinfo
)
5073 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5074 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
5077 static HRESULT WINAPI
HTMLUniqueName_GetTypeInfo(IHTMLUniqueName
*iface
, UINT iTInfo
,
5078 LCID lcid
, ITypeInfo
**ppTInfo
)
5080 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5081 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5084 static HRESULT WINAPI
HTMLUniqueName_GetIDsOfNames(IHTMLUniqueName
*iface
, REFIID riid
,
5085 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
5087 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5088 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
5092 static HRESULT WINAPI
HTMLUniqueName_Invoke(IHTMLUniqueName
*iface
, DISPID dispIdMember
, REFIID riid
,
5093 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5095 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5096 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
5097 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5100 HRESULT
elem_unique_id(unsigned id
, BSTR
*p
)
5104 static const WCHAR formatW
[] = {'m','s','_','_','i','d','%','u',0};
5106 swprintf(buf
, ARRAY_SIZE(buf
), formatW
, id
);
5107 *p
= SysAllocString(buf
);
5108 return *p
? S_OK
: E_OUTOFMEMORY
;
5111 static void ensure_unique_id(HTMLElement
*elem
)
5113 if(!elem
->unique_id
)
5114 elem
->unique_id
= ++elem
->node
.doc
->unique_id
;
5117 static HRESULT WINAPI
HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName
*iface
, LONG
*p
)
5119 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5121 TRACE("(%p)->(%p)\n", This
, p
);
5123 ensure_unique_id(This
);
5124 *p
= This
->unique_id
;
5128 static HRESULT WINAPI
HTMLUniqueName_get_uniqueID(IHTMLUniqueName
*iface
, BSTR
*p
)
5130 HTMLElement
*This
= impl_from_IHTMLUniqueName(iface
);
5132 TRACE("(%p)->(%p)\n", This
, p
);
5134 ensure_unique_id(This
);
5135 return elem_unique_id(This
->unique_id
, p
);
5138 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl
= {
5139 HTMLUniqueName_QueryInterface
,
5140 HTMLUniqueName_AddRef
,
5141 HTMLUniqueName_Release
,
5142 HTMLUniqueName_GetTypeInfoCount
,
5143 HTMLUniqueName_GetTypeInfo
,
5144 HTMLUniqueName_GetIDsOfNames
,
5145 HTMLUniqueName_Invoke
,
5146 HTMLUniqueName_get_uniqueNumber
,
5147 HTMLUniqueName_get_uniqueID
5150 static inline HTMLElement
*impl_from_IElementSelector(IElementSelector
*iface
)
5152 return CONTAINING_RECORD(iface
, HTMLElement
, IElementSelector_iface
);
5155 static HRESULT WINAPI
ElementSelector_QueryInterface(IElementSelector
*iface
, REFIID riid
, void **ppv
)
5157 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5158 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
5161 static ULONG WINAPI
ElementSelector_AddRef(IElementSelector
*iface
)
5163 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5164 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
5167 static ULONG WINAPI
ElementSelector_Release(IElementSelector
*iface
)
5169 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5170 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
5173 static HRESULT WINAPI
ElementSelector_GetTypeInfoCount(IElementSelector
*iface
, UINT
*pctinfo
)
5175 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5176 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
5179 static HRESULT WINAPI
ElementSelector_GetTypeInfo(IElementSelector
*iface
, UINT iTInfo
,
5180 LCID lcid
, ITypeInfo
**ppTInfo
)
5182 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5183 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5186 static HRESULT WINAPI
ElementSelector_GetIDsOfNames(IElementSelector
*iface
, REFIID riid
,
5187 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
5189 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5190 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
5193 static HRESULT WINAPI
ElementSelector_Invoke(IElementSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
5194 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5196 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5197 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
5198 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5201 static HRESULT WINAPI
ElementSelector_querySelector(IElementSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
5203 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5204 nsIDOMElement
*nselem
;
5210 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
5212 if(!This
->dom_element
) {
5213 FIXME("comment element\n");
5217 nsAString_InitDepend(&nsstr
, v
);
5218 nsres
= nsIDOMElement_QuerySelector(This
->dom_element
, &nsstr
, &nselem
);
5219 nsAString_Finish(&nsstr
);
5220 if(NS_FAILED(nsres
)) {
5221 ERR("QuerySelector failed: %08x\n", nsres
);
5230 hres
= get_element(nselem
, &elem
);
5231 nsIDOMElement_Release(nselem
);
5235 *pel
= &elem
->IHTMLElement_iface
;
5239 static HRESULT WINAPI
ElementSelector_querySelectorAll(IElementSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
5241 HTMLElement
*This
= impl_from_IElementSelector(iface
);
5242 nsIDOMNodeList
*node_list
;
5246 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
5248 if(!This
->dom_element
) {
5249 FIXME("comment element\n");
5253 nsAString_InitDepend(&nsstr
, v
);
5254 nsres
= nsIDOMElement_QuerySelectorAll(This
->dom_element
, &nsstr
, &node_list
);
5255 nsAString_Finish(&nsstr
);
5256 if(NS_FAILED(nsres
)) {
5257 ERR("QuerySelectorAll failed: %08x\n", nsres
);
5261 *pel
= create_child_collection(node_list
);
5262 nsIDOMNodeList_Release(node_list
);
5263 return *pel
? S_OK
: E_OUTOFMEMORY
;
5266 static const IElementSelectorVtbl ElementSelectorVtbl
= {
5267 ElementSelector_QueryInterface
,
5268 ElementSelector_AddRef
,
5269 ElementSelector_Release
,
5270 ElementSelector_GetTypeInfoCount
,
5271 ElementSelector_GetTypeInfo
,
5272 ElementSelector_GetIDsOfNames
,
5273 ElementSelector_Invoke
,
5274 ElementSelector_querySelector
,
5275 ElementSelector_querySelectorAll
5278 static inline HTMLElement
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
5280 return CONTAINING_RECORD(iface
, HTMLElement
, IProvideMultipleClassInfo_iface
);
5283 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
5284 REFIID riid
, void **ppv
)
5286 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5287 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
5290 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
5292 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5293 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
5296 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
5298 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5299 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
5302 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
5304 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5305 TRACE("(%p)->(%p)\n", This
, ppTI
);
5306 return get_class_typeinfo(This
->node
.vtbl
->clsid
, ppTI
);
5309 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
5311 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5312 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
5316 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
5318 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5319 FIXME("(%p)->(%p)\n", This
, pcti
);
5324 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
5325 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
5327 HTMLElement
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5328 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
5332 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
5333 ProvideClassInfo_QueryInterface
,
5334 ProvideClassInfo_AddRef
,
5335 ProvideClassInfo_Release
,
5336 ProvideClassInfo_GetClassInfo
,
5337 ProvideClassInfo2_GetGUID
,
5338 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
5339 ProvideMultipleClassInfo_GetInfoOfIndex
5342 static inline HTMLElement
*impl_from_IElementTraversal(IElementTraversal
*iface
)
5344 return CONTAINING_RECORD(iface
, HTMLElement
, IElementTraversal_iface
);
5347 static HRESULT WINAPI
ElementTraversal_QueryInterface(IElementTraversal
*iface
, REFIID riid
, void **ppv
)
5349 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5350 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
5353 static ULONG WINAPI
ElementTraversal_AddRef(IElementTraversal
*iface
)
5355 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5357 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
5360 static ULONG WINAPI
ElementTraversal_Release(IElementTraversal
*iface
)
5362 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5364 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
5367 static HRESULT WINAPI
ElementTraversal_GetTypeInfoCount(IElementTraversal
*iface
, UINT
*pctinfo
)
5369 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5370 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
5373 static HRESULT WINAPI
ElementTraversal_GetTypeInfo(IElementTraversal
*iface
, UINT iTInfo
,
5374 LCID lcid
, ITypeInfo
**ppTInfo
)
5376 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5377 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5380 static HRESULT WINAPI
ElementTraversal_GetIDsOfNames(IElementTraversal
*iface
, REFIID riid
,
5381 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
5383 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5384 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
5388 static HRESULT WINAPI
ElementTraversal_Invoke(IElementTraversal
*iface
, DISPID dispIdMember
, REFIID riid
,
5389 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5391 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5392 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
5393 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5396 static HRESULT WINAPI
ElementTraversal_get_firstElementChild(IElementTraversal
*iface
, IHTMLElement
**p
)
5398 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5399 nsIDOMElement
*nselem
= NULL
;
5403 TRACE("(%p)->(%p)\n", This
, p
);
5405 if(!This
->dom_element
) {
5410 nsIDOMElement_GetFirstElementChild(This
->dom_element
, &nselem
);
5416 hres
= get_element(nselem
, &elem
);
5417 nsIDOMElement_Release(nselem
);
5421 *p
= &elem
->IHTMLElement_iface
;
5425 static HRESULT WINAPI
ElementTraversal_get_lastElementChild(IElementTraversal
*iface
, IHTMLElement
**p
)
5427 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5428 FIXME("(%p)->(%p)\n", This
, p
);
5432 static HRESULT WINAPI
ElementTraversal_get_previousElementSibling(IElementTraversal
*iface
, IHTMLElement
**p
)
5434 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5435 FIXME("(%p)->(%p)\n", This
, p
);
5439 static HRESULT WINAPI
ElementTraversal_get_nextElementSibling(IElementTraversal
*iface
, IHTMLElement
**p
)
5441 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5442 FIXME("(%p)->(%p)\n", This
, p
);
5446 static HRESULT WINAPI
ElementTraversal_get_childElementCount(IElementTraversal
*iface
, LONG
*p
)
5448 HTMLElement
*This
= impl_from_IElementTraversal(iface
);
5449 FIXME("(%p)->(%p)\n", This
, p
);
5453 static const IElementTraversalVtbl ElementTraversalVtbl
= {
5454 ElementTraversal_QueryInterface
,
5455 ElementTraversal_AddRef
,
5456 ElementTraversal_Release
,
5457 ElementTraversal_GetTypeInfoCount
,
5458 ElementTraversal_GetTypeInfo
,
5459 ElementTraversal_GetIDsOfNames
,
5460 ElementTraversal_Invoke
,
5461 ElementTraversal_get_firstElementChild
,
5462 ElementTraversal_get_lastElementChild
,
5463 ElementTraversal_get_previousElementSibling
,
5464 ElementTraversal_get_nextElementSibling
,
5465 ElementTraversal_get_childElementCount
5468 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
5470 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
5473 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
5475 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
5477 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5478 *ppv
= &This
->IHTMLElement_iface
;
5479 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
5480 *ppv
= &This
->IHTMLElement_iface
;
5481 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
5482 *ppv
= &This
->IHTMLElement_iface
;
5483 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
5484 *ppv
= &This
->IHTMLElement2_iface
;
5485 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
5486 *ppv
= &This
->IHTMLElement3_iface
;
5487 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
5488 *ppv
= &This
->IHTMLElement4_iface
;
5489 }else if(IsEqualGUID(&IID_IHTMLElement6
, riid
)) {
5490 *ppv
= &This
->IHTMLElement6_iface
;
5491 }else if(IsEqualGUID(&IID_IHTMLUniqueName
, riid
)) {
5492 *ppv
= &This
->IHTMLUniqueName_iface
;
5493 }else if(IsEqualGUID(&IID_IElementSelector
, riid
)) {
5494 *ppv
= &This
->IElementSelector_iface
;
5495 }else if(IsEqualGUID(&IID_IElementTraversal
, riid
)) {
5496 *ppv
= &This
->IElementTraversal_iface
;
5497 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
5498 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
5499 }else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
)) {
5500 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5501 }else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
)) {
5502 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5503 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
)) {
5504 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5506 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
5509 IUnknown_AddRef((IUnknown
*)*ppv
);
5513 void HTMLElement_destructor(HTMLDOMNode
*iface
)
5515 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
5517 ConnectionPointContainer_Destroy(&This
->cp_container
);
5520 This
->style
->elem
= NULL
;
5521 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
5523 if(This
->runtime_style
) {
5524 This
->runtime_style
->elem
= NULL
;
5525 IHTMLStyle_Release(&This
->runtime_style
->IHTMLStyle_iface
);
5528 HTMLDOMAttribute
*attr
;
5530 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
5533 This
->attrs
->elem
= NULL
;
5534 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
5537 heap_free(This
->filter
);
5539 HTMLDOMNode_destructor(&This
->node
);
5542 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5544 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
5545 HTMLElement
*new_elem
;
5548 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
5553 new_elem
->filter
= heap_strdupW(This
->filter
);
5554 if(!new_elem
->filter
) {
5555 IHTMLElement_Release(&This
->IHTMLElement_iface
);
5556 return E_OUTOFMEMORY
;
5560 *ret
= &new_elem
->node
;
5564 HRESULT
HTMLElement_handle_event(HTMLDOMNode
*iface
, DWORD eid
, nsIDOMEvent
*event
, BOOL
*prevent_default
)
5566 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
5569 case EVENTID_KEYDOWN
: {
5570 nsIDOMKeyEvent
*key_event
;
5573 nsres
= nsIDOMEvent_QueryInterface(event
, &IID_nsIDOMKeyEvent
, (void**)&key_event
);
5574 if(NS_SUCCEEDED(nsres
)) {
5577 nsIDOMKeyEvent_GetKeyCode(key_event
, &code
);
5579 if(code
== VK_F1
/* DOM_VK_F1 */) {
5580 DOMEvent
*help_event
;
5583 TRACE("F1 pressed\n");
5585 hres
= create_document_event(This
->node
.doc
, EVENTID_HELP
, &help_event
);
5586 if(SUCCEEDED(hres
)) {
5587 dispatch_event(&This
->node
.event_target
, help_event
);
5588 IDOMEvent_Release(&help_event
->IDOMEvent_iface
);
5590 *prevent_default
= TRUE
;
5593 nsIDOMKeyEvent_Release(key_event
);
5601 cp_static_data_t HTMLElementEvents2_data
= { HTMLElementEvents2_tid
, NULL
/* FIXME */, TRUE
};
5603 const cpc_entry_t HTMLElement_cpc
[] = {
5608 static const NodeImplVtbl HTMLElementImplVtbl
= {
5609 &CLSID_HTMLUnknownElement
,
5611 HTMLElement_destructor
,
5614 HTMLElement_handle_event
,
5615 HTMLElement_get_attr_col
5618 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
5620 return CONTAINING_RECORD(iface
, HTMLElement
, node
.event_target
.dispex
);
5623 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
5624 DWORD grfdex
, DISPID
*pid
)
5626 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5628 if(This
->node
.vtbl
->get_dispid
)
5629 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
5631 return DISP_E_UNKNOWNNAME
;
5634 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
5635 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
5636 IServiceProvider
*caller
)
5638 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5640 if(This
->node
.vtbl
->invoke
)
5641 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
5642 params
, res
, ei
, caller
);
5644 ERR("(%p): element has no invoke method\n", This
);
5648 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
5650 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5651 nsIDOMMozNamedAttrMap
*attrs
;
5654 const PRUnichar
*str
;
5663 if(!This
->dom_element
)
5666 nsres
= nsIDOMElement_GetAttributes(This
->dom_element
, &attrs
);
5667 if(NS_FAILED(nsres
))
5670 nsres
= nsIDOMMozNamedAttrMap_GetLength(attrs
, &len
);
5671 if(NS_FAILED(nsres
)) {
5672 nsIDOMMozNamedAttrMap_Release(attrs
);
5676 nsAString_Init(&nsstr
, NULL
);
5677 for(i
=0; i
<len
; i
++) {
5678 nsres
= nsIDOMMozNamedAttrMap_Item(attrs
, i
, &attr
);
5679 if(NS_FAILED(nsres
))
5682 nsres
= nsIDOMAttr_GetNodeName(attr
, &nsstr
);
5683 if(NS_FAILED(nsres
)) {
5684 nsIDOMAttr_Release(attr
);
5688 nsAString_GetData(&nsstr
, &str
);
5689 name
= SysAllocString(str
);
5691 nsIDOMAttr_Release(attr
);
5695 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
5696 if(hres
!= DISP_E_UNKNOWNNAME
) {
5697 nsIDOMAttr_Release(attr
);
5698 SysFreeString(name
);
5702 nsres
= nsIDOMAttr_GetNodeValue(attr
, &nsstr
);
5703 nsIDOMAttr_Release(attr
);
5704 if(NS_FAILED(nsres
)) {
5705 SysFreeString(name
);
5709 nsAString_GetData(&nsstr
, &str
);
5710 V_VT(&value
) = VT_BSTR
;
5712 V_BSTR(&value
) = SysAllocString(str
);
5713 if(!V_BSTR(&value
)) {
5714 SysFreeString(name
);
5718 V_BSTR(&value
) = NULL
;
5720 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
5721 SysFreeString(name
);
5722 VariantClear(&value
);
5724 nsAString_Finish(&nsstr
);
5726 nsIDOMMozNamedAttrMap_Release(attrs
);
5730 static nsISupports
*HTMLElement_get_gecko_target(DispatchEx
*dispex
)
5732 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5733 return (nsISupports
*)This
->node
.nsnode
;
5736 static void HTMLElement_bind_event(DispatchEx
*dispex
, eventid_t eid
)
5738 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5739 ensure_doc_nsevent_handler(This
->node
.doc
, This
->node
.nsnode
, eid
);
5742 static HRESULT
HTMLElement_handle_event_default(DispatchEx
*dispex
, eventid_t eid
, nsIDOMEvent
*nsevent
, BOOL
*prevent_default
)
5744 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5746 if(!This
->node
.vtbl
->handle_event
)
5748 return This
->node
.vtbl
->handle_event(&This
->node
, eid
, nsevent
, prevent_default
);
5751 static EventTarget
*HTMLElement_get_parent_event_target(DispatchEx
*dispex
)
5753 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5759 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &nsnode
);
5760 assert(nsres
== NS_OK
);
5764 hres
= get_node(nsnode
, TRUE
, &node
);
5765 nsIDOMNode_Release(nsnode
);
5769 return &node
->event_target
;
5772 static ConnectionPointContainer
*HTMLElement_get_cp_container(DispatchEx
*dispex
)
5774 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5775 IConnectionPointContainer_AddRef(&This
->cp_container
.IConnectionPointContainer_iface
);
5776 return &This
->cp_container
;
5779 static IHTMLEventObj
*HTMLElement_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
5781 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
5782 return default_set_current_event(This
->node
.doc
->window
, event
);
5785 void HTMLElement_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
5787 static const dispex_hook_t elem2_ie11_hooks
[] = {
5788 {DISPID_IHTMLELEMENT2_DOSCROLL
, NULL
},
5792 HTMLDOMNode_init_dispex_info(info
, mode
);
5794 dispex_info_add_interface(info
, IHTMLElement2_tid
, mode
>= COMPAT_MODE_IE11
? elem2_ie11_hooks
: NULL
);
5796 if(mode
>= COMPAT_MODE_IE8
)
5797 dispex_info_add_interface(info
, IElementSelector_tid
, NULL
);
5799 if(mode
>= COMPAT_MODE_IE9
) {
5800 dispex_info_add_interface(info
, IHTMLElement6_tid
, NULL
);
5801 dispex_info_add_interface(info
, IElementTraversal_tid
, NULL
);
5805 static const tid_t HTMLElement_iface_tids
[] = {
5810 static event_target_vtbl_t HTMLElement_event_target_vtbl
= {
5813 HTMLElement_get_dispid
,
5816 HTMLElement_populate_props
5818 HTMLElement_get_gecko_target
,
5819 HTMLElement_bind_event
,
5820 HTMLElement_get_parent_event_target
,
5821 HTMLElement_handle_event_default
,
5822 HTMLElement_get_cp_container
,
5823 HTMLElement_set_current_event
5826 static dispex_static_data_t HTMLElement_dispex
= {
5827 &HTMLElement_event_target_vtbl
.dispex_vtbl
,
5828 DispHTMLUnknownElement_tid
,
5829 HTMLElement_iface_tids
,
5830 HTMLElement_init_dispex_info
5833 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, dispex_static_data_t
*dispex_data
)
5835 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
5836 This
->IHTMLElement2_iface
.lpVtbl
= &HTMLElement2Vtbl
;
5837 This
->IHTMLElement3_iface
.lpVtbl
= &HTMLElement3Vtbl
;
5838 This
->IHTMLElement4_iface
.lpVtbl
= &HTMLElement4Vtbl
;
5839 This
->IHTMLElement6_iface
.lpVtbl
= &HTMLElement6Vtbl
;
5840 This
->IHTMLUniqueName_iface
.lpVtbl
= &HTMLUniqueNameVtbl
;
5841 This
->IElementSelector_iface
.lpVtbl
= &ElementSelectorVtbl
;
5842 This
->IElementTraversal_iface
.lpVtbl
= &ElementTraversalVtbl
;
5843 This
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
5845 if(dispex_data
&& !dispex_data
->vtbl
)
5846 dispex_data
->vtbl
= &HTMLElement_event_target_vtbl
.dispex_vtbl
;
5849 nsIDOMHTMLElement
*html_element
;
5852 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
, dispex_data
? dispex_data
: &HTMLElement_dispex
);
5854 /* No AddRef, share reference with HTMLDOMNode */
5855 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
5856 This
->dom_element
= nselem
;
5858 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)&html_element
);
5859 if(NS_SUCCEEDED(nsres
)) {
5860 This
->html_element
= html_element
;
5861 /* share reference with HTMLDOMNode */
5862 assert((nsIDOMNode
*)html_element
== This
->node
.nsnode
);
5863 nsIDOMHTMLElement_Release(html_element
);
5867 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
, This
->node
.vtbl
->cpc_entries
);
5870 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
5872 nsIDOMElement
*nselem
;
5873 nsAString tag_name_str
;
5874 const PRUnichar
*tag_name
;
5875 const tag_desc_t
*tag
;
5880 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
5881 if(NS_FAILED(nsres
)) {
5882 ERR("no nsIDOMElement iface\n");
5886 nsAString_Init(&tag_name_str
, NULL
);
5887 nsIDOMElement_GetTagName(nselem
, &tag_name_str
);
5889 nsAString_GetData(&tag_name_str
, &tag_name
);
5891 tag
= get_tag_desc(tag_name
);
5893 hres
= tag
->constructor(doc
, nselem
, &elem
);
5895 nsIDOMSVGElement
*svg_element
;
5897 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMSVGElement
, (void**)&svg_element
);
5898 if(NS_SUCCEEDED(nsres
)) {
5899 hres
= create_svg_element(doc
, svg_element
, tag_name
, &elem
);
5900 nsIDOMSVGElement_Release(svg_element
);
5901 }else if(use_generic
) {
5902 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
5904 elem
= heap_alloc_zero(sizeof(HTMLElement
));
5906 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
5907 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
5910 hres
= E_OUTOFMEMORY
;
5915 TRACE("%s ret %p\n", debugstr_w(tag_name
), elem
);
5917 nsIDOMElement_Release(nselem
);
5918 nsAString_Finish(&tag_name_str
);
5926 HRESULT
get_element(nsIDOMElement
*nselem
, HTMLElement
**ret
)
5931 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
5935 *ret
= impl_from_HTMLDOMNode(node
);
5939 /* interface IHTMLFiltersCollection */
5940 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
5942 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
5944 TRACE("%p %s %p\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5946 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5947 *ppv
= &This
->IHTMLFiltersCollection_iface
;
5948 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
5949 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
5950 *ppv
= &This
->IHTMLFiltersCollection_iface
;
5951 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
5952 return *ppv
? S_OK
: E_NOINTERFACE
;
5955 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5956 return E_NOINTERFACE
;
5959 IUnknown_AddRef((IUnknown
*)*ppv
);
5963 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
5965 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
5966 LONG ref
= InterlockedIncrement(&This
->ref
);
5968 TRACE("(%p) ref=%d\n", This
, ref
);
5973 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
5975 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
5976 LONG ref
= InterlockedDecrement(&This
->ref
);
5978 TRACE("(%p) ref=%d\n", This
, ref
);
5988 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
5990 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
5991 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
5994 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
5995 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
5997 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
5998 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
6001 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
6002 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
6003 LCID lcid
, DISPID
*rgDispId
)
6005 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
6006 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
6010 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
6011 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
6012 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
6014 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
6015 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
6016 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
6019 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
6021 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
6026 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
6032 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
6034 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
6035 FIXME("(%p)->(%p)\n", This
, p
);
6039 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
6041 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
6042 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
6046 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
6047 HTMLFiltersCollection_QueryInterface
,
6048 HTMLFiltersCollection_AddRef
,
6049 HTMLFiltersCollection_Release
,
6050 HTMLFiltersCollection_GetTypeInfoCount
,
6051 HTMLFiltersCollection_GetTypeInfo
,
6052 HTMLFiltersCollection_GetIDsOfNames
,
6053 HTMLFiltersCollection_Invoke
,
6054 HTMLFiltersCollection_get_length
,
6055 HTMLFiltersCollection_get__newEnum
,
6056 HTMLFiltersCollection_item
6059 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
6064 for(ptr
= name
; *ptr
&& iswdigit(*ptr
); ptr
++)
6065 idx
= idx
*10 + (*ptr
-'0');
6067 return DISP_E_UNKNOWNNAME
;
6069 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
6070 TRACE("ret %x\n", *dispid
);
6074 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
6075 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
6077 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
6079 V_VT(res
) = VT_DISPATCH
;
6080 V_DISPATCH(res
) = NULL
;
6082 FIXME("always returning NULL\n");
6087 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
6089 HTMLFiltersCollection_get_dispid
,
6090 HTMLFiltersCollection_invoke
,
6094 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
6095 IHTMLFiltersCollection_tid
,
6098 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
6099 &HTMLFiltersCollection_dispex_vtbl
,
6100 IHTMLFiltersCollection_tid
,
6101 HTMLFiltersCollection_iface_tids
6104 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
6106 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
6108 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
6111 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
6112 &HTMLFiltersCollection_dispex
);
6114 return &ret
->IHTMLFiltersCollection_iface
;
6117 /* interface IHTMLAttributeCollection */
6118 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
6120 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
6123 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
6125 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6127 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
6129 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
6130 *ppv
= &This
->IHTMLAttributeCollection_iface
;
6131 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
6132 *ppv
= &This
->IHTMLAttributeCollection_iface
;
6133 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
6134 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
6135 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
6136 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
6137 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
6138 return *ppv
? S_OK
: E_NOINTERFACE
;
6141 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
6142 return E_NOINTERFACE
;
6145 IUnknown_AddRef((IUnknown
*)*ppv
);
6149 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
6151 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6152 LONG ref
= InterlockedIncrement(&This
->ref
);
6154 TRACE("(%p) ref=%d\n", This
, ref
);
6159 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
6161 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6162 LONG ref
= InterlockedDecrement(&This
->ref
);
6164 TRACE("(%p) ref=%d\n", This
, ref
);
6167 while(!list_empty(&This
->attrs
)) {
6168 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
6170 list_remove(&attr
->entry
);
6172 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
6181 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
6183 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6184 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
6187 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
6188 LCID lcid
, ITypeInfo
**ppTInfo
)
6190 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6191 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
6194 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
6195 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
6197 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6198 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
6202 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
6203 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
6204 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
6206 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6207 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
6208 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
6211 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
6213 IDispatchEx
*dispex
= &This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
;
6214 DISPID id
= DISPID_STARTENUM
;
6218 FIXME("filter non-enumerable attributes out\n");
6221 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
6224 else if(hres
== S_FALSE
)
6234 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
6241 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
6245 if(name
[0]>='0' && name
[0]<='9') {
6249 idx
= wcstoul(name
, &end_ptr
, 10);
6251 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
6258 WARN("NULL elem\n");
6259 return E_UNEXPECTED
;
6262 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.event_target
.dispex
.IDispatchEx_iface
,
6263 name
, fdexNameCaseInsensitive
, id
);
6267 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
6269 HTMLDOMAttribute
*iter
;
6274 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
6275 if(iter
->dispid
== id
) {
6284 WARN("NULL elem\n");
6285 return E_UNEXPECTED
;
6288 hres
= HTMLDOMAttribute_Create(NULL
, This
->elem
, id
, attr
);
6293 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
6299 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
6301 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6304 TRACE("(%p)->(%p)\n", This
, p
);
6307 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
6311 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
6313 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6314 FIXME("(%p)->(%p)\n", This
, p
);
6318 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
6320 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
6321 HTMLDOMAttribute
*attr
;
6325 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
6327 switch(V_VT(name
)) {
6329 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
6332 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
6335 FIXME("unsupported name %s\n", debugstr_variant(name
));
6338 if(hres
== DISP_E_UNKNOWNNAME
)
6339 return E_INVALIDARG
;
6343 hres
= get_domattr(This
, id
, NULL
, &attr
);
6347 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
6351 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
6352 HTMLAttributeCollection_QueryInterface
,
6353 HTMLAttributeCollection_AddRef
,
6354 HTMLAttributeCollection_Release
,
6355 HTMLAttributeCollection_GetTypeInfoCount
,
6356 HTMLAttributeCollection_GetTypeInfo
,
6357 HTMLAttributeCollection_GetIDsOfNames
,
6358 HTMLAttributeCollection_Invoke
,
6359 HTMLAttributeCollection_get_length
,
6360 HTMLAttributeCollection__newEnum
,
6361 HTMLAttributeCollection_item
6364 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
6366 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
6369 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
6371 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6372 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
6375 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
6377 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6378 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
6381 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
6383 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6384 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
6387 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
6389 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6390 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
6393 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
6394 LCID lcid
, ITypeInfo
**ppTInfo
)
6396 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6397 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
6400 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
6401 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
6403 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6404 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
6408 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
6409 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
6410 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
6412 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6413 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
6414 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
6417 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
6418 IHTMLDOMAttribute
**newretNode
)
6420 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6421 HTMLDOMAttribute
*attr
;
6425 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
6427 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
6428 if(hres
== DISP_E_UNKNOWNNAME
) {
6431 } else if(FAILED(hres
)) {
6435 hres
= get_domattr(This
, id
, NULL
, &attr
);
6439 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
6443 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
6444 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
6446 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6447 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
6451 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
6452 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
6454 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
6455 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
6459 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
6460 HTMLAttributeCollection2_QueryInterface
,
6461 HTMLAttributeCollection2_AddRef
,
6462 HTMLAttributeCollection2_Release
,
6463 HTMLAttributeCollection2_GetTypeInfoCount
,
6464 HTMLAttributeCollection2_GetTypeInfo
,
6465 HTMLAttributeCollection2_GetIDsOfNames
,
6466 HTMLAttributeCollection2_Invoke
,
6467 HTMLAttributeCollection2_getNamedItem
,
6468 HTMLAttributeCollection2_setNamedItem
,
6469 HTMLAttributeCollection2_removeNamedItem
6472 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
6474 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
6477 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
6479 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6480 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
6483 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
6485 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6486 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
6489 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
6491 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6492 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
6495 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
6497 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6498 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
6501 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
6502 LCID lcid
, ITypeInfo
**ppTInfo
)
6504 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6505 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
6508 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
6509 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
6511 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6512 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
6516 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
6517 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
6518 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
6520 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6521 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
6522 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
6525 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
6526 IHTMLDOMAttribute
**ppNodeOut
)
6528 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6529 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
6532 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
6533 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
6535 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6536 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
6540 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
6541 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
6543 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6544 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
6548 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
6550 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6551 HTMLDOMAttribute
*attr
;
6555 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
6557 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
6558 if(hres
== DISP_E_UNKNOWNNAME
)
6559 return E_INVALIDARG
;
6563 hres
= get_domattr(This
, id
, NULL
, &attr
);
6567 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
6571 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
6573 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
6574 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
6577 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
6578 HTMLAttributeCollection3_QueryInterface
,
6579 HTMLAttributeCollection3_AddRef
,
6580 HTMLAttributeCollection3_Release
,
6581 HTMLAttributeCollection3_GetTypeInfoCount
,
6582 HTMLAttributeCollection3_GetTypeInfo
,
6583 HTMLAttributeCollection3_GetIDsOfNames
,
6584 HTMLAttributeCollection3_Invoke
,
6585 HTMLAttributeCollection3_getNamedItem
,
6586 HTMLAttributeCollection3_setNamedItem
,
6587 HTMLAttributeCollection3_removeNamedItem
,
6588 HTMLAttributeCollection3_item
,
6589 HTMLAttributeCollection3_get_length
6592 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
6594 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
6597 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
6599 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
6600 HTMLDOMAttribute
*attr
;
6604 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
6606 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
6610 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
6613 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
6615 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
6619 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
6620 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
6622 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
6624 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
6627 case DISPATCH_PROPERTYGET
: {
6628 HTMLDOMAttribute
*iter
;
6631 pos
= id
-MSHTML_DISPID_CUSTOM_MIN
;
6633 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
6635 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
6636 V_VT(res
) = VT_DISPATCH
;
6637 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
6643 WARN("invalid arg\n");
6644 return E_INVALIDARG
;
6648 FIXME("unimplemented flags %x\n", flags
);
6653 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
6655 HTMLAttributeCollection_get_dispid
,
6656 HTMLAttributeCollection_invoke
,
6660 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
6661 IHTMLAttributeCollection_tid
,
6662 IHTMLAttributeCollection2_tid
,
6663 IHTMLAttributeCollection3_tid
,
6667 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
6668 &HTMLAttributeCollection_dispex_vtbl
,
6669 DispHTMLAttributeCollection_tid
,
6670 HTMLAttributeCollection_iface_tids
6673 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
6675 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
6678 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
6683 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
6685 return E_OUTOFMEMORY
;
6687 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
6688 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
6689 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
6690 This
->attrs
->ref
= 2;
6692 This
->attrs
->elem
= This
;
6693 list_init(&This
->attrs
->attrs
);
6694 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
6695 &HTMLAttributeCollection_dispex
);