mshtml: Added IHTMLElement2::getBoundingClientRect implementation.
[wine] / dlls / mshtml / htmlelem2.c
1 /*
2  * Copyright 2006-2010 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 typedef struct {
37     DispatchEx dispex;
38     const IHTMLRectVtbl *lpIHTMLRectVtbl;
39     LONG ref;
40 } HTMLRect;
41
42 #define HTMLRECT(x)  ((IHTMLRect*)  &(x)->lpIHTMLRectVtbl)
43
44 #define HTMLRECT_THIS(iface) DEFINE_THIS(HTMLRect, IHTMLRect, iface)
45
46 static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, void **ppv)
47 {
48     HTMLRect *This = HTMLRECT_THIS(iface);
49
50     if(IsEqualGUID(&IID_IUnknown, riid)) {
51         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
52         *ppv = HTMLRECT(This);
53     }else if(IsEqualGUID(&IID_IHTMLRect, riid)) {
54         TRACE("(%p)->(IID_IHTMLRect %p)\n", This, ppv);
55         *ppv = HTMLRECT(This);
56     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
57         return *ppv ? S_OK : E_NOINTERFACE;
58     }else {
59         FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
60         *ppv = NULL;
61         return E_NOINTERFACE;
62     }
63
64     IUnknown_AddRef((IUnknown*)*ppv);
65     return S_OK;
66 }
67
68 static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
69 {
70     HTMLRect *This = HTMLRECT_THIS(iface);
71     LONG ref = InterlockedIncrement(&This->ref);
72
73     TRACE("(%p) ref=%d\n", This, ref);
74
75     return ref;
76 }
77
78 static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
79 {
80     HTMLRect *This = HTMLRECT_THIS(iface);
81     LONG ref = InterlockedDecrement(&This->ref);
82
83     TRACE("(%p) ref=%d\n", This, ref);
84
85     if(!ref)
86         heap_free(This);
87
88     return ref;
89 }
90
91 static HRESULT WINAPI HTMLRect_GetTypeInfoCount(IHTMLRect *iface, UINT *pctinfo)
92 {
93     HTMLRect *This = HTMLRECT_THIS(iface);
94     FIXME("(%p)->(%p)\n", This, pctinfo);
95     return E_NOTIMPL;
96 }
97
98 static HRESULT WINAPI HTMLRect_GetTypeInfo(IHTMLRect *iface, UINT iTInfo,
99         LCID lcid, ITypeInfo **ppTInfo)
100 {
101     HTMLRect *This = HTMLRECT_THIS(iface);
102
103     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
104 }
105
106 static HRESULT WINAPI HTMLRect_GetIDsOfNames(IHTMLRect *iface, REFIID riid,
107         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
108 {
109     HTMLRect *This = HTMLRECT_THIS(iface);
110
111     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
112 }
113
114 static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
115         REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
116         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
117 {
118     HTMLRect *This = HTMLRECT_THIS(iface);
119
120     return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
121             pVarResult, pExcepInfo, puArgErr);
122 }
123
124 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
125 {
126     HTMLRect *This = HTMLRECT_THIS(iface);
127     FIXME("(%p)->(%d)\n", This, v);
128     return E_NOTIMPL;
129 }
130
131 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
132 {
133     HTMLRect *This = HTMLRECT_THIS(iface);
134     FIXME("(%p)->(%p)\n", This, p);
135     return E_NOTIMPL;
136 }
137
138 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
139 {
140     HTMLRect *This = HTMLRECT_THIS(iface);
141     FIXME("(%p)->(%d)\n", This, v);
142     return E_NOTIMPL;
143 }
144
145 static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
146 {
147     HTMLRect *This = HTMLRECT_THIS(iface);
148     FIXME("(%p)->(%p)\n", This, p);
149     return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
153 {
154     HTMLRect *This = HTMLRECT_THIS(iface);
155     FIXME("(%p)->(%d)\n", This, v);
156     return E_NOTIMPL;
157 }
158
159 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
160 {
161     HTMLRect *This = HTMLRECT_THIS(iface);
162     FIXME("(%p)->(%p)\n", This, p);
163     return E_NOTIMPL;
164 }
165
166 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
167 {
168     HTMLRect *This = HTMLRECT_THIS(iface);
169     FIXME("(%p)->(%d)\n", This, v);
170     return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
174 {
175     HTMLRect *This = HTMLRECT_THIS(iface);
176     FIXME("(%p)->(%p)\n", This, p);
177     return E_NOTIMPL;
178 }
179
180 #undef HTMLRECT_THIS
181
182 static const IHTMLRectVtbl HTMLRectVtbl = {
183     HTMLRect_QueryInterface,
184     HTMLRect_AddRef,
185     HTMLRect_Release,
186     HTMLRect_GetTypeInfoCount,
187     HTMLRect_GetTypeInfo,
188     HTMLRect_GetIDsOfNames,
189     HTMLRect_Invoke,
190     HTMLRect_put_left,
191     HTMLRect_get_left,
192     HTMLRect_put_top,
193     HTMLRect_get_top,
194     HTMLRect_put_right,
195     HTMLRect_get_right,
196     HTMLRect_put_bottom,
197     HTMLRect_get_bottom
198 };
199
200 static const tid_t HTMLRect_iface_tids[] = {
201     IHTMLRect_tid,
202     0
203 };
204 static dispex_static_data_t HTMLRect_dispex = {
205     NULL,
206     IHTMLRect_tid,
207     NULL,
208     HTMLRect_iface_tids
209 };
210
211 static HRESULT create_html_rect(IHTMLRect **ret)
212 {
213     HTMLRect *rect;
214
215     rect = heap_alloc_zero(sizeof(HTMLRect));
216     if(!rect)
217         return E_OUTOFMEMORY;
218
219     rect->lpIHTMLRectVtbl = &HTMLRectVtbl;
220     rect->ref = 1;
221
222     init_dispex(&rect->dispex, (IUnknown*)HTMLRECT(rect), &HTMLRect_dispex);
223
224     *ret = HTMLRECT(rect);
225     return S_OK;
226 }
227
228 #define HTMLELEM2_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement2, iface)
229
230 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
231                                                   REFIID riid, void **ppv)
232 {
233     HTMLElement *This = HTMLELEM2_THIS(iface);
234     return IHTMLElement_QueryInterface(HTMLELEM(This), riid, ppv);
235 }
236
237 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
238 {
239     HTMLElement *This = HTMLELEM2_THIS(iface);
240     return IHTMLElement_AddRef(HTMLELEM(This));
241 }
242
243 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
244 {
245     HTMLElement *This = HTMLELEM2_THIS(iface);
246     return IHTMLElement_Release(HTMLELEM(This));
247 }
248
249 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
250 {
251     HTMLElement *This = HTMLELEM2_THIS(iface);
252     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
253 }
254
255 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
256                                                LCID lcid, ITypeInfo **ppTInfo)
257 {
258     HTMLElement *This = HTMLELEM2_THIS(iface);
259     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
260 }
261
262 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
263                                                 LPOLESTR *rgszNames, UINT cNames,
264                                                 LCID lcid, DISPID *rgDispId)
265 {
266     HTMLElement *This = HTMLELEM2_THIS(iface);
267     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
268 }
269
270 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
271                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
272                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
273 {
274     HTMLElement *This = HTMLELEM2_THIS(iface);
275     return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
276             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
277 }
278
279 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
280 {
281     HTMLElement *This = HTMLELEM2_THIS(iface);
282     FIXME("(%p)->(%p)\n", This, p);
283     return E_NOTIMPL;
284 }
285
286 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
287 {
288     HTMLElement *This = HTMLELEM2_THIS(iface);
289     FIXME("(%p)->(%x)\n", This, containerCapture);
290     return E_NOTIMPL;
291 }
292
293 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
294 {
295     HTMLElement *This = HTMLELEM2_THIS(iface);
296     FIXME("(%p)\n", This);
297     return E_NOTIMPL;
298 }
299
300 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
301 {
302     HTMLElement *This = HTMLELEM2_THIS(iface);
303     FIXME("(%p)->()\n", This);
304     return E_NOTIMPL;
305 }
306
307 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
308 {
309     HTMLElement *This = HTMLELEM2_THIS(iface);
310     FIXME("(%p)->(%p)\n", This, p);
311     return E_NOTIMPL;
312 }
313
314 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
315                                                       LONG x, LONG y, BSTR *component)
316 {
317     HTMLElement *This = HTMLELEM2_THIS(iface);
318     FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
319     return E_NOTIMPL;
320 }
321
322 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
323 {
324     HTMLElement *This = HTMLELEM2_THIS(iface);
325
326     TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
327
328     if(!This->node.doc->content_ready
329        || !This->node.doc->basedoc.doc_obj->in_place_active)
330         return E_PENDING;
331
332     WARN("stub\n");
333     return S_OK;
334 }
335
336 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
337 {
338     HTMLElement *This = HTMLELEM2_THIS(iface);
339     FIXME("(%p)->()\n", This);
340     return E_NOTIMPL;
341 }
342
343 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
344 {
345     HTMLElement *This = HTMLELEM2_THIS(iface);
346     FIXME("(%p)->(%p)\n", This, p);
347     return E_NOTIMPL;
348 }
349
350 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
351 {
352     HTMLElement *This = HTMLELEM2_THIS(iface);
353
354     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
355
356     return set_node_event(&This->node, EVENTID_DRAG, &v);
357 }
358
359 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
360 {
361     HTMLElement *This = HTMLELEM2_THIS(iface);
362
363     TRACE("(%p)->(%p)\n", This, p);
364
365     return get_node_event(&This->node, EVENTID_DRAG, p);
366 }
367
368 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
369 {
370     HTMLElement *This = HTMLELEM2_THIS(iface);
371     FIXME("(%p)->()\n", This);
372     return E_NOTIMPL;
373 }
374
375 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
376 {
377     HTMLElement *This = HTMLELEM2_THIS(iface);
378     FIXME("(%p)->(%p)\n", This, p);
379     return E_NOTIMPL;
380 }
381
382 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
383 {
384     HTMLElement *This = HTMLELEM2_THIS(iface);
385     FIXME("(%p)->()\n", This);
386     return E_NOTIMPL;
387 }
388
389 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
390 {
391     HTMLElement *This = HTMLELEM2_THIS(iface);
392     FIXME("(%p)->(%p)\n", This, p);
393     return E_NOTIMPL;
394 }
395
396 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
397 {
398     HTMLElement *This = HTMLELEM2_THIS(iface);
399     FIXME("(%p)->()\n", This);
400     return E_NOTIMPL;
401 }
402
403 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
404 {
405     HTMLElement *This = HTMLELEM2_THIS(iface);
406     FIXME("(%p)->(%p)\n", This, p);
407     return E_NOTIMPL;
408 }
409
410 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
411 {
412     HTMLElement *This = HTMLELEM2_THIS(iface);
413     FIXME("(%p)->()\n", This);
414     return E_NOTIMPL;
415 }
416
417 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
418 {
419     HTMLElement *This = HTMLELEM2_THIS(iface);
420     FIXME("(%p)->(%p)\n", This, p);
421     return E_NOTIMPL;
422 }
423
424 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
425 {
426     HTMLElement *This = HTMLELEM2_THIS(iface);
427     FIXME("(%p)->()\n", This);
428     return E_NOTIMPL;
429 }
430
431 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
432 {
433     HTMLElement *This = HTMLELEM2_THIS(iface);
434     FIXME("(%p)->(%p)\n", This, p);
435     return E_NOTIMPL;
436 }
437
438 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
439 {
440     HTMLElement *This = HTMLELEM2_THIS(iface);
441     FIXME("(%p)->()\n", This);
442     return E_NOTIMPL;
443 }
444
445 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
446 {
447     HTMLElement *This = HTMLELEM2_THIS(iface);
448     FIXME("(%p)->(%p)\n", This, p);
449     return E_NOTIMPL;
450 }
451
452 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
453 {
454     HTMLElement *This = HTMLELEM2_THIS(iface);
455     FIXME("(%p)->()\n", This);
456     return E_NOTIMPL;
457 }
458
459 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
460 {
461     HTMLElement *This = HTMLELEM2_THIS(iface);
462     FIXME("(%p)->(%p)\n", This, p);
463     return E_NOTIMPL;
464 }
465
466 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
467 {
468     HTMLElement *This = HTMLELEM2_THIS(iface);
469     FIXME("(%p)->()\n", This);
470     return E_NOTIMPL;
471 }
472
473 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
474 {
475     HTMLElement *This = HTMLELEM2_THIS(iface);
476     FIXME("(%p)->(%p)\n", This, p);
477     return E_NOTIMPL;
478 }
479
480 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
481 {
482     HTMLElement *This = HTMLELEM2_THIS(iface);
483     FIXME("(%p)->()\n", This);
484     return E_NOTIMPL;
485 }
486
487 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
488 {
489     HTMLElement *This = HTMLELEM2_THIS(iface);
490     FIXME("(%p)->(%p)\n", This, p);
491     return E_NOTIMPL;
492 }
493
494 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
495 {
496     HTMLElement *This = HTMLELEM2_THIS(iface);
497     FIXME("(%p)->()\n", This);
498     return E_NOTIMPL;
499 }
500
501 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
502 {
503     HTMLElement *This = HTMLELEM2_THIS(iface);
504     FIXME("(%p)->(%p)\n", This, p);
505     return E_NOTIMPL;
506 }
507
508 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
509 {
510     HTMLElement *This = HTMLELEM2_THIS(iface);
511
512     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
513
514     return set_node_event(&This->node, EVENTID_PASTE, &v);
515 }
516
517 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
518 {
519     HTMLElement *This = HTMLELEM2_THIS(iface);
520
521     TRACE("(%p)->(%p)\n", This, p);
522
523     return get_node_event(&This->node, EVENTID_PASTE, p);
524 }
525
526 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
527 {
528     HTMLElement *This = HTMLELEM2_THIS(iface);
529
530     TRACE("(%p)->(%p)\n", This, p);
531
532     return HTMLCurrentStyle_Create(This, p);
533 }
534
535 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
536 {
537     HTMLElement *This = HTMLELEM2_THIS(iface);
538     FIXME("(%p)->()\n", This);
539     return E_NOTIMPL;
540 }
541
542 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
543 {
544     HTMLElement *This = HTMLELEM2_THIS(iface);
545     FIXME("(%p)->(%p)\n", This, p);
546     return E_NOTIMPL;
547 }
548
549 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
550 {
551     HTMLElement *This = HTMLELEM2_THIS(iface);
552     FIXME("(%p)->(%p)\n", This, pRectCol);
553     return E_NOTIMPL;
554 }
555
556 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
557 {
558     HTMLElement *This = HTMLELEM2_THIS(iface);
559
560     TRACE("(%p)->(%p)\n", This, pRect);
561
562     return create_html_rect(pRect);
563 }
564
565 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
566                                                  BSTR expression, BSTR language)
567 {
568     HTMLElement *This = HTMLELEM2_THIS(iface);
569     FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
570           debugstr_w(language));
571     return E_NOTIMPL;
572 }
573
574 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
575                                                  VARIANT *expression)
576 {
577     HTMLElement *This = HTMLELEM2_THIS(iface);
578     FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
579     return E_NOTIMPL;
580 }
581
582 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
583                                                     VARIANT_BOOL *pfSuccess)
584 {
585     HTMLElement *This = HTMLELEM2_THIS(iface);
586     FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
587     return E_NOTIMPL;
588 }
589
590 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
591 {
592     HTMLElement *This = HTMLELEM2_THIS(iface);
593     nsIDOMNSHTMLElement *nselem;
594     nsresult nsres;
595
596     TRACE("(%p)->(%d)\n", This, v);
597
598     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
599     if(NS_FAILED(nsres)) {
600         ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
601         return S_OK;
602     }
603
604     nsres = nsIDOMNSHTMLElement_SetTabIndex(nselem, v);
605     nsIDOMNSHTMLElement_Release(nselem);
606     if(NS_FAILED(nsres))
607         ERR("GetTabIndex failed: %08x\n", nsres);
608
609     return S_OK;
610 }
611
612 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
613 {
614     HTMLElement *This = HTMLELEM2_THIS(iface);
615     nsIDOMNSHTMLElement *nselem;
616     PRInt32 index = 0;
617     nsresult nsres;
618
619     TRACE("(%p)->(%p)\n", This, p);
620
621     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
622     if(NS_FAILED(nsres)) {
623         ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
624         return E_FAIL;
625     }
626
627     nsres = nsIDOMNSHTMLElement_GetTabIndex(nselem, &index);
628     nsIDOMNSHTMLElement_Release(nselem);
629     if(NS_FAILED(nsres)) {
630         ERR("GetTabIndex failed: %08x\n", nsres);
631         return E_FAIL;
632     }
633
634     *p = index;
635     return S_OK;
636 }
637
638 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
639 {
640     HTMLElement *This = HTMLELEM2_THIS(iface);
641     nsIDOMNSHTMLElement *nselem;
642     nsresult nsres;
643
644     TRACE("(%p)\n", This);
645
646     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
647     if(NS_SUCCEEDED(nsres)) {
648         nsIDOMNSHTMLElement_Focus(nselem);
649         nsIDOMNSHTMLElement_Release(nselem);
650     }else {
651         ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
652     }
653
654     return S_OK;
655 }
656
657 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
658 {
659     HTMLElement *This = HTMLELEM2_THIS(iface);
660     VARIANT var;
661
662     static WCHAR accessKeyW[] = {'a','c','c','e','s','s','K','e','y',0};
663
664     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
665
666     V_VT(&var) = VT_BSTR;
667     V_BSTR(&var) = v;
668     return IHTMLElement_setAttribute(HTMLELEM(This), accessKeyW, var, 0);
669 }
670
671 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
672 {
673     HTMLElement *This = HTMLELEM2_THIS(iface);
674     FIXME("(%p)->(%p)\n", This, p);
675     return E_NOTIMPL;
676 }
677
678 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
679 {
680     HTMLElement *This = HTMLELEM2_THIS(iface);
681
682     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
683
684     return set_node_event(&This->node, EVENTID_BLUR, &v);
685 }
686
687 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
688 {
689     HTMLElement *This = HTMLELEM2_THIS(iface);
690
691     TRACE("(%p)->(%p)\n", This, p);
692
693     return get_node_event(&This->node, EVENTID_BLUR, p);
694 }
695
696 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
697 {
698     HTMLElement *This = HTMLELEM2_THIS(iface);
699
700     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
701
702     return set_node_event(&This->node, EVENTID_FOCUS, &v);
703 }
704
705 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
706 {
707     HTMLElement *This = HTMLELEM2_THIS(iface);
708
709     TRACE("(%p)->(%p)\n", This, p);
710
711     return get_node_event(&This->node, EVENTID_FOCUS, p);
712 }
713
714 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
715 {
716     HTMLElement *This = HTMLELEM2_THIS(iface);
717     FIXME("(%p)->()\n", This);
718     return E_NOTIMPL;
719 }
720
721 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
722 {
723     HTMLElement *This = HTMLELEM2_THIS(iface);
724     FIXME("(%p)->(%p)\n", This, p);
725     return E_NOTIMPL;
726 }
727
728 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
729 {
730     HTMLElement *This = HTMLELEM2_THIS(iface);
731     FIXME("(%p)\n", This);
732     return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
736 {
737     HTMLElement *This = HTMLELEM2_THIS(iface);
738     FIXME("(%p)->(%p)\n", This, pUnk);
739     return E_NOTIMPL;
740 }
741
742 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
743 {
744     HTMLElement *This = HTMLELEM2_THIS(iface);
745     FIXME("(%p)->(%p)\n", This, pUnk);
746     return E_NOTIMPL;
747 }
748
749 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
750 {
751     HTMLElement *This = HTMLELEM2_THIS(iface);
752     nsIDOMNSElement *nselem;
753     PRInt32 height=0;
754     nsresult nsres;
755
756     TRACE("(%p)->(%p)\n", This, p);
757
758     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
759     if(NS_SUCCEEDED(nsres)) {
760         nsIDOMNSElement_GetClientHeight(nselem, &height);
761         nsIDOMNSElement_Release(nselem);
762     }else {
763         ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
764     }
765
766     *p = height;
767     return S_OK;
768 }
769
770 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
771 {
772     HTMLElement *This = HTMLELEM2_THIS(iface);
773     nsIDOMNSElement *nselem;
774     PRInt32 width=0;
775     nsresult nsres;
776
777     TRACE("(%p)->(%p)\n", This, p);
778
779     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
780     if(NS_SUCCEEDED(nsres)) {
781         nsIDOMNSElement_GetClientWidth(nselem, &width);
782         nsIDOMNSElement_Release(nselem);
783     }else {
784         ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
785     }
786
787     *p = width;
788     return S_OK;
789 }
790
791 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
792 {
793     HTMLElement *This = HTMLELEM2_THIS(iface);
794     nsIDOMNSElement *nselem;
795     PRInt32 client_top = 0;
796     nsresult nsres;
797
798     TRACE("(%p)->(%p)\n", This, p);
799
800     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
801     if(NS_SUCCEEDED(nsres)) {
802         nsres = nsIDOMNSElement_GetClientTop(nselem, &client_top);
803         nsIDOMNSElement_Release(nselem);
804         if(NS_FAILED(nsres))
805             ERR("GetScrollHeight failed: %08x\n", nsres);
806     }else {
807         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
808     }
809
810     *p = client_top;
811     TRACE("*p = %d\n", *p);
812     return S_OK;
813 }
814
815 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
816 {
817     HTMLElement *This = HTMLELEM2_THIS(iface);
818     nsIDOMNSElement *nselem;
819     PRInt32 client_left = 0;
820     nsresult nsres;
821
822     TRACE("(%p)->(%p)\n", This, p);
823
824     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
825     if(NS_SUCCEEDED(nsres)) {
826         nsres = nsIDOMNSElement_GetClientLeft(nselem, &client_left);
827         nsIDOMNSElement_Release(nselem);
828         if(NS_FAILED(nsres))
829             ERR("GetScrollHeight failed: %08x\n", nsres);
830     }else {
831         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
832     }
833
834     *p = client_left;
835     TRACE("*p = %d\n", *p);
836     return S_OK;
837 }
838
839 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
840                                                IDispatch *pDisp, VARIANT_BOOL *pfResult)
841 {
842     HTMLElement *This = HTMLELEM2_THIS(iface);
843
844     TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
845
846     return attach_event(get_node_event_target(&This->node), This->node.nsnode, &This->node.doc->basedoc, event, pDisp, pfResult);
847 }
848
849 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
850 {
851     HTMLElement *This = HTMLELEM2_THIS(iface);
852
853     TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
854
855     return detach_event(*get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp);
856 }
857
858 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
859 {
860     HTMLElement *This = HTMLELEM2_THIS(iface);
861     BSTR str;
862
863     TRACE("(%p)->(%p)\n", This, p);
864
865     if(This->node.vtbl->get_readystate) {
866         HRESULT hres;
867
868         hres = This->node.vtbl->get_readystate(&This->node, &str);
869         if(FAILED(hres))
870             return hres;
871     }else {
872         static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
873
874         str = SysAllocString(completeW);
875         if(!str)
876             return E_OUTOFMEMORY;
877     }
878
879     V_VT(p) = VT_BSTR;
880     V_BSTR(p) = str;
881     return S_OK;
882 }
883
884 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
885 {
886     HTMLElement *This = HTMLELEM2_THIS(iface);
887
888     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
889
890     return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
891 }
892
893 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
894 {
895     HTMLElement *This = HTMLELEM2_THIS(iface);
896
897     TRACE("(%p)->(%p)\n", This, p);
898
899     return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
900 }
901
902 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
903 {
904     HTMLElement *This = HTMLELEM2_THIS(iface);
905     FIXME("(%p)->()\n", This);
906     return E_NOTIMPL;
907 }
908
909 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
910 {
911     HTMLElement *This = HTMLELEM2_THIS(iface);
912     FIXME("(%p)->(%p)\n", This, p);
913     return E_NOTIMPL;
914 }
915
916 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
917 {
918     HTMLElement *This = HTMLELEM2_THIS(iface);
919     FIXME("(%p)->()\n", This);
920     return E_NOTIMPL;
921 }
922
923 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
924 {
925     HTMLElement *This = HTMLELEM2_THIS(iface);
926     FIXME("(%p)->(%p)\n", This, p);
927     return E_NOTIMPL;
928 }
929
930 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
931 {
932     HTMLElement *This = HTMLELEM2_THIS(iface);
933     FIXME("(%p)->()\n", This);
934     return E_NOTIMPL;
935 }
936
937 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
938 {
939     HTMLElement *This = HTMLELEM2_THIS(iface);
940     FIXME("(%p)->(%p)\n", This, p);
941     return E_NOTIMPL;
942 }
943
944 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
945 {
946     HTMLElement *This = HTMLELEM2_THIS(iface);
947     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
948     return E_NOTIMPL;
949 }
950
951 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
952 {
953     HTMLElement *This = HTMLELEM2_THIS(iface);
954
955     TRACE("(%p)->(%p)\n", This, p);
956
957     *p = NULL;
958
959     if(This->nselem) {
960         nsAString dir_str;
961         nsresult nsres;
962
963         nsAString_Init(&dir_str, NULL);
964
965         nsres = nsIDOMHTMLElement_GetDir(This->nselem, &dir_str);
966         if(NS_SUCCEEDED(nsres)) {
967             const PRUnichar *dir;
968             nsAString_GetData(&dir_str, &dir);
969             if(*dir)
970                 *p = SysAllocString(dir);
971         }else {
972             ERR("GetDir failed: %08x\n", nsres);
973         }
974
975         nsAString_Finish(&dir_str);
976     }
977
978     TRACE("ret %s\n", debugstr_w(*p));
979     return S_OK;
980 }
981
982 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
983 {
984     HTMLElement *This = HTMLELEM2_THIS(iface);
985     FIXME("(%p)->(%p)\n", This, range);
986     return E_NOTIMPL;
987 }
988
989 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
990 {
991     HTMLElement *This = HTMLELEM2_THIS(iface);
992     nsIDOMNSElement *nselem;
993     PRInt32 height = 0;
994     nsresult nsres;
995
996     TRACE("(%p)->(%p)\n", This, p);
997
998     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
999     if(NS_SUCCEEDED(nsres)) {
1000         nsres = nsIDOMNSElement_GetScrollHeight(nselem, &height);
1001         nsIDOMNSElement_Release(nselem);
1002         if(NS_FAILED(nsres))
1003             ERR("GetScrollHeight failed: %08x\n", nsres);
1004     }else {
1005         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
1006     }
1007
1008     *p = height;
1009     TRACE("*p = %d\n", *p);
1010
1011     return S_OK;
1012 }
1013
1014 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
1015 {
1016     HTMLElement *This = HTMLELEM2_THIS(iface);
1017     nsIDOMNSElement *nselem;
1018     PRInt32 width = 0;
1019     nsresult nsres;
1020
1021     TRACE("(%p)->(%p)\n", This, p);
1022
1023     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
1024     if(NS_SUCCEEDED(nsres)) {
1025         nsres = nsIDOMNSElement_GetScrollWidth(nselem, &width);
1026         nsIDOMNSElement_Release(nselem);
1027         if(NS_FAILED(nsres))
1028             ERR("GetScrollWidth failed: %08x\n", nsres);
1029     }else {
1030         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
1031     }
1032
1033     *p = width;
1034     TRACE("*p = %d\n", *p);
1035
1036     return S_OK;
1037 }
1038
1039 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
1040 {
1041     HTMLElement *This = HTMLELEM2_THIS(iface);
1042     nsIDOMNSElement *nselem;
1043     nsresult nsres;
1044
1045     TRACE("(%p)->(%d)\n", This, v);
1046
1047     if(!This->nselem) {
1048         FIXME("NULL nselem\n");
1049         return E_NOTIMPL;
1050     }
1051
1052     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
1053     if(NS_SUCCEEDED(nsres)) {
1054         nsIDOMNSElement_SetScrollTop(nselem, v);
1055         nsIDOMNSElement_Release(nselem);
1056     }else {
1057         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
1058     }
1059
1060     return S_OK;
1061 }
1062
1063 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
1064 {
1065     HTMLElement *This = HTMLELEM2_THIS(iface);
1066     nsIDOMNSElement *nselem;
1067     PRInt32 top = 0;
1068     nsresult nsres;
1069
1070     TRACE("(%p)->(%p)\n", This, p);
1071
1072     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
1073     if(NS_SUCCEEDED(nsres)) {
1074         nsres = nsIDOMNSElement_GetScrollTop(nselem, &top);
1075         nsIDOMNSElement_Release(nselem);
1076         if(NS_FAILED(nsres))
1077             ERR("GetScrollTop failed: %08x\n", nsres);
1078     }else {
1079         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
1080     }
1081
1082     *p = top;
1083     TRACE("*p = %d\n", *p);
1084
1085     return S_OK;
1086 }
1087
1088 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
1089 {
1090     HTMLElement *This = HTMLELEM2_THIS(iface);
1091     nsIDOMNSElement *nselem;
1092     nsresult nsres;
1093
1094     TRACE("(%p)->(%d)\n", This, v);
1095
1096     if(!This->nselem) {
1097         FIXME("NULL nselem\n");
1098         return E_NOTIMPL;
1099     }
1100
1101     nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
1102     if(NS_SUCCEEDED(nsres)) {
1103         nsIDOMNSElement_SetScrollLeft(nselem, v);
1104         nsIDOMNSElement_Release(nselem);
1105     }else {
1106         ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
1107     }
1108
1109     return S_OK;
1110 }
1111
1112 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
1113 {
1114     HTMLElement *This = HTMLELEM2_THIS(iface);
1115     nsIDOMNSElement *nselem;
1116     PRInt32 left = 0;
1117     nsresult nsres;
1118
1119     TRACE("(%p)->(%p)\n", This, p);
1120
1121     if(!p)
1122         return E_INVALIDARG;
1123
1124     if(!This->nselem)
1125     {
1126         FIXME("NULL nselem\n");
1127         return E_NOTIMPL;
1128     }
1129
1130     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
1131     if(NS_SUCCEEDED(nsres))
1132     {
1133         nsres = nsIDOMNSElement_GetScrollLeft(nselem, &left);
1134         nsIDOMNSElement_Release(nselem);
1135         if(NS_FAILED(nsres))
1136             left = 0;
1137     }
1138
1139     *p = left;
1140     TRACE("*p = %d\n", *p);
1141
1142     return S_OK;
1143 }
1144
1145 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
1146 {
1147     HTMLElement *This = HTMLELEM2_THIS(iface);
1148     FIXME("(%p)\n", This);
1149     return E_NOTIMPL;
1150 }
1151
1152 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
1153 {
1154     HTMLElement *This = HTMLELEM2_THIS(iface);
1155     FIXME("(%p)->(%p)\n", This, mergeThis);
1156     return E_NOTIMPL;
1157 }
1158
1159 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
1160 {
1161     HTMLElement *This = HTMLELEM2_THIS(iface);
1162     FIXME("(%p)->()\n", This);
1163     return E_NOTIMPL;
1164 }
1165
1166 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
1167 {
1168     HTMLElement *This = HTMLELEM2_THIS(iface);
1169     FIXME("(%p)->(%p)\n", This, p);
1170     return E_NOTIMPL;
1171 }
1172
1173 static HRESULT WINAPI HTMLElement2_insertAdjecentElement(IHTMLElement2 *iface, BSTR where,
1174         IHTMLElement *insertedElement, IHTMLElement **inserted)
1175 {
1176     HTMLElement *This = HTMLELEM2_THIS(iface);
1177     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
1178     return E_NOTIMPL;
1179 }
1180
1181 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
1182                                                 BSTR where, IHTMLElement **applied)
1183 {
1184     HTMLElement *This = HTMLELEM2_THIS(iface);
1185     FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
1186     return E_NOTIMPL;
1187 }
1188
1189 static HRESULT WINAPI HTMLElement2_getAdjecentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
1190 {
1191     HTMLElement *This = HTMLELEM2_THIS(iface);
1192     FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
1193     return E_NOTIMPL;
1194 }
1195
1196 static HRESULT WINAPI HTMLElement2_replaceAdjecentText(IHTMLElement2 *iface, BSTR where,
1197                                                        BSTR newText, BSTR *oldText)
1198 {
1199     HTMLElement *This = HTMLELEM2_THIS(iface);
1200     FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
1201     return E_NOTIMPL;
1202 }
1203
1204 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
1205 {
1206     HTMLElement *This = HTMLELEM2_THIS(iface);
1207     FIXME("(%p)->(%p)\n", This, p);
1208     return E_NOTIMPL;
1209 }
1210
1211 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
1212                                                VARIANT *pvarFactory, LONG *pCookie)
1213 {
1214     HTMLElement *This = HTMLELEM2_THIS(iface);
1215     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
1216     return E_NOTIMPL;
1217 }
1218
1219 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
1220                                                   VARIANT_BOOL *pfResult)
1221 {
1222     HTMLElement *This = HTMLELEM2_THIS(iface);
1223     FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
1224     return E_NOTIMPL;
1225 }
1226
1227 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
1228 {
1229     HTMLElement *This = HTMLELEM2_THIS(iface);
1230     FIXME("(%p)->(%p)\n", This, p);
1231     return E_NOTIMPL;
1232 }
1233
1234 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
1235 {
1236     HTMLElement *This = HTMLELEM2_THIS(iface);
1237     FIXME("(%p)->(%p)\n", This, p);
1238     return E_NOTIMPL;
1239 }
1240
1241 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
1242 {
1243     HTMLElement *This = HTMLELEM2_THIS(iface);
1244     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1245     return E_NOTIMPL;
1246 }
1247
1248 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
1249 {
1250     HTMLElement *This = HTMLELEM2_THIS(iface);
1251     FIXME("(%p)->(%p)\n", This, p);
1252     return E_NOTIMPL;
1253 }
1254
1255 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
1256 {
1257     HTMLElement *This = HTMLELEM2_THIS(iface);
1258     FIXME("(%p)->()\n", This);
1259     return E_NOTIMPL;
1260 }
1261
1262 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
1263 {
1264     HTMLElement *This = HTMLELEM2_THIS(iface);
1265     FIXME("(%p)->(%p)\n", This, p);
1266     return E_NOTIMPL;
1267 }
1268
1269 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
1270 {
1271     HTMLElement *This = HTMLELEM2_THIS(iface);
1272     FIXME("(%p)->(%p)\n", This, p);
1273     return E_NOTIMPL;
1274 }
1275
1276 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
1277                                                        IHTMLElementCollection **pelColl)
1278 {
1279     HTMLElement *This = HTMLELEM2_THIS(iface);
1280     nsIDOMNodeList *nslist;
1281     nsAString tag_str;
1282     nsresult nsres;
1283
1284     TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
1285
1286     nsAString_InitDepend(&tag_str, v);
1287     nsres = nsIDOMHTMLElement_GetElementsByTagName(This->nselem, &tag_str, &nslist);
1288     nsAString_Finish(&tag_str);
1289     if(NS_FAILED(nsres)) {
1290         ERR("GetElementByTagName failed: %08x\n", nsres);
1291         return E_FAIL;
1292     }
1293
1294     *pelColl = create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nslist);
1295     nsIDOMNodeList_Release(nslist);
1296     return S_OK;
1297 }
1298
1299 #undef HTMLELEM2_THIS
1300
1301 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
1302     HTMLElement2_QueryInterface,
1303     HTMLElement2_AddRef,
1304     HTMLElement2_Release,
1305     HTMLElement2_GetTypeInfoCount,
1306     HTMLElement2_GetTypeInfo,
1307     HTMLElement2_GetIDsOfNames,
1308     HTMLElement2_Invoke,
1309     HTMLElement2_get_scopeName,
1310     HTMLElement2_setCapture,
1311     HTMLElement2_releaseCapture,
1312     HTMLElement2_put_onlosecapture,
1313     HTMLElement2_get_onlosecapture,
1314     HTMLElement2_componentFromPoint,
1315     HTMLElement2_doScroll,
1316     HTMLElement2_put_onscroll,
1317     HTMLElement2_get_onscroll,
1318     HTMLElement2_put_ondrag,
1319     HTMLElement2_get_ondrag,
1320     HTMLElement2_put_ondragend,
1321     HTMLElement2_get_ondragend,
1322     HTMLElement2_put_ondragenter,
1323     HTMLElement2_get_ondragenter,
1324     HTMLElement2_put_ondragover,
1325     HTMLElement2_get_ondragover,
1326     HTMLElement2_put_ondragleave,
1327     HTMLElement2_get_ondragleave,
1328     HTMLElement2_put_ondrop,
1329     HTMLElement2_get_ondrop,
1330     HTMLElement2_put_onbeforecut,
1331     HTMLElement2_get_onbeforecut,
1332     HTMLElement2_put_oncut,
1333     HTMLElement2_get_oncut,
1334     HTMLElement2_put_onbeforecopy,
1335     HTMLElement2_get_onbeforecopy,
1336     HTMLElement2_put_oncopy,
1337     HTMLElement2_get_oncopy,
1338     HTMLElement2_put_onbeforepaste,
1339     HTMLElement2_get_onbeforepaste,
1340     HTMLElement2_put_onpaste,
1341     HTMLElement2_get_onpaste,
1342     HTMLElement2_get_currentStyle,
1343     HTMLElement2_put_onpropertychange,
1344     HTMLElement2_get_onpropertychange,
1345     HTMLElement2_getClientRects,
1346     HTMLElement2_getBoundingClientRect,
1347     HTMLElement2_setExpression,
1348     HTMLElement2_getExpression,
1349     HTMLElement2_removeExpression,
1350     HTMLElement2_put_tabIndex,
1351     HTMLElement2_get_tabIndex,
1352     HTMLElement2_focus,
1353     HTMLElement2_put_accessKey,
1354     HTMLElement2_get_accessKey,
1355     HTMLElement2_put_onblur,
1356     HTMLElement2_get_onblur,
1357     HTMLElement2_put_onfocus,
1358     HTMLElement2_get_onfocus,
1359     HTMLElement2_put_onresize,
1360     HTMLElement2_get_onresize,
1361     HTMLElement2_blur,
1362     HTMLElement2_addFilter,
1363     HTMLElement2_removeFilter,
1364     HTMLElement2_get_clientHeight,
1365     HTMLElement2_get_clientWidth,
1366     HTMLElement2_get_clientTop,
1367     HTMLElement2_get_clientLeft,
1368     HTMLElement2_attachEvent,
1369     HTMLElement2_detachEvent,
1370     HTMLElement2_get_readyState,
1371     HTMLElement2_put_onreadystatechange,
1372     HTMLElement2_get_onreadystatechange,
1373     HTMLElement2_put_onrowsdelete,
1374     HTMLElement2_get_onrowsdelete,
1375     HTMLElement2_put_onrowsinserted,
1376     HTMLElement2_get_onrowsinserted,
1377     HTMLElement2_put_oncellchange,
1378     HTMLElement2_get_oncellchange,
1379     HTMLElement2_put_dir,
1380     HTMLElement2_get_dir,
1381     HTMLElement2_createControlRange,
1382     HTMLElement2_get_scrollHeight,
1383     HTMLElement2_get_scrollWidth,
1384     HTMLElement2_put_scrollTop,
1385     HTMLElement2_get_scrollTop,
1386     HTMLElement2_put_scrollLeft,
1387     HTMLElement2_get_scrollLeft,
1388     HTMLElement2_clearAttributes,
1389     HTMLElement2_mergeAttributes,
1390     HTMLElement2_put_oncontextmenu,
1391     HTMLElement2_get_oncontextmenu,
1392     HTMLElement2_insertAdjecentElement,
1393     HTMLElement2_applyElement,
1394     HTMLElement2_getAdjecentText,
1395     HTMLElement2_replaceAdjecentText,
1396     HTMLElement2_get_canHandleChildren,
1397     HTMLElement2_addBehavior,
1398     HTMLElement2_removeBehavior,
1399     HTMLElement2_get_runtimeStyle,
1400     HTMLElement2_get_behaviorUrns,
1401     HTMLElement2_put_tagUrn,
1402     HTMLElement2_get_tagUrn,
1403     HTMLElement2_put_onbeforeeditfocus,
1404     HTMLElement2_get_onbeforeeditfocus,
1405     HTMLElement2_get_readyStateValue,
1406     HTMLElement2_getElementsByTagName,
1407 };
1408
1409 void HTMLElement2_Init(HTMLElement *This)
1410 {
1411     This->lpHTMLElement2Vtbl = &HTMLElement2Vtbl;
1412 }