mshtml: Remove an extra quote in the pngfile registration.
[wine] / dlls / mshtml / htmlelem3.c
1 /*
2  * Copyright 2008 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include <stdarg.h>
20
21 #define COBJMACROS
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
27
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
30
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
33
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35
36 static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
37 {
38     return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
39 }
40
41 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
42                                                   REFIID riid, void **ppv)
43 {
44     HTMLElement *This = impl_from_IHTMLElement3(iface);
45     return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
46 }
47
48 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
49 {
50     HTMLElement *This = impl_from_IHTMLElement3(iface);
51     return IHTMLElement_AddRef(&This->IHTMLElement_iface);
52 }
53
54 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
55 {
56     HTMLElement *This = impl_from_IHTMLElement3(iface);
57     return IHTMLElement_Release(&This->IHTMLElement_iface);
58 }
59
60 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
61 {
62     HTMLElement *This = impl_from_IHTMLElement3(iface);
63     return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
64 }
65
66 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
67                                                LCID lcid, ITypeInfo **ppTInfo)
68 {
69     HTMLElement *This = impl_from_IHTMLElement3(iface);
70     return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
71 }
72
73 static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID riid,
74                                                 LPOLESTR *rgszNames, UINT cNames,
75                                                 LCID lcid, DISPID *rgDispId)
76 {
77     HTMLElement *This = impl_from_IHTMLElement3(iface);
78     return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
79             lcid, rgDispId);
80 }
81
82 static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMember,
83                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
84                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
85 {
86     HTMLElement *This = impl_from_IHTMLElement3(iface);
87     return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
88             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
89 }
90
91 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
92 {
93     HTMLElement *This = impl_from_IHTMLElement3(iface);
94     FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
95     return E_NOTIMPL;
96 }
97
98 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
99 {
100     HTMLElement *This = impl_from_IHTMLElement3(iface);
101     FIXME("(%p)->(%p)\n", This, p);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
106 {
107     HTMLElement *This = impl_from_IHTMLElement3(iface);
108     FIXME("(%p)->(%p)\n", This, p);
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
113 {
114     HTMLElement *This = impl_from_IHTMLElement3(iface);
115     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
120 {
121     HTMLElement *This = impl_from_IHTMLElement3(iface);
122     FIXME("(%p)->(%p)\n", This, p);
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
127 {
128     HTMLElement *This = impl_from_IHTMLElement3(iface);
129     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
134 {
135     HTMLElement *This = impl_from_IHTMLElement3(iface);
136     FIXME("(%p)->(%p)\n", This, p);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
141 {
142     HTMLElement *This = impl_from_IHTMLElement3(iface);
143     FIXME("(%p)->(%x)\n", This, v);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
148 {
149     HTMLElement *This = impl_from_IHTMLElement3(iface);
150     FIXME("(%p)->(%p)\n", This, p);
151     return E_NOTIMPL;
152 }
153
154 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
155 {
156     HTMLElement *This = impl_from_IHTMLElement3(iface);
157     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
162 {
163     HTMLElement *This = impl_from_IHTMLElement3(iface);
164     FIXME("(%p)->(%p)\n", This, p);
165     return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
169 {
170     HTMLElement *This = impl_from_IHTMLElement3(iface);
171     FIXME("(%p)\n", This);
172     return E_NOTIMPL;
173 }
174
175 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
176 {
177     HTMLElement *This = impl_from_IHTMLElement3(iface);
178     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
179     return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
183 {
184     HTMLElement *This = impl_from_IHTMLElement3(iface);
185     FIXME("(%p)->(%p)\n", This, p);
186     return E_NOTIMPL;
187 }
188
189 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
190 {
191     HTMLElement *This = impl_from_IHTMLElement3(iface);
192     FIXME("(%p)->(%p)\n", This, p);
193     return E_NOTIMPL;
194 }
195
196 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
197 {
198     HTMLElement *This = impl_from_IHTMLElement3(iface);
199     FIXME("(%p)->(%x)\n", This, v);
200     return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
204 {
205     HTMLElement *This = impl_from_IHTMLElement3(iface);
206     FIXME("(%p)->(%p)\n", This, p);
207     return E_NOTIMPL;
208 }
209
210 static const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
211
212 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
213 {
214     HTMLElement *This = impl_from_IHTMLElement3(iface);
215     VARIANT *var;
216     HRESULT hres;
217
218     TRACE("(%p)->(%x)\n", This, v);
219
220     if(This->node.vtbl->put_disabled)
221         return This->node.vtbl->put_disabled(&This->node, v);
222
223     hres = dispex_get_dprop_ref(&This->node.dispex, disabledW, TRUE, &var);
224     if(FAILED(hres))
225         return hres;
226
227     VariantClear(var);
228     V_VT(var) = VT_BOOL;
229     V_BOOL(var) = v;
230     return S_OK;
231 }
232
233 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
234 {
235     HTMLElement *This = impl_from_IHTMLElement3(iface);
236     VARIANT *var;
237     HRESULT hres;
238
239     TRACE("(%p)->(%p)\n", This, p);
240
241     if(This->node.vtbl->get_disabled)
242         return This->node.vtbl->get_disabled(&This->node, p);
243
244     hres = dispex_get_dprop_ref(&This->node.dispex, disabledW, FALSE, &var);
245     if(hres == DISP_E_UNKNOWNNAME) {
246         *p = VARIANT_FALSE;
247         return S_OK;
248     }
249     if(FAILED(hres))
250         return hres;
251
252     if(V_VT(var) != VT_BOOL) {
253         FIXME("vt %d\n", V_VT(var));
254         return E_NOTIMPL;
255     }
256
257     *p = V_BOOL(var);
258     return S_OK;
259 }
260
261 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
262 {
263     HTMLElement *This = impl_from_IHTMLElement3(iface);
264     FIXME("(%p)->(%p)\n", This, p);
265     return E_NOTIMPL;
266 }
267
268 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
269 {
270     HTMLElement *This = impl_from_IHTMLElement3(iface);
271     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
272     return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
276 {
277     HTMLElement *This = impl_from_IHTMLElement3(iface);
278     FIXME("(%p)->(%p)\n", This, p);
279     return E_NOTIMPL;
280 }
281
282 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
283 {
284     HTMLElement *This = impl_from_IHTMLElement3(iface);
285     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
286     return E_NOTIMPL;
287 }
288
289 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
290 {
291     HTMLElement *This = impl_from_IHTMLElement3(iface);
292     FIXME("(%p)->(%p)\n", This, p);
293     return E_NOTIMPL;
294 }
295
296 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
297         VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
298 {
299     HTMLElement *This = impl_from_IHTMLElement3(iface);
300
301     TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
302           pfCancelled);
303
304     return dispatch_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
305 }
306
307 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
308 {
309     HTMLElement *This = impl_from_IHTMLElement3(iface);
310     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
311     return E_NOTIMPL;
312 }
313
314 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
315 {
316     HTMLElement *This = impl_from_IHTMLElement3(iface);
317     FIXME("(%p)->(%p)\n", This, p);
318     return E_NOTIMPL;
319 }
320
321 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
322 {
323     HTMLElement *This = impl_from_IHTMLElement3(iface);
324     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
325     return E_NOTIMPL;
326 }
327
328 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
329 {
330     HTMLElement *This = impl_from_IHTMLElement3(iface);
331     FIXME("(%p)->(%p)\n", This, p);
332     return E_NOTIMPL;
333 }
334
335 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
336 {
337     HTMLElement *This = impl_from_IHTMLElement3(iface);
338     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
339     return E_NOTIMPL;
340 }
341
342 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
343 {
344     HTMLElement *This = impl_from_IHTMLElement3(iface);
345     FIXME("(%p)->(%p)\n", This, p);
346     return E_NOTIMPL;
347 }
348
349 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
350 {
351     HTMLElement *This = impl_from_IHTMLElement3(iface);
352     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
353     return E_NOTIMPL;
354 }
355
356 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
357 {
358     HTMLElement *This = impl_from_IHTMLElement3(iface);
359     FIXME("(%p)->(%p)\n", This, p);
360     return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
364 {
365     HTMLElement *This = impl_from_IHTMLElement3(iface);
366     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
367     return E_NOTIMPL;
368 }
369
370 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
371 {
372     HTMLElement *This = impl_from_IHTMLElement3(iface);
373     FIXME("(%p)->(%p)\n", This, p);
374     return E_NOTIMPL;
375 }
376
377 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
378 {
379     HTMLElement *This = impl_from_IHTMLElement3(iface);
380     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
381     return E_NOTIMPL;
382 }
383
384 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
385 {
386     HTMLElement *This = impl_from_IHTMLElement3(iface);
387     FIXME("(%p)->(%p)\n", This, p);
388     return E_NOTIMPL;
389 }
390
391 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
392 {
393     HTMLElement *This = impl_from_IHTMLElement3(iface);
394     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
395     return E_NOTIMPL;
396 }
397
398 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
399 {
400     HTMLElement *This = impl_from_IHTMLElement3(iface);
401     FIXME("(%p)->(%p)\n", This, p);
402     return E_NOTIMPL;
403 }
404
405 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
406 {
407     HTMLElement *This = impl_from_IHTMLElement3(iface);
408     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
409     return E_NOTIMPL;
410 }
411
412 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
413 {
414     HTMLElement *This = impl_from_IHTMLElement3(iface);
415     FIXME("(%p)->(%p)\n", This, p);
416     return E_NOTIMPL;
417 }
418
419 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
420 {
421     HTMLElement *This = impl_from_IHTMLElement3(iface);
422     FIXME("(%p)->(%p)\n", This, pfRet);
423     return E_NOTIMPL;
424 }
425
426 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
427 {
428     HTMLElement *This = impl_from_IHTMLElement3(iface);
429     FIXME("(%p)->(%p)\n", This, p);
430     return E_NOTIMPL;
431 }
432
433 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
434     HTMLElement3_QueryInterface,
435     HTMLElement3_AddRef,
436     HTMLElement3_Release,
437     HTMLElement3_GetTypeInfoCount,
438     HTMLElement3_GetTypeInfo,
439     HTMLElement3_GetIDsOfNames,
440     HTMLElement3_Invoke,
441     HTMLElement3_mergeAttributes,
442     HTMLElement3_get_isMultiLine,
443     HTMLElement3_get_canHaveHTML,
444     HTMLElement3_put_onlayoutcomplete,
445     HTMLElement3_get_onlayoutcomplete,
446     HTMLElement3_put_onpage,
447     HTMLElement3_get_onpage,
448     HTMLElement3_put_inflateBlock,
449     HTMLElement3_get_inflateBlock,
450     HTMLElement3_put_onbeforedeactivate,
451     HTMLElement3_get_onbeforedeactivate,
452     HTMLElement3_setActive,
453     HTMLElement3_put_contentEditable,
454     HTMLElement3_get_contentEditable,
455     HTMLElement3_get_isContentEditable,
456     HTMLElement3_put_hideFocus,
457     HTMLElement3_get_hideFocus,
458     HTMLElement3_put_disabled,
459     HTMLElement3_get_disabled,
460     HTMLElement3_get_isDisabled,
461     HTMLElement3_put_onmove,
462     HTMLElement3_get_onmove,
463     HTMLElement3_put_oncontrolselect,
464     HTMLElement3_get_oncontrolselect,
465     HTMLElement3_fireEvent,
466     HTMLElement3_put_onresizestart,
467     HTMLElement3_get_onresizestart,
468     HTMLElement3_put_onresizeend,
469     HTMLElement3_get_onresizeend,
470     HTMLElement3_put_onmovestart,
471     HTMLElement3_get_onmovestart,
472     HTMLElement3_put_onmoveend,
473     HTMLElement3_get_onmoveend,
474     HTMLElement3_put_onmousecenter,
475     HTMLElement3_get_onmousecenter,
476     HTMLElement3_put_onmouseleave,
477     HTMLElement3_get_onmouseleave,
478     HTMLElement3_put_onactivate,
479     HTMLElement3_get_onactivate,
480     HTMLElement3_put_ondeactivate,
481     HTMLElement3_get_ondeactivate,
482     HTMLElement3_dragDrop,
483     HTMLElement3_get_glyphMode
484 };
485
486 static inline HTMLElement *impl_from_IHTMLElement4(IHTMLElement4 *iface)
487 {
488     return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement4_iface);
489 }
490
491 static HRESULT WINAPI HTMLElement4_QueryInterface(IHTMLElement4 *iface,
492         REFIID riid, void **ppv)
493 {
494     HTMLElement *This = impl_from_IHTMLElement4(iface);
495     return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
496 }
497
498 static ULONG WINAPI HTMLElement4_AddRef(IHTMLElement4 *iface)
499 {
500     HTMLElement *This = impl_from_IHTMLElement4(iface);
501     return IHTMLElement_AddRef(&This->IHTMLElement_iface);
502 }
503
504 static ULONG WINAPI HTMLElement4_Release(IHTMLElement4 *iface)
505 {
506     HTMLElement *This = impl_from_IHTMLElement4(iface);
507     return IHTMLElement_Release(&This->IHTMLElement_iface);
508 }
509
510 static HRESULT WINAPI HTMLElement4_GetTypeInfoCount(IHTMLElement4 *iface, UINT *pctinfo)
511 {
512     HTMLElement *This = impl_from_IHTMLElement4(iface);
513     return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
514 }
515
516 static HRESULT WINAPI HTMLElement4_GetTypeInfo(IHTMLElement4 *iface, UINT iTInfo,
517         LCID lcid, ITypeInfo **ppTInfo)
518 {
519     HTMLElement *This = impl_from_IHTMLElement4(iface);
520     return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
521 }
522
523 static HRESULT WINAPI HTMLElement4_GetIDsOfNames(IHTMLElement4 *iface, REFIID riid,
524         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
525 {
526     HTMLElement *This = impl_from_IHTMLElement4(iface);
527     return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
528             lcid, rgDispId);
529 }
530
531 static HRESULT WINAPI HTMLElement4_Invoke(IHTMLElement4 *iface, DISPID dispIdMember, REFIID riid,
532         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
533 {
534     HTMLElement *This = impl_from_IHTMLElement4(iface);
535     return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
536             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
537 }
538
539 static HRESULT WINAPI HTMLElement4_put_onmousewheel(IHTMLElement4 *iface, VARIANT v)
540 {
541     HTMLElement *This = impl_from_IHTMLElement4(iface);
542     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
543     return E_NOTIMPL;
544 }
545
546 static HRESULT WINAPI HTMLElement4_get_onmousewheel(IHTMLElement4 *iface, VARIANT *p)
547 {
548     HTMLElement *This = impl_from_IHTMLElement4(iface);
549     FIXME("(%p)->(%p)\n", This, p);
550     return E_NOTIMPL;
551 }
552
553 static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
554 {
555     HTMLElement *This = impl_from_IHTMLElement4(iface);
556     FIXME("(%p)\n", This);
557     return E_NOTIMPL;
558 }
559
560 /* FIXME: This should be done in IDispatchEx implementation layer */
561 static BOOL get_attr_from_nselem(HTMLElement *This, BSTR name, DISPID *dispid)
562 {
563     const PRUnichar *v;
564     nsIDOMAttr *nsattr;
565     nsAString nsstr;
566     BSTR val = NULL;
567     nsresult nsres;
568     HRESULT hres;
569
570     nsAString_InitDepend(&nsstr, name);
571     nsres = nsIDOMHTMLElement_GetAttributeNode(This->nselem, &nsstr, &nsattr);
572     nsAString_Finish(&nsstr);
573     if(NS_FAILED(nsres) || !nsattr)
574         return FALSE;
575
576     FIXME("HACK\n");
577
578     nsAString_Init(&nsstr, NULL);
579     nsres = nsIDOMAttr_GetNodeValue(nsattr, &nsstr);
580     if(NS_FAILED(nsres)) {
581         nsAString_Finish(&nsstr);
582         return FALSE;
583     }
584
585     nsAString_GetData(&nsstr, &v);
586     if(*v) {
587         val = SysAllocString(v);
588         if(!val) {
589             nsAString_Finish(&nsstr);
590             return FALSE;
591         }
592     }
593     nsAString_Finish(&nsstr);
594
595     hres = IDispatchEx_GetDispID(&This->node.dispex.IDispatchEx_iface, name, fdexNameEnsure, dispid);
596     if(SUCCEEDED(hres)) {
597         VARIANT arg;
598         DISPPARAMS dp = {&arg, NULL, 1, 0};
599         EXCEPINFO ei;
600
601         V_VT(&arg) = VT_BSTR;
602         V_BSTR(&arg) = val;
603         memset(&ei, 0, sizeof(ei));
604         hres = IDispatchEx_InvokeEx(&This->node.dispex.IDispatchEx_iface, *dispid,
605                 LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL);
606     }
607
608     SysFreeString(val);
609     return SUCCEEDED(hres);
610 }
611
612 static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR bstrname, IHTMLDOMAttribute **ppAttribute)
613 {
614     HTMLElement *This = impl_from_IHTMLElement4(iface);
615     HTMLDOMAttribute *attr = NULL, *iter;
616     DISPID dispid;
617     HRESULT hres;
618
619     TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrname), ppAttribute);
620
621     hres = IDispatchEx_GetDispID(&This->node.dispex.IDispatchEx_iface, bstrname, fdexNameCaseInsensitive, &dispid);
622     if(hres == DISP_E_UNKNOWNNAME) {
623         if(!get_attr_from_nselem(This, bstrname, &dispid)) {
624             *ppAttribute = NULL;
625             return S_OK;
626         }
627     }else if(FAILED(hres)) {
628         return hres;
629     }
630
631     LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) {
632         if(iter->dispid == dispid) {
633             attr = iter;
634             break;
635         }
636     }
637
638     if(!attr) {
639         hres = HTMLDOMAttribute_Create(This, dispid, &attr);
640         if(FAILED(hres))
641             return hres;
642     }
643
644     IHTMLDOMAttribute_AddRef(&attr->IHTMLDOMAttribute_iface);
645     *ppAttribute = &attr->IHTMLDOMAttribute_iface;
646     return S_OK;
647 }
648
649 static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
650         IHTMLDOMAttribute **ppretAttribute)
651 {
652     HTMLElement *This = impl_from_IHTMLElement4(iface);
653     FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
654     return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI HTMLElement4_removeAttributeNode(IHTMLElement4 *iface, IHTMLDOMAttribute *pattr,
658         IHTMLDOMAttribute **ppretAttribute)
659 {
660     HTMLElement *This = impl_from_IHTMLElement4(iface);
661     FIXME("(%p)->(%p %p)\n", This, pattr, ppretAttribute);
662     return E_NOTIMPL;
663 }
664
665 static HRESULT WINAPI HTMLElement4_put_onbeforeactivate(IHTMLElement4 *iface, VARIANT v)
666 {
667     HTMLElement *This = impl_from_IHTMLElement4(iface);
668     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
669     return E_NOTIMPL;
670 }
671
672 static HRESULT WINAPI HTMLElement4_get_onbeforeactivate(IHTMLElement4 *iface, VARIANT *p)
673 {
674     HTMLElement *This = impl_from_IHTMLElement4(iface);
675     FIXME("(%p)->(%p)\n", This, p);
676     return E_NOTIMPL;
677 }
678
679 static HRESULT WINAPI HTMLElement4_put_onfocusin(IHTMLElement4 *iface, VARIANT v)
680 {
681     HTMLElement *This = impl_from_IHTMLElement4(iface);
682     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
683     return E_NOTIMPL;
684 }
685
686 static HRESULT WINAPI HTMLElement4_get_onfocusin(IHTMLElement4 *iface, VARIANT *p)
687 {
688     HTMLElement *This = impl_from_IHTMLElement4(iface);
689     FIXME("(%p)->(%p)\n", This, p);
690     return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI HTMLElement4_put_onfocusout(IHTMLElement4 *iface, VARIANT v)
694 {
695     HTMLElement *This = impl_from_IHTMLElement4(iface);
696     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
697     return E_NOTIMPL;
698 }
699
700 static HRESULT WINAPI HTMLElement4_get_onfocusout(IHTMLElement4 *iface, VARIANT *p)
701 {
702     HTMLElement *This = impl_from_IHTMLElement4(iface);
703     FIXME("(%p)->(%p)\n", This, p);
704     return E_NOTIMPL;
705 }
706
707 static const IHTMLElement4Vtbl HTMLElement4Vtbl = {
708     HTMLElement4_QueryInterface,
709     HTMLElement4_AddRef,
710     HTMLElement4_Release,
711     HTMLElement4_GetTypeInfoCount,
712     HTMLElement4_GetTypeInfo,
713     HTMLElement4_GetIDsOfNames,
714     HTMLElement4_Invoke,
715     HTMLElement4_put_onmousewheel,
716     HTMLElement4_get_onmousewheel,
717     HTMLElement4_normalize,
718     HTMLElement4_getAttributeNode,
719     HTMLElement4_setAttributeNode,
720     HTMLElement4_removeAttributeNode,
721     HTMLElement4_put_onbeforeactivate,
722     HTMLElement4_get_onbeforeactivate,
723     HTMLElement4_put_onfocusin,
724     HTMLElement4_get_onfocusin,
725     HTMLElement4_put_onfocusout,
726     HTMLElement4_get_onfocusout
727 };
728
729 void HTMLElement3_Init(HTMLElement *This)
730 {
731     This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
732     This->IHTMLElement4_iface.lpVtbl = &HTMLElement4Vtbl;
733 }