2 * Copyright 2006-2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
36 #include "htmlevent.h"
37 #include "htmlstyle.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
41 static const WCHAR aW
[] = {'A',0};
42 static const WCHAR bodyW
[] = {'B','O','D','Y',0};
43 static const WCHAR buttonW
[] = {'B','U','T','T','O','N',0};
44 static const WCHAR embedW
[] = {'E','M','B','E','D',0};
45 static const WCHAR formW
[] = {'F','O','R','M',0};
46 static const WCHAR frameW
[] = {'F','R','A','M','E',0};
47 static const WCHAR headW
[] = {'H','E','A','D',0};
48 static const WCHAR iframeW
[] = {'I','F','R','A','M','E',0};
49 static const WCHAR imgW
[] = {'I','M','G',0};
50 static const WCHAR inputW
[] = {'I','N','P','U','T',0};
51 static const WCHAR labelW
[] = {'L','A','B','E','L',0};
52 static const WCHAR linkW
[] = {'L','I','N','K',0};
53 static const WCHAR metaW
[] = {'M','E','T','A',0};
54 static const WCHAR objectW
[] = {'O','B','J','E','C','T',0};
55 static const WCHAR optionW
[] = {'O','P','T','I','O','N',0};
56 static const WCHAR scriptW
[] = {'S','C','R','I','P','T',0};
57 static const WCHAR selectW
[] = {'S','E','L','E','C','T',0};
58 static const WCHAR styleW
[] = {'S','T','Y','L','E',0};
59 static const WCHAR tableW
[] = {'T','A','B','L','E',0};
60 static const WCHAR tdW
[] = {'T','D',0};
61 static const WCHAR textareaW
[] = {'T','E','X','T','A','R','E','A',0};
62 static const WCHAR title_tagW
[]= {'T','I','T','L','E',0};
63 static const WCHAR trW
[] = {'T','R',0};
67 HRESULT (*constructor
)(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
70 static const tag_desc_t tag_descs
[] = {
71 {aW
, HTMLAnchorElement_Create
},
72 {bodyW
, HTMLBodyElement_Create
},
73 {buttonW
, HTMLButtonElement_Create
},
74 {embedW
, HTMLEmbedElement_Create
},
75 {formW
, HTMLFormElement_Create
},
76 {frameW
, HTMLFrameElement_Create
},
77 {headW
, HTMLHeadElement_Create
},
78 {iframeW
, HTMLIFrame_Create
},
79 {imgW
, HTMLImgElement_Create
},
80 {inputW
, HTMLInputElement_Create
},
81 {labelW
, HTMLLabelElement_Create
},
82 {linkW
, HTMLLinkElement_Create
},
83 {metaW
, HTMLMetaElement_Create
},
84 {objectW
, HTMLObjectElement_Create
},
85 {optionW
, HTMLOptionElement_Create
},
86 {scriptW
, HTMLScriptElement_Create
},
87 {selectW
, HTMLSelectElement_Create
},
88 {styleW
, HTMLStyleElement_Create
},
89 {tableW
, HTMLTable_Create
},
90 {tdW
, HTMLTableCell_Create
},
91 {textareaW
, HTMLTextAreaElement_Create
},
92 {title_tagW
, HTMLTitleElement_Create
},
93 {trW
, HTMLTableRow_Create
}
96 static const tag_desc_t
*get_tag_desc(const WCHAR
*tag_name
)
98 DWORD min
=0, max
=sizeof(tag_descs
)/sizeof(*tag_descs
)-1, i
;
103 r
= strcmpW(tag_name
, tag_descs
[i
].name
);
116 HRESULT
replace_node_by_html(nsIDOMHTMLDocument
*nsdoc
, nsIDOMNode
*nsnode
, const WCHAR
*html
)
118 nsIDOMDocumentFragment
*nsfragment
;
119 nsIDOMNode
*nsparent
;
125 nsres
= nsIDOMHTMLDocument_CreateRange(nsdoc
, &range
);
126 if(NS_FAILED(nsres
)) {
127 ERR("CreateRange failed: %08x\n", nsres
);
131 nsAString_InitDepend(&html_str
, html
);
132 nsIDOMRange_CreateContextualFragment(range
, &html_str
, &nsfragment
);
133 nsIDOMRange_Release(range
);
134 nsAString_Finish(&html_str
);
135 if(NS_FAILED(nsres
)) {
136 ERR("CreateContextualFragment failed: %08x\n", nsres
);
140 nsres
= nsIDOMNode_GetParentNode(nsnode
, &nsparent
);
141 if(NS_SUCCEEDED(nsres
) && nsparent
) {
144 nsres
= nsIDOMNode_ReplaceChild(nsparent
, (nsIDOMNode
*)nsfragment
, nsnode
, &nstmp
);
145 nsIDOMNode_Release(nsparent
);
146 if(NS_FAILED(nsres
)) {
147 ERR("ReplaceChild failed: %08x\n", nsres
);
150 nsIDOMNode_Release(nstmp
);
153 ERR("GetParentNode failed: %08x\n", nsres
);
157 nsIDOMDocumentFragment_Release(nsfragment
);
161 nsresult
get_elem_attr_value(nsIDOMHTMLElement
*nselem
, const WCHAR
*name
, nsAString
*val_str
, const PRUnichar
**val
)
166 nsAString_InitDepend(&name_str
, name
);
167 nsAString_Init(val_str
, NULL
);
168 nsres
= nsIDOMHTMLElement_GetAttribute(nselem
, &name_str
, val_str
);
169 nsAString_Finish(&name_str
);
170 if(NS_FAILED(nsres
)) {
171 ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name
), nsres
);
172 nsAString_Finish(val_str
);
176 nsAString_GetData(val_str
, val
);
180 HRESULT
elem_string_attr_getter(HTMLElement
*elem
, const WCHAR
*name
, BOOL use_null
, BSTR
*p
)
182 const PRUnichar
*val
;
187 nsres
= get_elem_attr_value(elem
->nselem
, name
, &val_str
, &val
);
191 TRACE("%s: returning %s\n", debugstr_w(name
), debugstr_w(val
));
193 if(*val
|| !use_null
) {
194 *p
= SysAllocString(val
);
196 hres
= E_OUTOFMEMORY
;
200 nsAString_Finish(&val_str
);
204 HRESULT
elem_string_attr_setter(HTMLElement
*elem
, const WCHAR
*name
, const WCHAR
*value
)
206 nsAString name_str
, val_str
;
209 nsAString_InitDepend(&name_str
, name
);
210 nsAString_InitDepend(&val_str
, value
);
211 nsres
= nsIDOMHTMLElement_SetAttribute(elem
->nselem
, &name_str
, &val_str
);
212 nsAString_Finish(&name_str
);
213 nsAString_Finish(&val_str
);
215 if(NS_FAILED(nsres
)) {
216 WARN("SetAttribute failed: %08x\n", nsres
);
223 HRESULT
get_readystate_string(READYSTATE readystate
, BSTR
*p
)
225 static const WCHAR uninitializedW
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
226 static const WCHAR loadingW
[] = {'l','o','a','d','i','n','g',0};
227 static const WCHAR loadedW
[] = {'l','o','a','d','e','d',0};
228 static const WCHAR interactiveW
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
229 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
231 static const LPCWSTR readystate_strs
[] = {
239 assert(readystate
<= READYSTATE_COMPLETE
);
240 *p
= SysAllocString(readystate_strs
[readystate
]);
241 return *p
? S_OK
: E_OUTOFMEMORY
;
247 IHTMLFiltersCollection IHTMLFiltersCollection_iface
;
250 } HTMLFiltersCollection
;
252 static inline HTMLFiltersCollection
*impl_from_IHTMLFiltersCollection(IHTMLFiltersCollection
*iface
)
254 return CONTAINING_RECORD(iface
, HTMLFiltersCollection
, IHTMLFiltersCollection_iface
);
257 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void);
259 static inline HTMLElement
*impl_from_IHTMLElement(IHTMLElement
*iface
)
261 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement_iface
);
264 HRESULT
create_nselem(HTMLDocumentNode
*doc
, const WCHAR
*tag
, nsIDOMHTMLElement
**ret
)
266 nsIDOMElement
*nselem
;
271 WARN("NULL nsdoc\n");
275 nsAString_InitDepend(&tag_str
, tag
);
276 nsres
= nsIDOMHTMLDocument_CreateElement(doc
->nsdoc
, &tag_str
, &nselem
);
277 nsAString_Finish(&tag_str
);
278 if(NS_FAILED(nsres
)) {
279 ERR("CreateElement failed: %08x\n", nsres
);
283 nsres
= nsIDOMElement_QueryInterface(nselem
, &IID_nsIDOMHTMLElement
, (void**)ret
);
284 nsIDOMElement_Release(nselem
);
285 if(NS_FAILED(nsres
)) {
286 ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres
);
293 HRESULT
create_element(HTMLDocumentNode
*doc
, const WCHAR
*tag
, HTMLElement
**ret
)
295 nsIDOMHTMLElement
*nselem
;
298 /* Use owner doc if called on document fragment */
302 hres
= create_nselem(doc
, tag
, &nselem
);
306 hres
= HTMLElement_Create(doc
, (nsIDOMNode
*)nselem
, TRUE
, ret
);
307 nsIDOMHTMLElement_Release(nselem
);
313 IHTMLRect IHTMLRect_iface
;
317 nsIDOMClientRect
*nsrect
;
320 static inline HTMLRect
*impl_from_IHTMLRect(IHTMLRect
*iface
)
322 return CONTAINING_RECORD(iface
, HTMLRect
, IHTMLRect_iface
);
325 static HRESULT WINAPI
HTMLRect_QueryInterface(IHTMLRect
*iface
, REFIID riid
, void **ppv
)
327 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
329 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
331 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
332 *ppv
= &This
->IHTMLRect_iface
;
333 }else if(IsEqualGUID(&IID_IHTMLRect
, riid
)) {
334 *ppv
= &This
->IHTMLRect_iface
;
335 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
336 return *ppv
? S_OK
: E_NOINTERFACE
;
338 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
340 return E_NOINTERFACE
;
343 IUnknown_AddRef((IUnknown
*)*ppv
);
347 static ULONG WINAPI
HTMLRect_AddRef(IHTMLRect
*iface
)
349 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
350 LONG ref
= InterlockedIncrement(&This
->ref
);
352 TRACE("(%p) ref=%d\n", This
, ref
);
357 static ULONG WINAPI
HTMLRect_Release(IHTMLRect
*iface
)
359 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
360 LONG ref
= InterlockedDecrement(&This
->ref
);
362 TRACE("(%p) ref=%d\n", This
, ref
);
366 nsIDOMClientRect_Release(This
->nsrect
);
373 static HRESULT WINAPI
HTMLRect_GetTypeInfoCount(IHTMLRect
*iface
, UINT
*pctinfo
)
375 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
376 FIXME("(%p)->(%p)\n", This
, pctinfo
);
380 static HRESULT WINAPI
HTMLRect_GetTypeInfo(IHTMLRect
*iface
, UINT iTInfo
,
381 LCID lcid
, ITypeInfo
**ppTInfo
)
383 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
385 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
388 static HRESULT WINAPI
HTMLRect_GetIDsOfNames(IHTMLRect
*iface
, REFIID riid
,
389 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
391 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
393 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
397 static HRESULT WINAPI
HTMLRect_Invoke(IHTMLRect
*iface
, DISPID dispIdMember
,
398 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
399 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
401 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
403 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
404 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
407 static HRESULT WINAPI
HTMLRect_put_left(IHTMLRect
*iface
, LONG v
)
409 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
410 FIXME("(%p)->(%d)\n", This
, v
);
414 static HRESULT WINAPI
HTMLRect_get_left(IHTMLRect
*iface
, LONG
*p
)
416 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
420 TRACE("(%p)->(%p)\n", This
, p
);
422 nsres
= nsIDOMClientRect_GetLeft(This
->nsrect
, &left
);
423 if(NS_FAILED(nsres
)) {
424 ERR("GetLeft failed: %08x\n", nsres
);
428 *p
= floor(left
+0.5);
432 static HRESULT WINAPI
HTMLRect_put_top(IHTMLRect
*iface
, LONG v
)
434 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
435 FIXME("(%p)->(%d)\n", This
, v
);
439 static HRESULT WINAPI
HTMLRect_get_top(IHTMLRect
*iface
, LONG
*p
)
441 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
445 TRACE("(%p)->(%p)\n", This
, p
);
447 nsres
= nsIDOMClientRect_GetTop(This
->nsrect
, &top
);
448 if(NS_FAILED(nsres
)) {
449 ERR("GetTop failed: %08x\n", nsres
);
457 static HRESULT WINAPI
HTMLRect_put_right(IHTMLRect
*iface
, LONG v
)
459 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
460 FIXME("(%p)->(%d)\n", This
, v
);
464 static HRESULT WINAPI
HTMLRect_get_right(IHTMLRect
*iface
, LONG
*p
)
466 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
470 TRACE("(%p)->(%p)\n", This
, p
);
472 nsres
= nsIDOMClientRect_GetRight(This
->nsrect
, &right
);
473 if(NS_FAILED(nsres
)) {
474 ERR("GetRight failed: %08x\n", nsres
);
478 *p
= floor(right
+0.5);
482 static HRESULT WINAPI
HTMLRect_put_bottom(IHTMLRect
*iface
, LONG v
)
484 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
485 FIXME("(%p)->(%d)\n", This
, v
);
489 static HRESULT WINAPI
HTMLRect_get_bottom(IHTMLRect
*iface
, LONG
*p
)
491 HTMLRect
*This
= impl_from_IHTMLRect(iface
);
495 TRACE("(%p)->(%p)\n", This
, p
);
497 nsres
= nsIDOMClientRect_GetBottom(This
->nsrect
, &bottom
);
498 if(NS_FAILED(nsres
)) {
499 ERR("GetBottom failed: %08x\n", nsres
);
503 *p
= floor(bottom
+0.5);
507 static const IHTMLRectVtbl HTMLRectVtbl
= {
508 HTMLRect_QueryInterface
,
511 HTMLRect_GetTypeInfoCount
,
512 HTMLRect_GetTypeInfo
,
513 HTMLRect_GetIDsOfNames
,
525 static const tid_t HTMLRect_iface_tids
[] = {
529 static dispex_static_data_t HTMLRect_dispex
= {
536 static HRESULT
create_html_rect(nsIDOMClientRect
*nsrect
, IHTMLRect
**ret
)
540 rect
= heap_alloc_zero(sizeof(HTMLRect
));
542 return E_OUTOFMEMORY
;
544 rect
->IHTMLRect_iface
.lpVtbl
= &HTMLRectVtbl
;
547 init_dispex(&rect
->dispex
, (IUnknown
*)&rect
->IHTMLRect_iface
, &HTMLRect_dispex
);
549 nsIDOMClientRect_AddRef(nsrect
);
550 rect
->nsrect
= nsrect
;
552 *ret
= &rect
->IHTMLRect_iface
;
556 static HRESULT WINAPI
HTMLElement_QueryInterface(IHTMLElement
*iface
,
557 REFIID riid
, void **ppv
)
559 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
561 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
564 static ULONG WINAPI
HTMLElement_AddRef(IHTMLElement
*iface
)
566 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
568 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
571 static ULONG WINAPI
HTMLElement_Release(IHTMLElement
*iface
)
573 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
575 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
578 static HRESULT WINAPI
HTMLElement_GetTypeInfoCount(IHTMLElement
*iface
, UINT
*pctinfo
)
580 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
581 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
584 static HRESULT WINAPI
HTMLElement_GetTypeInfo(IHTMLElement
*iface
, UINT iTInfo
,
585 LCID lcid
, ITypeInfo
**ppTInfo
)
587 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
588 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
591 static HRESULT WINAPI
HTMLElement_GetIDsOfNames(IHTMLElement
*iface
, REFIID riid
,
592 LPOLESTR
*rgszNames
, UINT cNames
,
593 LCID lcid
, DISPID
*rgDispId
)
595 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
596 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
600 static HRESULT WINAPI
HTMLElement_Invoke(IHTMLElement
*iface
, DISPID dispIdMember
,
601 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
602 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
604 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
605 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
606 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
609 #define ATTRFLAG_CASESENSITIVE 0x0001
610 #define ATTRFLAG_ASSTRING 0x0002
611 #define ATTRFLAG_EXPANDURL 0x0004
613 static HRESULT WINAPI
HTMLElement_setAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
614 VARIANT AttributeValue
, LONG lFlags
)
616 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
618 DISPID dispid
, dispidNamed
= DISPID_PROPERTYPUT
;
619 DISPPARAMS dispParams
;
622 TRACE("(%p)->(%s %s %08x)\n", This
, debugstr_w(strAttributeName
), debugstr_variant(&AttributeValue
), lFlags
);
624 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
625 (lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
) | fdexNameEnsure
, &dispid
);
629 if(dispid
== DISPID_IHTMLELEMENT_STYLE
) {
630 TRACE("Ignoring call on style attribute\n");
634 dispParams
.cArgs
= 1;
635 dispParams
.cNamedArgs
= 1;
636 dispParams
.rgdispidNamedArgs
= &dispidNamed
;
637 dispParams
.rgvarg
= &AttributeValue
;
639 return IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
,
640 LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYPUT
, &dispParams
, NULL
, &excep
, NULL
);
643 static HRESULT WINAPI
HTMLElement_getAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
644 LONG lFlags
, VARIANT
*AttributeValue
)
646 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
649 DISPPARAMS dispParams
= {NULL
, NULL
, 0, 0};
652 TRACE("(%p)->(%s %08x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, AttributeValue
);
654 if(lFlags
& ~(ATTRFLAG_CASESENSITIVE
|ATTRFLAG_ASSTRING
))
655 FIXME("Unsuported flags %x\n", lFlags
);
657 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
658 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &dispid
);
659 if(hres
== DISP_E_UNKNOWNNAME
) {
660 V_VT(AttributeValue
) = VT_NULL
;
665 V_VT(AttributeValue
) = VT_NULL
;
669 hres
= IDispatchEx_InvokeEx(&This
->node
.dispex
.IDispatchEx_iface
, dispid
, LOCALE_SYSTEM_DEFAULT
,
670 DISPATCH_PROPERTYGET
, &dispParams
, AttributeValue
, &excep
, NULL
);
674 if(lFlags
& ATTRFLAG_ASSTRING
) {
675 switch(V_VT(AttributeValue
)) {
679 IDispatch_Release(V_DISPATCH(AttributeValue
));
680 V_VT(AttributeValue
) = VT_BSTR
;
681 V_BSTR(AttributeValue
) = SysAllocString(NULL
);
684 hres
= VariantChangeType(AttributeValue
, AttributeValue
, 0, VT_BSTR
);
693 static HRESULT WINAPI
HTMLElement_removeAttribute(IHTMLElement
*iface
, BSTR strAttributeName
,
694 LONG lFlags
, VARIANT_BOOL
*pfSuccess
)
696 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
700 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(strAttributeName
), lFlags
, pfSuccess
);
702 hres
= IDispatchEx_GetDispID(&This
->node
.dispex
.IDispatchEx_iface
, strAttributeName
,
703 lFlags
&ATTRFLAG_CASESENSITIVE
? fdexNameCaseSensitive
: fdexNameCaseInsensitive
, &id
);
704 if(hres
== DISP_E_UNKNOWNNAME
) {
705 *pfSuccess
= VARIANT_FALSE
;
711 if(id
== DISPID_IHTMLELEMENT_STYLE
) {
714 TRACE("Special case: style\n");
716 hres
= IHTMLElement_get_style(&This
->IHTMLElement_iface
, &style
);
720 hres
= IHTMLStyle_put_cssText(style
, NULL
);
721 IHTMLStyle_Release(style
);
725 *pfSuccess
= VARIANT_TRUE
;
729 return remove_attribute(&This
->node
.dispex
, id
, pfSuccess
);
732 static HRESULT WINAPI
HTMLElement_put_className(IHTMLElement
*iface
, BSTR v
)
734 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
735 nsAString classname_str
;
738 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
741 FIXME("NULL nselem\n");
745 nsAString_InitDepend(&classname_str
, v
);
746 nsres
= nsIDOMHTMLElement_SetClassName(This
->nselem
, &classname_str
);
747 nsAString_Finish(&classname_str
);
749 ERR("SetClassName failed: %08x\n", nsres
);
754 static HRESULT WINAPI
HTMLElement_get_className(IHTMLElement
*iface
, BSTR
*p
)
756 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
760 TRACE("(%p)->(%p)\n", This
, p
);
763 FIXME("NULL nselem\n");
767 nsAString_Init(&class_str
, NULL
);
768 nsres
= nsIDOMHTMLElement_GetClassName(This
->nselem
, &class_str
);
769 return return_nsstr(nsres
, &class_str
, p
);
772 static HRESULT WINAPI
HTMLElement_put_id(IHTMLElement
*iface
, BSTR v
)
774 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
778 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
781 FIXME("nselem == NULL\n");
785 nsAString_InitDepend(&id_str
, v
);
786 nsres
= nsIDOMHTMLElement_SetId(This
->nselem
, &id_str
);
787 nsAString_Finish(&id_str
);
789 ERR("SetId failed: %08x\n", nsres
);
794 static HRESULT WINAPI
HTMLElement_get_id(IHTMLElement
*iface
, BSTR
*p
)
796 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
800 TRACE("(%p)->(%p)\n", This
, p
);
807 nsAString_Init(&id_str
, NULL
);
808 nsres
= nsIDOMHTMLElement_GetId(This
->nselem
, &id_str
);
809 return return_nsstr(nsres
, &id_str
, p
);
812 static HRESULT WINAPI
HTMLElement_get_tagName(IHTMLElement
*iface
, BSTR
*p
)
814 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
818 TRACE("(%p)->(%p)\n", This
, p
);
821 static const WCHAR comment_tagW
[] = {'!',0};
823 WARN("NULL nselem, assuming comment\n");
825 *p
= SysAllocString(comment_tagW
);
826 return *p
? S_OK
: E_OUTOFMEMORY
;
829 nsAString_Init(&tag_str
, NULL
);
830 nsres
= nsIDOMHTMLElement_GetTagName(This
->nselem
, &tag_str
);
831 return return_nsstr(nsres
, &tag_str
, p
);
834 static HRESULT WINAPI
HTMLElement_get_parentElement(IHTMLElement
*iface
, IHTMLElement
**p
)
836 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
840 TRACE("(%p)->(%p)\n", This
, p
);
842 hres
= IHTMLDOMNode_get_parentNode(&This
->node
.IHTMLDOMNode_iface
, &node
);
846 hres
= IHTMLDOMNode_QueryInterface(node
, &IID_IHTMLElement
, (void**)p
);
847 IHTMLDOMNode_Release(node
);
854 static HRESULT WINAPI
HTMLElement_get_style(IHTMLElement
*iface
, IHTMLStyle
**p
)
856 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
858 TRACE("(%p)->(%p)\n", This
, p
);
863 hres
= HTMLStyle_Create(This
, &This
->style
);
868 *p
= &This
->style
->IHTMLStyle_iface
;
869 IHTMLStyle_AddRef(*p
);
873 static HRESULT WINAPI
HTMLElement_put_onhelp(IHTMLElement
*iface
, VARIANT v
)
875 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
876 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
880 static HRESULT WINAPI
HTMLElement_get_onhelp(IHTMLElement
*iface
, VARIANT
*p
)
882 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
883 FIXME("(%p)->(%p)\n", This
, p
);
887 static HRESULT WINAPI
HTMLElement_put_onclick(IHTMLElement
*iface
, VARIANT v
)
889 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
891 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
893 return set_node_event(&This
->node
, EVENTID_CLICK
, &v
);
896 static HRESULT WINAPI
HTMLElement_get_onclick(IHTMLElement
*iface
, VARIANT
*p
)
898 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
900 TRACE("(%p)->(%p)\n", This
, p
);
902 return get_node_event(&This
->node
, EVENTID_CLICK
, p
);
905 static HRESULT WINAPI
HTMLElement_put_ondblclick(IHTMLElement
*iface
, VARIANT v
)
907 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
909 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
911 return set_node_event(&This
->node
, EVENTID_DBLCLICK
, &v
);
914 static HRESULT WINAPI
HTMLElement_get_ondblclick(IHTMLElement
*iface
, VARIANT
*p
)
916 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
918 TRACE("(%p)->(%p)\n", This
, p
);
920 return get_node_event(&This
->node
, EVENTID_DBLCLICK
, p
);
923 static HRESULT WINAPI
HTMLElement_put_onkeydown(IHTMLElement
*iface
, VARIANT v
)
925 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
927 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
929 return set_node_event(&This
->node
, EVENTID_KEYDOWN
, &v
);
932 static HRESULT WINAPI
HTMLElement_get_onkeydown(IHTMLElement
*iface
, VARIANT
*p
)
934 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
936 TRACE("(%p)->(%p)\n", This
, p
);
938 return get_node_event(&This
->node
, EVENTID_KEYDOWN
, p
);
941 static HRESULT WINAPI
HTMLElement_put_onkeyup(IHTMLElement
*iface
, VARIANT v
)
943 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
945 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
947 return set_node_event(&This
->node
, EVENTID_KEYUP
, &v
);
950 static HRESULT WINAPI
HTMLElement_get_onkeyup(IHTMLElement
*iface
, VARIANT
*p
)
952 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
953 FIXME("(%p)->(%p)\n", This
, p
);
957 static HRESULT WINAPI
HTMLElement_put_onkeypress(IHTMLElement
*iface
, VARIANT v
)
959 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
961 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
963 return set_node_event(&This
->node
, EVENTID_KEYPRESS
, &v
);
966 static HRESULT WINAPI
HTMLElement_get_onkeypress(IHTMLElement
*iface
, VARIANT
*p
)
968 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
970 TRACE("(%p)->(%p)\n", This
, p
);
972 return get_node_event(&This
->node
, EVENTID_KEYPRESS
, p
);
975 static HRESULT WINAPI
HTMLElement_put_onmouseout(IHTMLElement
*iface
, VARIANT v
)
977 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
979 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
981 return set_node_event(&This
->node
, EVENTID_MOUSEOUT
, &v
);
984 static HRESULT WINAPI
HTMLElement_get_onmouseout(IHTMLElement
*iface
, VARIANT
*p
)
986 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
988 TRACE("(%p)->(%p)\n", This
, p
);
990 return get_node_event(&This
->node
, EVENTID_MOUSEOUT
, p
);
993 static HRESULT WINAPI
HTMLElement_put_onmouseover(IHTMLElement
*iface
, VARIANT v
)
995 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
997 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
999 return set_node_event(&This
->node
, EVENTID_MOUSEOVER
, &v
);
1002 static HRESULT WINAPI
HTMLElement_get_onmouseover(IHTMLElement
*iface
, VARIANT
*p
)
1004 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1006 TRACE("(%p)->(%p)\n", This
, p
);
1008 return get_node_event(&This
->node
, EVENTID_MOUSEOVER
, p
);
1011 static HRESULT WINAPI
HTMLElement_put_onmousemove(IHTMLElement
*iface
, VARIANT v
)
1013 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1015 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1017 return set_node_event(&This
->node
, EVENTID_MOUSEMOVE
, &v
);
1020 static HRESULT WINAPI
HTMLElement_get_onmousemove(IHTMLElement
*iface
, VARIANT
*p
)
1022 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1024 TRACE("(%p)->(%p)\n", This
, p
);
1026 return get_node_event(&This
->node
, EVENTID_MOUSEMOVE
, p
);
1029 static HRESULT WINAPI
HTMLElement_put_onmousedown(IHTMLElement
*iface
, VARIANT v
)
1031 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1033 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1035 return set_node_event(&This
->node
, EVENTID_MOUSEDOWN
, &v
);
1038 static HRESULT WINAPI
HTMLElement_get_onmousedown(IHTMLElement
*iface
, VARIANT
*p
)
1040 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1042 TRACE("(%p)->(%p)\n", This
, p
);
1044 return get_node_event(&This
->node
, EVENTID_MOUSEDOWN
, p
);
1047 static HRESULT WINAPI
HTMLElement_put_onmouseup(IHTMLElement
*iface
, VARIANT v
)
1049 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1051 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1053 return set_node_event(&This
->node
, EVENTID_MOUSEUP
, &v
);
1056 static HRESULT WINAPI
HTMLElement_get_onmouseup(IHTMLElement
*iface
, VARIANT
*p
)
1058 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1060 TRACE("(%p)->(%p)\n", This
, p
);
1062 return get_node_event(&This
->node
, EVENTID_MOUSEUP
, p
);
1065 static HRESULT WINAPI
HTMLElement_get_document(IHTMLElement
*iface
, IDispatch
**p
)
1067 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1069 TRACE("(%p)->(%p)\n", This
, p
);
1074 if(This
->node
.vtbl
->get_document
)
1075 return This
->node
.vtbl
->get_document(&This
->node
, p
);
1077 *p
= (IDispatch
*)&This
->node
.doc
->basedoc
.IHTMLDocument2_iface
;
1078 IDispatch_AddRef(*p
);
1082 static const WCHAR titleW
[] = {'t','i','t','l','e',0};
1084 static HRESULT WINAPI
HTMLElement_put_title(IHTMLElement
*iface
, BSTR v
)
1086 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1087 nsAString title_str
;
1090 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1096 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, TRUE
, &var
);
1101 V_VT(var
) = VT_BSTR
;
1102 V_BSTR(var
) = v
? SysAllocString(v
) : NULL
;
1106 nsAString_InitDepend(&title_str
, v
);
1107 nsres
= nsIDOMHTMLElement_SetTitle(This
->nselem
, &title_str
);
1108 nsAString_Finish(&title_str
);
1109 if(NS_FAILED(nsres
))
1110 ERR("SetTitle failed: %08x\n", nsres
);
1115 static HRESULT WINAPI
HTMLElement_get_title(IHTMLElement
*iface
, BSTR
*p
)
1117 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1118 nsAString title_str
;
1121 TRACE("(%p)->(%p)\n", This
, p
);
1127 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, titleW
, FALSE
, &var
);
1128 if(hres
== DISP_E_UNKNOWNNAME
) {
1130 }else if(V_VT(var
) != VT_BSTR
) {
1131 FIXME("title = %s\n", debugstr_variant(var
));
1134 *p
= V_BSTR(var
) ? SysAllocString(V_BSTR(var
)) : NULL
;
1140 nsAString_Init(&title_str
, NULL
);
1141 nsres
= nsIDOMHTMLElement_GetTitle(This
->nselem
, &title_str
);
1142 return return_nsstr(nsres
, &title_str
, p
);
1145 static const WCHAR languageW
[] = {'l','a','n','g','u','a','g','e',0};
1147 static HRESULT WINAPI
HTMLElement_put_language(IHTMLElement
*iface
, BSTR v
)
1149 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1151 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1153 return elem_string_attr_setter(This
, languageW
, v
);
1156 static HRESULT WINAPI
HTMLElement_get_language(IHTMLElement
*iface
, BSTR
*p
)
1158 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1160 TRACE("(%p)->(%p)\n", This
, p
);
1162 return elem_string_attr_getter(This
, languageW
, TRUE
, p
);
1165 static HRESULT WINAPI
HTMLElement_put_onselectstart(IHTMLElement
*iface
, VARIANT v
)
1167 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1169 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1171 return set_node_event(&This
->node
, EVENTID_SELECTSTART
, &v
);
1174 static HRESULT WINAPI
HTMLElement_get_onselectstart(IHTMLElement
*iface
, VARIANT
*p
)
1176 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1178 TRACE("(%p)->(%p)\n", This
, p
);
1180 return get_node_event(&This
->node
, EVENTID_SELECTSTART
, p
);
1183 static HRESULT WINAPI
HTMLElement_scrollIntoView(IHTMLElement
*iface
, VARIANT varargStart
)
1185 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1186 cpp_bool start
= TRUE
;
1189 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&varargStart
));
1191 switch(V_VT(&varargStart
)) {
1196 start
= V_BOOL(&varargStart
) != VARIANT_FALSE
;
1199 FIXME("Unsupported argument %s\n", debugstr_variant(&varargStart
));
1203 FIXME("Unsupported for comments\n");
1207 nsres
= nsIDOMHTMLElement_ScrollIntoView(This
->nselem
, start
, 1);
1208 assert(nsres
== NS_OK
);
1213 static HRESULT WINAPI
HTMLElement_contains(IHTMLElement
*iface
, IHTMLElement
*pChild
,
1214 VARIANT_BOOL
*pfResult
)
1216 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1217 cpp_bool result
= FALSE
;
1219 TRACE("(%p)->(%p %p)\n", This
, pChild
, pfResult
);
1225 child
= unsafe_impl_from_IHTMLElement(pChild
);
1227 ERR("not our element\n");
1231 nsres
= nsIDOMNode_Contains(This
->node
.nsnode
, child
->node
.nsnode
, &result
);
1232 assert(nsres
== NS_OK
);
1235 *pfResult
= result
? VARIANT_TRUE
: VARIANT_FALSE
;
1239 static HRESULT WINAPI
HTMLElement_get_sourceIndex(IHTMLElement
*iface
, LONG
*p
)
1241 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1243 TRACE("(%p)->(%p)\n", This
, p
);
1245 return get_elem_source_index(This
, p
);
1248 static HRESULT WINAPI
HTMLElement_get_recordNumber(IHTMLElement
*iface
, VARIANT
*p
)
1250 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1251 FIXME("(%p)->(%p)\n", This
, p
);
1255 static HRESULT WINAPI
HTMLElement_put_lang(IHTMLElement
*iface
, BSTR v
)
1257 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1258 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1262 static HRESULT WINAPI
HTMLElement_get_lang(IHTMLElement
*iface
, BSTR
*p
)
1264 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1265 FIXME("(%p)->(%p)\n", This
, p
);
1269 static HRESULT WINAPI
HTMLElement_get_offsetLeft(IHTMLElement
*iface
, LONG
*p
)
1271 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1274 TRACE("(%p)->(%p)\n", This
, p
);
1276 nsres
= nsIDOMHTMLElement_GetOffsetLeft(This
->nselem
, p
);
1277 if(NS_FAILED(nsres
)) {
1278 ERR("GetOffsetLeft failed: %08x\n", nsres
);
1285 static HRESULT WINAPI
HTMLElement_get_offsetTop(IHTMLElement
*iface
, LONG
*p
)
1287 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1290 TRACE("(%p)->(%p)\n", This
, p
);
1292 nsres
= nsIDOMHTMLElement_GetOffsetTop(This
->nselem
, p
);
1293 if(NS_FAILED(nsres
)) {
1294 ERR("GetOffsetTop failed: %08x\n", nsres
);
1301 static HRESULT WINAPI
HTMLElement_get_offsetWidth(IHTMLElement
*iface
, LONG
*p
)
1303 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1306 TRACE("(%p)->(%p)\n", This
, p
);
1308 nsres
= nsIDOMHTMLElement_GetOffsetWidth(This
->nselem
, p
);
1309 if(NS_FAILED(nsres
)) {
1310 ERR("GetOffsetWidth failed: %08x\n", nsres
);
1317 static HRESULT WINAPI
HTMLElement_get_offsetHeight(IHTMLElement
*iface
, LONG
*p
)
1319 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1322 TRACE("(%p)->(%p)\n", This
, p
);
1324 nsres
= nsIDOMHTMLElement_GetOffsetHeight(This
->nselem
, p
);
1325 if(NS_FAILED(nsres
)) {
1326 ERR("GetOffsetHeight failed: %08x\n", nsres
);
1333 static HRESULT WINAPI
HTMLElement_get_offsetParent(IHTMLElement
*iface
, IHTMLElement
**p
)
1335 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1336 nsIDOMElement
*nsparent
;
1340 TRACE("(%p)->(%p)\n", This
, p
);
1342 nsres
= nsIDOMHTMLElement_GetOffsetParent(This
->nselem
, &nsparent
);
1343 if(NS_FAILED(nsres
)) {
1344 ERR("GetOffsetParent failed: %08x\n", nsres
);
1351 hres
= get_node(This
->node
.doc
, (nsIDOMNode
*)nsparent
, TRUE
, &node
);
1352 nsIDOMElement_Release(nsparent
);
1356 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
1366 static HRESULT WINAPI
HTMLElement_put_innerHTML(IHTMLElement
*iface
, BSTR v
)
1368 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1372 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1375 FIXME("NULL nselem\n");
1379 nsAString_InitDepend(&html_str
, v
);
1380 nsres
= nsIDOMHTMLElement_SetInnerHTML(This
->nselem
, &html_str
);
1381 nsAString_Finish(&html_str
);
1382 if(NS_FAILED(nsres
)) {
1383 FIXME("SetInnerHtml failed %08x\n", nsres
);
1390 static HRESULT WINAPI
HTMLElement_get_innerHTML(IHTMLElement
*iface
, BSTR
*p
)
1392 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1396 TRACE("(%p)->(%p)\n", This
, p
);
1399 FIXME("NULL nselem\n");
1403 nsAString_Init(&html_str
, NULL
);
1404 nsres
= nsIDOMHTMLElement_GetInnerHTML(This
->nselem
, &html_str
);
1405 return return_nsstr(nsres
, &html_str
, p
);
1408 static HRESULT WINAPI
HTMLElement_put_innerText(IHTMLElement
*iface
, BSTR v
)
1410 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1411 nsIDOMNode
*nschild
, *tmp
;
1412 nsIDOMText
*text_node
;
1416 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1419 nsres
= nsIDOMHTMLElement_GetLastChild(This
->nselem
, &nschild
);
1420 if(NS_FAILED(nsres
)) {
1421 ERR("GetLastChild failed: %08x\n", nsres
);
1427 nsres
= nsIDOMHTMLElement_RemoveChild(This
->nselem
, nschild
, &tmp
);
1428 nsIDOMNode_Release(nschild
);
1429 if(NS_FAILED(nsres
)) {
1430 ERR("RemoveChild failed: %08x\n", nsres
);
1433 nsIDOMNode_Release(tmp
);
1436 nsAString_InitDepend(&text_str
, v
);
1437 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &text_str
, &text_node
);
1438 nsAString_Finish(&text_str
);
1439 if(NS_FAILED(nsres
)) {
1440 ERR("CreateTextNode failed: %08x\n", nsres
);
1444 nsres
= nsIDOMHTMLElement_AppendChild(This
->nselem
, (nsIDOMNode
*)text_node
, &tmp
);
1445 if(NS_FAILED(nsres
)) {
1446 ERR("AppendChild failed: %08x\n", nsres
);
1450 nsIDOMNode_Release(tmp
);
1454 static HRESULT WINAPI
HTMLElement_get_innerText(IHTMLElement
*iface
, BSTR
*p
)
1456 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1458 TRACE("(%p)->(%p)\n", This
, p
);
1460 return get_node_text(&This
->node
, p
);
1463 static HRESULT WINAPI
HTMLElement_put_outerHTML(IHTMLElement
*iface
, BSTR v
)
1465 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1467 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1469 return replace_node_by_html(This
->node
.doc
->nsdoc
, This
->node
.nsnode
, v
);
1472 static HRESULT WINAPI
HTMLElement_get_outerHTML(IHTMLElement
*iface
, BSTR
*p
)
1474 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1478 WARN("(%p)->(%p) semi-stub\n", This
, p
);
1480 nsAString_Init(&html_str
, NULL
);
1481 hres
= nsnode_to_nsstring(This
->node
.nsnode
, &html_str
);
1482 if(SUCCEEDED(hres
)) {
1483 const PRUnichar
*html
;
1485 nsAString_GetData(&html_str
, &html
);
1486 *p
= SysAllocString(html
);
1488 hres
= E_OUTOFMEMORY
;
1491 nsAString_Finish(&html_str
);
1493 TRACE("ret %s\n", debugstr_w(*p
));
1497 static HRESULT WINAPI
HTMLElement_put_outerText(IHTMLElement
*iface
, BSTR v
)
1499 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1500 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1504 static HRESULT WINAPI
HTMLElement_get_outerText(IHTMLElement
*iface
, BSTR
*p
)
1506 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1507 FIXME("(%p)->(%p)\n", This
, p
);
1511 static HRESULT
insert_adjacent_node(HTMLElement
*This
, const WCHAR
*where
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret_node
)
1513 nsIDOMNode
*ret_nsnode
;
1515 HRESULT hres
= S_OK
;
1517 static const WCHAR beforebeginW
[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
1518 static const WCHAR afterbeginW
[] = {'a','f','t','e','r','b','e','g','i','n',0};
1519 static const WCHAR beforeendW
[] = {'b','e','f','o','r','e','e','n','d',0};
1520 static const WCHAR afterendW
[] = {'a','f','t','e','r','e','n','d',0};
1522 if (!strcmpiW(where
, beforebeginW
)) {
1525 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1526 if(NS_FAILED(nsres
))
1530 return E_INVALIDARG
;
1532 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, This
->node
.nsnode
, &ret_nsnode
);
1533 nsIDOMNode_Release(parent
);
1534 }else if(!strcmpiW(where
, afterbeginW
)) {
1535 nsIDOMNode
*first_child
;
1537 nsres
= nsIDOMNode_GetFirstChild(This
->node
.nsnode
, &first_child
);
1538 if(NS_FAILED(nsres
))
1541 nsres
= nsIDOMNode_InsertBefore(This
->node
.nsnode
, nsnode
, first_child
, &ret_nsnode
);
1542 if(NS_FAILED(nsres
))
1546 nsIDOMNode_Release(first_child
);
1547 }else if (!strcmpiW(where
, beforeendW
)) {
1548 nsres
= nsIDOMNode_AppendChild(This
->node
.nsnode
, nsnode
, &ret_nsnode
);
1549 }else if (!strcmpiW(where
, afterendW
)) {
1550 nsIDOMNode
*next_sibling
, *parent
;
1552 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &parent
);
1553 if(NS_FAILED(nsres
))
1556 return E_INVALIDARG
;
1558 nsres
= nsIDOMNode_GetNextSibling(This
->node
.nsnode
, &next_sibling
);
1559 if(NS_SUCCEEDED(nsres
)) {
1561 nsres
= nsIDOMNode_InsertBefore(parent
, nsnode
, next_sibling
, &ret_nsnode
);
1562 nsIDOMNode_Release(next_sibling
);
1564 nsres
= nsIDOMNode_AppendChild(parent
, nsnode
, &ret_nsnode
);
1568 nsIDOMNode_Release(parent
);
1570 ERR("invalid where: %s\n", debugstr_w(where
));
1571 return E_INVALIDARG
;
1574 if (NS_FAILED(nsres
))
1578 hres
= get_node(This
->node
.doc
, ret_nsnode
, TRUE
, ret_node
);
1579 nsIDOMNode_Release(ret_nsnode
);
1583 static HRESULT WINAPI
HTMLElement_insertAdjacentHTML(IHTMLElement
*iface
, BSTR where
,
1586 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1593 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(html
));
1595 if(!This
->node
.doc
->nsdoc
) {
1596 WARN("NULL nsdoc\n");
1597 return E_UNEXPECTED
;
1600 nsres
= nsIDOMHTMLDocument_CreateRange(This
->node
.doc
->nsdoc
, &range
);
1601 if(NS_FAILED(nsres
))
1603 ERR("CreateRange failed: %08x\n", nsres
);
1607 nsIDOMRange_SetStartBefore(range
, This
->node
.nsnode
);
1609 nsAString_InitDepend(&ns_html
, html
);
1610 nsres
= nsIDOMRange_CreateContextualFragment(range
, &ns_html
, (nsIDOMDocumentFragment
**)&nsnode
);
1611 nsAString_Finish(&ns_html
);
1612 nsIDOMRange_Release(range
);
1614 if(NS_FAILED(nsres
) || !nsnode
)
1616 ERR("CreateTextNode failed: %08x\n", nsres
);
1620 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1621 nsIDOMNode_Release(nsnode
);
1625 static HRESULT WINAPI
HTMLElement_insertAdjacentText(IHTMLElement
*iface
, BSTR where
,
1628 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1634 TRACE("(%p)->(%s %s)\n", This
, debugstr_w(where
), debugstr_w(text
));
1636 if(!This
->node
.doc
->nsdoc
) {
1637 WARN("NULL nsdoc\n");
1638 return E_UNEXPECTED
;
1642 nsAString_InitDepend(&ns_text
, text
);
1643 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->node
.doc
->nsdoc
, &ns_text
, (nsIDOMText
**)&nsnode
);
1644 nsAString_Finish(&ns_text
);
1646 if(NS_FAILED(nsres
) || !nsnode
)
1648 ERR("CreateTextNode failed: %08x\n", nsres
);
1652 hr
= insert_adjacent_node(This
, where
, nsnode
, NULL
);
1653 nsIDOMNode_Release(nsnode
);
1658 static HRESULT WINAPI
HTMLElement_get_parentTextEdit(IHTMLElement
*iface
, IHTMLElement
**p
)
1660 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1661 FIXME("(%p)->(%p)\n", This
, p
);
1665 static HRESULT WINAPI
HTMLElement_get_isTextEdit(IHTMLElement
*iface
, VARIANT_BOOL
*p
)
1667 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1669 TRACE("(%p)->(%p)\n", This
, p
);
1671 *p
= This
->node
.vtbl
->is_text_edit
&& This
->node
.vtbl
->is_text_edit(&This
->node
)
1672 ? VARIANT_TRUE
: VARIANT_FALSE
;
1676 static HRESULT WINAPI
HTMLElement_click(IHTMLElement
*iface
)
1678 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1680 TRACE("(%p)\n", This
);
1682 return call_fire_event(&This
->node
, EVENTID_CLICK
);
1685 static HRESULT WINAPI
HTMLElement_get_filters(IHTMLElement
*iface
,
1686 IHTMLFiltersCollection
**p
)
1688 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1689 TRACE("(%p)->(%p)\n", This
, p
);
1694 *p
= HTMLFiltersCollection_Create();
1699 static HRESULT WINAPI
HTMLElement_put_ondragstart(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_ondragstart(IHTMLElement
*iface
, VARIANT
*p
)
1708 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1709 FIXME("(%p)->(%p)\n", This
, p
);
1713 static HRESULT WINAPI
HTMLElement_toString(IHTMLElement
*iface
, BSTR
*String
)
1715 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1716 FIXME("(%p)->(%p)\n", This
, String
);
1720 static HRESULT WINAPI
HTMLElement_put_onbeforeupdate(IHTMLElement
*iface
, VARIANT v
)
1722 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1723 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1727 static HRESULT WINAPI
HTMLElement_get_onbeforeupdate(IHTMLElement
*iface
, VARIANT
*p
)
1729 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1730 FIXME("(%p)->(%p)\n", This
, p
);
1734 static HRESULT WINAPI
HTMLElement_put_onafterupdate(IHTMLElement
*iface
, VARIANT v
)
1736 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1737 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1741 static HRESULT WINAPI
HTMLElement_get_onafterupdate(IHTMLElement
*iface
, VARIANT
*p
)
1743 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1744 FIXME("(%p)->(%p)\n", This
, p
);
1748 static HRESULT WINAPI
HTMLElement_put_onerrorupdate(IHTMLElement
*iface
, VARIANT v
)
1750 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1751 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1755 static HRESULT WINAPI
HTMLElement_get_onerrorupdate(IHTMLElement
*iface
, VARIANT
*p
)
1757 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1758 FIXME("(%p)->(%p)\n", This
, p
);
1762 static HRESULT WINAPI
HTMLElement_put_onrowexit(IHTMLElement
*iface
, VARIANT v
)
1764 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1765 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1769 static HRESULT WINAPI
HTMLElement_get_onrowexit(IHTMLElement
*iface
, VARIANT
*p
)
1771 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1772 FIXME("(%p)->(%p)\n", This
, p
);
1776 static HRESULT WINAPI
HTMLElement_put_onrowenter(IHTMLElement
*iface
, VARIANT v
)
1778 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1779 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1783 static HRESULT WINAPI
HTMLElement_get_onrowenter(IHTMLElement
*iface
, VARIANT
*p
)
1785 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1786 FIXME("(%p)->(%p)\n", This
, p
);
1790 static HRESULT WINAPI
HTMLElement_put_ondatasetchanged(IHTMLElement
*iface
, VARIANT v
)
1792 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1793 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1797 static HRESULT WINAPI
HTMLElement_get_ondatasetchanged(IHTMLElement
*iface
, VARIANT
*p
)
1799 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1800 FIXME("(%p)->(%p)\n", This
, p
);
1804 static HRESULT WINAPI
HTMLElement_put_ondataavailable(IHTMLElement
*iface
, VARIANT v
)
1806 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1808 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1810 return set_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, &v
);
1813 static HRESULT WINAPI
HTMLElement_get_ondataavailable(IHTMLElement
*iface
, VARIANT
*p
)
1815 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1817 TRACE("(%p)->(%p)\n", This
, p
);
1819 return get_node_event(&This
->node
, EVENTID_DATAAVAILABLE
, p
);
1822 static HRESULT WINAPI
HTMLElement_put_ondatasetcomplete(IHTMLElement
*iface
, VARIANT v
)
1824 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1825 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1829 static HRESULT WINAPI
HTMLElement_get_ondatasetcomplete(IHTMLElement
*iface
, VARIANT
*p
)
1831 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1832 FIXME("(%p)->(%p)\n", This
, p
);
1836 static HRESULT WINAPI
HTMLElement_put_onfilterchange(IHTMLElement
*iface
, VARIANT v
)
1838 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1839 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1843 static HRESULT WINAPI
HTMLElement_get_onfilterchange(IHTMLElement
*iface
, VARIANT
*p
)
1845 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1846 FIXME("(%p)->(%p)\n", This
, p
);
1850 static HRESULT WINAPI
HTMLElement_get_children(IHTMLElement
*iface
, IDispatch
**p
)
1852 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1853 nsIDOMNodeList
*nsnode_list
;
1856 TRACE("(%p)->(%p)\n", This
, p
);
1858 nsres
= nsIDOMNode_GetChildNodes(This
->node
.nsnode
, &nsnode_list
);
1859 if(NS_FAILED(nsres
)) {
1860 ERR("GetChildNodes failed: %08x\n", nsres
);
1864 *p
= (IDispatch
*)create_collection_from_nodelist(This
->node
.doc
, nsnode_list
);
1866 nsIDOMNodeList_Release(nsnode_list
);
1870 static HRESULT WINAPI
HTMLElement_get_all(IHTMLElement
*iface
, IDispatch
**p
)
1872 HTMLElement
*This
= impl_from_IHTMLElement(iface
);
1874 TRACE("(%p)->(%p)\n", This
, p
);
1876 *p
= (IDispatch
*)create_all_collection(&This
->node
, FALSE
);
1880 static const IHTMLElementVtbl HTMLElementVtbl
= {
1881 HTMLElement_QueryInterface
,
1883 HTMLElement_Release
,
1884 HTMLElement_GetTypeInfoCount
,
1885 HTMLElement_GetTypeInfo
,
1886 HTMLElement_GetIDsOfNames
,
1888 HTMLElement_setAttribute
,
1889 HTMLElement_getAttribute
,
1890 HTMLElement_removeAttribute
,
1891 HTMLElement_put_className
,
1892 HTMLElement_get_className
,
1895 HTMLElement_get_tagName
,
1896 HTMLElement_get_parentElement
,
1897 HTMLElement_get_style
,
1898 HTMLElement_put_onhelp
,
1899 HTMLElement_get_onhelp
,
1900 HTMLElement_put_onclick
,
1901 HTMLElement_get_onclick
,
1902 HTMLElement_put_ondblclick
,
1903 HTMLElement_get_ondblclick
,
1904 HTMLElement_put_onkeydown
,
1905 HTMLElement_get_onkeydown
,
1906 HTMLElement_put_onkeyup
,
1907 HTMLElement_get_onkeyup
,
1908 HTMLElement_put_onkeypress
,
1909 HTMLElement_get_onkeypress
,
1910 HTMLElement_put_onmouseout
,
1911 HTMLElement_get_onmouseout
,
1912 HTMLElement_put_onmouseover
,
1913 HTMLElement_get_onmouseover
,
1914 HTMLElement_put_onmousemove
,
1915 HTMLElement_get_onmousemove
,
1916 HTMLElement_put_onmousedown
,
1917 HTMLElement_get_onmousedown
,
1918 HTMLElement_put_onmouseup
,
1919 HTMLElement_get_onmouseup
,
1920 HTMLElement_get_document
,
1921 HTMLElement_put_title
,
1922 HTMLElement_get_title
,
1923 HTMLElement_put_language
,
1924 HTMLElement_get_language
,
1925 HTMLElement_put_onselectstart
,
1926 HTMLElement_get_onselectstart
,
1927 HTMLElement_scrollIntoView
,
1928 HTMLElement_contains
,
1929 HTMLElement_get_sourceIndex
,
1930 HTMLElement_get_recordNumber
,
1931 HTMLElement_put_lang
,
1932 HTMLElement_get_lang
,
1933 HTMLElement_get_offsetLeft
,
1934 HTMLElement_get_offsetTop
,
1935 HTMLElement_get_offsetWidth
,
1936 HTMLElement_get_offsetHeight
,
1937 HTMLElement_get_offsetParent
,
1938 HTMLElement_put_innerHTML
,
1939 HTMLElement_get_innerHTML
,
1940 HTMLElement_put_innerText
,
1941 HTMLElement_get_innerText
,
1942 HTMLElement_put_outerHTML
,
1943 HTMLElement_get_outerHTML
,
1944 HTMLElement_put_outerText
,
1945 HTMLElement_get_outerText
,
1946 HTMLElement_insertAdjacentHTML
,
1947 HTMLElement_insertAdjacentText
,
1948 HTMLElement_get_parentTextEdit
,
1949 HTMLElement_get_isTextEdit
,
1951 HTMLElement_get_filters
,
1952 HTMLElement_put_ondragstart
,
1953 HTMLElement_get_ondragstart
,
1954 HTMLElement_toString
,
1955 HTMLElement_put_onbeforeupdate
,
1956 HTMLElement_get_onbeforeupdate
,
1957 HTMLElement_put_onafterupdate
,
1958 HTMLElement_get_onafterupdate
,
1959 HTMLElement_put_onerrorupdate
,
1960 HTMLElement_get_onerrorupdate
,
1961 HTMLElement_put_onrowexit
,
1962 HTMLElement_get_onrowexit
,
1963 HTMLElement_put_onrowenter
,
1964 HTMLElement_get_onrowenter
,
1965 HTMLElement_put_ondatasetchanged
,
1966 HTMLElement_get_ondatasetchanged
,
1967 HTMLElement_put_ondataavailable
,
1968 HTMLElement_get_ondataavailable
,
1969 HTMLElement_put_ondatasetcomplete
,
1970 HTMLElement_get_ondatasetcomplete
,
1971 HTMLElement_put_onfilterchange
,
1972 HTMLElement_get_onfilterchange
,
1973 HTMLElement_get_children
,
1977 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*iface
)
1979 return iface
->lpVtbl
== &HTMLElementVtbl
? impl_from_IHTMLElement(iface
) : NULL
;
1982 static inline HTMLElement
*impl_from_IHTMLElement2(IHTMLElement2
*iface
)
1984 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement2_iface
);
1987 static HRESULT WINAPI
HTMLElement2_QueryInterface(IHTMLElement2
*iface
,
1988 REFIID riid
, void **ppv
)
1990 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1991 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
1994 static ULONG WINAPI
HTMLElement2_AddRef(IHTMLElement2
*iface
)
1996 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
1997 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
2000 static ULONG WINAPI
HTMLElement2_Release(IHTMLElement2
*iface
)
2002 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2003 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
2006 static HRESULT WINAPI
HTMLElement2_GetTypeInfoCount(IHTMLElement2
*iface
, UINT
*pctinfo
)
2008 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2009 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
2012 static HRESULT WINAPI
HTMLElement2_GetTypeInfo(IHTMLElement2
*iface
, UINT iTInfo
,
2013 LCID lcid
, ITypeInfo
**ppTInfo
)
2015 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2016 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2019 static HRESULT WINAPI
HTMLElement2_GetIDsOfNames(IHTMLElement2
*iface
, REFIID riid
,
2020 LPOLESTR
*rgszNames
, UINT cNames
,
2021 LCID lcid
, DISPID
*rgDispId
)
2023 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2024 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
2028 static HRESULT WINAPI
HTMLElement2_Invoke(IHTMLElement2
*iface
, DISPID dispIdMember
,
2029 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2030 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2032 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2033 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
2034 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2037 static HRESULT WINAPI
HTMLElement2_get_scopeName(IHTMLElement2
*iface
, BSTR
*p
)
2039 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2040 FIXME("(%p)->(%p)\n", This
, p
);
2044 static HRESULT WINAPI
HTMLElement2_setCapture(IHTMLElement2
*iface
, VARIANT_BOOL containerCapture
)
2046 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2047 FIXME("(%p)->(%x)\n", This
, containerCapture
);
2051 static HRESULT WINAPI
HTMLElement2_releaseCapture(IHTMLElement2
*iface
)
2053 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2054 FIXME("(%p)\n", This
);
2058 static HRESULT WINAPI
HTMLElement2_put_onlosecapture(IHTMLElement2
*iface
, VARIANT v
)
2060 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2061 FIXME("(%p)->()\n", This
);
2065 static HRESULT WINAPI
HTMLElement2_get_onlosecapture(IHTMLElement2
*iface
, VARIANT
*p
)
2067 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2068 FIXME("(%p)->(%p)\n", This
, p
);
2072 static HRESULT WINAPI
HTMLElement2_componentFromPoint(IHTMLElement2
*iface
,
2073 LONG x
, LONG y
, BSTR
*component
)
2075 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2076 FIXME("(%p)->(%d %d %p)\n", This
, x
, y
, component
);
2080 static HRESULT WINAPI
HTMLElement2_doScroll(IHTMLElement2
*iface
, VARIANT component
)
2082 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2084 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&component
));
2086 if(!This
->node
.doc
->content_ready
2087 || !This
->node
.doc
->basedoc
.doc_obj
->in_place_active
)
2094 static HRESULT WINAPI
HTMLElement2_put_onscroll(IHTMLElement2
*iface
, VARIANT v
)
2096 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2097 FIXME("(%p)->()\n", This
);
2101 static HRESULT WINAPI
HTMLElement2_get_onscroll(IHTMLElement2
*iface
, VARIANT
*p
)
2103 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2104 FIXME("(%p)->(%p)\n", This
, p
);
2108 static HRESULT WINAPI
HTMLElement2_put_ondrag(IHTMLElement2
*iface
, VARIANT v
)
2110 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2112 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2114 return set_node_event(&This
->node
, EVENTID_DRAG
, &v
);
2117 static HRESULT WINAPI
HTMLElement2_get_ondrag(IHTMLElement2
*iface
, VARIANT
*p
)
2119 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2121 TRACE("(%p)->(%p)\n", This
, p
);
2123 return get_node_event(&This
->node
, EVENTID_DRAG
, p
);
2126 static HRESULT WINAPI
HTMLElement2_put_ondragend(IHTMLElement2
*iface
, VARIANT v
)
2128 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2129 FIXME("(%p)->()\n", This
);
2133 static HRESULT WINAPI
HTMLElement2_get_ondragend(IHTMLElement2
*iface
, VARIANT
*p
)
2135 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2136 FIXME("(%p)->(%p)\n", This
, p
);
2140 static HRESULT WINAPI
HTMLElement2_put_ondragenter(IHTMLElement2
*iface
, VARIANT v
)
2142 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2143 FIXME("(%p)->()\n", This
);
2147 static HRESULT WINAPI
HTMLElement2_get_ondragenter(IHTMLElement2
*iface
, VARIANT
*p
)
2149 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2150 FIXME("(%p)->(%p)\n", This
, p
);
2154 static HRESULT WINAPI
HTMLElement2_put_ondragover(IHTMLElement2
*iface
, VARIANT v
)
2156 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2157 FIXME("(%p)->()\n", This
);
2161 static HRESULT WINAPI
HTMLElement2_get_ondragover(IHTMLElement2
*iface
, VARIANT
*p
)
2163 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2164 FIXME("(%p)->(%p)\n", This
, p
);
2168 static HRESULT WINAPI
HTMLElement2_put_ondragleave(IHTMLElement2
*iface
, VARIANT v
)
2170 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2171 FIXME("(%p)->()\n", This
);
2175 static HRESULT WINAPI
HTMLElement2_get_ondragleave(IHTMLElement2
*iface
, VARIANT
*p
)
2177 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2178 FIXME("(%p)->(%p)\n", This
, p
);
2182 static HRESULT WINAPI
HTMLElement2_put_ondrop(IHTMLElement2
*iface
, VARIANT v
)
2184 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2185 FIXME("(%p)->()\n", This
);
2189 static HRESULT WINAPI
HTMLElement2_get_ondrop(IHTMLElement2
*iface
, VARIANT
*p
)
2191 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2192 FIXME("(%p)->(%p)\n", This
, p
);
2196 static HRESULT WINAPI
HTMLElement2_put_onbeforecut(IHTMLElement2
*iface
, VARIANT v
)
2198 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2199 FIXME("(%p)->()\n", This
);
2203 static HRESULT WINAPI
HTMLElement2_get_onbeforecut(IHTMLElement2
*iface
, VARIANT
*p
)
2205 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2206 FIXME("(%p)->(%p)\n", This
, p
);
2210 static HRESULT WINAPI
HTMLElement2_put_oncut(IHTMLElement2
*iface
, VARIANT v
)
2212 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2213 FIXME("(%p)->()\n", This
);
2217 static HRESULT WINAPI
HTMLElement2_get_oncut(IHTMLElement2
*iface
, VARIANT
*p
)
2219 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2220 FIXME("(%p)->(%p)\n", This
, p
);
2224 static HRESULT WINAPI
HTMLElement2_put_onbeforecopy(IHTMLElement2
*iface
, VARIANT v
)
2226 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2227 FIXME("(%p)->()\n", This
);
2231 static HRESULT WINAPI
HTMLElement2_get_onbeforecopy(IHTMLElement2
*iface
, VARIANT
*p
)
2233 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2234 FIXME("(%p)->(%p)\n", This
, p
);
2238 static HRESULT WINAPI
HTMLElement2_put_oncopy(IHTMLElement2
*iface
, VARIANT v
)
2240 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2241 FIXME("(%p)->()\n", This
);
2245 static HRESULT WINAPI
HTMLElement2_get_oncopy(IHTMLElement2
*iface
, VARIANT
*p
)
2247 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2248 FIXME("(%p)->(%p)\n", This
, p
);
2252 static HRESULT WINAPI
HTMLElement2_put_onbeforepaste(IHTMLElement2
*iface
, VARIANT v
)
2254 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2255 FIXME("(%p)->()\n", This
);
2259 static HRESULT WINAPI
HTMLElement2_get_onbeforepaste(IHTMLElement2
*iface
, VARIANT
*p
)
2261 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2262 FIXME("(%p)->(%p)\n", This
, p
);
2266 static HRESULT WINAPI
HTMLElement2_put_onpaste(IHTMLElement2
*iface
, VARIANT v
)
2268 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2270 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2272 return set_node_event(&This
->node
, EVENTID_PASTE
, &v
);
2275 static HRESULT WINAPI
HTMLElement2_get_onpaste(IHTMLElement2
*iface
, VARIANT
*p
)
2277 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2279 TRACE("(%p)->(%p)\n", This
, p
);
2281 return get_node_event(&This
->node
, EVENTID_PASTE
, p
);
2284 static HRESULT WINAPI
HTMLElement2_get_currentStyle(IHTMLElement2
*iface
, IHTMLCurrentStyle
**p
)
2286 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2288 TRACE("(%p)->(%p)\n", This
, p
);
2290 return HTMLCurrentStyle_Create(This
, p
);
2293 static HRESULT WINAPI
HTMLElement2_put_onpropertychange(IHTMLElement2
*iface
, VARIANT v
)
2295 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2296 FIXME("(%p)->()\n", This
);
2300 static HRESULT WINAPI
HTMLElement2_get_onpropertychange(IHTMLElement2
*iface
, VARIANT
*p
)
2302 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2303 FIXME("(%p)->(%p)\n", This
, p
);
2307 static HRESULT WINAPI
HTMLElement2_getClientRects(IHTMLElement2
*iface
, IHTMLRectCollection
**pRectCol
)
2309 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2310 FIXME("(%p)->(%p)\n", This
, pRectCol
);
2314 static HRESULT WINAPI
HTMLElement2_getBoundingClientRect(IHTMLElement2
*iface
, IHTMLRect
**pRect
)
2316 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2317 nsIDOMClientRect
*nsrect
;
2321 TRACE("(%p)->(%p)\n", This
, pRect
);
2323 nsres
= nsIDOMHTMLElement_GetBoundingClientRect(This
->nselem
, &nsrect
);
2324 if(NS_FAILED(nsres
) || !nsrect
) {
2325 ERR("GetBoindingClientRect failed: %08x\n", nsres
);
2329 hres
= create_html_rect(nsrect
, pRect
);
2331 nsIDOMClientRect_Release(nsrect
);
2335 static HRESULT WINAPI
HTMLElement2_setExpression(IHTMLElement2
*iface
, BSTR propname
,
2336 BSTR expression
, BSTR language
)
2338 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2339 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(propname
), debugstr_w(expression
),
2340 debugstr_w(language
));
2344 static HRESULT WINAPI
HTMLElement2_getExpression(IHTMLElement2
*iface
, BSTR propname
,
2345 VARIANT
*expression
)
2347 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2348 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), expression
);
2352 static HRESULT WINAPI
HTMLElement2_removeExpression(IHTMLElement2
*iface
, BSTR propname
,
2353 VARIANT_BOOL
*pfSuccess
)
2355 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2356 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(propname
), pfSuccess
);
2360 static HRESULT WINAPI
HTMLElement2_put_tabIndex(IHTMLElement2
*iface
, short v
)
2362 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2365 TRACE("(%p)->(%d)\n", This
, v
);
2367 nsres
= nsIDOMHTMLElement_SetTabIndex(This
->nselem
, v
);
2368 if(NS_FAILED(nsres
))
2369 ERR("GetTabIndex failed: %08x\n", nsres
);
2374 static HRESULT WINAPI
HTMLElement2_get_tabIndex(IHTMLElement2
*iface
, short *p
)
2376 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2380 TRACE("(%p)->(%p)\n", This
, p
);
2382 nsres
= nsIDOMHTMLElement_GetTabIndex(This
->nselem
, &index
);
2383 if(NS_FAILED(nsres
)) {
2384 ERR("GetTabIndex failed: %08x\n", nsres
);
2392 static HRESULT WINAPI
HTMLElement2_focus(IHTMLElement2
*iface
)
2394 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2397 TRACE("(%p)\n", This
);
2399 nsres
= nsIDOMHTMLElement_Focus(This
->nselem
);
2400 if(NS_FAILED(nsres
))
2401 ERR("Focus failed: %08x\n", nsres
);
2406 static HRESULT WINAPI
HTMLElement2_put_accessKey(IHTMLElement2
*iface
, BSTR v
)
2408 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2411 static WCHAR accessKeyW
[] = {'a','c','c','e','s','s','K','e','y',0};
2413 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2415 V_VT(&var
) = VT_BSTR
;
2417 return IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, accessKeyW
, var
, 0);
2420 static HRESULT WINAPI
HTMLElement2_get_accessKey(IHTMLElement2
*iface
, BSTR
*p
)
2422 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2423 FIXME("(%p)->(%p)\n", This
, p
);
2427 static HRESULT WINAPI
HTMLElement2_put_onblur(IHTMLElement2
*iface
, VARIANT v
)
2429 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2431 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2433 return set_node_event(&This
->node
, EVENTID_BLUR
, &v
);
2436 static HRESULT WINAPI
HTMLElement2_get_onblur(IHTMLElement2
*iface
, VARIANT
*p
)
2438 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2440 TRACE("(%p)->(%p)\n", This
, p
);
2442 return get_node_event(&This
->node
, EVENTID_BLUR
, p
);
2445 static HRESULT WINAPI
HTMLElement2_put_onfocus(IHTMLElement2
*iface
, VARIANT v
)
2447 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2449 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2451 return set_node_event(&This
->node
, EVENTID_FOCUS
, &v
);
2454 static HRESULT WINAPI
HTMLElement2_get_onfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2456 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2458 TRACE("(%p)->(%p)\n", This
, p
);
2460 return get_node_event(&This
->node
, EVENTID_FOCUS
, p
);
2463 static HRESULT WINAPI
HTMLElement2_put_onresize(IHTMLElement2
*iface
, VARIANT v
)
2465 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2466 FIXME("(%p)->()\n", This
);
2470 static HRESULT WINAPI
HTMLElement2_get_onresize(IHTMLElement2
*iface
, VARIANT
*p
)
2472 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2473 FIXME("(%p)->(%p)\n", This
, p
);
2477 static HRESULT WINAPI
HTMLElement2_blur(IHTMLElement2
*iface
)
2479 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2482 TRACE("(%p)\n", This
);
2484 nsres
= nsIDOMHTMLElement_Blur(This
->nselem
);
2485 if(NS_FAILED(nsres
)) {
2486 ERR("Blur failed: %08x\n", nsres
);
2493 static HRESULT WINAPI
HTMLElement2_addFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2495 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2496 FIXME("(%p)->(%p)\n", This
, pUnk
);
2500 static HRESULT WINAPI
HTMLElement2_removeFilter(IHTMLElement2
*iface
, IUnknown
*pUnk
)
2502 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2503 FIXME("(%p)->(%p)\n", This
, pUnk
);
2507 static HRESULT WINAPI
HTMLElement2_get_clientHeight(IHTMLElement2
*iface
, LONG
*p
)
2509 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2512 TRACE("(%p)->(%p)\n", This
, p
);
2514 nsres
= nsIDOMHTMLElement_GetClientHeight(This
->nselem
, p
);
2515 assert(nsres
== NS_OK
);
2519 static HRESULT WINAPI
HTMLElement2_get_clientWidth(IHTMLElement2
*iface
, LONG
*p
)
2521 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2524 TRACE("(%p)->(%p)\n", This
, p
);
2526 nsres
= nsIDOMHTMLElement_GetClientWidth(This
->nselem
, p
);
2527 assert(nsres
== NS_OK
);
2531 static HRESULT WINAPI
HTMLElement2_get_clientTop(IHTMLElement2
*iface
, LONG
*p
)
2533 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2536 TRACE("(%p)->(%p)\n", This
, p
);
2538 nsres
= nsIDOMHTMLElement_GetClientTop(This
->nselem
, p
);
2539 assert(nsres
== NS_OK
);
2541 TRACE("*p = %d\n", *p
);
2545 static HRESULT WINAPI
HTMLElement2_get_clientLeft(IHTMLElement2
*iface
, LONG
*p
)
2547 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2550 TRACE("(%p)->(%p)\n", This
, p
);
2552 nsres
= nsIDOMHTMLElement_GetClientLeft(This
->nselem
, p
);
2553 assert(nsres
== NS_OK
);
2555 TRACE("*p = %d\n", *p
);
2559 static HRESULT WINAPI
HTMLElement2_attachEvent(IHTMLElement2
*iface
, BSTR event
,
2560 IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
2562 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2564 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2566 return attach_event(get_node_event_target(&This
->node
), &This
->node
.doc
->basedoc
, event
, pDisp
, pfResult
);
2569 static HRESULT WINAPI
HTMLElement2_detachEvent(IHTMLElement2
*iface
, BSTR event
, IDispatch
*pDisp
)
2571 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2573 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2575 return detach_event(*get_node_event_target(&This
->node
), &This
->node
.doc
->basedoc
, event
, pDisp
);
2578 static HRESULT WINAPI
HTMLElement2_get_readyState(IHTMLElement2
*iface
, VARIANT
*p
)
2580 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2583 TRACE("(%p)->(%p)\n", This
, p
);
2585 if(This
->node
.vtbl
->get_readystate
) {
2588 hres
= This
->node
.vtbl
->get_readystate(&This
->node
, &str
);
2592 static const WCHAR completeW
[] = {'c','o','m','p','l','e','t','e',0};
2594 str
= SysAllocString(completeW
);
2596 return E_OUTOFMEMORY
;
2604 static HRESULT WINAPI
HTMLElement2_put_onreadystatechange(IHTMLElement2
*iface
, VARIANT v
)
2606 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2608 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2610 return set_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, &v
);
2613 static HRESULT WINAPI
HTMLElement2_get_onreadystatechange(IHTMLElement2
*iface
, VARIANT
*p
)
2615 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2617 TRACE("(%p)->(%p)\n", This
, p
);
2619 return get_node_event(&This
->node
, EVENTID_READYSTATECHANGE
, p
);
2622 static HRESULT WINAPI
HTMLElement2_put_onrowsdelete(IHTMLElement2
*iface
, VARIANT v
)
2624 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2625 FIXME("(%p)->()\n", This
);
2629 static HRESULT WINAPI
HTMLElement2_get_onrowsdelete(IHTMLElement2
*iface
, VARIANT
*p
)
2631 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2632 FIXME("(%p)->(%p)\n", This
, p
);
2636 static HRESULT WINAPI
HTMLElement2_put_onrowsinserted(IHTMLElement2
*iface
, VARIANT v
)
2638 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2639 FIXME("(%p)->()\n", This
);
2643 static HRESULT WINAPI
HTMLElement2_get_onrowsinserted(IHTMLElement2
*iface
, VARIANT
*p
)
2645 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2646 FIXME("(%p)->(%p)\n", This
, p
);
2650 static HRESULT WINAPI
HTMLElement2_put_oncellchange(IHTMLElement2
*iface
, VARIANT v
)
2652 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2653 FIXME("(%p)->()\n", This
);
2657 static HRESULT WINAPI
HTMLElement2_get_oncellchange(IHTMLElement2
*iface
, VARIANT
*p
)
2659 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2660 FIXME("(%p)->(%p)\n", This
, p
);
2664 static HRESULT WINAPI
HTMLElement2_put_dir(IHTMLElement2
*iface
, BSTR v
)
2666 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2670 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2673 FIXME("Unsupported for comment nodes.\n");
2677 nsAString_InitDepend(&nsstr
, v
);
2678 nsres
= nsIDOMHTMLElement_SetDir(This
->nselem
, &nsstr
);
2679 nsAString_Finish(&nsstr
);
2680 if(NS_FAILED(nsres
)) {
2681 ERR("SetDir failed: %08x\n", nsres
);
2688 static HRESULT WINAPI
HTMLElement2_get_dir(IHTMLElement2
*iface
, BSTR
*p
)
2690 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2694 TRACE("(%p)->(%p)\n", This
, p
);
2701 nsAString_Init(&dir_str
, NULL
);
2702 nsres
= nsIDOMHTMLElement_GetDir(This
->nselem
, &dir_str
);
2703 return return_nsstr(nsres
, &dir_str
, p
);
2706 static HRESULT WINAPI
HTMLElement2_createControlRange(IHTMLElement2
*iface
, IDispatch
**range
)
2708 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2709 FIXME("(%p)->(%p)\n", This
, range
);
2713 static HRESULT WINAPI
HTMLElement2_get_scrollHeight(IHTMLElement2
*iface
, LONG
*p
)
2715 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2718 TRACE("(%p)->(%p)\n", This
, p
);
2720 nsres
= nsIDOMHTMLElement_GetScrollHeight(This
->nselem
, p
);
2721 assert(nsres
== NS_OK
);
2723 TRACE("*p = %d\n", *p
);
2727 static HRESULT WINAPI
HTMLElement2_get_scrollWidth(IHTMLElement2
*iface
, LONG
*p
)
2729 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2732 TRACE("(%p)->(%p)\n", This
, p
);
2734 nsres
= nsIDOMHTMLElement_GetScrollWidth(This
->nselem
, p
);
2735 assert(nsres
== NS_OK
);
2737 TRACE("*p = %d\n", *p
);
2741 static HRESULT WINAPI
HTMLElement2_put_scrollTop(IHTMLElement2
*iface
, LONG v
)
2743 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2745 TRACE("(%p)->(%d)\n", This
, v
);
2748 FIXME("NULL nselem\n");
2752 nsIDOMHTMLElement_SetScrollTop(This
->nselem
, v
);
2756 static HRESULT WINAPI
HTMLElement2_get_scrollTop(IHTMLElement2
*iface
, LONG
*p
)
2758 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2761 TRACE("(%p)->(%p)\n", This
, p
);
2763 nsres
= nsIDOMHTMLElement_GetScrollTop(This
->nselem
, p
);
2764 assert(nsres
== NS_OK
);
2766 TRACE("*p = %d\n", *p
);
2770 static HRESULT WINAPI
HTMLElement2_put_scrollLeft(IHTMLElement2
*iface
, LONG v
)
2772 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2774 TRACE("(%p)->(%d)\n", This
, v
);
2777 FIXME("NULL nselem\n");
2781 nsIDOMHTMLElement_SetScrollLeft(This
->nselem
, v
);
2785 static HRESULT WINAPI
HTMLElement2_get_scrollLeft(IHTMLElement2
*iface
, LONG
*p
)
2787 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2790 TRACE("(%p)->(%p)\n", This
, p
);
2793 return E_INVALIDARG
;
2797 FIXME("NULL nselem\n");
2801 nsres
= nsIDOMHTMLElement_GetScrollLeft(This
->nselem
, p
);
2802 assert(nsres
== NS_OK
);
2804 TRACE("*p = %d\n", *p
);
2808 static HRESULT WINAPI
HTMLElement2_clearAttributes(IHTMLElement2
*iface
)
2810 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2811 FIXME("(%p)\n", This
);
2815 static HRESULT WINAPI
HTMLElement2_mergeAttributes(IHTMLElement2
*iface
, IHTMLElement
*mergeThis
)
2817 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2818 FIXME("(%p)->(%p)\n", This
, mergeThis
);
2822 static HRESULT WINAPI
HTMLElement2_put_oncontextmenu(IHTMLElement2
*iface
, VARIANT v
)
2824 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2825 FIXME("(%p)->()\n", This
);
2829 static HRESULT WINAPI
HTMLElement2_get_oncontextmenu(IHTMLElement2
*iface
, VARIANT
*p
)
2831 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2832 FIXME("(%p)->(%p)\n", This
, p
);
2836 static HRESULT WINAPI
HTMLElement2_insertAdjacentElement(IHTMLElement2
*iface
, BSTR where
,
2837 IHTMLElement
*insertedElement
, IHTMLElement
**inserted
)
2839 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2840 HTMLDOMNode
*ret_node
;
2844 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(where
), insertedElement
, inserted
);
2846 elem
= unsafe_impl_from_IHTMLElement(insertedElement
);
2848 return E_INVALIDARG
;
2850 hres
= insert_adjacent_node(This
, where
, elem
->node
.nsnode
, &ret_node
);
2854 hres
= IHTMLDOMNode_QueryInterface(&ret_node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)inserted
);
2855 IHTMLDOMNode_Release(&ret_node
->IHTMLDOMNode_iface
);
2859 static HRESULT WINAPI
HTMLElement2_applyElement(IHTMLElement2
*iface
, IHTMLElement
*apply
,
2860 BSTR where
, IHTMLElement
**applied
)
2862 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2863 FIXME("(%p)->(%p %s %p)\n", This
, apply
, debugstr_w(where
), applied
);
2867 static HRESULT WINAPI
HTMLElement2_getAdjacentText(IHTMLElement2
*iface
, BSTR where
, BSTR
*text
)
2869 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2870 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(where
), text
);
2874 static HRESULT WINAPI
HTMLElement2_replaceAdjacentText(IHTMLElement2
*iface
, BSTR where
,
2875 BSTR newText
, BSTR
*oldText
)
2877 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2878 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(where
), debugstr_w(newText
), oldText
);
2882 static HRESULT WINAPI
HTMLElement2_get_canHandleChildren(IHTMLElement2
*iface
, VARIANT_BOOL
*p
)
2884 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2885 FIXME("(%p)->(%p)\n", This
, p
);
2889 static HRESULT WINAPI
HTMLElement2_addBehavior(IHTMLElement2
*iface
, BSTR bstrUrl
,
2890 VARIANT
*pvarFactory
, LONG
*pCookie
)
2892 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2893 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrUrl
), pvarFactory
, pCookie
);
2897 static HRESULT WINAPI
HTMLElement2_removeBehavior(IHTMLElement2
*iface
, LONG cookie
,
2898 VARIANT_BOOL
*pfResult
)
2900 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2901 FIXME("(%p)->(%d %p)\n", This
, cookie
, pfResult
);
2905 static HRESULT WINAPI
HTMLElement2_get_runtimeStyle(IHTMLElement2
*iface
, IHTMLStyle
**p
)
2907 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2909 FIXME("(%p)->(%p): hack\n", This
, p
);
2911 /* We can't implement correct behavior on top of Gecko (although we could
2912 try a bit harder). Making runtimeStyle behave like regular style is
2913 enough for most use cases. */
2914 if(!This
->runtime_style
) {
2917 hres
= HTMLStyle_Create(This
, &This
->runtime_style
);
2922 *p
= &This
->runtime_style
->IHTMLStyle_iface
;
2923 IHTMLStyle_AddRef(*p
);
2927 static HRESULT WINAPI
HTMLElement2_get_behaviorUrns(IHTMLElement2
*iface
, IDispatch
**p
)
2929 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2930 FIXME("(%p)->(%p)\n", This
, p
);
2934 static HRESULT WINAPI
HTMLElement2_put_tagUrn(IHTMLElement2
*iface
, BSTR v
)
2936 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2937 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2941 static HRESULT WINAPI
HTMLElement2_get_tagUrn(IHTMLElement2
*iface
, BSTR
*p
)
2943 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2944 FIXME("(%p)->(%p)\n", This
, p
);
2948 static HRESULT WINAPI
HTMLElement2_put_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT vv
)
2950 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2951 FIXME("(%p)->()\n", This
);
2955 static HRESULT WINAPI
HTMLElement2_get_onbeforeeditfocus(IHTMLElement2
*iface
, VARIANT
*p
)
2957 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2958 FIXME("(%p)->(%p)\n", This
, p
);
2962 static HRESULT WINAPI
HTMLElement2_get_readyStateValue(IHTMLElement2
*iface
, LONG
*p
)
2964 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2965 FIXME("(%p)->(%p)\n", This
, p
);
2969 static HRESULT WINAPI
HTMLElement2_getElementsByTagName(IHTMLElement2
*iface
, BSTR v
,
2970 IHTMLElementCollection
**pelColl
)
2972 HTMLElement
*This
= impl_from_IHTMLElement2(iface
);
2973 nsIDOMHTMLCollection
*nscol
;
2977 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2979 nsAString_InitDepend(&tag_str
, v
);
2980 nsres
= nsIDOMHTMLElement_GetElementsByTagName(This
->nselem
, &tag_str
, &nscol
);
2981 nsAString_Finish(&tag_str
);
2982 if(NS_FAILED(nsres
)) {
2983 ERR("GetElementByTagName failed: %08x\n", nsres
);
2987 *pelColl
= create_collection_from_htmlcol(This
->node
.doc
, nscol
);
2988 nsIDOMHTMLCollection_Release(nscol
);
2992 static const IHTMLElement2Vtbl HTMLElement2Vtbl
= {
2993 HTMLElement2_QueryInterface
,
2994 HTMLElement2_AddRef
,
2995 HTMLElement2_Release
,
2996 HTMLElement2_GetTypeInfoCount
,
2997 HTMLElement2_GetTypeInfo
,
2998 HTMLElement2_GetIDsOfNames
,
2999 HTMLElement2_Invoke
,
3000 HTMLElement2_get_scopeName
,
3001 HTMLElement2_setCapture
,
3002 HTMLElement2_releaseCapture
,
3003 HTMLElement2_put_onlosecapture
,
3004 HTMLElement2_get_onlosecapture
,
3005 HTMLElement2_componentFromPoint
,
3006 HTMLElement2_doScroll
,
3007 HTMLElement2_put_onscroll
,
3008 HTMLElement2_get_onscroll
,
3009 HTMLElement2_put_ondrag
,
3010 HTMLElement2_get_ondrag
,
3011 HTMLElement2_put_ondragend
,
3012 HTMLElement2_get_ondragend
,
3013 HTMLElement2_put_ondragenter
,
3014 HTMLElement2_get_ondragenter
,
3015 HTMLElement2_put_ondragover
,
3016 HTMLElement2_get_ondragover
,
3017 HTMLElement2_put_ondragleave
,
3018 HTMLElement2_get_ondragleave
,
3019 HTMLElement2_put_ondrop
,
3020 HTMLElement2_get_ondrop
,
3021 HTMLElement2_put_onbeforecut
,
3022 HTMLElement2_get_onbeforecut
,
3023 HTMLElement2_put_oncut
,
3024 HTMLElement2_get_oncut
,
3025 HTMLElement2_put_onbeforecopy
,
3026 HTMLElement2_get_onbeforecopy
,
3027 HTMLElement2_put_oncopy
,
3028 HTMLElement2_get_oncopy
,
3029 HTMLElement2_put_onbeforepaste
,
3030 HTMLElement2_get_onbeforepaste
,
3031 HTMLElement2_put_onpaste
,
3032 HTMLElement2_get_onpaste
,
3033 HTMLElement2_get_currentStyle
,
3034 HTMLElement2_put_onpropertychange
,
3035 HTMLElement2_get_onpropertychange
,
3036 HTMLElement2_getClientRects
,
3037 HTMLElement2_getBoundingClientRect
,
3038 HTMLElement2_setExpression
,
3039 HTMLElement2_getExpression
,
3040 HTMLElement2_removeExpression
,
3041 HTMLElement2_put_tabIndex
,
3042 HTMLElement2_get_tabIndex
,
3044 HTMLElement2_put_accessKey
,
3045 HTMLElement2_get_accessKey
,
3046 HTMLElement2_put_onblur
,
3047 HTMLElement2_get_onblur
,
3048 HTMLElement2_put_onfocus
,
3049 HTMLElement2_get_onfocus
,
3050 HTMLElement2_put_onresize
,
3051 HTMLElement2_get_onresize
,
3053 HTMLElement2_addFilter
,
3054 HTMLElement2_removeFilter
,
3055 HTMLElement2_get_clientHeight
,
3056 HTMLElement2_get_clientWidth
,
3057 HTMLElement2_get_clientTop
,
3058 HTMLElement2_get_clientLeft
,
3059 HTMLElement2_attachEvent
,
3060 HTMLElement2_detachEvent
,
3061 HTMLElement2_get_readyState
,
3062 HTMLElement2_put_onreadystatechange
,
3063 HTMLElement2_get_onreadystatechange
,
3064 HTMLElement2_put_onrowsdelete
,
3065 HTMLElement2_get_onrowsdelete
,
3066 HTMLElement2_put_onrowsinserted
,
3067 HTMLElement2_get_onrowsinserted
,
3068 HTMLElement2_put_oncellchange
,
3069 HTMLElement2_get_oncellchange
,
3070 HTMLElement2_put_dir
,
3071 HTMLElement2_get_dir
,
3072 HTMLElement2_createControlRange
,
3073 HTMLElement2_get_scrollHeight
,
3074 HTMLElement2_get_scrollWidth
,
3075 HTMLElement2_put_scrollTop
,
3076 HTMLElement2_get_scrollTop
,
3077 HTMLElement2_put_scrollLeft
,
3078 HTMLElement2_get_scrollLeft
,
3079 HTMLElement2_clearAttributes
,
3080 HTMLElement2_mergeAttributes
,
3081 HTMLElement2_put_oncontextmenu
,
3082 HTMLElement2_get_oncontextmenu
,
3083 HTMLElement2_insertAdjacentElement
,
3084 HTMLElement2_applyElement
,
3085 HTMLElement2_getAdjacentText
,
3086 HTMLElement2_replaceAdjacentText
,
3087 HTMLElement2_get_canHandleChildren
,
3088 HTMLElement2_addBehavior
,
3089 HTMLElement2_removeBehavior
,
3090 HTMLElement2_get_runtimeStyle
,
3091 HTMLElement2_get_behaviorUrns
,
3092 HTMLElement2_put_tagUrn
,
3093 HTMLElement2_get_tagUrn
,
3094 HTMLElement2_put_onbeforeeditfocus
,
3095 HTMLElement2_get_onbeforeeditfocus
,
3096 HTMLElement2_get_readyStateValue
,
3097 HTMLElement2_getElementsByTagName
,
3100 static inline HTMLElement
*impl_from_IHTMLElement3(IHTMLElement3
*iface
)
3102 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement3_iface
);
3105 static HRESULT WINAPI
HTMLElement3_QueryInterface(IHTMLElement3
*iface
,
3106 REFIID riid
, void **ppv
)
3108 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3109 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3112 static ULONG WINAPI
HTMLElement3_AddRef(IHTMLElement3
*iface
)
3114 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3115 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3118 static ULONG WINAPI
HTMLElement3_Release(IHTMLElement3
*iface
)
3120 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3121 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3124 static HRESULT WINAPI
HTMLElement3_GetTypeInfoCount(IHTMLElement3
*iface
, UINT
*pctinfo
)
3126 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3127 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
3130 static HRESULT WINAPI
HTMLElement3_GetTypeInfo(IHTMLElement3
*iface
, UINT iTInfo
,
3131 LCID lcid
, ITypeInfo
**ppTInfo
)
3133 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3134 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3137 static HRESULT WINAPI
HTMLElement3_GetIDsOfNames(IHTMLElement3
*iface
, REFIID riid
,
3138 LPOLESTR
*rgszNames
, UINT cNames
,
3139 LCID lcid
, DISPID
*rgDispId
)
3141 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3142 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3146 static HRESULT WINAPI
HTMLElement3_Invoke(IHTMLElement3
*iface
, DISPID dispIdMember
,
3147 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3148 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3150 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3151 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3152 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3155 static HRESULT WINAPI
HTMLElement3_mergeAttributes(IHTMLElement3
*iface
, IHTMLElement
*mergeThis
, VARIANT
*pvarFlags
)
3157 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3158 FIXME("(%p)->(%p %p)\n", This
, mergeThis
, pvarFlags
);
3162 static HRESULT WINAPI
HTMLElement3_get_isMultiLine(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3164 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3165 FIXME("(%p)->(%p)\n", This
, p
);
3169 static HRESULT WINAPI
HTMLElement3_get_canHaveHTML(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3171 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3172 FIXME("(%p)->(%p)\n", This
, p
);
3176 static HRESULT WINAPI
HTMLElement3_put_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT v
)
3178 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3179 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3183 static HRESULT WINAPI
HTMLElement3_get_onlayoutcomplete(IHTMLElement3
*iface
, VARIANT
*p
)
3185 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3186 FIXME("(%p)->(%p)\n", This
, p
);
3190 static HRESULT WINAPI
HTMLElement3_put_onpage(IHTMLElement3
*iface
, VARIANT v
)
3192 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3193 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3197 static HRESULT WINAPI
HTMLElement3_get_onpage(IHTMLElement3
*iface
, VARIANT
*p
)
3199 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3200 FIXME("(%p)->(%p)\n", This
, p
);
3204 static HRESULT WINAPI
HTMLElement3_put_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3206 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3207 FIXME("(%p)->(%x)\n", This
, v
);
3211 static HRESULT WINAPI
HTMLElement3_get_inflateBlock(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3213 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3214 FIXME("(%p)->(%p)\n", This
, p
);
3218 static HRESULT WINAPI
HTMLElement3_put_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT v
)
3220 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3221 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3225 static HRESULT WINAPI
HTMLElement3_get_onbeforedeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3227 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3228 FIXME("(%p)->(%p)\n", This
, p
);
3232 static HRESULT WINAPI
HTMLElement3_setActive(IHTMLElement3
*iface
)
3234 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3235 FIXME("(%p)\n", This
);
3239 static HRESULT WINAPI
HTMLElement3_put_contentEditable(IHTMLElement3
*iface
, BSTR v
)
3241 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3245 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
3247 nsAString_InitDepend(&str
, v
);
3248 nsres
= nsIDOMHTMLElement_SetContentEditable(This
->nselem
, &str
);
3249 nsAString_Finish(&str
);
3251 if (NS_FAILED(nsres
)){
3252 ERR("SetContentEditable(%s) failed!\n", debugstr_w(v
));
3259 static HRESULT WINAPI
HTMLElement3_get_contentEditable(IHTMLElement3
*iface
, BSTR
*p
)
3261 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3265 TRACE("(%p)->(%p)\n", This
, p
);
3267 nsAString_Init(&str
, NULL
);
3268 nsres
= nsIDOMHTMLElement_GetContentEditable(This
->nselem
, &str
);
3269 return return_nsstr(nsres
, &str
, p
);
3272 static HRESULT WINAPI
HTMLElement3_get_isContentEditable(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3274 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3275 FIXME("(%p)->(%p)\n", This
, p
);
3279 static HRESULT WINAPI
HTMLElement3_put_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3281 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3282 FIXME("(%p)->(%x)\n", This
, v
);
3286 static HRESULT WINAPI
HTMLElement3_get_hideFocus(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3288 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3289 FIXME("(%p)->(%p)\n", This
, p
);
3293 static const WCHAR disabledW
[] = {'d','i','s','a','b','l','e','d',0};
3295 static HRESULT WINAPI
HTMLElement3_put_disabled(IHTMLElement3
*iface
, VARIANT_BOOL v
)
3297 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3301 TRACE("(%p)->(%x)\n", This
, v
);
3303 if(This
->node
.vtbl
->put_disabled
)
3304 return This
->node
.vtbl
->put_disabled(&This
->node
, v
);
3306 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, disabledW
, TRUE
, &var
);
3311 V_VT(var
) = VT_BOOL
;
3316 static HRESULT WINAPI
HTMLElement3_get_disabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3318 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3322 TRACE("(%p)->(%p)\n", This
, p
);
3324 if(This
->node
.vtbl
->get_disabled
)
3325 return This
->node
.vtbl
->get_disabled(&This
->node
, p
);
3327 hres
= dispex_get_dprop_ref(&This
->node
.dispex
, disabledW
, FALSE
, &var
);
3328 if(hres
== DISP_E_UNKNOWNNAME
) {
3335 if(V_VT(var
) != VT_BOOL
) {
3336 FIXME("value is %s\n", debugstr_variant(var
));
3344 static HRESULT WINAPI
HTMLElement3_get_isDisabled(IHTMLElement3
*iface
, VARIANT_BOOL
*p
)
3346 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3347 FIXME("(%p)->(%p)\n", This
, p
);
3351 static HRESULT WINAPI
HTMLElement3_put_onmove(IHTMLElement3
*iface
, VARIANT v
)
3353 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3354 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3358 static HRESULT WINAPI
HTMLElement3_get_onmove(IHTMLElement3
*iface
, VARIANT
*p
)
3360 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3361 FIXME("(%p)->(%p)\n", This
, p
);
3365 static HRESULT WINAPI
HTMLElement3_put_oncontrolselect(IHTMLElement3
*iface
, VARIANT v
)
3367 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3368 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3372 static HRESULT WINAPI
HTMLElement3_get_oncontrolselect(IHTMLElement3
*iface
, VARIANT
*p
)
3374 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3375 FIXME("(%p)->(%p)\n", This
, p
);
3379 static HRESULT WINAPI
HTMLElement3_fireEvent(IHTMLElement3
*iface
, BSTR bstrEventName
,
3380 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCancelled
)
3382 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3384 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrEventName
), debugstr_variant(pvarEventObject
),
3387 return dispatch_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCancelled
);
3390 static HRESULT WINAPI
HTMLElement3_put_onresizestart(IHTMLElement3
*iface
, VARIANT v
)
3392 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3393 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3397 static HRESULT WINAPI
HTMLElement3_get_onresizestart(IHTMLElement3
*iface
, VARIANT
*p
)
3399 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3400 FIXME("(%p)->(%p)\n", This
, p
);
3404 static HRESULT WINAPI
HTMLElement3_put_onresizeend(IHTMLElement3
*iface
, VARIANT v
)
3406 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3407 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3411 static HRESULT WINAPI
HTMLElement3_get_onresizeend(IHTMLElement3
*iface
, VARIANT
*p
)
3413 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3414 FIXME("(%p)->(%p)\n", This
, p
);
3418 static HRESULT WINAPI
HTMLElement3_put_onmovestart(IHTMLElement3
*iface
, VARIANT v
)
3420 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3421 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3425 static HRESULT WINAPI
HTMLElement3_get_onmovestart(IHTMLElement3
*iface
, VARIANT
*p
)
3427 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3428 FIXME("(%p)->(%p)\n", This
, p
);
3432 static HRESULT WINAPI
HTMLElement3_put_onmoveend(IHTMLElement3
*iface
, VARIANT v
)
3434 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3435 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3439 static HRESULT WINAPI
HTMLElement3_get_onmoveend(IHTMLElement3
*iface
, VARIANT
*p
)
3441 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3442 FIXME("(%p)->(%p)\n", This
, p
);
3446 static HRESULT WINAPI
HTMLElement3_put_onmousecenter(IHTMLElement3
*iface
, VARIANT v
)
3448 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3449 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3453 static HRESULT WINAPI
HTMLElement3_get_onmousecenter(IHTMLElement3
*iface
, VARIANT
*p
)
3455 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3456 FIXME("(%p)->(%p)\n", This
, p
);
3460 static HRESULT WINAPI
HTMLElement3_put_onmouseleave(IHTMLElement3
*iface
, VARIANT v
)
3462 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3463 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3467 static HRESULT WINAPI
HTMLElement3_get_onmouseleave(IHTMLElement3
*iface
, VARIANT
*p
)
3469 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3470 FIXME("(%p)->(%p)\n", This
, p
);
3474 static HRESULT WINAPI
HTMLElement3_put_onactivate(IHTMLElement3
*iface
, VARIANT v
)
3476 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3477 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3481 static HRESULT WINAPI
HTMLElement3_get_onactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3483 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3484 FIXME("(%p)->(%p)\n", This
, p
);
3488 static HRESULT WINAPI
HTMLElement3_put_ondeactivate(IHTMLElement3
*iface
, VARIANT v
)
3490 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3491 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3495 static HRESULT WINAPI
HTMLElement3_get_ondeactivate(IHTMLElement3
*iface
, VARIANT
*p
)
3497 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3498 FIXME("(%p)->(%p)\n", This
, p
);
3502 static HRESULT WINAPI
HTMLElement3_dragDrop(IHTMLElement3
*iface
, VARIANT_BOOL
*pfRet
)
3504 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3505 FIXME("(%p)->(%p)\n", This
, pfRet
);
3509 static HRESULT WINAPI
HTMLElement3_get_glyphMode(IHTMLElement3
*iface
, LONG
*p
)
3511 HTMLElement
*This
= impl_from_IHTMLElement3(iface
);
3512 FIXME("(%p)->(%p)\n", This
, p
);
3516 static const IHTMLElement3Vtbl HTMLElement3Vtbl
= {
3517 HTMLElement3_QueryInterface
,
3518 HTMLElement3_AddRef
,
3519 HTMLElement3_Release
,
3520 HTMLElement3_GetTypeInfoCount
,
3521 HTMLElement3_GetTypeInfo
,
3522 HTMLElement3_GetIDsOfNames
,
3523 HTMLElement3_Invoke
,
3524 HTMLElement3_mergeAttributes
,
3525 HTMLElement3_get_isMultiLine
,
3526 HTMLElement3_get_canHaveHTML
,
3527 HTMLElement3_put_onlayoutcomplete
,
3528 HTMLElement3_get_onlayoutcomplete
,
3529 HTMLElement3_put_onpage
,
3530 HTMLElement3_get_onpage
,
3531 HTMLElement3_put_inflateBlock
,
3532 HTMLElement3_get_inflateBlock
,
3533 HTMLElement3_put_onbeforedeactivate
,
3534 HTMLElement3_get_onbeforedeactivate
,
3535 HTMLElement3_setActive
,
3536 HTMLElement3_put_contentEditable
,
3537 HTMLElement3_get_contentEditable
,
3538 HTMLElement3_get_isContentEditable
,
3539 HTMLElement3_put_hideFocus
,
3540 HTMLElement3_get_hideFocus
,
3541 HTMLElement3_put_disabled
,
3542 HTMLElement3_get_disabled
,
3543 HTMLElement3_get_isDisabled
,
3544 HTMLElement3_put_onmove
,
3545 HTMLElement3_get_onmove
,
3546 HTMLElement3_put_oncontrolselect
,
3547 HTMLElement3_get_oncontrolselect
,
3548 HTMLElement3_fireEvent
,
3549 HTMLElement3_put_onresizestart
,
3550 HTMLElement3_get_onresizestart
,
3551 HTMLElement3_put_onresizeend
,
3552 HTMLElement3_get_onresizeend
,
3553 HTMLElement3_put_onmovestart
,
3554 HTMLElement3_get_onmovestart
,
3555 HTMLElement3_put_onmoveend
,
3556 HTMLElement3_get_onmoveend
,
3557 HTMLElement3_put_onmousecenter
,
3558 HTMLElement3_get_onmousecenter
,
3559 HTMLElement3_put_onmouseleave
,
3560 HTMLElement3_get_onmouseleave
,
3561 HTMLElement3_put_onactivate
,
3562 HTMLElement3_get_onactivate
,
3563 HTMLElement3_put_ondeactivate
,
3564 HTMLElement3_get_ondeactivate
,
3565 HTMLElement3_dragDrop
,
3566 HTMLElement3_get_glyphMode
3569 static inline HTMLElement
*impl_from_IHTMLElement4(IHTMLElement4
*iface
)
3571 return CONTAINING_RECORD(iface
, HTMLElement
, IHTMLElement4_iface
);
3574 static HRESULT WINAPI
HTMLElement4_QueryInterface(IHTMLElement4
*iface
,
3575 REFIID riid
, void **ppv
)
3577 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3578 return IHTMLElement_QueryInterface(&This
->IHTMLElement_iface
, riid
, ppv
);
3581 static ULONG WINAPI
HTMLElement4_AddRef(IHTMLElement4
*iface
)
3583 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3584 return IHTMLElement_AddRef(&This
->IHTMLElement_iface
);
3587 static ULONG WINAPI
HTMLElement4_Release(IHTMLElement4
*iface
)
3589 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3590 return IHTMLElement_Release(&This
->IHTMLElement_iface
);
3593 static HRESULT WINAPI
HTMLElement4_GetTypeInfoCount(IHTMLElement4
*iface
, UINT
*pctinfo
)
3595 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3596 return IDispatchEx_GetTypeInfoCount(&This
->node
.dispex
.IDispatchEx_iface
, pctinfo
);
3599 static HRESULT WINAPI
HTMLElement4_GetTypeInfo(IHTMLElement4
*iface
, UINT iTInfo
,
3600 LCID lcid
, ITypeInfo
**ppTInfo
)
3602 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3603 return IDispatchEx_GetTypeInfo(&This
->node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3606 static HRESULT WINAPI
HTMLElement4_GetIDsOfNames(IHTMLElement4
*iface
, REFIID riid
,
3607 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3609 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3610 return IDispatchEx_GetIDsOfNames(&This
->node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
3614 static HRESULT WINAPI
HTMLElement4_Invoke(IHTMLElement4
*iface
, DISPID dispIdMember
, REFIID riid
,
3615 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3617 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3618 return IDispatchEx_Invoke(&This
->node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
3619 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3622 static HRESULT WINAPI
HTMLElement4_put_onmousewheel(IHTMLElement4
*iface
, VARIANT v
)
3624 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3626 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3628 return set_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, &v
);
3631 static HRESULT WINAPI
HTMLElement4_get_onmousewheel(IHTMLElement4
*iface
, VARIANT
*p
)
3633 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3635 TRACE("(%p)->(%p)\n", This
, p
);
3637 return get_node_event(&This
->node
, EVENTID_MOUSEWHEEL
, p
);
3640 static HRESULT WINAPI
HTMLElement4_normalize(IHTMLElement4
*iface
)
3642 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3643 FIXME("(%p)\n", This
);
3647 static HRESULT WINAPI
HTMLElement4_getAttributeNode(IHTMLElement4
*iface
, BSTR bstrname
, IHTMLDOMAttribute
**ppAttribute
)
3649 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3650 HTMLAttributeCollection
*attrs
;
3653 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrname
), ppAttribute
);
3655 hres
= HTMLElement_get_attr_col(&This
->node
, &attrs
);
3659 hres
= IHTMLAttributeCollection2_getNamedItem(&attrs
->IHTMLAttributeCollection2_iface
, bstrname
, ppAttribute
);
3660 IHTMLAttributeCollection_Release(&attrs
->IHTMLAttributeCollection_iface
);
3664 static HRESULT WINAPI
HTMLElement4_setAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3665 IHTMLDOMAttribute
**ppretAttribute
)
3667 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3668 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3672 static HRESULT WINAPI
HTMLElement4_removeAttributeNode(IHTMLElement4
*iface
, IHTMLDOMAttribute
*pattr
,
3673 IHTMLDOMAttribute
**ppretAttribute
)
3675 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3676 FIXME("(%p)->(%p %p)\n", This
, pattr
, ppretAttribute
);
3680 static HRESULT WINAPI
HTMLElement4_put_onbeforeactivate(IHTMLElement4
*iface
, VARIANT v
)
3682 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3683 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3687 static HRESULT WINAPI
HTMLElement4_get_onbeforeactivate(IHTMLElement4
*iface
, VARIANT
*p
)
3689 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3690 FIXME("(%p)->(%p)\n", This
, p
);
3694 static HRESULT WINAPI
HTMLElement4_put_onfocusin(IHTMLElement4
*iface
, VARIANT v
)
3696 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3698 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
3700 return set_node_event(&This
->node
, EVENTID_FOCUSIN
, &v
);
3703 static HRESULT WINAPI
HTMLElement4_get_onfocusin(IHTMLElement4
*iface
, VARIANT
*p
)
3705 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3707 TRACE("(%p)->(%p)\n", This
, p
);
3709 return get_node_event(&This
->node
, EVENTID_FOCUSIN
, p
);
3712 static HRESULT WINAPI
HTMLElement4_put_onfocusout(IHTMLElement4
*iface
, VARIANT v
)
3714 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3715 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3719 static HRESULT WINAPI
HTMLElement4_get_onfocusout(IHTMLElement4
*iface
, VARIANT
*p
)
3721 HTMLElement
*This
= impl_from_IHTMLElement4(iface
);
3722 FIXME("(%p)->(%p)\n", This
, p
);
3726 static const IHTMLElement4Vtbl HTMLElement4Vtbl
= {
3727 HTMLElement4_QueryInterface
,
3728 HTMLElement4_AddRef
,
3729 HTMLElement4_Release
,
3730 HTMLElement4_GetTypeInfoCount
,
3731 HTMLElement4_GetTypeInfo
,
3732 HTMLElement4_GetIDsOfNames
,
3733 HTMLElement4_Invoke
,
3734 HTMLElement4_put_onmousewheel
,
3735 HTMLElement4_get_onmousewheel
,
3736 HTMLElement4_normalize
,
3737 HTMLElement4_getAttributeNode
,
3738 HTMLElement4_setAttributeNode
,
3739 HTMLElement4_removeAttributeNode
,
3740 HTMLElement4_put_onbeforeactivate
,
3741 HTMLElement4_get_onbeforeactivate
,
3742 HTMLElement4_put_onfocusin
,
3743 HTMLElement4_get_onfocusin
,
3744 HTMLElement4_put_onfocusout
,
3745 HTMLElement4_get_onfocusout
3748 static inline HTMLElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
3750 return CONTAINING_RECORD(iface
, HTMLElement
, node
);
3753 HRESULT
HTMLElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
3755 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3757 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
3758 *ppv
= &This
->IHTMLElement_iface
;
3759 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
3760 *ppv
= &This
->IHTMLElement_iface
;
3761 }else if(IsEqualGUID(&IID_IHTMLElement
, riid
)) {
3762 *ppv
= &This
->IHTMLElement_iface
;
3763 }else if(IsEqualGUID(&IID_IHTMLElement2
, riid
)) {
3764 *ppv
= &This
->IHTMLElement2_iface
;
3765 }else if(IsEqualGUID(&IID_IHTMLElement3
, riid
)) {
3766 *ppv
= &This
->IHTMLElement3_iface
;
3767 }else if(IsEqualGUID(&IID_IHTMLElement4
, riid
)) {
3768 *ppv
= &This
->IHTMLElement4_iface
;
3769 }else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
)) {
3770 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
3772 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
3775 IUnknown_AddRef((IUnknown
*)*ppv
);
3779 void HTMLElement_destructor(HTMLDOMNode
*iface
)
3781 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3783 ConnectionPointContainer_Destroy(&This
->cp_container
);
3786 This
->style
->elem
= NULL
;
3787 IHTMLStyle_Release(&This
->style
->IHTMLStyle_iface
);
3789 if(This
->runtime_style
) {
3790 This
->runtime_style
->elem
= NULL
;
3791 IHTMLStyle_Release(&This
->runtime_style
->IHTMLStyle_iface
);
3794 HTMLDOMAttribute
*attr
;
3796 LIST_FOR_EACH_ENTRY(attr
, &This
->attrs
->attrs
, HTMLDOMAttribute
, entry
)
3799 This
->attrs
->elem
= NULL
;
3800 IHTMLAttributeCollection_Release(&This
->attrs
->IHTMLAttributeCollection_iface
);
3803 heap_free(This
->filter
);
3805 HTMLDOMNode_destructor(&This
->node
);
3808 HRESULT
HTMLElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
3810 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3811 HTMLElement
*new_elem
;
3814 hres
= HTMLElement_Create(This
->node
.doc
, nsnode
, FALSE
, &new_elem
);
3819 new_elem
->filter
= heap_strdupW(This
->filter
);
3820 if(!new_elem
->filter
) {
3821 IHTMLElement_Release(&This
->IHTMLElement_iface
);
3822 return E_OUTOFMEMORY
;
3826 *ret
= &new_elem
->node
;
3830 HRESULT
HTMLElement_handle_event(HTMLDOMNode
*iface
, DWORD eid
, nsIDOMEvent
*event
, BOOL
*prevent_default
)
3832 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
3835 case EVENTID_KEYDOWN
: {
3836 nsIDOMKeyEvent
*key_event
;
3839 nsres
= nsIDOMEvent_QueryInterface(event
, &IID_nsIDOMKeyEvent
, (void**)&key_event
);
3840 if(NS_SUCCEEDED(nsres
)) {
3843 nsIDOMKeyEvent_GetKeyCode(key_event
, &code
);
3846 case VK_F1
: /* DOM_VK_F1 */
3847 TRACE("F1 pressed\n");
3848 fire_event(This
->node
.doc
, EVENTID_HELP
, TRUE
, This
->node
.nsnode
, NULL
, NULL
);
3849 *prevent_default
= TRUE
;
3852 nsIDOMKeyEvent_Release(key_event
);
3860 cp_static_data_t HTMLElementEvents2_data
= { HTMLElementEvents2_tid
, NULL
/* FIXME */, TRUE
};
3862 const cpc_entry_t HTMLElement_cpc
[] = {
3867 static const NodeImplVtbl HTMLElementImplVtbl
= {
3869 HTMLElement_destructor
,
3872 HTMLElement_handle_event
,
3873 HTMLElement_get_attr_col
3876 static inline HTMLElement
*impl_from_DispatchEx(DispatchEx
*iface
)
3878 return CONTAINING_RECORD(iface
, HTMLElement
, node
.dispex
);
3881 static HRESULT
HTMLElement_get_dispid(DispatchEx
*dispex
, BSTR name
,
3882 DWORD grfdex
, DISPID
*pid
)
3884 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3886 if(This
->node
.vtbl
->get_dispid
)
3887 return This
->node
.vtbl
->get_dispid(&This
->node
, name
, grfdex
, pid
);
3889 return DISP_E_UNKNOWNNAME
;
3892 static HRESULT
HTMLElement_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
3893 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
,
3894 IServiceProvider
*caller
)
3896 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3898 if(This
->node
.vtbl
->invoke
)
3899 return This
->node
.vtbl
->invoke(&This
->node
, id
, lcid
, flags
,
3900 params
, res
, ei
, caller
);
3902 ERR("(%p): element has no invoke method\n", This
);
3906 static HRESULT
HTMLElement_populate_props(DispatchEx
*dispex
)
3908 HTMLElement
*This
= impl_from_DispatchEx(dispex
);
3909 nsIDOMMozNamedAttrMap
*attrs
;
3912 const PRUnichar
*str
;
3924 nsres
= nsIDOMHTMLElement_GetAttributes(This
->nselem
, &attrs
);
3925 if(NS_FAILED(nsres
))
3928 nsres
= nsIDOMMozNamedAttrMap_GetLength(attrs
, &len
);
3929 if(NS_FAILED(nsres
)) {
3930 nsIDOMMozNamedAttrMap_Release(attrs
);
3934 nsAString_Init(&nsstr
, NULL
);
3935 for(i
=0; i
<len
; i
++) {
3936 nsres
= nsIDOMMozNamedAttrMap_Item(attrs
, i
, &attr
);
3937 if(NS_FAILED(nsres
))
3940 nsres
= nsIDOMAttr_GetNodeName(attr
, &nsstr
);
3941 if(NS_FAILED(nsres
)) {
3942 nsIDOMAttr_Release(attr
);
3946 nsAString_GetData(&nsstr
, &str
);
3947 name
= SysAllocString(str
);
3949 nsIDOMAttr_Release(attr
);
3953 hres
= IDispatchEx_GetDispID(&dispex
->IDispatchEx_iface
, name
, fdexNameCaseInsensitive
, &id
);
3954 if(hres
!= DISP_E_UNKNOWNNAME
) {
3955 nsIDOMAttr_Release(attr
);
3956 SysFreeString(name
);
3960 nsres
= nsIDOMAttr_GetNodeValue(attr
, &nsstr
);
3961 nsIDOMAttr_Release(attr
);
3962 if(NS_FAILED(nsres
)) {
3963 SysFreeString(name
);
3967 nsAString_GetData(&nsstr
, &str
);
3968 V_VT(&value
) = VT_BSTR
;
3970 V_BSTR(&value
) = SysAllocString(str
);
3971 if(!V_BSTR(&value
)) {
3972 SysFreeString(name
);
3976 V_BSTR(&value
) = NULL
;
3978 IHTMLElement_setAttribute(&This
->IHTMLElement_iface
, name
, value
, 0);
3979 SysFreeString(name
);
3980 VariantClear(&value
);
3982 nsAString_Finish(&nsstr
);
3984 nsIDOMMozNamedAttrMap_Release(attrs
);
3988 static const tid_t HTMLElement_iface_tids
[] = {
3993 static dispex_static_data_vtbl_t HTMLElement_dispex_vtbl
= {
3995 HTMLElement_get_dispid
,
3997 HTMLElement_populate_props
4000 static dispex_static_data_t HTMLElement_dispex
= {
4001 &HTMLElement_dispex_vtbl
,
4002 DispHTMLUnknownElement_tid
,
4004 HTMLElement_iface_tids
4007 void HTMLElement_Init(HTMLElement
*This
, HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, dispex_static_data_t
*dispex_data
)
4009 This
->IHTMLElement_iface
.lpVtbl
= &HTMLElementVtbl
;
4010 This
->IHTMLElement2_iface
.lpVtbl
= &HTMLElement2Vtbl
;
4011 This
->IHTMLElement3_iface
.lpVtbl
= &HTMLElement3Vtbl
;
4012 This
->IHTMLElement4_iface
.lpVtbl
= &HTMLElement4Vtbl
;
4014 if(dispex_data
&& !dispex_data
->vtbl
)
4015 dispex_data
->vtbl
= &HTMLElement_dispex_vtbl
;
4016 init_dispex(&This
->node
.dispex
, (IUnknown
*)&This
->IHTMLElement_iface
,
4017 dispex_data
? dispex_data
: &HTMLElement_dispex
);
4020 HTMLDOMNode_Init(doc
, &This
->node
, (nsIDOMNode
*)nselem
);
4022 /* No AddRef, share reference with HTMLDOMNode */
4023 assert((nsIDOMNode
*)nselem
== This
->node
.nsnode
);
4024 This
->nselem
= nselem
;
4027 This
->node
.cp_container
= &This
->cp_container
;
4028 ConnectionPointContainer_Init(&This
->cp_container
, (IUnknown
*)&This
->IHTMLElement_iface
, This
->node
.vtbl
->cpc_entries
);
4031 HRESULT
HTMLElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, BOOL use_generic
, HTMLElement
**ret
)
4033 nsIDOMHTMLElement
*nselem
;
4034 nsAString class_name_str
;
4035 const PRUnichar
*class_name
;
4036 const tag_desc_t
*tag
;
4041 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMHTMLElement
, (void**)&nselem
);
4042 if(NS_FAILED(nsres
))
4045 nsAString_Init(&class_name_str
, NULL
);
4046 nsIDOMHTMLElement_GetTagName(nselem
, &class_name_str
);
4048 nsAString_GetData(&class_name_str
, &class_name
);
4050 tag
= get_tag_desc(class_name
);
4052 hres
= tag
->constructor(doc
, nselem
, &elem
);
4053 }else if(use_generic
) {
4054 hres
= HTMLGenericElement_Create(doc
, nselem
, &elem
);
4056 elem
= heap_alloc_zero(sizeof(HTMLElement
));
4058 elem
->node
.vtbl
= &HTMLElementImplVtbl
;
4059 HTMLElement_Init(elem
, doc
, nselem
, &HTMLElement_dispex
);
4062 hres
= E_OUTOFMEMORY
;
4066 TRACE("%s ret %p\n", debugstr_w(class_name
), elem
);
4068 nsIDOMHTMLElement_Release(nselem
);
4069 nsAString_Finish(&class_name_str
);
4077 HRESULT
get_elem(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**ret
)
4082 hres
= get_node(doc
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
4086 *ret
= impl_from_HTMLDOMNode(node
);
4090 /* interface IHTMLFiltersCollection */
4091 static HRESULT WINAPI
HTMLFiltersCollection_QueryInterface(IHTMLFiltersCollection
*iface
, REFIID riid
, void **ppv
)
4093 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4095 TRACE("%p %s %p\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4097 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4098 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4099 }else if(IsEqualGUID(&IID_IHTMLFiltersCollection
, riid
)) {
4100 TRACE("(%p)->(IID_IHTMLFiltersCollection %p)\n", This
, ppv
);
4101 *ppv
= &This
->IHTMLFiltersCollection_iface
;
4102 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4103 return *ppv
? S_OK
: E_NOINTERFACE
;
4106 FIXME("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4107 return E_NOINTERFACE
;
4110 IUnknown_AddRef((IUnknown
*)*ppv
);
4114 static ULONG WINAPI
HTMLFiltersCollection_AddRef(IHTMLFiltersCollection
*iface
)
4116 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4117 LONG ref
= InterlockedIncrement(&This
->ref
);
4119 TRACE("(%p) ref=%d\n", This
, ref
);
4124 static ULONG WINAPI
HTMLFiltersCollection_Release(IHTMLFiltersCollection
*iface
)
4126 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4127 LONG ref
= InterlockedDecrement(&This
->ref
);
4129 TRACE("(%p) ref=%d\n", This
, ref
);
4139 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfoCount(IHTMLFiltersCollection
*iface
, UINT
*pctinfo
)
4141 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4142 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4145 static HRESULT WINAPI
HTMLFiltersCollection_GetTypeInfo(IHTMLFiltersCollection
*iface
,
4146 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
4148 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4149 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4152 static HRESULT WINAPI
HTMLFiltersCollection_GetIDsOfNames(IHTMLFiltersCollection
*iface
,
4153 REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
4154 LCID lcid
, DISPID
*rgDispId
)
4156 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4157 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4161 static HRESULT WINAPI
HTMLFiltersCollection_Invoke(IHTMLFiltersCollection
*iface
, DISPID dispIdMember
, REFIID riid
,
4162 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
4163 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4165 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4166 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4167 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4170 static HRESULT WINAPI
HTMLFiltersCollection_get_length(IHTMLFiltersCollection
*iface
, LONG
*p
)
4172 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4177 FIXME("(%p)->(%p) Always returning 0\n", This
, p
);
4183 static HRESULT WINAPI
HTMLFiltersCollection_get__newEnum(IHTMLFiltersCollection
*iface
, IUnknown
**p
)
4185 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4186 FIXME("(%p)->(%p)\n", This
, p
);
4190 static HRESULT WINAPI
HTMLFiltersCollection_item(IHTMLFiltersCollection
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
4192 HTMLFiltersCollection
*This
= impl_from_IHTMLFiltersCollection(iface
);
4193 FIXME("(%p)->(%p, %p)\n", This
, pvarIndex
, pvarResult
);
4197 static const IHTMLFiltersCollectionVtbl HTMLFiltersCollectionVtbl
= {
4198 HTMLFiltersCollection_QueryInterface
,
4199 HTMLFiltersCollection_AddRef
,
4200 HTMLFiltersCollection_Release
,
4201 HTMLFiltersCollection_GetTypeInfoCount
,
4202 HTMLFiltersCollection_GetTypeInfo
,
4203 HTMLFiltersCollection_GetIDsOfNames
,
4204 HTMLFiltersCollection_Invoke
,
4205 HTMLFiltersCollection_get_length
,
4206 HTMLFiltersCollection_get__newEnum
,
4207 HTMLFiltersCollection_item
4210 static HRESULT
HTMLFiltersCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4215 for(ptr
= name
; *ptr
&& isdigitW(*ptr
); ptr
++)
4216 idx
= idx
*10 + (*ptr
-'0');
4218 return DISP_E_UNKNOWNNAME
;
4220 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+ idx
;
4221 TRACE("ret %x\n", *dispid
);
4225 static HRESULT
HTMLFiltersCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4226 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4228 TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex
, id
, lcid
, flags
, params
, res
, ei
);
4230 V_VT(res
) = VT_DISPATCH
;
4231 V_DISPATCH(res
) = NULL
;
4233 FIXME("always returning NULL\n");
4238 static const dispex_static_data_vtbl_t HTMLFiltersCollection_dispex_vtbl
= {
4240 HTMLFiltersCollection_get_dispid
,
4241 HTMLFiltersCollection_invoke
,
4245 static const tid_t HTMLFiltersCollection_iface_tids
[] = {
4246 IHTMLFiltersCollection_tid
,
4249 static dispex_static_data_t HTMLFiltersCollection_dispex
= {
4250 &HTMLFiltersCollection_dispex_vtbl
,
4251 IHTMLFiltersCollection_tid
,
4253 HTMLFiltersCollection_iface_tids
4256 static IHTMLFiltersCollection
*HTMLFiltersCollection_Create(void)
4258 HTMLFiltersCollection
*ret
= heap_alloc(sizeof(HTMLFiltersCollection
));
4260 ret
->IHTMLFiltersCollection_iface
.lpVtbl
= &HTMLFiltersCollectionVtbl
;
4263 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IHTMLFiltersCollection_iface
,
4264 &HTMLFiltersCollection_dispex
);
4266 return &ret
->IHTMLFiltersCollection_iface
;
4269 /* interface IHTMLAttributeCollection */
4270 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection(IHTMLAttributeCollection
*iface
)
4272 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection_iface
);
4275 static HRESULT WINAPI
HTMLAttributeCollection_QueryInterface(IHTMLAttributeCollection
*iface
, REFIID riid
, void **ppv
)
4277 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4279 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4281 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4282 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4283 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection
, riid
)) {
4284 *ppv
= &This
->IHTMLAttributeCollection_iface
;
4285 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection2
, riid
)) {
4286 *ppv
= &This
->IHTMLAttributeCollection2_iface
;
4287 }else if(IsEqualGUID(&IID_IHTMLAttributeCollection3
, riid
)) {
4288 *ppv
= &This
->IHTMLAttributeCollection3_iface
;
4289 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4290 return *ppv
? S_OK
: E_NOINTERFACE
;
4293 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4294 return E_NOINTERFACE
;
4297 IUnknown_AddRef((IUnknown
*)*ppv
);
4301 static ULONG WINAPI
HTMLAttributeCollection_AddRef(IHTMLAttributeCollection
*iface
)
4303 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4304 LONG ref
= InterlockedIncrement(&This
->ref
);
4306 TRACE("(%p) ref=%d\n", This
, ref
);
4311 static ULONG WINAPI
HTMLAttributeCollection_Release(IHTMLAttributeCollection
*iface
)
4313 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4314 LONG ref
= InterlockedDecrement(&This
->ref
);
4316 TRACE("(%p) ref=%d\n", This
, ref
);
4319 while(!list_empty(&This
->attrs
)) {
4320 HTMLDOMAttribute
*attr
= LIST_ENTRY(list_head(&This
->attrs
), HTMLDOMAttribute
, entry
);
4322 list_remove(&attr
->entry
);
4324 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4333 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfoCount(IHTMLAttributeCollection
*iface
, UINT
*pctinfo
)
4335 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4336 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4339 static HRESULT WINAPI
HTMLAttributeCollection_GetTypeInfo(IHTMLAttributeCollection
*iface
, UINT iTInfo
,
4340 LCID lcid
, ITypeInfo
**ppTInfo
)
4342 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4343 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4346 static HRESULT WINAPI
HTMLAttributeCollection_GetIDsOfNames(IHTMLAttributeCollection
*iface
, REFIID riid
,
4347 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4349 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4350 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4354 static HRESULT WINAPI
HTMLAttributeCollection_Invoke(IHTMLAttributeCollection
*iface
, DISPID dispIdMember
,
4355 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4356 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4358 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4359 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4360 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4363 static HRESULT
get_attr_dispid_by_idx(HTMLAttributeCollection
*This
, LONG
*idx
, DISPID
*dispid
)
4365 IDispatchEx
*dispex
= &This
->elem
->node
.dispex
.IDispatchEx_iface
;
4366 DISPID id
= DISPID_STARTENUM
;
4370 FIXME("filter non-enumerable attributes out\n");
4373 hres
= IDispatchEx_GetNextDispID(dispex
, fdexEnumAll
, id
, &id
);
4376 else if(hres
== S_FALSE
)
4386 return *idx
==len
? S_OK
: DISP_E_UNKNOWNNAME
;
4393 static inline HRESULT
get_attr_dispid_by_name(HTMLAttributeCollection
*This
, BSTR name
, DISPID
*id
)
4397 if(name
[0]>='0' && name
[0]<='9') {
4401 idx
= strtoulW(name
, &end_ptr
, 10);
4403 hres
= get_attr_dispid_by_idx(This
, &idx
, id
);
4410 WARN("NULL elem\n");
4411 return E_UNEXPECTED
;
4414 hres
= IDispatchEx_GetDispID(&This
->elem
->node
.dispex
.IDispatchEx_iface
,
4415 name
, fdexNameCaseInsensitive
, id
);
4419 static inline HRESULT
get_domattr(HTMLAttributeCollection
*This
, DISPID id
, LONG
*list_pos
, HTMLDOMAttribute
**attr
)
4421 HTMLDOMAttribute
*iter
;
4426 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4427 if(iter
->dispid
== id
) {
4436 WARN("NULL elem\n");
4437 return E_UNEXPECTED
;
4440 hres
= HTMLDOMAttribute_Create(NULL
, This
->elem
, id
, attr
);
4445 IHTMLDOMAttribute_AddRef(&(*attr
)->IHTMLDOMAttribute_iface
);
4451 static HRESULT WINAPI
HTMLAttributeCollection_get_length(IHTMLAttributeCollection
*iface
, LONG
*p
)
4453 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4456 TRACE("(%p)->(%p)\n", This
, p
);
4459 hres
= get_attr_dispid_by_idx(This
, p
, NULL
);
4463 static HRESULT WINAPI
HTMLAttributeCollection__newEnum(IHTMLAttributeCollection
*iface
, IUnknown
**p
)
4465 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4466 FIXME("(%p)->(%p)\n", This
, p
);
4470 static HRESULT WINAPI
HTMLAttributeCollection_item(IHTMLAttributeCollection
*iface
, VARIANT
*name
, IDispatch
**ppItem
)
4472 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection(iface
);
4473 HTMLDOMAttribute
*attr
;
4477 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(name
), ppItem
);
4479 switch(V_VT(name
)) {
4481 hres
= get_attr_dispid_by_idx(This
, &V_I4(name
), &id
);
4484 hres
= get_attr_dispid_by_name(This
, V_BSTR(name
), &id
);
4487 FIXME("unsupported name %s\n", debugstr_variant(name
));
4490 if(hres
== DISP_E_UNKNOWNNAME
)
4491 return E_INVALIDARG
;
4495 hres
= get_domattr(This
, id
, NULL
, &attr
);
4499 *ppItem
= (IDispatch
*)&attr
->IHTMLDOMAttribute_iface
;
4503 static const IHTMLAttributeCollectionVtbl HTMLAttributeCollectionVtbl
= {
4504 HTMLAttributeCollection_QueryInterface
,
4505 HTMLAttributeCollection_AddRef
,
4506 HTMLAttributeCollection_Release
,
4507 HTMLAttributeCollection_GetTypeInfoCount
,
4508 HTMLAttributeCollection_GetTypeInfo
,
4509 HTMLAttributeCollection_GetIDsOfNames
,
4510 HTMLAttributeCollection_Invoke
,
4511 HTMLAttributeCollection_get_length
,
4512 HTMLAttributeCollection__newEnum
,
4513 HTMLAttributeCollection_item
4516 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection2(IHTMLAttributeCollection2
*iface
)
4518 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection2_iface
);
4521 static HRESULT WINAPI
HTMLAttributeCollection2_QueryInterface(IHTMLAttributeCollection2
*iface
, REFIID riid
, void **ppv
)
4523 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4524 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4527 static ULONG WINAPI
HTMLAttributeCollection2_AddRef(IHTMLAttributeCollection2
*iface
)
4529 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4530 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4533 static ULONG WINAPI
HTMLAttributeCollection2_Release(IHTMLAttributeCollection2
*iface
)
4535 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4536 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4539 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfoCount(IHTMLAttributeCollection2
*iface
, UINT
*pctinfo
)
4541 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4542 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4545 static HRESULT WINAPI
HTMLAttributeCollection2_GetTypeInfo(IHTMLAttributeCollection2
*iface
, UINT iTInfo
,
4546 LCID lcid
, ITypeInfo
**ppTInfo
)
4548 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4549 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4552 static HRESULT WINAPI
HTMLAttributeCollection2_GetIDsOfNames(IHTMLAttributeCollection2
*iface
, REFIID riid
,
4553 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4555 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4556 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4560 static HRESULT WINAPI
HTMLAttributeCollection2_Invoke(IHTMLAttributeCollection2
*iface
, DISPID dispIdMember
,
4561 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4562 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4564 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4565 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4566 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4569 static HRESULT WINAPI
HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollection2
*iface
, BSTR bstrName
,
4570 IHTMLDOMAttribute
**newretNode
)
4572 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4573 HTMLDOMAttribute
*attr
;
4577 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4579 hres
= get_attr_dispid_by_name(This
, bstrName
, &id
);
4580 if(hres
== DISP_E_UNKNOWNNAME
) {
4583 } else if(FAILED(hres
)) {
4587 hres
= get_domattr(This
, id
, NULL
, &attr
);
4591 *newretNode
= &attr
->IHTMLDOMAttribute_iface
;
4595 static HRESULT WINAPI
HTMLAttributeCollection2_setNamedItem(IHTMLAttributeCollection2
*iface
,
4596 IHTMLDOMAttribute
*ppNode
, IHTMLDOMAttribute
**newretNode
)
4598 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4599 FIXME("(%p)->(%p %p)\n", This
, ppNode
, newretNode
);
4603 static HRESULT WINAPI
HTMLAttributeCollection2_removeNamedItem(IHTMLAttributeCollection2
*iface
,
4604 BSTR bstrName
, IHTMLDOMAttribute
**newretNode
)
4606 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection2(iface
);
4607 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), newretNode
);
4611 static const IHTMLAttributeCollection2Vtbl HTMLAttributeCollection2Vtbl
= {
4612 HTMLAttributeCollection2_QueryInterface
,
4613 HTMLAttributeCollection2_AddRef
,
4614 HTMLAttributeCollection2_Release
,
4615 HTMLAttributeCollection2_GetTypeInfoCount
,
4616 HTMLAttributeCollection2_GetTypeInfo
,
4617 HTMLAttributeCollection2_GetIDsOfNames
,
4618 HTMLAttributeCollection2_Invoke
,
4619 HTMLAttributeCollection2_getNamedItem
,
4620 HTMLAttributeCollection2_setNamedItem
,
4621 HTMLAttributeCollection2_removeNamedItem
4624 static inline HTMLAttributeCollection
*impl_from_IHTMLAttributeCollection3(IHTMLAttributeCollection3
*iface
)
4626 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, IHTMLAttributeCollection3_iface
);
4629 static HRESULT WINAPI
HTMLAttributeCollection3_QueryInterface(IHTMLAttributeCollection3
*iface
, REFIID riid
, void **ppv
)
4631 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4632 return IHTMLAttributeCollection_QueryInterface(&This
->IHTMLAttributeCollection_iface
, riid
, ppv
);
4635 static ULONG WINAPI
HTMLAttributeCollection3_AddRef(IHTMLAttributeCollection3
*iface
)
4637 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4638 return IHTMLAttributeCollection_AddRef(&This
->IHTMLAttributeCollection_iface
);
4641 static ULONG WINAPI
HTMLAttributeCollection3_Release(IHTMLAttributeCollection3
*iface
)
4643 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4644 return IHTMLAttributeCollection_Release(&This
->IHTMLAttributeCollection_iface
);
4647 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfoCount(IHTMLAttributeCollection3
*iface
, UINT
*pctinfo
)
4649 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4650 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
4653 static HRESULT WINAPI
HTMLAttributeCollection3_GetTypeInfo(IHTMLAttributeCollection3
*iface
, UINT iTInfo
,
4654 LCID lcid
, ITypeInfo
**ppTInfo
)
4656 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4657 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4660 static HRESULT WINAPI
HTMLAttributeCollection3_GetIDsOfNames(IHTMLAttributeCollection3
*iface
, REFIID riid
,
4661 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4663 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4664 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
4668 static HRESULT WINAPI
HTMLAttributeCollection3_Invoke(IHTMLAttributeCollection3
*iface
, DISPID dispIdMember
,
4669 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4670 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4672 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4673 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
4674 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4677 static HRESULT WINAPI
HTMLAttributeCollection3_getNamedItem(IHTMLAttributeCollection3
*iface
, BSTR bstrName
,
4678 IHTMLDOMAttribute
**ppNodeOut
)
4680 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4681 return IHTMLAttributeCollection2_getNamedItem(&This
->IHTMLAttributeCollection2_iface
, bstrName
, ppNodeOut
);
4684 static HRESULT WINAPI
HTMLAttributeCollection3_setNamedItem(IHTMLAttributeCollection3
*iface
,
4685 IHTMLDOMAttribute
*pNodeIn
, IHTMLDOMAttribute
**ppNodeOut
)
4687 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4688 FIXME("(%p)->(%p %p)\n", This
, pNodeIn
, ppNodeOut
);
4692 static HRESULT WINAPI
HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCollection3
*iface
,
4693 BSTR bstrName
, IHTMLDOMAttribute
**ppNodeOut
)
4695 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4696 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrName
), ppNodeOut
);
4700 static HRESULT WINAPI
HTMLAttributeCollection3_item(IHTMLAttributeCollection3
*iface
, LONG index
, IHTMLDOMAttribute
**ppNodeOut
)
4702 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4703 HTMLDOMAttribute
*attr
;
4707 TRACE("(%p)->(%d %p)\n", This
, index
, ppNodeOut
);
4709 hres
= get_attr_dispid_by_idx(This
, &index
, &id
);
4710 if(hres
== DISP_E_UNKNOWNNAME
)
4711 return E_INVALIDARG
;
4715 hres
= get_domattr(This
, id
, NULL
, &attr
);
4719 *ppNodeOut
= &attr
->IHTMLDOMAttribute_iface
;
4723 static HRESULT WINAPI
HTMLAttributeCollection3_get_length(IHTMLAttributeCollection3
*iface
, LONG
*p
)
4725 HTMLAttributeCollection
*This
= impl_from_IHTMLAttributeCollection3(iface
);
4726 return IHTMLAttributeCollection_get_length(&This
->IHTMLAttributeCollection_iface
, p
);
4729 static const IHTMLAttributeCollection3Vtbl HTMLAttributeCollection3Vtbl
= {
4730 HTMLAttributeCollection3_QueryInterface
,
4731 HTMLAttributeCollection3_AddRef
,
4732 HTMLAttributeCollection3_Release
,
4733 HTMLAttributeCollection3_GetTypeInfoCount
,
4734 HTMLAttributeCollection3_GetTypeInfo
,
4735 HTMLAttributeCollection3_GetIDsOfNames
,
4736 HTMLAttributeCollection3_Invoke
,
4737 HTMLAttributeCollection3_getNamedItem
,
4738 HTMLAttributeCollection3_setNamedItem
,
4739 HTMLAttributeCollection3_removeNamedItem
,
4740 HTMLAttributeCollection3_item
,
4741 HTMLAttributeCollection3_get_length
4744 static inline HTMLAttributeCollection
*HTMLAttributeCollection_from_DispatchEx(DispatchEx
*iface
)
4746 return CONTAINING_RECORD(iface
, HTMLAttributeCollection
, dispex
);
4749 static HRESULT
HTMLAttributeCollection_get_dispid(DispatchEx
*dispex
, BSTR name
, DWORD flags
, DISPID
*dispid
)
4751 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4752 HTMLDOMAttribute
*attr
;
4756 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(name
), flags
, dispid
);
4758 hres
= get_attr_dispid_by_name(This
, name
, dispid
);
4762 hres
= get_domattr(This
, *dispid
, &pos
, &attr
);
4765 IHTMLDOMAttribute_Release(&attr
->IHTMLDOMAttribute_iface
);
4767 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+pos
;
4771 static HRESULT
HTMLAttributeCollection_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
,
4772 WORD flags
, DISPPARAMS
*params
, VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4774 HTMLAttributeCollection
*This
= HTMLAttributeCollection_from_DispatchEx(dispex
);
4776 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, flags
, params
, res
, ei
, caller
);
4779 case DISPATCH_PROPERTYGET
: {
4780 HTMLDOMAttribute
*iter
;
4783 pos
= id
-MSHTML_DISPID_CUSTOM_MIN
;
4785 LIST_FOR_EACH_ENTRY(iter
, &This
->attrs
, HTMLDOMAttribute
, entry
) {
4787 IHTMLDOMAttribute_AddRef(&iter
->IHTMLDOMAttribute_iface
);
4788 V_VT(res
) = VT_DISPATCH
;
4789 V_DISPATCH(res
) = (IDispatch
*)&iter
->IHTMLDOMAttribute_iface
;
4795 WARN("invalid arg\n");
4796 return E_INVALIDARG
;
4800 FIXME("unimplemented flags %x\n", flags
);
4805 static const dispex_static_data_vtbl_t HTMLAttributeCollection_dispex_vtbl
= {
4807 HTMLAttributeCollection_get_dispid
,
4808 HTMLAttributeCollection_invoke
,
4812 static const tid_t HTMLAttributeCollection_iface_tids
[] = {
4813 IHTMLAttributeCollection_tid
,
4814 IHTMLAttributeCollection2_tid
,
4815 IHTMLAttributeCollection3_tid
,
4819 static dispex_static_data_t HTMLAttributeCollection_dispex
= {
4820 &HTMLAttributeCollection_dispex_vtbl
,
4821 DispHTMLAttributeCollection_tid
,
4823 HTMLAttributeCollection_iface_tids
4826 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*iface
, HTMLAttributeCollection
**ac
)
4828 HTMLElement
*This
= impl_from_HTMLDOMNode(iface
);
4831 IHTMLAttributeCollection_AddRef(&This
->attrs
->IHTMLAttributeCollection_iface
);
4836 This
->attrs
= heap_alloc_zero(sizeof(HTMLAttributeCollection
));
4838 return E_OUTOFMEMORY
;
4840 This
->attrs
->IHTMLAttributeCollection_iface
.lpVtbl
= &HTMLAttributeCollectionVtbl
;
4841 This
->attrs
->IHTMLAttributeCollection2_iface
.lpVtbl
= &HTMLAttributeCollection2Vtbl
;
4842 This
->attrs
->IHTMLAttributeCollection3_iface
.lpVtbl
= &HTMLAttributeCollection3Vtbl
;
4843 This
->attrs
->ref
= 2;
4845 This
->attrs
->elem
= This
;
4846 list_init(&This
->attrs
->attrs
);
4847 init_dispex(&This
->attrs
->dispex
, (IUnknown
*)&This
->attrs
->IHTMLAttributeCollection_iface
,
4848 &HTMLAttributeCollection_dispex
);