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
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
35 #include "htmlevent.h"
36 #include "htmlstyle.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
40 static const WCHAR aW
[] = {'A',0};
41 static const WCHAR bodyW
[] = {'B','O','D','Y',0};
42 static const WCHAR buttonW
[] = {'B','U','T','T','O','N',0};
43 static const WCHAR embedW
[] = {'E','M','B','E','D',0};
44 static const WCHAR formW
[] = {'F','O','R','M',0};
45 static const WCHAR frameW
[] = {'F','R','A','M','E',0};
46 static const WCHAR headW
[] = {'H','E','A','D',0};
47 static const WCHAR iframeW
[] = {'I','F','R','A','M','E',0};
48 static const WCHAR imgW
[] = {'I','M','G',0};
49 static const WCHAR inputW
[] = {'I','N','P','U','T',0};
50 static const WCHAR labelW
[] = {'L','A','B','E','L',0};
51 static const WCHAR linkW
[] = {'L','I','N','K',0};
52 static const WCHAR metaW
[] = {'M','E','T','A',0};
53 static const WCHAR objectW
[] = {'O','B','J','E','C','T',0};
54 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
55 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
56 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
57 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
58 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
59 static const WCHAR tdW
[] = {'T','D',0};
60 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
61 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
62 static const WCHAR trW
[] = {'T','R',0};
66 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
69 static const tag_desc_t tag_descs
[] = {
70 {aW
, HTMLAnchorElement_Create
},
71 {bodyW
, HTMLBodyElement_Create
},
72 {buttonW
, HTMLButtonElement_Create
},
73 {embedW
, HTMLEmbedElement_Create
},
74 {formW
, HTMLFormElement_Create
},
75 {frameW
, HTMLFrameElement_Create
},
76 {headW
, HTMLHeadElement_Create
},
77 {iframeW
, HTMLIFrame_Create
},
78 {imgW
, HTMLImgElement_Create
},
79 {inputW
, HTMLInputElement_Create
},
80 {labelW
, HTMLLabelElement_Create
},
81 {linkW
, HTMLLinkElement_Create
},
82 {metaW
, HTMLMetaElement_Create
},
83 {objectW
, HTMLObjectElement_Create
},
84 {optionW
, HTMLOptionElement_Create
},
85 {scriptW
, HTMLScriptElement_Create
},
86 {selectW
, HTMLSelectElement_Create
},
87 {styleW
, HTMLStyleElement_Create
},
88 {tableW
, HTMLTable_Create
},
89 {tdW
, HTMLTableCell_Create
},
90 {textareaW
, HTMLTextAreaElement_Create
},
91 {title_tagW
, HTMLTitleElement_Create
},
92 {trW
, HTMLTableRow_Create
}
95 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
97 DWORD min
=0, max
=sizeof(tag_descs
)/sizeof(*tag_descs
)-1, i
;
102 r
= strcmpW(tag_name
, tag_descs
[i
].name
);
115 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
117 nsIDOMDocumentFragment
*nsfragment
;
118 nsIDOMNode
*nsparent
;
124 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
125 if(NS_FAILED(nsres
)) {
126 ERR("CreateRange failed: %08x\n", nsres
);
130 nsAString_InitDepend(&html_str
, html
);
131 nsIDOMRange_CreateContextualFragment(range
, &html_str
, &nsfragment
);
132 nsIDOMRange_Release(range
);
133 nsAString_Finish(&html_str
);
134 if(NS_FAILED(nsres
)) {
135 ERR("CreateContextualFragment failed: %08x\n", nsres
);
139 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
140 if(NS_SUCCEEDED(nsres
) && nsparent
) {
143 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
144 nsIDOMNode_Release(nsparent
);
145 if(NS_FAILED(nsres
)) {
146 ERR("ReplaceChild failed: %08x\n", nsres
);
149 nsIDOMNode_Release(nstmp
);
152 ERR("GetParentNode failed: %08x\n", nsres
);
156 nsIDOMDocumentFragment_Release(nsfragment
);
160 nsresult
get_elem_attr_value(nsIDOMHTMLElement
*nselem
, const WCHAR
*name
, nsAString
*val_str
, const PRUnichar
**val
)
165 nsAString_InitDepend(&name_str
, name
);
166 nsAString_Init(val_str
, NULL
);
167 nsres
= nsIDOMHTMLElement_GetAttribute(nselem
, &name_str
, val_str
);
168 nsAString_Finish(&name_str
);
169 if(NS_FAILED(nsres
)) {
170 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name
), nsres
);
171 nsAString_Finish(val_str
);
175 nsAString_GetData(val_str
, val
);
179 HRESULT
elem_string_attr_getter(HTMLElement
*elem
, const WCHAR
*name
, BOOL use_null
, BSTR
*p
)
181 const PRUnichar
*val
;
186 nsres
= get_elem_attr_value(elem
->nselem
, name
, &val_str
, &val
);
190 TRACE("%s: returning %s\n", debugstr_w(name
), debugstr_w(val
));
192 if(*val
|| !use_null
) {
193 *p
= SysAllocString(val
);
195 hres
= E_OUTOFMEMORY
;
199 nsAString_Finish(&val_str
);
203 HRESULT
elem_string_attr_setter(HTMLElement
*elem
, const WCHAR
*name
, const WCHAR
*value
)
205 nsAString name_str
, val_str
;
208 nsAString_InitDepend(&name_str
, name
);
209 nsAString_InitDepend(&val_str
, value
);
210 nsres
= nsIDOMHTMLElement_SetAttribute(elem
->nselem
, &name_str
, &val_str
);
211 nsAString_Finish(&name_str
);
212 nsAString_Finish(&val_str
);
214 if(NS_FAILED(nsres
)) {
215 WARN("SetAttribute failed: %08x\n", nsres
);
222 HRESULT
get_readystate_string(READYSTATE readystate
, BSTR
*p
)
224 static const WCHAR uninitializedW
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
225 static const WCHAR loadingW
[] = {'l','o','a','d','i','n','g',0};
226 static const WCHAR loadedW
[] = {'l','o','a','d','e','d',0};
227 static const WCHAR interactiveW
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
228 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
230 static const LPCWSTR readystate_strs
[] = {
238 assert(readystate
<= READYSTATE_COMPLETE
);
239 *p
= SysAllocString(readystate_strs
[readystate
]);
240 return *p
? S_OK
: E_OUTOFMEMORY
;
246 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
249 } HTMLFiltersCollection
;
251 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
253 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
256 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
258 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
260 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
263 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMHTMLElement
**ret
)
265 nsIDOMElement
*nselem
;
270 WARN("NULL nsdoc\n");
274 nsAString_InitDepend(&tag_str
, tag
);
275 nsres
= nsIDOMHTMLDocument_CreateElement(doc
->nsdoc
, &tag_str
, &nselem
);
276 nsAString_Finish(&tag_str
);
277 if(NS_FAILED(nsres
)) {
278 ERR("CreateElement failed: %08x\n", nsres
);
282 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)ret
);
283 nsIDOMElement_Release(nselem
);
284 if(NS_FAILED(nsres
)) {
285 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres
);
292 HRESULT
create_element(HTMLDocumentNode
*doc
, const WCHAR
*tag
, HTMLElement
**ret
)
294 nsIDOMHTMLElement
*nselem
;
297 /* Use owner doc if called on document fragment */
301 hres
= create_nselem(doc
, tag
, &nselem
);
305 hres
= HTMLElement_Create(doc
, (nsIDOMNode
*)nselem
, TRUE
, ret
);
306 nsIDOMHTMLElement_Release(nselem
);
312 IHTMLRect IHTMLRect_iface
;
316 nsIDOMClientRect
*nsrect
;
319 static inline HTMLRect
*impl_from_IHTMLRect(IHTMLRect
*iface
)
321 return CONTAINING_RECORD(iface
, HTMLRect
, IHTMLRect_iface
);
324 static HRESULT WINAPI
HTMLRect_QueryInterface(IHTMLRect
*iface
, REFIID riid
, void **ppv
)
326 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
328 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
330 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
331 *ppv
= &This
->IHTMLRect_iface
;
332 }else if(IsEqualGUID(&IID_IHTMLRect
, riid
)) {
333 *ppv
= &This
->IHTMLRect_iface
;
334 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
335 return *ppv
? S_OK
: E_NOINTERFACE
;
337 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
339 return E_NOINTERFACE
;
342 IUnknown_AddRef((IUnknown
*)*ppv
);
346 static ULONG WINAPI
HTMLRect_AddRef(IHTMLRect
*iface
)
348 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
349 LONG ref
= InterlockedIncrement(&This
->ref
);
351 TRACE("(%p) ref=%d\n", This
, ref
);
356 static ULONG WINAPI
HTMLRect_Release(IHTMLRect
*iface
)
358 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
359 LONG ref
= InterlockedDecrement(&This
->ref
);
361 TRACE("(%p) ref=%d\n", This
, ref
);
365 nsIDOMClientRect_Release(This
->nsrect
);
372 static HRESULT WINAPI
HTMLRect_GetTypeInfoCount(IHTMLRect
*iface
, UINT
*pctinfo
)
374 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
375 FIXME("(%p)->(%p)\n", This
, pctinfo
);
379 static HRESULT WINAPI
HTMLRect_GetTypeInfo(IHTMLRect
*iface
, UINT iTInfo
,
380 LCID lcid
, ITypeInfo
**ppTInfo
)
382 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
384 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
387 static HRESULT WINAPI
HTMLRect_GetIDsOfNames(IHTMLRect
*iface
, REFIID riid
,
388 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
390 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
392 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
396 static HRESULT WINAPI
HTMLRect_Invoke(IHTMLRect
*iface
, DISPID dispIdMember
,
397 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
398 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
400 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
402 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
403 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
406 static HRESULT WINAPI
HTMLRect_put_left(IHTMLRect
*iface
, LONG v
)
408 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
409 FIXME("(%p)->(%d)\n", This
, v
);
413 static HRESULT WINAPI
HTMLRect_get_left(IHTMLRect
*iface
, LONG
*p
)
415 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
419 TRACE("(%p)->(%p)\n", This
, p
);
421 nsres
= nsIDOMClientRect_GetLeft(This
->nsrect
, &left
);
422 if(NS_FAILED(nsres
)) {
423 ERR("GetLeft failed: %08x\n", nsres
);
427 *p
= floor(left
+0.5);
431 static HRESULT WINAPI
HTMLRect_put_top(IHTMLRect
*iface
, LONG v
)
433 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
434 FIXME("(%p)->(%d)\n", This
, v
);
438 static HRESULT WINAPI
HTMLRect_get_top(IHTMLRect
*iface
, LONG
*p
)
440 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
444 TRACE("(%p)->(%p)\n", This
, p
);
446 nsres
= nsIDOMClientRect_GetTop(This
->nsrect
, &top
);
447 if(NS_FAILED(nsres
)) {
448 ERR("GetTop failed: %08x\n", nsres
);
456 static HRESULT WINAPI
HTMLRect_put_right(IHTMLRect
*iface
, LONG v
)
458 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
459 FIXME("(%p)->(%d)\n", This
, v
);
463 static HRESULT WINAPI
HTMLRect_get_right(IHTMLRect
*iface
, LONG
*p
)
465 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
469 TRACE("(%p)->(%p)\n", This
, p
);
471 nsres
= nsIDOMClientRect_GetRight(This
->nsrect
, &right
);
472 if(NS_FAILED(nsres
)) {
473 ERR("GetRight failed: %08x\n", nsres
);
477 *p
= floor(right
+0.5);
481 static HRESULT WINAPI
HTMLRect_put_bottom(IHTMLRect
*iface
, LONG v
)
483 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
484 FIXME("(%p)->(%d)\n", This
, v
);
488 static HRESULT WINAPI
HTMLRect_get_bottom(IHTMLRect
*iface
, LONG
*p
)
490 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
494 TRACE("(%p)->(%p)\n", This
, p
);
496 nsres
= nsIDOMClientRect_GetBottom(This
->nsrect
, &bottom
);
497 if(NS_FAILED(nsres
)) {
498 ERR("GetBottom failed: %08x\n", nsres
);
502 *p
= floor(bottom
+0.5);
506 static const IHTMLRectVtbl HTMLRectVtbl
= {
507 HTMLRect_QueryInterface
,
510 HTMLRect_GetTypeInfoCount
,
511 HTMLRect_GetTypeInfo
,
512 HTMLRect_GetIDsOfNames
,
524 static const tid_t HTMLRect_iface_tids
[] = {
528 static dispex_static_data_t HTMLRect_dispex
= {
535 static HRESULT
create_html_rect(nsIDOMClientRect
*nsrect
, IHTMLRect
**ret
)
539 rect
= heap_alloc_zero(sizeof(HTMLRect
));
541 return E_OUTOFMEMORY
;
543 rect
->IHTMLRect_iface
.lpVtbl
= &HTMLRectVtbl
;
546 init_dispex(&rect
->dispex
, (IUnknown
*)&rect
->IHTMLRect_iface
, &HTMLRect_dispex
);
548 nsIDOMClientRect_AddRef(nsrect
);
549 rect
->nsrect
= nsrect
;
551 *ret
= &rect
->IHTMLRect_iface
;
555 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
556 REFIID riid
, void **ppv
)
558 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
560 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
563 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
565 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
567 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
570 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
572 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
574 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
577 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
579 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
580 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
583 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
584 LCID lcid
, ITypeInfo
**ppTInfo
)
586 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
587 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
590 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
591 LPOLESTR
*rgszNames
, UINT cNames
,
592 LCID lcid
, DISPID
*rgDispId
)
594 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
595 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
599 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
600 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
601 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
603 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
604 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
605 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
608 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
609 VARIANT AttributeValue
, LONG lFlags
)
611 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
613 DISPID dispid
, dispidNamed
= DISPID_PROPERTYPUT
;
614 DISPPARAMS dispParams
;
617 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
), debugstr_variant(&AttributeValue
), lFlags
);
619 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
620 fdexNameCaseInsensitive
| fdexNameEnsure
, &dispid
);
624 dispParams
.cArgs
= 1;
625 dispParams
.cNamedArgs
= 1;
626 dispParams
.rgdispidNamedArgs
= &dispidNamed
;
627 dispParams
.rgvarg
= &AttributeValue
;
629 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
,
630 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dispParams
, NULL
, &excep
, NULL
);
634 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
635 LONG lFlags
, VARIANT
*AttributeValue
)
637 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
640 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
643 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
645 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
646 fdexNameCaseInsensitive
, &dispid
);
647 if(hres
== DISP_E_UNKNOWNNAME
) {
648 V_VT(AttributeValue
) = VT_NULL
;
653 V_VT(AttributeValue
) = VT_NULL
;
657 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
658 DISPATCH_PROPERTYGET
, &dispParams
, AttributeValue
, &excep
, NULL
);
663 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
664 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
666 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
668 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
670 return remove_prop(&This
->node
.dispex
, strAttributeName
, pfSuccess
);
673 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
675 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
676 nsAString classname_str
;
679 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
682 FIXME("NULL nselem\n");
686 nsAString_InitDepend(&classname_str
, v
);
687 nsres
= nsIDOMHTMLElement_SetClassName(This
->nselem
, &classname_str
);
688 nsAString_Finish(&classname_str
);
690 ERR("SetClassName failed: %08x\n", nsres
);
695 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
697 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
701 TRACE("(%p)->(%p)\n", This
, p
);
704 FIXME("NULL nselem\n");
708 nsAString_Init(&class_str
, NULL
);
709 nsres
= nsIDOMHTMLElement_GetClassName(This
->nselem
, &class_str
);
710 return return_nsstr(nsres
, &class_str
, p
);
713 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
715 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
719 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
722 FIXME("nselem == NULL\n");
726 nsAString_InitDepend(&id_str
, v
);
727 nsres
= nsIDOMHTMLElement_SetId(This
->nselem
, &id_str
);
728 nsAString_Finish(&id_str
);
730 ERR("SetId failed: %08x\n", nsres
);
735 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
737 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
741 TRACE("(%p)->(%p)\n", This
, p
);
748 nsAString_Init(&id_str
, NULL
);
749 nsres
= nsIDOMHTMLElement_GetId(This
->nselem
, &id_str
);
750 return return_nsstr(nsres
, &id_str
, p
);
753 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
755 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
759 TRACE("(%p)->(%p)\n", This
, p
);
762 static const WCHAR comment_tagW
[] = {'!',0};
764 WARN("NULL nselem, assuming comment\n");
766 *p
= SysAllocString(comment_tagW
);
767 return *p
? S_OK
: E_OUTOFMEMORY
;
770 nsAString_Init(&tag_str
, NULL
);
771 nsres
= nsIDOMHTMLElement_GetTagName(This
->nselem
, &tag_str
);
772 return return_nsstr(nsres
, &tag_str
, p
);
775 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
777 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
781 TRACE("(%p)->(%p)\n", This
, p
);
783 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
787 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
788 IHTMLDOMNode_Release(node
);
795 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
797 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
799 TRACE("(%p)->(%p)\n", This
, p
);
804 hres
= HTMLStyle_Create(This
, &This
->style
);
809 *p
= &This
->style
->IHTMLStyle_iface
;
810 IHTMLStyle_AddRef(*p
);
814 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
816 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
817 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
821 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
823 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
824 FIXME("(%p)->(%p)\n", This
, p
);
828 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
830 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
832 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
834 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
837 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
839 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
841 TRACE("(%p)->(%p)\n", This
, p
);
843 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
846 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
848 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
850 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
852 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
855 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
857 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
859 TRACE("(%p)->(%p)\n", This
, p
);
861 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
864 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
866 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
868 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
870 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
873 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
875 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
877 TRACE("(%p)->(%p)\n", This
, p
);
879 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
882 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
884 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
886 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
888 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
891 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
893 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
894 FIXME("(%p)->(%p)\n", This
, p
);
898 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
900 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
902 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
904 return set_node_event(&This
->node
, EVENTID_KEYPRESS
, &v
);
907 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
909 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
911 TRACE("(%p)->(%p)\n", This
, p
);
913 return get_node_event(&This
->node
, EVENTID_KEYPRESS
, p
);
916 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
918 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
920 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
922 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
925 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
927 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
929 TRACE("(%p)->(%p)\n", This
, p
);
931 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
934 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
936 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
938 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
940 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
943 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
945 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
947 TRACE("(%p)->(%p)\n", This
, p
);
949 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
952 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
954 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
956 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
958 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
961 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
963 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
965 TRACE("(%p)->(%p)\n", This
, p
);
967 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
970 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
972 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
974 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
976 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
979 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
981 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
983 TRACE("(%p)->(%p)\n", This
, p
);
985 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
988 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
990 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
992 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
994 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
997 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
999 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1001 TRACE("(%p)->(%p)\n", This
, p
);
1003 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
1006 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
1008 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1010 TRACE("(%p)->(%p)\n", This
, p
);
1015 if(This
->node
.vtbl
->get_document
)
1016 return This
->node
.vtbl
->get_document(&This
->node
, p
);
1018 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
1019 IDispatch_AddRef(*p
);
1023 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
1025 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
1027 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1028 nsAString title_str
;
1031 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1037 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, TRUE
, &var
);
1042 V_VT(var
) = VT_BSTR
;
1043 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
1047 nsAString_InitDepend(&title_str
, v
);
1048 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
1049 nsAString_Finish(&title_str
);
1050 if(NS_FAILED(nsres
))
1051 ERR("SetTitle failed: %08x\n", nsres
);
1056 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
1058 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1059 nsAString title_str
;
1062 TRACE("(%p)->(%p)\n", This
, p
);
1068 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, FALSE
, &var
);
1069 if(hres
== DISP_E_UNKNOWNNAME
) {
1071 }else if(V_VT(var
) != VT_BSTR
) {
1072 FIXME("title = %s\n", debugstr_variant(var
));
1075 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
1081 nsAString_Init(&title_str
, NULL
);
1082 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
1083 return return_nsstr(nsres
, &title_str
, p
);
1086 static const WCHAR languageW
[] = {'l','a','n','g','u','a','g','e',0};
1088 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
1090 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1092 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1094 return elem_string_attr_setter(This
, languageW
, v
);
1097 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
1099 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1101 TRACE("(%p)->(%p)\n", This
, p
);
1103 return elem_string_attr_getter(This
, languageW
, TRUE
, p
);
1106 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
1108 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1110 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1112 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
1115 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
1117 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1119 TRACE("(%p)->(%p)\n", This
, p
);
1121 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
1124 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
1126 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1127 cpp_bool start
= TRUE
;
1130 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
1132 switch(V_VT(&varargStart
)) {
1137 start
= V_BOOL(&varargStart
) != VARIANT_FALSE
;
1140 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart
));
1144 FIXME("Unsupported for comments\n");
1148 nsres
= nsIDOMHTMLElement_ScrollIntoView(This
->nselem
, start
, 1);
1149 assert(nsres
== NS_OK
);
1154 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
1155 VARIANT_BOOL
*pfResult
)
1157 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1158 cpp_bool result
= FALSE
;
1160 TRACE("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
1166 child
= unsafe_impl_from_IHTMLElement(pChild
);
1168 ERR("not our element\n");
1172 nsres
= nsIDOMNode_Contains(This
->node
.nsnode
, child
->node
.nsnode
, &result
);
1173 assert(nsres
== NS_OK
);
1176 *pfResult
= result
? VARIANT_TRUE
: VARIANT_FALSE
;
1180 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
1182 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1184 TRACE("(%p)->(%p)\n", This
, p
);
1186 return get_elem_source_index(This
, p
);
1189 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
1191 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1192 FIXME("(%p)->(%p)\n", This
, p
);
1196 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
1198 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1199 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1203 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
1205 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1206 FIXME("(%p)->(%p)\n", This
, p
);
1210 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
1212 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1215 TRACE("(%p)->(%p)\n", This
, p
);
1217 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, p
);
1218 if(NS_FAILED(nsres
)) {
1219 ERR("GetOffsetLeft failed: %08x\n", nsres
);
1226 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
1228 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1231 TRACE("(%p)->(%p)\n", This
, p
);
1233 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, p
);
1234 if(NS_FAILED(nsres
)) {
1235 ERR("GetOffsetTop failed: %08x\n", nsres
);
1242 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
1244 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1247 TRACE("(%p)->(%p)\n", This
, p
);
1249 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, p
);
1250 if(NS_FAILED(nsres
)) {
1251 ERR("GetOffsetWidth failed: %08x\n", nsres
);
1258 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
1260 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1263 TRACE("(%p)->(%p)\n", This
, p
);
1265 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, p
);
1266 if(NS_FAILED(nsres
)) {
1267 ERR("GetOffsetHeight failed: %08x\n", nsres
);
1274 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
1276 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1277 nsIDOMElement
*nsparent
;
1281 TRACE("(%p)->(%p)\n", This
, p
);
1283 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
1284 if(NS_FAILED(nsres
)) {
1285 ERR("GetOffsetParent failed: %08x\n", nsres
);
1292 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
1293 nsIDOMElement_Release(nsparent
);
1297 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
1307 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
1309 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1313 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1316 FIXME("NULL nselem\n");
1320 nsAString_InitDepend(&html_str
, v
);
1321 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
1322 nsAString_Finish(&html_str
);
1323 if(NS_FAILED(nsres
)) {
1324 FIXME("SetInnerHtml failed %08x\n", nsres
);
1331 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1333 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1337 TRACE("(%p)->(%p)\n", This
, p
);
1340 FIXME("NULL nselem\n");
1344 nsAString_Init(&html_str
, NULL
);
1345 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
1346 return return_nsstr(nsres
, &html_str
, p
);
1349 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1351 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1352 nsIDOMNode
*nschild
, *tmp
;
1353 nsIDOMText
*text_node
;
1357 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1360 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
1361 if(NS_FAILED(nsres
)) {
1362 ERR("GetLastChild failed: %08x\n", nsres
);
1368 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
1369 nsIDOMNode_Release(nschild
);
1370 if(NS_FAILED(nsres
)) {
1371 ERR("RemoveChild failed: %08x\n", nsres
);
1374 nsIDOMNode_Release(tmp
);
1377 nsAString_InitDepend(&text_str
, v
);
1378 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1379 nsAString_Finish(&text_str
);
1380 if(NS_FAILED(nsres
)) {
1381 ERR("CreateTextNode failed: %08x\n", nsres
);
1385 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1386 if(NS_FAILED(nsres
)) {
1387 ERR("AppendChild failed: %08x\n", nsres
);
1391 nsIDOMNode_Release(tmp
);
1395 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1397 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1399 TRACE("(%p)->(%p)\n", This
, p
);
1401 return get_node_text(&This
->node
, p
);
1404 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1406 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1408 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1410 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1413 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1415 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1419 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1421 nsAString_Init(&html_str
, NULL
);
1422 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1423 if(SUCCEEDED(hres
)) {
1424 const PRUnichar
*html
;
1426 nsAString_GetData(&html_str
, &html
);
1427 *p
= SysAllocString(html
);
1429 hres
= E_OUTOFMEMORY
;
1432 nsAString_Finish(&html_str
);
1434 TRACE("ret %s\n", debugstr_w(*p
));
1438 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1440 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1441 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1445 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1447 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1448 FIXME("(%p)->(%p)\n", This
, p
);
1452 HRESULT
insert_adjacent_node(HTMLElement
*This
, const WCHAR
*where
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret_node
)
1454 nsIDOMNode
*ret_nsnode
;
1456 HRESULT hres
= S_OK
;
1458 static const WCHAR beforebeginW
[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
1459 static const WCHAR afterbeginW
[] = {'a','f','t','e','r','b','e','g','i','n',0};
1460 static const WCHAR beforeendW
[] = {'b','e','f','o','r','e','e','n','d',0};
1461 static const WCHAR afterendW
[] = {'a','f','t','e','r','e','n','d',0};
1463 if (!strcmpiW(where
, beforebeginW
)) {
1466 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1467 if(NS_FAILED(nsres
))
1471 return E_INVALIDARG
;
1473 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &ret_nsnode
);
1474 nsIDOMNode_Release(parent
);
1475 }else if(!strcmpiW(where
, afterbeginW
)) {
1476 nsIDOMNode
*first_child
;
1478 nsres
= nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1479 if(NS_FAILED(nsres
))
1482 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &ret_nsnode
);
1483 if(NS_FAILED(nsres
))
1487 nsIDOMNode_Release(first_child
);
1488 }else if (!strcmpiW(where
, beforeendW
)) {
1489 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &ret_nsnode
);
1490 }else if (!strcmpiW(where
, afterendW
)) {
1491 nsIDOMNode
*next_sibling
, *parent
;
1493 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1494 if(NS_FAILED(nsres
))
1497 return E_INVALIDARG
;
1499 nsres
= nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1500 if(NS_SUCCEEDED(nsres
)) {
1502 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &ret_nsnode
);
1503 nsIDOMNode_Release(next_sibling
);
1505 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &ret_nsnode
);
1509 nsIDOMNode_Release(parent
);
1511 ERR("invalid where: %s\n", debugstr_w(where
));
1512 return E_INVALIDARG
;
1515 if (NS_FAILED(nsres
))
1519 hres
= get_node(This
->node
.doc
, ret_nsnode
, TRUE
, ret_node
);
1520 nsIDOMNode_Release(ret_nsnode
);
1524 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1527 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1534 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1536 if(!This
->node
.doc
->nsdoc
) {
1537 WARN("NULL nsdoc\n");
1538 return E_UNEXPECTED
;
1541 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1542 if(NS_FAILED(nsres
))
1544 ERR("CreateRange failed: %08x\n", nsres
);
1548 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1550 nsAString_InitDepend(&ns_html
, html
);
1551 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1552 nsAString_Finish(&ns_html
);
1553 nsIDOMRange_Release(range
);
1555 if(NS_FAILED(nsres
) || !nsnode
)
1557 ERR("CreateTextNode failed: %08x\n", nsres
);
1561 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1562 nsIDOMNode_Release(nsnode
);
1566 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1569 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1575 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1577 if(!This
->node
.doc
->nsdoc
) {
1578 WARN("NULL nsdoc\n");
1579 return E_UNEXPECTED
;
1583 nsAString_InitDepend(&ns_text
, text
);
1584 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1585 nsAString_Finish(&ns_text
);
1587 if(NS_FAILED(nsres
) || !nsnode
)
1589 ERR("CreateTextNode failed: %08x\n", nsres
);
1593 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1594 nsIDOMNode_Release(nsnode
);
1599 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1601 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1602 FIXME("(%p)->(%p)\n", This
, p
);
1606 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1608 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1609 FIXME("(%p)->(%p)\n", This
, p
);
1613 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1615 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1617 TRACE("(%p)\n", This
);
1619 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1622 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1623 IHTMLFiltersCollection
**p
)
1625 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1626 TRACE("(%p)->(%p)\n", This
, p
);
1631 *p
= HTMLFiltersCollection_Create();
1636 static HRESULT WINAPI
HTMLElement_put_ondragstart(IHTMLElement
*iface
, VARIANT v
)
1638 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1639 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1643 static HRESULT WINAPI
HTMLElement_get_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1645 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1646 FIXME("(%p)->(%p)\n", This
, p
);
1650 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1652 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1653 FIXME("(%p)->(%p)\n", This
, String
);
1657 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1659 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1660 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1664 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1666 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1667 FIXME("(%p)->(%p)\n", This
, p
);
1671 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1673 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1674 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1678 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1680 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1681 FIXME("(%p)->(%p)\n", This
, p
);
1685 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1687 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1688 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1692 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1694 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1695 FIXME("(%p)->(%p)\n", This
, p
);
1699 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1701 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1702 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1706 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1708 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1709 FIXME("(%p)->(%p)\n", This
, p
);
1713 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1715 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1716 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1720 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1722 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1723 FIXME("(%p)->(%p)\n", This
, p
);
1727 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1729 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1730 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1734 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1736 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1737 FIXME("(%p)->(%p)\n", This
, p
);
1741 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1743 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1745 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1747 return set_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, &v
);
1750 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1752 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1754 TRACE("(%p)->(%p)\n", This
, p
);
1756 return get_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, p
);
1759 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1761 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1762 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1766 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1768 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1769 FIXME("(%p)->(%p)\n", This
, p
);
1773 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1775 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1776 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1780 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1782 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1783 FIXME("(%p)->(%p)\n", This
, p
);
1787 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1789 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1790 nsIDOMNodeList
*nsnode_list
;
1793 TRACE("(%p)->(%p)\n", This
, p
);
1795 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1796 if(NS_FAILED(nsres
)) {
1797 ERR("GetChildNodes failed: %08x\n", nsres
);
1801 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
, nsnode_list
);
1803 nsIDOMNodeList_Release(nsnode_list
);
1807 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1809 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1811 TRACE("(%p)->(%p)\n", This
, p
);
1813 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1817 static const IHTMLElementVtbl HTMLElementVtbl
= {
1818 HTMLElement_QueryInterface
,
1820 HTMLElement_Release
,
1821 HTMLElement_GetTypeInfoCount
,
1822 HTMLElement_GetTypeInfo
,
1823 HTMLElement_GetIDsOfNames
,
1825 HTMLElement_setAttribute
,
1826 HTMLElement_getAttribute
,
1827 HTMLElement_removeAttribute
,
1828 HTMLElement_put_className
,
1829 HTMLElement_get_className
,
1832 HTMLElement_get_tagName
,
1833 HTMLElement_get_parentElement
,
1834 HTMLElement_get_style
,
1835 HTMLElement_put_onhelp
,
1836 HTMLElement_get_onhelp
,
1837 HTMLElement_put_onclick
,
1838 HTMLElement_get_onclick
,
1839 HTMLElement_put_ondblclick
,
1840 HTMLElement_get_ondblclick
,
1841 HTMLElement_put_onkeydown
,
1842 HTMLElement_get_onkeydown
,
1843 HTMLElement_put_onkeyup
,
1844 HTMLElement_get_onkeyup
,
1845 HTMLElement_put_onkeypress
,
1846 HTMLElement_get_onkeypress
,
1847 HTMLElement_put_onmouseout
,
1848 HTMLElement_get_onmouseout
,
1849 HTMLElement_put_onmouseover
,
1850 HTMLElement_get_onmouseover
,
1851 HTMLElement_put_onmousemove
,
1852 HTMLElement_get_onmousemove
,
1853 HTMLElement_put_onmousedown
,
1854 HTMLElement_get_onmousedown
,
1855 HTMLElement_put_onmouseup
,
1856 HTMLElement_get_onmouseup
,
1857 HTMLElement_get_document
,
1858 HTMLElement_put_title
,
1859 HTMLElement_get_title
,
1860 HTMLElement_put_language
,
1861 HTMLElement_get_language
,
1862 HTMLElement_put_onselectstart
,
1863 HTMLElement_get_onselectstart
,
1864 HTMLElement_scrollIntoView
,
1865 HTMLElement_contains
,
1866 HTMLElement_get_sourceIndex
,
1867 HTMLElement_get_recordNumber
,
1868 HTMLElement_put_lang
,
1869 HTMLElement_get_lang
,
1870 HTMLElement_get_offsetLeft
,
1871 HTMLElement_get_offsetTop
,
1872 HTMLElement_get_offsetWidth
,
1873 HTMLElement_get_offsetHeight
,
1874 HTMLElement_get_offsetParent
,
1875 HTMLElement_put_innerHTML
,
1876 HTMLElement_get_innerHTML
,
1877 HTMLElement_put_innerText
,
1878 HTMLElement_get_innerText
,
1879 HTMLElement_put_outerHTML
,
1880 HTMLElement_get_outerHTML
,
1881 HTMLElement_put_outerText
,
1882 HTMLElement_get_outerText
,
1883 HTMLElement_insertAdjacentHTML
,
1884 HTMLElement_insertAdjacentText
,
1885 HTMLElement_get_parentTextEdit
,
1886 HTMLElement_get_isTextEdit
,
1888 HTMLElement_get_filters
,
1889 HTMLElement_put_ondragstart
,
1890 HTMLElement_get_ondragstart
,
1891 HTMLElement_toString
,
1892 HTMLElement_put_onbeforeupdate
,
1893 HTMLElement_get_onbeforeupdate
,
1894 HTMLElement_put_onafterupdate
,
1895 HTMLElement_get_onafterupdate
,
1896 HTMLElement_put_onerrorupdate
,
1897 HTMLElement_get_onerrorupdate
,
1898 HTMLElement_put_onrowexit
,
1899 HTMLElement_get_onrowexit
,
1900 HTMLElement_put_onrowenter
,
1901 HTMLElement_get_onrowenter
,
1902 HTMLElement_put_ondatasetchanged
,
1903 HTMLElement_get_ondatasetchanged
,
1904 HTMLElement_put_ondataavailable
,
1905 HTMLElement_get_ondataavailable
,
1906 HTMLElement_put_ondatasetcomplete
,
1907 HTMLElement_get_ondatasetcomplete
,
1908 HTMLElement_put_onfilterchange
,
1909 HTMLElement_get_onfilterchange
,
1910 HTMLElement_get_children
,
1914 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1916 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1919 static inline HTMLElement
*impl_from_IHTMLElement2(IHTMLElement2
*iface
)
1921 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement2_iface
);
1924 static HRESULT WINAPI
HTMLElement2_QueryInterface(IHTMLElement2
*iface
,
1925 REFIID riid
, void **ppv
)
1927 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1928 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
1931 static ULONG WINAPI
HTMLElement2_AddRef(IHTMLElement2
*iface
)
1933 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1934 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
1937 static ULONG WINAPI
HTMLElement2_Release(IHTMLElement2
*iface
)
1939 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1940 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
1943 static HRESULT WINAPI
HTMLElement2_GetTypeInfoCount(IHTMLElement2
*iface
, UINT
*pctinfo
)
1945 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1946 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
1949 static HRESULT WINAPI
HTMLElement2_GetTypeInfo(IHTMLElement2
*iface
, UINT iTInfo
,
1950 LCID lcid
, ITypeInfo
**ppTInfo
)
1952 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1953 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1956 static HRESULT WINAPI
HTMLElement2_GetIDsOfNames(IHTMLElement2
*iface
, REFIID riid
,
1957 LPOLESTR
*rgszNames
, UINT cNames
,
1958 LCID lcid
, DISPID
*rgDispId
)
1960 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1961 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
1965 static HRESULT WINAPI
HTMLElement2_Invoke(IHTMLElement2
*iface
, DISPID dispIdMember
,
1966 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1967 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1969 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1970 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
1971 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1974 static HRESULT WINAPI
HTMLElement2_get_scopeName(IHTMLElement2
*iface
, BSTR
*p
)
1976 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1977 FIXME("(%p)->(%p)\n", This
, p
);
1981 static HRESULT WINAPI
HTMLElement2_setCapture(IHTMLElement2
*iface
, VARIANT_BOOL containerCapture
)
1983 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1984 FIXME("(%p)->(%x)\n", This
, containerCapture
);
1988 static HRESULT WINAPI
HTMLElement2_releaseCapture(IHTMLElement2
*iface
)
1990 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1991 FIXME("(%p)\n", This
);
1995 static HRESULT WINAPI
HTMLElement2_put_onlosecapture(IHTMLElement2
*iface
, VARIANT v
)
1997 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1998 FIXME("(%p)->()\n", This
);
2002 static HRESULT WINAPI
HTMLElement2_get_onlosecapture(IHTMLElement2
*iface
, VARIANT
*p
)
2004 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2005 FIXME("(%p)->(%p)\n", This
, p
);
2009 static HRESULT WINAPI
HTMLElement2_componentFromPoint(IHTMLElement2
*iface
,
2010 LONG x
, LONG y
, BSTR
*component
)
2012 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2013 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, component
);
2017 static HRESULT WINAPI
HTMLElement2_doScroll(IHTMLElement2
*iface
, VARIANT component
)
2019 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2021 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&component
));
2023 if(!This
->node
.doc
->content_ready
2024 || !This
->node
.doc
->basedoc
.doc_obj
->in_place_active
)
2031 static HRESULT WINAPI
HTMLElement2_put_onscroll(IHTMLElement2
*iface
, VARIANT v
)
2033 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2034 FIXME("(%p)->()\n", This
);
2038 static HRESULT WINAPI
HTMLElement2_get_onscroll(IHTMLElement2
*iface
, VARIANT
*p
)
2040 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2041 FIXME("(%p)->(%p)\n", This
, p
);
2045 static HRESULT WINAPI
HTMLElement2_put_ondrag(IHTMLElement2
*iface
, VARIANT v
)
2047 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2049 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2051 return set_node_event(&This
->node
, EVENTID_DRAG
, &v
);
2054 static HRESULT WINAPI
HTMLElement2_get_ondrag(IHTMLElement2
*iface
, VARIANT
*p
)
2056 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2058 TRACE("(%p)->(%p)\n", This
, p
);
2060 return get_node_event(&This
->node
, EVENTID_DRAG
, p
);
2063 static HRESULT WINAPI
HTMLElement2_put_ondragend(IHTMLElement2
*iface
, VARIANT v
)
2065 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2066 FIXME("(%p)->()\n", This
);
2070 static HRESULT WINAPI
HTMLElement2_get_ondragend(IHTMLElement2
*iface
, VARIANT
*p
)
2072 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2073 FIXME("(%p)->(%p)\n", This
, p
);
2077 static HRESULT WINAPI
HTMLElement2_put_ondragenter(IHTMLElement2
*iface
, VARIANT v
)
2079 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2080 FIXME("(%p)->()\n", This
);
2084 static HRESULT WINAPI
HTMLElement2_get_ondragenter(IHTMLElement2
*iface
, VARIANT
*p
)
2086 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2087 FIXME("(%p)->(%p)\n", This
, p
);
2091 static HRESULT WINAPI
HTMLElement2_put_ondragover(IHTMLElement2
*iface
, VARIANT v
)
2093 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2094 FIXME("(%p)->()\n", This
);
2098 static HRESULT WINAPI
HTMLElement2_get_ondragover(IHTMLElement2
*iface
, VARIANT
*p
)
2100 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2101 FIXME("(%p)->(%p)\n", This
, p
);
2105 static HRESULT WINAPI
HTMLElement2_put_ondragleave(IHTMLElement2
*iface
, VARIANT v
)
2107 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2108 FIXME("(%p)->()\n", This
);
2112 static HRESULT WINAPI
HTMLElement2_get_ondragleave(IHTMLElement2
*iface
, VARIANT
*p
)
2114 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2115 FIXME("(%p)->(%p)\n", This
, p
);
2119 static HRESULT WINAPI
HTMLElement2_put_ondrop(IHTMLElement2
*iface
, VARIANT v
)
2121 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2122 FIXME("(%p)->()\n", This
);
2126 static HRESULT WINAPI
HTMLElement2_get_ondrop(IHTMLElement2
*iface
, VARIANT
*p
)
2128 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2129 FIXME("(%p)->(%p)\n", This
, p
);
2133 static HRESULT WINAPI
HTMLElement2_put_onbeforecut(IHTMLElement2
*iface
, VARIANT v
)
2135 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2136 FIXME("(%p)->()\n", This
);
2140 static HRESULT WINAPI
HTMLElement2_get_onbeforecut(IHTMLElement2
*iface
, VARIANT
*p
)
2142 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2143 FIXME("(%p)->(%p)\n", This
, p
);
2147 static HRESULT WINAPI
HTMLElement2_put_oncut(IHTMLElement2
*iface
, VARIANT v
)
2149 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2150 FIXME("(%p)->()\n", This
);
2154 static HRESULT WINAPI
HTMLElement2_get_oncut(IHTMLElement2
*iface
, VARIANT
*p
)
2156 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2157 FIXME("(%p)->(%p)\n", This
, p
);
2161 static HRESULT WINAPI
HTMLElement2_put_onbeforecopy(IHTMLElement2
*iface
, VARIANT v
)
2163 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2164 FIXME("(%p)->()\n", This
);
2168 static HRESULT WINAPI
HTMLElement2_get_onbeforecopy(IHTMLElement2
*iface
, VARIANT
*p
)
2170 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2171 FIXME("(%p)->(%p)\n", This
, p
);
2175 static HRESULT WINAPI
HTMLElement2_put_oncopy(IHTMLElement2
*iface
, VARIANT v
)
2177 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2178 FIXME("(%p)->()\n", This
);
2182 static HRESULT WINAPI
HTMLElement2_get_oncopy(IHTMLElement2
*iface
, VARIANT
*p
)
2184 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2185 FIXME("(%p)->(%p)\n", This
, p
);
2189 static HRESULT WINAPI
HTMLElement2_put_onbeforepaste(IHTMLElement2
*iface
, VARIANT v
)
2191 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2192 FIXME("(%p)->()\n", This
);
2196 static HRESULT WINAPI
HTMLElement2_get_onbeforepaste(IHTMLElement2
*iface
, VARIANT
*p
)
2198 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2199 FIXME("(%p)->(%p)\n", This
, p
);
2203 static HRESULT WINAPI
HTMLElement2_put_onpaste(IHTMLElement2
*iface
, VARIANT v
)
2205 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2207 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2209 return set_node_event(&This
->node
, EVENTID_PASTE
, &v
);
2212 static HRESULT WINAPI
HTMLElement2_get_onpaste(IHTMLElement2
*iface
, VARIANT
*p
)
2214 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2216 TRACE("(%p)->(%p)\n", This
, p
);
2218 return get_node_event(&This
->node
, EVENTID_PASTE
, p
);
2221 static HRESULT WINAPI
HTMLElement2_get_currentStyle(IHTMLElement2
*iface
, IHTMLCurrentStyle
**p
)
2223 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2225 TRACE("(%p)->(%p)\n", This
, p
);
2227 return HTMLCurrentStyle_Create(This
, p
);
2230 static HRESULT WINAPI
HTMLElement2_put_onpropertychange(IHTMLElement2
*iface
, VARIANT v
)
2232 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2233 FIXME("(%p)->()\n", This
);
2237 static HRESULT WINAPI
HTMLElement2_get_onpropertychange(IHTMLElement2
*iface
, VARIANT
*p
)
2239 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2240 FIXME("(%p)->(%p)\n", This
, p
);
2244 static HRESULT WINAPI
HTMLElement2_getClientRects(IHTMLElement2
*iface
, IHTMLRectCollection
**pRectCol
)
2246 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2247 FIXME("(%p)->(%p)\n", This
, pRectCol
);
2251 static HRESULT WINAPI
HTMLElement2_getBoundingClientRect(IHTMLElement2
*iface
, IHTMLRect
**pRect
)
2253 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2254 nsIDOMClientRect
*nsrect
;
2258 TRACE("(%p)->(%p)\n", This
, pRect
);
2260 nsres
= nsIDOMHTMLElement_GetBoundingClientRect(This
->nselem
, &nsrect
);
2261 if(NS_FAILED(nsres
) || !nsrect
) {
2262 ERR("GetBoindingClientRect failed: %08x\n", nsres
);
2266 hres
= create_html_rect(nsrect
, pRect
);
2268 nsIDOMClientRect_Release(nsrect
);
2272 static HRESULT WINAPI
HTMLElement2_setExpression(IHTMLElement2
*iface
, BSTR propname
,
2273 BSTR expression
, BSTR language
)
2275 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2276 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(propname
), debugstr_w(expression
),
2277 debugstr_w(language
));
2281 static HRESULT WINAPI
HTMLElement2_getExpression(IHTMLElement2
*iface
, BSTR propname
,
2282 VARIANT
*expression
)
2284 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2285 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), expression
);
2289 static HRESULT WINAPI
HTMLElement2_removeExpression(IHTMLElement2
*iface
, BSTR propname
,
2290 VARIANT_BOOL
*pfSuccess
)
2292 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2293 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), pfSuccess
);
2297 static HRESULT WINAPI
HTMLElement2_put_tabIndex(IHTMLElement2
*iface
, short v
)
2299 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2302 TRACE("(%p)->(%d)\n", This
, v
);
2304 nsres
= nsIDOMHTMLElement_SetTabIndex(This
->nselem
, v
);
2305 if(NS_FAILED(nsres
))
2306 ERR("GetTabIndex failed: %08x\n", nsres
);
2311 static HRESULT WINAPI
HTMLElement2_get_tabIndex(IHTMLElement2
*iface
, short *p
)
2313 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2317 TRACE("(%p)->(%p)\n", This
, p
);
2319 nsres
= nsIDOMHTMLElement_GetTabIndex(This
->nselem
, &index
);
2320 if(NS_FAILED(nsres
)) {
2321 ERR("GetTabIndex failed: %08x\n", nsres
);
2329 static HRESULT WINAPI
HTMLElement2_focus(IHTMLElement2
*iface
)
2331 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2334 TRACE("(%p)\n", This
);
2336 nsres
= nsIDOMHTMLElement_Focus(This
->nselem
);
2337 if(NS_FAILED(nsres
))
2338 ERR("Focus failed: %08x\n", nsres
);
2343 static HRESULT WINAPI
HTMLElement2_put_accessKey(IHTMLElement2
*iface
, BSTR v
)
2345 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2348 static WCHAR accessKeyW
[] = {'a','c','c','e','s','s','K','e','y',0};
2350 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2352 V_VT(&var
) = VT_BSTR
;
2354 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, accessKeyW
, var
, 0);
2357 static HRESULT WINAPI
HTMLElement2_get_accessKey(IHTMLElement2
*iface
, BSTR
*p
)
2359 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2360 FIXME("(%p)->(%p)\n", This
, p
);
2364 static HRESULT WINAPI
HTMLElement2_put_onblur(IHTMLElement2
*iface
, VARIANT v
)
2366 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2368 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2370 return set_node_event(&This
->node
, EVENTID_BLUR
, &v
);
2373 static HRESULT WINAPI
HTMLElement2_get_onblur(IHTMLElement2
*iface
, VARIANT
*p
)
2375 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2377 TRACE("(%p)->(%p)\n", This
, p
);
2379 return get_node_event(&This
->node
, EVENTID_BLUR
, p
);
2382 static HRESULT WINAPI
HTMLElement2_put_onfocus(IHTMLElement2
*iface
, VARIANT v
)
2384 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2386 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2388 return set_node_event(&This
->node
, EVENTID_FOCUS
, &v
);
2391 static HRESULT WINAPI
HTMLElement2_get_onfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2393 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2395 TRACE("(%p)->(%p)\n", This
, p
);
2397 return get_node_event(&This
->node
, EVENTID_FOCUS
, p
);
2400 static HRESULT WINAPI
HTMLElement2_put_onresize(IHTMLElement2
*iface
, VARIANT v
)
2402 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2403 FIXME("(%p)->()\n", This
);
2407 static HRESULT WINAPI
HTMLElement2_get_onresize(IHTMLElement2
*iface
, VARIANT
*p
)
2409 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2410 FIXME("(%p)->(%p)\n", This
, p
);
2414 static HRESULT WINAPI
HTMLElement2_blur(IHTMLElement2
*iface
)
2416 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2419 TRACE("(%p)\n", This
);
2421 nsres
= nsIDOMHTMLElement_Blur(This
->nselem
);
2422 if(NS_FAILED(nsres
)) {
2423 ERR("Blur failed: %08x\n", nsres
);
2430 static HRESULT WINAPI
HTMLElement2_addFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2432 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2433 FIXME("(%p)->(%p)\n", This
, pUnk
);
2437 static HRESULT WINAPI
HTMLElement2_removeFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2439 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2440 FIXME("(%p)->(%p)\n", This
, pUnk
);
2444 static HRESULT WINAPI
HTMLElement2_get_clientHeight(IHTMLElement2
*iface
, LONG
*p
)
2446 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2449 TRACE("(%p)->(%p)\n", This
, p
);
2451 nsres
= nsIDOMHTMLElement_GetClientHeight(This
->nselem
, p
);
2452 assert(nsres
== NS_OK
);
2456 static HRESULT WINAPI
HTMLElement2_get_clientWidth(IHTMLElement2
*iface
, LONG
*p
)
2458 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2461 TRACE("(%p)->(%p)\n", This
, p
);
2463 nsres
= nsIDOMHTMLElement_GetClientWidth(This
->nselem
, p
);
2464 assert(nsres
== NS_OK
);
2468 static HRESULT WINAPI
HTMLElement2_get_clientTop(IHTMLElement2
*iface
, LONG
*p
)
2470 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2473 TRACE("(%p)->(%p)\n", This
, p
);
2475 nsres
= nsIDOMHTMLElement_GetClientTop(This
->nselem
, p
);
2476 assert(nsres
== NS_OK
);
2478 TRACE("*p = %d\n", *p
);
2482 static HRESULT WINAPI
HTMLElement2_get_clientLeft(IHTMLElement2
*iface
, LONG
*p
)
2484 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2487 TRACE("(%p)->(%p)\n", This
, p
);
2489 nsres
= nsIDOMHTMLElement_GetClientLeft(This
->nselem
, p
);
2490 assert(nsres
== NS_OK
);
2492 TRACE("*p = %d\n", *p
);
2496 static HRESULT WINAPI
HTMLElement2_attachEvent(IHTMLElement2
*iface
, BSTR event
,
2497 IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
2499 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2501 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2503 return attach_event(get_node_event_target(&This
->node
), &This
->node
.doc
->basedoc
, event
, pDisp
, pfResult
);
2506 static HRESULT WINAPI
HTMLElement2_detachEvent(IHTMLElement2
*iface
, BSTR event
, IDispatch
*pDisp
)
2508 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2510 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2512 return detach_event(*get_node_event_target(&This
->node
), &This
->node
.doc
->basedoc
, event
, pDisp
);
2515 static HRESULT WINAPI
HTMLElement2_get_readyState(IHTMLElement2
*iface
, VARIANT
*p
)
2517 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2520 TRACE("(%p)->(%p)\n", This
, p
);
2522 if(This
->node
.vtbl
->get_readystate
) {
2525 hres
= This
->node
.vtbl
->get_readystate(&This
->node
, &str
);
2529 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
2531 str
= SysAllocString(completeW
);
2533 return E_OUTOFMEMORY
;
2541 static HRESULT WINAPI
HTMLElement2_put_onreadystatechange(IHTMLElement2
*iface
, VARIANT v
)
2543 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2545 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2547 return set_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, &v
);
2550 static HRESULT WINAPI
HTMLElement2_get_onreadystatechange(IHTMLElement2
*iface
, VARIANT
*p
)
2552 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2554 TRACE("(%p)->(%p)\n", This
, p
);
2556 return get_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, p
);
2559 static HRESULT WINAPI
HTMLElement2_put_onrowsdelete(IHTMLElement2
*iface
, VARIANT v
)
2561 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2562 FIXME("(%p)->()\n", This
);
2566 static HRESULT WINAPI
HTMLElement2_get_onrowsdelete(IHTMLElement2
*iface
, VARIANT
*p
)
2568 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2569 FIXME("(%p)->(%p)\n", This
, p
);
2573 static HRESULT WINAPI
HTMLElement2_put_onrowsinserted(IHTMLElement2
*iface
, VARIANT v
)
2575 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2576 FIXME("(%p)->()\n", This
);
2580 static HRESULT WINAPI
HTMLElement2_get_onrowsinserted(IHTMLElement2
*iface
, VARIANT
*p
)
2582 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2583 FIXME("(%p)->(%p)\n", This
, p
);
2587 static HRESULT WINAPI
HTMLElement2_put_oncellchange(IHTMLElement2
*iface
, VARIANT v
)
2589 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2590 FIXME("(%p)->()\n", This
);
2594 static HRESULT WINAPI
HTMLElement2_get_oncellchange(IHTMLElement2
*iface
, VARIANT
*p
)
2596 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2597 FIXME("(%p)->(%p)\n", This
, p
);
2601 static HRESULT WINAPI
HTMLElement2_put_dir(IHTMLElement2
*iface
, BSTR v
)
2603 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2607 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2610 FIXME("Unsupported for comment nodes.\n");
2614 nsAString_InitDepend(&nsstr
, v
);
2615 nsres
= nsIDOMHTMLElement_SetDir(This
->nselem
, &nsstr
);
2616 nsAString_Finish(&nsstr
);
2617 if(NS_FAILED(nsres
)) {
2618 ERR("SetDir failed: %08x\n", nsres
);
2625 static HRESULT WINAPI
HTMLElement2_get_dir(IHTMLElement2
*iface
, BSTR
*p
)
2627 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2631 TRACE("(%p)->(%p)\n", This
, p
);
2638 nsAString_Init(&dir_str
, NULL
);
2639 nsres
= nsIDOMHTMLElement_GetDir(This
->nselem
, &dir_str
);
2640 return return_nsstr(nsres
, &dir_str
, p
);
2643 static HRESULT WINAPI
HTMLElement2_createControlRange(IHTMLElement2
*iface
, IDispatch
**range
)
2645 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2646 FIXME("(%p)->(%p)\n", This
, range
);
2650 static HRESULT WINAPI
HTMLElement2_get_scrollHeight(IHTMLElement2
*iface
, LONG
*p
)
2652 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2655 TRACE("(%p)->(%p)\n", This
, p
);
2657 nsres
= nsIDOMHTMLElement_GetScrollHeight(This
->nselem
, p
);
2658 assert(nsres
== NS_OK
);
2660 TRACE("*p = %d\n", *p
);
2664 static HRESULT WINAPI
HTMLElement2_get_scrollWidth(IHTMLElement2
*iface
, LONG
*p
)
2666 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2669 TRACE("(%p)->(%p)\n", This
, p
);
2671 nsres
= nsIDOMHTMLElement_GetScrollWidth(This
->nselem
, p
);
2672 assert(nsres
== NS_OK
);
2674 TRACE("*p = %d\n", *p
);
2678 static HRESULT WINAPI
HTMLElement2_put_scrollTop(IHTMLElement2
*iface
, LONG v
)
2680 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2682 TRACE("(%p)->(%d)\n", This
, v
);
2685 FIXME("NULL nselem\n");
2689 nsIDOMHTMLElement_SetScrollTop(This
->nselem
, v
);
2693 static HRESULT WINAPI
HTMLElement2_get_scrollTop(IHTMLElement2
*iface
, LONG
*p
)
2695 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2698 TRACE("(%p)->(%p)\n", This
, p
);
2700 nsres
= nsIDOMHTMLElement_GetScrollTop(This
->nselem
, p
);
2701 assert(nsres
== NS_OK
);
2703 TRACE("*p = %d\n", *p
);
2707 static HRESULT WINAPI
HTMLElement2_put_scrollLeft(IHTMLElement2
*iface
, LONG v
)
2709 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2711 TRACE("(%p)->(%d)\n", This
, v
);
2714 FIXME("NULL nselem\n");
2718 nsIDOMHTMLElement_SetScrollLeft(This
->nselem
, v
);
2722 static HRESULT WINAPI
HTMLElement2_get_scrollLeft(IHTMLElement2
*iface
, LONG
*p
)
2724 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2727 TRACE("(%p)->(%p)\n", This
, p
);
2730 return E_INVALIDARG
;
2734 FIXME("NULL nselem\n");
2738 nsres
= nsIDOMHTMLElement_GetScrollLeft(This
->nselem
, p
);
2739 assert(nsres
== NS_OK
);
2741 TRACE("*p = %d\n", *p
);
2745 static HRESULT WINAPI
HTMLElement2_clearAttributes(IHTMLElement2
*iface
)
2747 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2748 FIXME("(%p)\n", This
);
2752 static HRESULT WINAPI
HTMLElement2_mergeAttributes(IHTMLElement2
*iface
, IHTMLElement
*mergeThis
)
2754 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2755 FIXME("(%p)->(%p)\n", This
, mergeThis
);
2759 static HRESULT WINAPI
HTMLElement2_put_oncontextmenu(IHTMLElement2
*iface
, VARIANT v
)
2761 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2762 FIXME("(%p)->()\n", This
);
2766 static HRESULT WINAPI
HTMLElement2_get_oncontextmenu(IHTMLElement2
*iface
, VARIANT
*p
)
2768 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2769 FIXME("(%p)->(%p)\n", This
, p
);
2773 static HRESULT WINAPI
HTMLElement2_insertAdjacentElement(IHTMLElement2
*iface
, BSTR where
,
2774 IHTMLElement
*insertedElement
, IHTMLElement
**inserted
)
2776 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2777 HTMLDOMNode
*ret_node
;
2781 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(where
), insertedElement
, inserted
);
2783 elem
= unsafe_impl_from_IHTMLElement(insertedElement
);
2785 return E_INVALIDARG
;
2787 hres
= insert_adjacent_node(This
, where
, elem
->node
.nsnode
, &ret_node
);
2791 hres
= IHTMLDOMNode_QueryInterface(&ret_node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)inserted
);
2792 IHTMLDOMNode_Release(&ret_node
->IHTMLDOMNode_iface
);
2796 static HRESULT WINAPI
HTMLElement2_applyElement(IHTMLElement2
*iface
, IHTMLElement
*apply
,
2797 BSTR where
, IHTMLElement
**applied
)
2799 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2800 FIXME("(%p)->(%p %s %p)\n", This
, apply
, debugstr_w(where
), applied
);
2804 static HRESULT WINAPI
HTMLElement2_getAdjacentText(IHTMLElement2
*iface
, BSTR where
, BSTR
*text
)
2806 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2807 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(where
), text
);
2811 static HRESULT WINAPI
HTMLElement2_replaceAdjacentText(IHTMLElement2
*iface
, BSTR where
,
2812 BSTR newText
, BSTR
*oldText
)
2814 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2815 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(where
), debugstr_w(newText
), oldText
);
2819 static HRESULT WINAPI
HTMLElement2_get_canHandleChildren(IHTMLElement2
*iface
, VARIANT_BOOL
*p
)
2821 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2822 FIXME("(%p)->(%p)\n", This
, p
);
2826 static HRESULT WINAPI
HTMLElement2_addBehavior(IHTMLElement2
*iface
, BSTR bstrUrl
,
2827 VARIANT
*pvarFactory
, LONG
*pCookie
)
2829 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2830 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrUrl
), pvarFactory
, pCookie
);
2834 static HRESULT WINAPI
HTMLElement2_removeBehavior(IHTMLElement2
*iface
, LONG cookie
,
2835 VARIANT_BOOL
*pfResult
)
2837 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2838 FIXME("(%p)->(%d %p)\n", This
, cookie
, pfResult
);
2842 static HRESULT WINAPI
HTMLElement2_get_runtimeStyle(IHTMLElement2
*iface
, IHTMLStyle
**p
)
2844 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2846 FIXME("(%p)->(%p): hack\n", This
, p
);
2848 /* We can't implement correct behavior on top of Gecko (although we could
2849 try a bit harder). Making runtimeStyle behave like regular style is
2850 enough for most use cases. */
2851 if(!This
->runtime_style
) {
2854 hres
= HTMLStyle_Create(This
, &This
->runtime_style
);
2859 *p
= &This
->runtime_style
->IHTMLStyle_iface
;
2860 IHTMLStyle_AddRef(*p
);
2864 static HRESULT WINAPI
HTMLElement2_get_behaviorUrns(IHTMLElement2
*iface
, IDispatch
**p
)
2866 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2867 FIXME("(%p)->(%p)\n", This
, p
);
2871 static HRESULT WINAPI
HTMLElement2_put_tagUrn(IHTMLElement2
*iface
, BSTR v
)
2873 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2874 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2878 static HRESULT WINAPI
HTMLElement2_get_tagUrn(IHTMLElement2
*iface
, BSTR
*p
)
2880 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2881 FIXME("(%p)->(%p)\n", This
, p
);
2885 static HRESULT WINAPI
HTMLElement2_put_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT vv
)
2887 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2888 FIXME("(%p)->()\n", This
);
2892 static HRESULT WINAPI
HTMLElement2_get_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2894 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2895 FIXME("(%p)->(%p)\n", This
, p
);
2899 static HRESULT WINAPI
HTMLElement2_get_readyStateValue(IHTMLElement2
*iface
, LONG
*p
)
2901 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2902 FIXME("(%p)->(%p)\n", This
, p
);
2906 static HRESULT WINAPI
HTMLElement2_getElementsByTagName(IHTMLElement2
*iface
, BSTR v
,
2907 IHTMLElementCollection
**pelColl
)
2909 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2910 nsIDOMHTMLCollection
*nscol
;
2914 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2916 nsAString_InitDepend(&tag_str
, v
);
2917 nsres
= nsIDOMHTMLElement_GetElementsByTagName(This
->nselem
, &tag_str
, &nscol
);
2918 nsAString_Finish(&tag_str
);
2919 if(NS_FAILED(nsres
)) {
2920 ERR("GetElementByTagName failed: %08x\n", nsres
);
2924 *pelColl
= create_collection_from_htmlcol(This
->node
.doc
, nscol
);
2925 nsIDOMHTMLCollection_Release(nscol
);
2929 static const IHTMLElement2Vtbl HTMLElement2Vtbl
= {
2930 HTMLElement2_QueryInterface
,
2931 HTMLElement2_AddRef
,
2932 HTMLElement2_Release
,
2933 HTMLElement2_GetTypeInfoCount
,
2934 HTMLElement2_GetTypeInfo
,
2935 HTMLElement2_GetIDsOfNames
,
2936 HTMLElement2_Invoke
,
2937 HTMLElement2_get_scopeName
,
2938 HTMLElement2_setCapture
,
2939 HTMLElement2_releaseCapture
,
2940 HTMLElement2_put_onlosecapture
,
2941 HTMLElement2_get_onlosecapture
,
2942 HTMLElement2_componentFromPoint
,
2943 HTMLElement2_doScroll
,
2944 HTMLElement2_put_onscroll
,
2945 HTMLElement2_get_onscroll
,
2946 HTMLElement2_put_ondrag
,
2947 HTMLElement2_get_ondrag
,
2948 HTMLElement2_put_ondragend
,
2949 HTMLElement2_get_ondragend
,
2950 HTMLElement2_put_ondragenter
,
2951 HTMLElement2_get_ondragenter
,
2952 HTMLElement2_put_ondragover
,
2953 HTMLElement2_get_ondragover
,
2954 HTMLElement2_put_ondragleave
,
2955 HTMLElement2_get_ondragleave
,
2956 HTMLElement2_put_ondrop
,
2957 HTMLElement2_get_ondrop
,
2958 HTMLElement2_put_onbeforecut
,
2959 HTMLElement2_get_onbeforecut
,
2960 HTMLElement2_put_oncut
,
2961 HTMLElement2_get_oncut
,
2962 HTMLElement2_put_onbeforecopy
,
2963 HTMLElement2_get_onbeforecopy
,
2964 HTMLElement2_put_oncopy
,
2965 HTMLElement2_get_oncopy
,
2966 HTMLElement2_put_onbeforepaste
,
2967 HTMLElement2_get_onbeforepaste
,
2968 HTMLElement2_put_onpaste
,
2969 HTMLElement2_get_onpaste
,
2970 HTMLElement2_get_currentStyle
,
2971 HTMLElement2_put_onpropertychange
,
2972 HTMLElement2_get_onpropertychange
,
2973 HTMLElement2_getClientRects
,
2974 HTMLElement2_getBoundingClientRect
,
2975 HTMLElement2_setExpression
,
2976 HTMLElement2_getExpression
,
2977 HTMLElement2_removeExpression
,
2978 HTMLElement2_put_tabIndex
,
2979 HTMLElement2_get_tabIndex
,
2981 HTMLElement2_put_accessKey
,
2982 HTMLElement2_get_accessKey
,
2983 HTMLElement2_put_onblur
,
2984 HTMLElement2_get_onblur
,
2985 HTMLElement2_put_onfocus
,
2986 HTMLElement2_get_onfocus
,
2987 HTMLElement2_put_onresize
,
2988 HTMLElement2_get_onresize
,
2990 HTMLElement2_addFilter
,
2991 HTMLElement2_removeFilter
,
2992 HTMLElement2_get_clientHeight
,
2993 HTMLElement2_get_clientWidth
,
2994 HTMLElement2_get_clientTop
,
2995 HTMLElement2_get_clientLeft
,
2996 HTMLElement2_attachEvent
,
2997 HTMLElement2_detachEvent
,
2998 HTMLElement2_get_readyState
,
2999 HTMLElement2_put_onreadystatechange
,
3000 HTMLElement2_get_onreadystatechange
,
3001 HTMLElement2_put_onrowsdelete
,
3002 HTMLElement2_get_onrowsdelete
,
3003 HTMLElement2_put_onrowsinserted
,
3004 HTMLElement2_get_onrowsinserted
,
3005 HTMLElement2_put_oncellchange
,
3006 HTMLElement2_get_oncellchange
,
3007 HTMLElement2_put_dir
,
3008 HTMLElement2_get_dir
,
3009 HTMLElement2_createControlRange
,
3010 HTMLElement2_get_scrollHeight
,
3011 HTMLElement2_get_scrollWidth
,
3012 HTMLElement2_put_scrollTop
,
3013 HTMLElement2_get_scrollTop
,
3014 HTMLElement2_put_scrollLeft
,
3015 HTMLElement2_get_scrollLeft
,
3016 HTMLElement2_clearAttributes
,
3017 HTMLElement2_mergeAttributes
,
3018 HTMLElement2_put_oncontextmenu
,
3019 HTMLElement2_get_oncontextmenu
,
3020 HTMLElement2_insertAdjacentElement
,
3021 HTMLElement2_applyElement
,
3022 HTMLElement2_getAdjacentText
,
3023 HTMLElement2_replaceAdjacentText
,
3024 HTMLElement2_get_canHandleChildren
,
3025 HTMLElement2_addBehavior
,
3026 HTMLElement2_removeBehavior
,
3027 HTMLElement2_get_runtimeStyle
,
3028 HTMLElement2_get_behaviorUrns
,
3029 HTMLElement2_put_tagUrn
,
3030 HTMLElement2_get_tagUrn
,
3031 HTMLElement2_put_onbeforeeditfocus
,
3032 HTMLElement2_get_onbeforeeditfocus
,
3033 HTMLElement2_get_readyStateValue
,
3034 HTMLElement2_getElementsByTagName
,
3037 static inline HTMLElement
*impl_from_IHTMLElement3(IHTMLElement3
*iface
)
3039 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement3_iface
);
3042 static HRESULT WINAPI
HTMLElement3_QueryInterface(IHTMLElement3
*iface
,
3043 REFIID riid
, void **ppv
)
3045 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3046 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3049 static ULONG WINAPI
HTMLElement3_AddRef(IHTMLElement3
*iface
)
3051 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3052 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3055 static ULONG WINAPI
HTMLElement3_Release(IHTMLElement3
*iface
)
3057 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3058 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3061 static HRESULT WINAPI
HTMLElement3_GetTypeInfoCount(IHTMLElement3
*iface
, UINT
*pctinfo
)
3063 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3064 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
3067 static HRESULT WINAPI
HTMLElement3_GetTypeInfo(IHTMLElement3
*iface
, UINT iTInfo
,
3068 LCID lcid
, ITypeInfo
**ppTInfo
)
3070 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3071 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3074 static HRESULT WINAPI
HTMLElement3_GetIDsOfNames(IHTMLElement3
*iface
, REFIID riid
,
3075 LPOLESTR
*rgszNames
, UINT cNames
,
3076 LCID lcid
, DISPID
*rgDispId
)
3078 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3079 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3083 static HRESULT WINAPI
HTMLElement3_Invoke(IHTMLElement3
*iface
, DISPID dispIdMember
,
3084 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3085 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3087 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3088 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3089 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3092 static HRESULT WINAPI
HTMLElement3_mergeAttributes(IHTMLElement3
*iface
, IHTMLElement
*mergeThis
, VARIANT
*pvarFlags
)
3094 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3095 FIXME("(%p)->(%p %p)\n", This
, mergeThis
, pvarFlags
);
3099 static HRESULT WINAPI
HTMLElement3_get_isMultiLine(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3101 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3102 FIXME("(%p)->(%p)\n", This
, p
);
3106 static HRESULT WINAPI
HTMLElement3_get_canHaveHTML(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3108 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3109 FIXME("(%p)->(%p)\n", This
, p
);
3113 static HRESULT WINAPI
HTMLElement3_put_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT v
)
3115 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3116 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3120 static HRESULT WINAPI
HTMLElement3_get_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT
*p
)
3122 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3123 FIXME("(%p)->(%p)\n", This
, p
);
3127 static HRESULT WINAPI
HTMLElement3_put_onpage(IHTMLElement3
*iface
, VARIANT v
)
3129 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3130 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3134 static HRESULT WINAPI
HTMLElement3_get_onpage(IHTMLElement3
*iface
, VARIANT
*p
)
3136 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3137 FIXME("(%p)->(%p)\n", This
, p
);
3141 static HRESULT WINAPI
HTMLElement3_put_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3143 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3144 FIXME("(%p)->(%x)\n", This
, v
);
3148 static HRESULT WINAPI
HTMLElement3_get_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3150 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3151 FIXME("(%p)->(%p)\n", This
, p
);
3155 static HRESULT WINAPI
HTMLElement3_put_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT v
)
3157 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3158 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3162 static HRESULT WINAPI
HTMLElement3_get_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3164 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3165 FIXME("(%p)->(%p)\n", This
, p
);
3169 static HRESULT WINAPI
HTMLElement3_setActive(IHTMLElement3
*iface
)
3171 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3172 FIXME("(%p)\n", This
);
3176 static HRESULT WINAPI
HTMLElement3_put_contentEditable(IHTMLElement3
*iface
, BSTR v
)
3178 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3182 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3184 nsAString_InitDepend(&str
, v
);
3185 nsres
= nsIDOMHTMLElement_SetContentEditable(This
->nselem
, &str
);
3186 nsAString_Finish(&str
);
3188 if (NS_FAILED(nsres
)){
3189 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v
));
3196 static HRESULT WINAPI
HTMLElement3_get_contentEditable(IHTMLElement3
*iface
, BSTR
*p
)
3198 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3202 TRACE("(%p)->(%p)\n", This
, p
);
3204 nsAString_Init(&str
, NULL
);
3205 nsres
= nsIDOMHTMLElement_GetContentEditable(This
->nselem
, &str
);
3206 return return_nsstr(nsres
, &str
, p
);
3209 static HRESULT WINAPI
HTMLElement3_get_isContentEditable(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3211 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3212 FIXME("(%p)->(%p)\n", This
, p
);
3216 static HRESULT WINAPI
HTMLElement3_put_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3218 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3219 FIXME("(%p)->(%x)\n", This
, v
);
3223 static HRESULT WINAPI
HTMLElement3_get_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3225 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3226 FIXME("(%p)->(%p)\n", This
, p
);
3230 static const WCHAR disabledW
[] = {'d','i','s','a','b','l','e','d',0};
3232 static HRESULT WINAPI
HTMLElement3_put_disabled(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3234 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3238 TRACE("(%p)->(%x)\n", This
, v
);
3240 if(This
->node
.vtbl
->put_disabled
)
3241 return This
->node
.vtbl
->put_disabled(&This
->node
, v
);
3243 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, disabledW
, TRUE
, &var
);
3248 V_VT(var
) = VT_BOOL
;
3253 static HRESULT WINAPI
HTMLElement3_get_disabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3255 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3259 TRACE("(%p)->(%p)\n", This
, p
);
3261 if(This
->node
.vtbl
->get_disabled
)
3262 return This
->node
.vtbl
->get_disabled(&This
->node
, p
);
3264 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, disabledW
, FALSE
, &var
);
3265 if(hres
== DISP_E_UNKNOWNNAME
) {
3272 if(V_VT(var
) != VT_BOOL
) {
3273 FIXME("value is %s\n", debugstr_variant(var
));
3281 static HRESULT WINAPI
HTMLElement3_get_isDisabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3283 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3284 FIXME("(%p)->(%p)\n", This
, p
);
3288 static HRESULT WINAPI
HTMLElement3_put_onmove(IHTMLElement3
*iface
, VARIANT v
)
3290 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3291 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3295 static HRESULT WINAPI
HTMLElement3_get_onmove(IHTMLElement3
*iface
, VARIANT
*p
)
3297 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3298 FIXME("(%p)->(%p)\n", This
, p
);
3302 static HRESULT WINAPI
HTMLElement3_put_oncontrolselect(IHTMLElement3
*iface
, VARIANT v
)
3304 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3305 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3309 static HRESULT WINAPI
HTMLElement3_get_oncontrolselect(IHTMLElement3
*iface
, VARIANT
*p
)
3311 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3312 FIXME("(%p)->(%p)\n", This
, p
);
3316 static HRESULT WINAPI
HTMLElement3_fireEvent(IHTMLElement3
*iface
, BSTR bstrEventName
,
3317 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCancelled
)
3319 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3321 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrEventName
), debugstr_variant(pvarEventObject
),
3324 return dispatch_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCancelled
);
3327 static HRESULT WINAPI
HTMLElement3_put_onresizestart(IHTMLElement3
*iface
, VARIANT v
)
3329 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3330 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3334 static HRESULT WINAPI
HTMLElement3_get_onresizestart(IHTMLElement3
*iface
, VARIANT
*p
)
3336 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3337 FIXME("(%p)->(%p)\n", This
, p
);
3341 static HRESULT WINAPI
HTMLElement3_put_onresizeend(IHTMLElement3
*iface
, VARIANT v
)
3343 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3344 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3348 static HRESULT WINAPI
HTMLElement3_get_onresizeend(IHTMLElement3
*iface
, VARIANT
*p
)
3350 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3351 FIXME("(%p)->(%p)\n", This
, p
);
3355 static HRESULT WINAPI
HTMLElement3_put_onmovestart(IHTMLElement3
*iface
, VARIANT v
)
3357 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3358 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3362 static HRESULT WINAPI
HTMLElement3_get_onmovestart(IHTMLElement3
*iface
, VARIANT
*p
)
3364 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3365 FIXME("(%p)->(%p)\n", This
, p
);
3369 static HRESULT WINAPI
HTMLElement3_put_onmoveend(IHTMLElement3
*iface
, VARIANT v
)
3371 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3372 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3376 static HRESULT WINAPI
HTMLElement3_get_onmoveend(IHTMLElement3
*iface
, VARIANT
*p
)
3378 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3379 FIXME("(%p)->(%p)\n", This
, p
);
3383 static HRESULT WINAPI
HTMLElement3_put_onmousecenter(IHTMLElement3
*iface
, VARIANT v
)
3385 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3386 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3390 static HRESULT WINAPI
HTMLElement3_get_onmousecenter(IHTMLElement3
*iface
, VARIANT
*p
)
3392 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3393 FIXME("(%p)->(%p)\n", This
, p
);
3397 static HRESULT WINAPI
HTMLElement3_put_onmouseleave(IHTMLElement3
*iface
, VARIANT v
)
3399 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3400 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3404 static HRESULT WINAPI
HTMLElement3_get_onmouseleave(IHTMLElement3
*iface
, VARIANT
*p
)
3406 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3407 FIXME("(%p)->(%p)\n", This
, p
);
3411 static HRESULT WINAPI
HTMLElement3_put_onactivate(IHTMLElement3
*iface
, VARIANT v
)
3413 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3414 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3418 static HRESULT WINAPI
HTMLElement3_get_onactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3420 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3421 FIXME("(%p)->(%p)\n", This
, p
);
3425 static HRESULT WINAPI
HTMLElement3_put_ondeactivate(IHTMLElement3
*iface
, VARIANT v
)
3427 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3428 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3432 static HRESULT WINAPI
HTMLElement3_get_ondeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3434 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3435 FIXME("(%p)->(%p)\n", This
, p
);
3439 static HRESULT WINAPI
HTMLElement3_dragDrop(IHTMLElement3
*iface
, VARIANT_BOOL
*pfRet
)
3441 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3442 FIXME("(%p)->(%p)\n", This
, pfRet
);
3446 static HRESULT WINAPI
HTMLElement3_get_glyphMode(IHTMLElement3
*iface
, LONG
*p
)
3448 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3449 FIXME("(%p)->(%p)\n", This
, p
);
3453 static const IHTMLElement3Vtbl HTMLElement3Vtbl
= {
3454 HTMLElement3_QueryInterface
,
3455 HTMLElement3_AddRef
,
3456 HTMLElement3_Release
,
3457 HTMLElement3_GetTypeInfoCount
,
3458 HTMLElement3_GetTypeInfo
,
3459 HTMLElement3_GetIDsOfNames
,
3460 HTMLElement3_Invoke
,
3461 HTMLElement3_mergeAttributes
,
3462 HTMLElement3_get_isMultiLine
,
3463 HTMLElement3_get_canHaveHTML
,
3464 HTMLElement3_put_onlayoutcomplete
,
3465 HTMLElement3_get_onlayoutcomplete
,
3466 HTMLElement3_put_onpage
,
3467 HTMLElement3_get_onpage
,
3468 HTMLElement3_put_inflateBlock
,
3469 HTMLElement3_get_inflateBlock
,
3470 HTMLElement3_put_onbeforedeactivate
,
3471 HTMLElement3_get_onbeforedeactivate
,
3472 HTMLElement3_setActive
,
3473 HTMLElement3_put_contentEditable
,
3474 HTMLElement3_get_contentEditable
,
3475 HTMLElement3_get_isContentEditable
,
3476 HTMLElement3_put_hideFocus
,
3477 HTMLElement3_get_hideFocus
,
3478 HTMLElement3_put_disabled
,
3479 HTMLElement3_get_disabled
,
3480 HTMLElement3_get_isDisabled
,
3481 HTMLElement3_put_onmove
,
3482 HTMLElement3_get_onmove
,
3483 HTMLElement3_put_oncontrolselect
,
3484 HTMLElement3_get_oncontrolselect
,
3485 HTMLElement3_fireEvent
,
3486 HTMLElement3_put_onresizestart
,
3487 HTMLElement3_get_onresizestart
,
3488 HTMLElement3_put_onresizeend
,
3489 HTMLElement3_get_onresizeend
,
3490 HTMLElement3_put_onmovestart
,
3491 HTMLElement3_get_onmovestart
,
3492 HTMLElement3_put_onmoveend
,
3493 HTMLElement3_get_onmoveend
,
3494 HTMLElement3_put_onmousecenter
,
3495 HTMLElement3_get_onmousecenter
,
3496 HTMLElement3_put_onmouseleave
,
3497 HTMLElement3_get_onmouseleave
,
3498 HTMLElement3_put_onactivate
,
3499 HTMLElement3_get_onactivate
,
3500 HTMLElement3_put_ondeactivate
,
3501 HTMLElement3_get_ondeactivate
,
3502 HTMLElement3_dragDrop
,
3503 HTMLElement3_get_glyphMode
3506 static inline HTMLElement
*impl_from_IHTMLElement4(IHTMLElement4
*iface
)
3508 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement4_iface
);
3511 static HRESULT WINAPI
HTMLElement4_QueryInterface(IHTMLElement4
*iface
,
3512 REFIID riid
, void **ppv
)
3514 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3515 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3518 static ULONG WINAPI
HTMLElement4_AddRef(IHTMLElement4
*iface
)
3520 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3521 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3524 static ULONG WINAPI
HTMLElement4_Release(IHTMLElement4
*iface
)
3526 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3527 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3530 static HRESULT WINAPI
HTMLElement4_GetTypeInfoCount(IHTMLElement4
*iface
, UINT
*pctinfo
)
3532 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3533 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
3536 static HRESULT WINAPI
HTMLElement4_GetTypeInfo(IHTMLElement4
*iface
, UINT iTInfo
,
3537 LCID lcid
, ITypeInfo
**ppTInfo
)
3539 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3540 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3543 static HRESULT WINAPI
HTMLElement4_GetIDsOfNames(IHTMLElement4
*iface
, REFIID riid
,
3544 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3546 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3547 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3551 static HRESULT WINAPI
HTMLElement4_Invoke(IHTMLElement4
*iface
, DISPID dispIdMember
, REFIID riid
,
3552 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3554 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3555 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3556 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3559 static HRESULT WINAPI
HTMLElement4_put_onmousewheel(IHTMLElement4
*iface
, VARIANT v
)
3561 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3563 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3565 return set_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, &v
);
3568 static HRESULT WINAPI
HTMLElement4_get_onmousewheel(IHTMLElement4
*iface
, VARIANT
*p
)
3570 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3572 TRACE("(%p)->(%p)\n", This
, p
);
3574 return get_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, p
);
3577 static HRESULT WINAPI
HTMLElement4_normalize(IHTMLElement4
*iface
)
3579 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3580 FIXME("(%p)\n", This
);
3584 static HRESULT WINAPI
HTMLElement4_getAttributeNode(IHTMLElement4
*iface
, BSTR bstrname
, IHTMLDOMAttribute
**ppAttribute
)
3586 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3587 HTMLAttributeCollection
*attrs
;
3590 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrname
), ppAttribute
);
3592 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
3596 hres
= IHTMLAttributeCollection2_getNamedItem(&attrs
->IHTMLAttributeCollection2_iface
, bstrname
, ppAttribute
);
3597 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
3601 static HRESULT WINAPI
HTMLElement4_setAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3602 IHTMLDOMAttribute
**ppretAttribute
)
3604 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3605 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3609 static HRESULT WINAPI
HTMLElement4_removeAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3610 IHTMLDOMAttribute
**ppretAttribute
)
3612 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3613 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3617 static HRESULT WINAPI
HTMLElement4_put_onbeforeactivate(IHTMLElement4
*iface
, VARIANT v
)
3619 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3620 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3624 static HRESULT WINAPI
HTMLElement4_get_onbeforeactivate(IHTMLElement4
*iface
, VARIANT
*p
)
3626 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3627 FIXME("(%p)->(%p)\n", This
, p
);
3631 static HRESULT WINAPI
HTMLElement4_put_onfocusin(IHTMLElement4
*iface
, VARIANT v
)
3633 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3634 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3638 static HRESULT WINAPI
HTMLElement4_get_onfocusin(IHTMLElement4
*iface
, VARIANT
*p
)
3640 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3641 FIXME("(%p)->(%p)\n", This
, p
);
3645 static HRESULT WINAPI
HTMLElement4_put_onfocusout(IHTMLElement4
*iface
, VARIANT v
)
3647 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3648 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3652 static HRESULT WINAPI
HTMLElement4_get_onfocusout(IHTMLElement4
*iface
, VARIANT
*p
)
3654 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3655 FIXME("(%p)->(%p)\n", This
, p
);
3659 static const IHTMLElement4Vtbl HTMLElement4Vtbl
= {
3660 HTMLElement4_QueryInterface
,
3661 HTMLElement4_AddRef
,
3662 HTMLElement4_Release
,
3663 HTMLElement4_GetTypeInfoCount
,
3664 HTMLElement4_GetTypeInfo
,
3665 HTMLElement4_GetIDsOfNames
,
3666 HTMLElement4_Invoke
,
3667 HTMLElement4_put_onmousewheel
,
3668 HTMLElement4_get_onmousewheel
,
3669 HTMLElement4_normalize
,
3670 HTMLElement4_getAttributeNode
,
3671 HTMLElement4_setAttributeNode
,
3672 HTMLElement4_removeAttributeNode
,
3673 HTMLElement4_put_onbeforeactivate
,
3674 HTMLElement4_get_onbeforeactivate
,
3675 HTMLElement4_put_onfocusin
,
3676 HTMLElement4_get_onfocusin
,
3677 HTMLElement4_put_onfocusout
,
3678 HTMLElement4_get_onfocusout
3681 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
3683 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
3686 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
3688 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3690 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
3691 *ppv
= &This
->IHTMLElement_iface
;
3692 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
3693 *ppv
= &This
->IHTMLElement_iface
;
3694 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
3695 *ppv
= &This
->IHTMLElement_iface
;
3696 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
3697 *ppv
= &This
->IHTMLElement2_iface
;
3698 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
3699 *ppv
= &This
->IHTMLElement3_iface
;
3700 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
3701 *ppv
= &This
->IHTMLElement4_iface
;
3702 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
3703 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
3705 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
3708 IUnknown_AddRef((IUnknown
*)*ppv
);
3712 void HTMLElement_destructor(HTMLDOMNode
*iface
)
3714 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3716 ConnectionPointContainer_Destroy(&This
->cp_container
);
3719 This
->style
->elem
= NULL
;
3720 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
3722 if(This
->runtime_style
) {
3723 This
->runtime_style
->elem
= NULL
;
3724 IHTMLStyle_Release(&This
->runtime_style
->IHTMLStyle_iface
);
3727 HTMLDOMAttribute
*attr
;
3729 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
3732 This
->attrs
->elem
= NULL
;
3733 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
3736 heap_free(This
->filter
);
3738 HTMLDOMNode_destructor(&This
->node
);
3741 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
3743 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3744 HTMLElement
*new_elem
;
3747 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
3752 new_elem
->filter
= heap_strdupW(This
->filter
);
3753 if(!new_elem
->filter
) {
3754 IHTMLElement_Release(&This
->IHTMLElement_iface
);
3755 return E_OUTOFMEMORY
;
3759 *ret
= &new_elem
->node
;
3763 HRESULT
HTMLElement_handle_event(HTMLDOMNode
*iface
, DWORD eid
, nsIDOMEvent
*event
, BOOL
*prevent_default
)
3765 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3768 case EVENTID_KEYDOWN
: {
3769 nsIDOMKeyEvent
*key_event
;
3772 nsres
= nsIDOMEvent_QueryInterface(event
, &IID_nsIDOMKeyEvent
, (void**)&key_event
);
3773 if(NS_SUCCEEDED(nsres
)) {
3776 nsIDOMKeyEvent_GetKeyCode(key_event
, &code
);
3779 case VK_F1
: /* DOM_VK_F1 */
3780 TRACE("F1 pressed\n");
3781 fire_event(This
->node
.doc
, EVENTID_HELP
, TRUE
, This
->node
.nsnode
, NULL
, NULL
);
3782 *prevent_default
= TRUE
;
3785 nsIDOMKeyEvent_Release(key_event
);
3793 cp_static_data_t HTMLElementEvents2_data
= { HTMLElementEvents2_tid
, NULL
/* FIXME */, TRUE
};
3795 const cpc_entry_t HTMLElement_cpc
[] = {
3800 static const NodeImplVtbl HTMLElementImplVtbl
= {
3802 HTMLElement_destructor
,
3805 HTMLElement_handle_event
,
3806 HTMLElement_get_attr_col
3809 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
3811 return CONTAINING_RECORD(iface
, HTMLElement
, node
.dispex
);
3814 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
3815 DWORD grfdex
, DISPID
*pid
)
3817 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3819 if(This
->node
.vtbl
->get_dispid
)
3820 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
3822 return DISP_E_UNKNOWNNAME
;
3825 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
3826 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
3827 IServiceProvider
*caller
)
3829 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3831 if(This
->node
.vtbl
->invoke
)
3832 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
3833 params
, res
, ei
, caller
);
3835 ERR("(%p): element has no invoke method\n", This
);
3839 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
3841 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3842 nsIDOMMozNamedAttrMap
*attrs
;
3845 const PRUnichar
*str
;
3857 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
3858 if(NS_FAILED(nsres
))
3861 nsres
= nsIDOMMozNamedAttrMap_GetLength(attrs
, &len
);
3862 if(NS_FAILED(nsres
)) {
3863 nsIDOMMozNamedAttrMap_Release(attrs
);
3867 nsAString_Init(&nsstr
, NULL
);
3868 for(i
=0; i
<len
; i
++) {
3869 nsres
= nsIDOMMozNamedAttrMap_Item(attrs
, i
, &attr
);
3870 if(NS_FAILED(nsres
))
3873 nsres
= nsIDOMAttr_GetNodeName(attr
, &nsstr
);
3874 if(NS_FAILED(nsres
)) {
3875 nsIDOMAttr_Release(attr
);
3879 nsAString_GetData(&nsstr
, &str
);
3880 name
= SysAllocString(str
);
3882 nsIDOMAttr_Release(attr
);
3886 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
3887 if(hres
!= DISP_E_UNKNOWNNAME
) {
3888 nsIDOMAttr_Release(attr
);
3889 SysFreeString(name
);
3893 nsres
= nsIDOMAttr_GetNodeValue(attr
, &nsstr
);
3894 nsIDOMAttr_Release(attr
);
3895 if(NS_FAILED(nsres
)) {
3896 SysFreeString(name
);
3900 nsAString_GetData(&nsstr
, &str
);
3901 V_VT(&value
) = VT_BSTR
;
3903 V_BSTR(&value
) = SysAllocString(str
);
3904 if(!V_BSTR(&value
)) {
3905 SysFreeString(name
);
3909 V_BSTR(&value
) = NULL
;
3911 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
3912 SysFreeString(name
);
3913 VariantClear(&value
);
3915 nsAString_Finish(&nsstr
);
3917 nsIDOMMozNamedAttrMap_Release(attrs
);
3921 static const tid_t HTMLElement_iface_tids
[] = {
3926 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
3928 HTMLElement_get_dispid
,
3930 HTMLElement_populate_props
3933 static dispex_static_data_t HTMLElement_dispex
= {
3934 &HTMLElement_dispex_vtbl
,
3935 DispHTMLUnknownElement_tid
,
3937 HTMLElement_iface_tids
3940 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
3942 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
3943 This
->IHTMLElement2_iface
.lpVtbl
= &HTMLElement2Vtbl
;
3944 This
->IHTMLElement3_iface
.lpVtbl
= &HTMLElement3Vtbl
;
3945 This
->IHTMLElement4_iface
.lpVtbl
= &HTMLElement4Vtbl
;
3947 if(dispex_data
&& !dispex_data
->vtbl
)
3948 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
3949 init_dispex(&This
->node
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
3950 dispex_data
? dispex_data
: &HTMLElement_dispex
);
3953 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
3955 /* No AddRef, share reference with HTMLDOMNode */
3956 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
3957 This
->nselem
= nselem
;
3960 This
->node
.cp_container
= &This
->cp_container
;
3961 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
, This
->node
.vtbl
->cpc_entries
);
3964 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
3966 nsIDOMHTMLElement
*nselem
;
3967 nsAString class_name_str
;
3968 const PRUnichar
*class_name
;
3969 const tag_desc_t
*tag
;
3974 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
3975 if(NS_FAILED(nsres
))
3978 nsAString_Init(&class_name_str
, NULL
);
3979 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
3981 nsAString_GetData(&class_name_str
, &class_name
);
3983 tag
= get_tag_desc(class_name
);
3985 hres
= tag
->constructor(doc
, nselem
, &elem
);
3986 }else if(use_generic
) {
3987 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
3989 elem
= heap_alloc_zero(sizeof(HTMLElement
));
3991 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
3992 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
3995 hres
= E_OUTOFMEMORY
;
3999 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
4001 nsIDOMHTMLElement_Release(nselem
);
4002 nsAString_Finish(&class_name_str
);
4010 HRESULT
get_elem(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**ret
)
4015 hres
= get_node(doc
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
4019 *ret
= impl_from_HTMLDOMNode(node
);
4023 /* interface IHTMLFiltersCollection */
4024 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
4026 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4028 TRACE("%p %s %p\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4030 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4031 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4032 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
4033 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
4034 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4035 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4036 return *ppv
? S_OK
: E_NOINTERFACE
;
4039 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4040 return E_NOINTERFACE
;
4043 IUnknown_AddRef((IUnknown
*)*ppv
);
4047 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
4049 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4050 LONG ref
= InterlockedIncrement(&This
->ref
);
4052 TRACE("(%p) ref=%d\n", This
, ref
);
4057 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
4059 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4060 LONG ref
= InterlockedDecrement(&This
->ref
);
4062 TRACE("(%p) ref=%d\n", This
, ref
);
4072 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
4074 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4075 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4078 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
4079 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
4081 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4082 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4085 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
4086 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
4087 LCID lcid
, DISPID
*rgDispId
)
4089 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4090 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4094 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
4095 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
4096 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4098 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4099 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4100 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4103 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
4105 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4110 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
4116 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
4118 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4119 FIXME("(%p)->(%p)\n", This
, p
);
4123 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
4125 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4126 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
4130 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
4131 HTMLFiltersCollection_QueryInterface
,
4132 HTMLFiltersCollection_AddRef
,
4133 HTMLFiltersCollection_Release
,
4134 HTMLFiltersCollection_GetTypeInfoCount
,
4135 HTMLFiltersCollection_GetTypeInfo
,
4136 HTMLFiltersCollection_GetIDsOfNames
,
4137 HTMLFiltersCollection_Invoke
,
4138 HTMLFiltersCollection_get_length
,
4139 HTMLFiltersCollection_get__newEnum
,
4140 HTMLFiltersCollection_item
4143 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4148 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
4149 idx
= idx
*10 + (*ptr
-'0');
4151 return DISP_E_UNKNOWNNAME
;
4153 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
4154 TRACE("ret %x\n", *dispid
);
4158 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4159 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4161 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
4163 V_VT(res
) = VT_DISPATCH
;
4164 V_DISPATCH(res
) = NULL
;
4166 FIXME("always returning NULL\n");
4171 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
4173 HTMLFiltersCollection_get_dispid
,
4174 HTMLFiltersCollection_invoke
,
4178 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
4179 IHTMLFiltersCollection_tid
,
4182 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
4183 &HTMLFiltersCollection_dispex_vtbl
,
4184 IHTMLFiltersCollection_tid
,
4186 HTMLFiltersCollection_iface_tids
4189 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
4191 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
4193 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
4196 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
4197 &HTMLFiltersCollection_dispex
);
4199 return &ret
->IHTMLFiltersCollection_iface
;
4202 /* interface IHTMLAttributeCollection */
4203 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
4205 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
4208 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
4210 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4212 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4213 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4214 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
4215 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4216 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
4217 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
4218 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
4219 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
4220 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4221 return *ppv
? S_OK
: E_NOINTERFACE
;
4224 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4225 return E_NOINTERFACE
;
4228 IUnknown_AddRef((IUnknown
*)*ppv
);
4232 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
4234 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4235 LONG ref
= InterlockedIncrement(&This
->ref
);
4237 TRACE("(%p) ref=%d\n", This
, ref
);
4242 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
4244 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4245 LONG ref
= InterlockedDecrement(&This
->ref
);
4247 TRACE("(%p) ref=%d\n", This
, ref
);
4250 while(!list_empty(&This
->attrs
)) {
4251 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
4253 list_remove(&attr
->entry
);
4255 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4264 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
4266 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4267 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4270 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
4271 LCID lcid
, ITypeInfo
**ppTInfo
)
4273 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4274 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4277 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
4278 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4280 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4281 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4285 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
4286 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4287 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4289 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4290 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4291 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4294 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
4296 IDispatchEx
*dispex
= &This
->elem
->node
.dispex
.IDispatchEx_iface
;
4297 DISPID id
= DISPID_STARTENUM
;
4301 FIXME("filter non-enumerable attributes out\n");
4304 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
4307 else if(hres
== S_FALSE
)
4317 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
4324 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
4328 if(name
[0]>='0' && name
[0]<='9') {
4332 idx
= strtoulW(name
, &end_ptr
, 10);
4334 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
4341 WARN("NULL elem\n");
4342 return E_UNEXPECTED
;
4345 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.dispex
.IDispatchEx_iface
,
4346 name
, fdexNameCaseInsensitive
, id
);
4350 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
4352 HTMLDOMAttribute
*iter
;
4357 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4358 if(iter
->dispid
== id
) {
4367 WARN("NULL elem\n");
4368 return E_UNEXPECTED
;
4371 hres
= HTMLDOMAttribute_Create(NULL
, This
->elem
, id
, attr
);
4376 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
4382 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
4384 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4387 TRACE("(%p)->(%p)\n", This
, p
);
4390 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
4394 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
4396 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4397 FIXME("(%p)->(%p)\n", This
, p
);
4401 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
4403 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4404 HTMLDOMAttribute
*attr
;
4408 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
4410 switch(V_VT(name
)) {
4412 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
4415 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
4418 FIXME("unsupported name %s\n", debugstr_variant(name
));
4421 if(hres
== DISP_E_UNKNOWNNAME
)
4422 return E_INVALIDARG
;
4426 hres
= get_domattr(This
, id
, NULL
, &attr
);
4430 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
4434 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
4435 HTMLAttributeCollection_QueryInterface
,
4436 HTMLAttributeCollection_AddRef
,
4437 HTMLAttributeCollection_Release
,
4438 HTMLAttributeCollection_GetTypeInfoCount
,
4439 HTMLAttributeCollection_GetTypeInfo
,
4440 HTMLAttributeCollection_GetIDsOfNames
,
4441 HTMLAttributeCollection_Invoke
,
4442 HTMLAttributeCollection_get_length
,
4443 HTMLAttributeCollection__newEnum
,
4444 HTMLAttributeCollection_item
4447 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
4449 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
4452 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
4454 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4455 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4458 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
4460 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4461 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4464 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
4466 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4467 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4470 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
4472 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4473 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4476 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
4477 LCID lcid
, ITypeInfo
**ppTInfo
)
4479 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4480 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4483 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
4484 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4486 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4487 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4491 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
4492 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4493 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4495 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4496 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4497 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4500 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
4501 IHTMLDOMAttribute
**newretNode
)
4503 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4504 HTMLDOMAttribute
*attr
;
4508 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4510 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
4511 if(hres
== DISP_E_UNKNOWNNAME
) {
4514 } else if(FAILED(hres
)) {
4518 hres
= get_domattr(This
, id
, NULL
, &attr
);
4522 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
4526 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
4527 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
4529 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4530 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
4534 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
4535 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
4537 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4538 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4542 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
4543 HTMLAttributeCollection2_QueryInterface
,
4544 HTMLAttributeCollection2_AddRef
,
4545 HTMLAttributeCollection2_Release
,
4546 HTMLAttributeCollection2_GetTypeInfoCount
,
4547 HTMLAttributeCollection2_GetTypeInfo
,
4548 HTMLAttributeCollection2_GetIDsOfNames
,
4549 HTMLAttributeCollection2_Invoke
,
4550 HTMLAttributeCollection2_getNamedItem
,
4551 HTMLAttributeCollection2_setNamedItem
,
4552 HTMLAttributeCollection2_removeNamedItem
4555 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
4557 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
4560 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
4562 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4563 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4566 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
4568 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4569 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4572 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
4574 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4575 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4578 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
4580 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4581 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4584 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
4585 LCID lcid
, ITypeInfo
**ppTInfo
)
4587 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4588 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4591 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
4592 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4594 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4595 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4599 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
4600 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4601 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4603 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4604 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4605 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4608 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
4609 IHTMLDOMAttribute
**ppNodeOut
)
4611 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4612 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
4615 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
4616 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
4618 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4619 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
4623 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
4624 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
4626 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4627 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
4631 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
4633 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4634 HTMLDOMAttribute
*attr
;
4638 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
4640 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
4641 if(hres
== DISP_E_UNKNOWNNAME
)
4642 return E_INVALIDARG
;
4646 hres
= get_domattr(This
, id
, NULL
, &attr
);
4650 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
4654 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
4656 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4657 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
4660 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
4661 HTMLAttributeCollection3_QueryInterface
,
4662 HTMLAttributeCollection3_AddRef
,
4663 HTMLAttributeCollection3_Release
,
4664 HTMLAttributeCollection3_GetTypeInfoCount
,
4665 HTMLAttributeCollection3_GetTypeInfo
,
4666 HTMLAttributeCollection3_GetIDsOfNames
,
4667 HTMLAttributeCollection3_Invoke
,
4668 HTMLAttributeCollection3_getNamedItem
,
4669 HTMLAttributeCollection3_setNamedItem
,
4670 HTMLAttributeCollection3_removeNamedItem
,
4671 HTMLAttributeCollection3_item
,
4672 HTMLAttributeCollection3_get_length
4675 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
4677 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
4680 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4682 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4683 HTMLDOMAttribute
*attr
;
4687 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
4689 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
4693 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
4696 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4698 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
4702 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
4703 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4705 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4707 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
4710 case DISPATCH_PROPERTYGET
: {
4711 HTMLDOMAttribute
*iter
;
4714 pos
= id
-MSHTML_DISPID_CUSTOM_MIN
;
4716 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4718 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
4719 V_VT(res
) = VT_DISPATCH
;
4720 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
4726 WARN("invalid arg\n");
4727 return E_INVALIDARG
;
4731 FIXME("unimplemented flags %x\n", flags
);
4736 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
4738 HTMLAttributeCollection_get_dispid
,
4739 HTMLAttributeCollection_invoke
,
4743 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
4744 IHTMLAttributeCollection_tid
,
4745 IHTMLAttributeCollection2_tid
,
4746 IHTMLAttributeCollection3_tid
,
4750 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
4751 &HTMLAttributeCollection_dispex_vtbl
,
4752 DispHTMLAttributeCollection_tid
,
4754 HTMLAttributeCollection_iface_tids
4757 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
4759 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
4762 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
4767 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
4769 return E_OUTOFMEMORY
;
4771 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
4772 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
4773 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
4774 This
->attrs
->ref
= 2;
4776 This
->attrs
->elem
= This
;
4777 list_init(&This
->attrs
->attrs
);
4778 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
4779 &HTMLAttributeCollection_dispex
);