mshtml: Added IHTMLElement2::focus implementation.
[wine] / dlls / mshtml / htmlelem2.c
1 /*
2  * Copyright 2006 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
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 #define HTMLELEM2_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement2, iface)
36
37 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
38                                                   REFIID riid, void **ppv)
39 {
40     HTMLElement *This = HTMLELEM2_THIS(iface);
41     return IHTMLElement_QueryInterface(HTMLELEM(This), riid, ppv);
42 }
43
44 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
45 {
46     HTMLElement *This = HTMLELEM2_THIS(iface);
47     return IHTMLElement_AddRef(HTMLELEM(This));
48 }
49
50 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
51 {
52     HTMLElement *This = HTMLELEM2_THIS(iface);
53     return IHTMLElement_Release(HTMLELEM(This));
54 }
55
56 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
57 {
58     HTMLElement *This = HTMLELEM2_THIS(iface);
59     FIXME("(%p)->(%p)\n", This, pctinfo);
60     return E_NOTIMPL;
61 }
62
63 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
64                                                LCID lcid, ITypeInfo **ppTInfo)
65 {
66     HTMLElement *This = HTMLELEM2_THIS(iface);
67     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
68     return E_NOTIMPL;
69 }
70
71 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
72                                                 LPOLESTR *rgszNames, UINT cNames,
73                                                 LCID lcid, DISPID *rgDispId)
74 {
75     HTMLElement *This = HTMLELEM2_THIS(iface);
76     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
77                                         lcid, rgDispId);
78     return E_NOTIMPL;
79 }
80
81 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
82                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
83                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
84 {
85     HTMLElement *This = HTMLELEM2_THIS(iface);
86     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
87             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
88     return E_NOTIMPL;
89 }
90
91 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
92 {
93     HTMLElement *This = HTMLELEM2_THIS(iface);
94     FIXME("(%p)->(%p)\n", This, p);
95     return E_NOTIMPL;
96 }
97
98 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
99 {
100     HTMLElement *This = HTMLELEM2_THIS(iface);
101     FIXME("(%p)->(%x)\n", This, containerCapture);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
106 {
107     HTMLElement *This = HTMLELEM2_THIS(iface);
108     FIXME("(%p)\n", This);
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
113 {
114     HTMLElement *This = HTMLELEM2_THIS(iface);
115     FIXME("(%p)->()\n", This);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
120 {
121     HTMLElement *This = HTMLELEM2_THIS(iface);
122     FIXME("(%p)->(%p)\n", This, p);
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
127                                                       long x, long y, BSTR *component)
128 {
129     HTMLElement *This = HTMLELEM2_THIS(iface);
130     FIXME("(%p)->(%ld %ld %p)\n", This, x, y, component);
131     return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
135 {
136     HTMLElement *This = HTMLELEM2_THIS(iface);
137     FIXME("(%p)->()\n", This);
138     return E_NOTIMPL;
139 }
140
141 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
142 {
143     HTMLElement *This = HTMLELEM2_THIS(iface);
144     FIXME("(%p)->()\n", This);
145     return E_NOTIMPL;
146 }
147
148 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
149 {
150     HTMLElement *This = HTMLELEM2_THIS(iface);
151     FIXME("(%p)->(%p)\n", This, p);
152     return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
156 {
157     HTMLElement *This = HTMLELEM2_THIS(iface);
158     FIXME("(%p)->()\n", This);
159     return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
163 {
164     HTMLElement *This = HTMLELEM2_THIS(iface);
165     FIXME("(%p)->(%p)\n", This, p);
166     return E_NOTIMPL;
167 }
168
169 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
170 {
171     HTMLElement *This = HTMLELEM2_THIS(iface);
172     FIXME("(%p)->()\n", This);
173     return E_NOTIMPL;
174 }
175
176 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
177 {
178     HTMLElement *This = HTMLELEM2_THIS(iface);
179     FIXME("(%p)->(%p)\n", This, p);
180     return E_NOTIMPL;
181 }
182
183 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
184 {
185     HTMLElement *This = HTMLELEM2_THIS(iface);
186     FIXME("(%p)->()\n", This);
187     return E_NOTIMPL;
188 }
189
190 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
191 {
192     HTMLElement *This = HTMLELEM2_THIS(iface);
193     FIXME("(%p)->(%p)\n", This, p);
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
198 {
199     HTMLElement *This = HTMLELEM2_THIS(iface);
200     FIXME("(%p)->()\n", This);
201     return E_NOTIMPL;
202 }
203
204 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
205 {
206     HTMLElement *This = HTMLELEM2_THIS(iface);
207     FIXME("(%p)->(%p)\n", This, p);
208     return E_NOTIMPL;
209 }
210
211 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
212 {
213     HTMLElement *This = HTMLELEM2_THIS(iface);
214     FIXME("(%p)->()\n", This);
215     return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
219 {
220     HTMLElement *This = HTMLELEM2_THIS(iface);
221     FIXME("(%p)->(%p)\n", This, p);
222     return E_NOTIMPL;
223 }
224
225 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
226 {
227     HTMLElement *This = HTMLELEM2_THIS(iface);
228     FIXME("(%p)->()\n", This);
229     return E_NOTIMPL;
230 }
231
232 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
233 {
234     HTMLElement *This = HTMLELEM2_THIS(iface);
235     FIXME("(%p)->(%p)\n", This, p);
236     return E_NOTIMPL;
237 }
238
239 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
240 {
241     HTMLElement *This = HTMLELEM2_THIS(iface);
242     FIXME("(%p)->()\n", This);
243     return E_NOTIMPL;
244 }
245
246 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
247 {
248     HTMLElement *This = HTMLELEM2_THIS(iface);
249     FIXME("(%p)->(%p)\n", This, p);
250     return E_NOTIMPL;
251 }
252
253 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
254 {
255     HTMLElement *This = HTMLELEM2_THIS(iface);
256     FIXME("(%p)->()\n", This);
257     return E_NOTIMPL;
258 }
259
260 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
261 {
262     HTMLElement *This = HTMLELEM2_THIS(iface);
263     FIXME("(%p)->(%p)\n", This, p);
264     return E_NOTIMPL;
265 }
266
267 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
268 {
269     HTMLElement *This = HTMLELEM2_THIS(iface);
270     FIXME("(%p)->()\n", This);
271     return E_NOTIMPL;
272 }
273
274 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
275 {
276     HTMLElement *This = HTMLELEM2_THIS(iface);
277     FIXME("(%p)->(%p)\n", This, p);
278     return E_NOTIMPL;
279 }
280
281 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
282 {
283     HTMLElement *This = HTMLELEM2_THIS(iface);
284     FIXME("(%p)->()\n", This);
285     return E_NOTIMPL;
286 }
287
288 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
289 {
290     HTMLElement *This = HTMLELEM2_THIS(iface);
291     FIXME("(%p)->(%p)\n", This, p);
292     return E_NOTIMPL;
293 }
294
295 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
296 {
297     HTMLElement *This = HTMLELEM2_THIS(iface);
298     FIXME("(%p)->()\n", This);
299     return E_NOTIMPL;
300 }
301
302 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
303 {
304     HTMLElement *This = HTMLELEM2_THIS(iface);
305     FIXME("(%p)->(%p)\n", This, p);
306     return E_NOTIMPL;
307 }
308
309 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
310 {
311     HTMLElement *This = HTMLELEM2_THIS(iface);
312     FIXME("(%p)->()\n", This);
313     return E_NOTIMPL;
314 }
315
316 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
317 {
318     HTMLElement *This = HTMLELEM2_THIS(iface);
319     FIXME("(%p)->(%p)\n", This, p);
320     return E_NOTIMPL;
321 }
322
323 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
324 {
325     HTMLElement *This = HTMLELEM2_THIS(iface);
326     FIXME("(%p)->(%p)\n", This, p);
327     return E_NOTIMPL;
328 }
329
330 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
331 {
332     HTMLElement *This = HTMLELEM2_THIS(iface);
333     FIXME("(%p)->()\n", This);
334     return E_NOTIMPL;
335 }
336
337 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
338 {
339     HTMLElement *This = HTMLELEM2_THIS(iface);
340     FIXME("(%p)->(%p)\n", This, p);
341     return E_NOTIMPL;
342 }
343
344 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
345 {
346     HTMLElement *This = HTMLELEM2_THIS(iface);
347     FIXME("(%p)->(%p)\n", This, pRectCol);
348     return E_NOTIMPL;
349 }
350
351 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
352 {
353     HTMLElement *This = HTMLELEM2_THIS(iface);
354     FIXME("(%p)->(%p)\n", This, pRect);
355     return E_NOTIMPL;
356 }
357
358 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
359                                                  BSTR expression, BSTR language)
360 {
361     HTMLElement *This = HTMLELEM2_THIS(iface);
362     FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
363           debugstr_w(language));
364     return E_NOTIMPL;
365 }
366
367 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
368                                                  VARIANT *expression)
369 {
370     HTMLElement *This = HTMLELEM2_THIS(iface);
371     FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
372     return E_NOTIMPL;
373 }
374
375 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
376                                                     VARIANT_BOOL *pfSuccess)
377 {
378     HTMLElement *This = HTMLELEM2_THIS(iface);
379     FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
380     return E_NOTIMPL;
381 }
382
383 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
384 {
385     HTMLElement *This = HTMLELEM2_THIS(iface);
386     FIXME("(%p)->(%d)\n", This, v);
387     return E_NOTIMPL;
388 }
389
390 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
391 {
392     HTMLElement *This = HTMLELEM2_THIS(iface);
393     FIXME("(%p)->(%p)\n", This, p);
394     return E_NOTIMPL;
395 }
396
397 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
398 {
399     HTMLElement *This = HTMLELEM2_THIS(iface);
400     nsIDOMNSHTMLElement *nselem;
401     nsresult nsres;
402
403     TRACE("(%p)\n", This);
404
405     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
406     if(NS_SUCCEEDED(nsres)) {
407         nsIDOMNSHTMLElement_focus(nselem);
408         nsIDOMNSHTMLElement_Release(nselem);
409     }else {
410         ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
411     }
412
413     return S_OK;
414 }
415
416 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
417 {
418     HTMLElement *This = HTMLELEM2_THIS(iface);
419     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
420     return E_NOTIMPL;
421 }
422
423 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
424 {
425     HTMLElement *This = HTMLELEM2_THIS(iface);
426     FIXME("(%p)->(%p)\n", This, p);
427     return E_NOTIMPL;
428 }
429
430 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
431 {
432     HTMLElement *This = HTMLELEM2_THIS(iface);
433     FIXME("(%p)->()\n", This);
434     return E_NOTIMPL;
435 }
436
437 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
438 {
439     HTMLElement *This = HTMLELEM2_THIS(iface);
440     FIXME("(%p)->(%p)\n", This, p);
441     return E_NOTIMPL;
442 }
443
444 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
445 {
446     HTMLElement *This = HTMLELEM2_THIS(iface);
447     FIXME("(%p)->()\n", This);
448     return E_NOTIMPL;
449 }
450
451 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
452 {
453     HTMLElement *This = HTMLELEM2_THIS(iface);
454     FIXME("(%p)->(%p)\n", This, p);
455     return E_NOTIMPL;
456 }
457
458 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
459 {
460     HTMLElement *This = HTMLELEM2_THIS(iface);
461     FIXME("(%p)->()\n", This);
462     return E_NOTIMPL;
463 }
464
465 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
466 {
467     HTMLElement *This = HTMLELEM2_THIS(iface);
468     FIXME("(%p)->(%p)\n", This, p);
469     return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
473 {
474     HTMLElement *This = HTMLELEM2_THIS(iface);
475     FIXME("(%p)\n", This);
476     return E_NOTIMPL;
477 }
478
479 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
480 {
481     HTMLElement *This = HTMLELEM2_THIS(iface);
482     FIXME("(%p)->(%p)\n", This, pUnk);
483     return E_NOTIMPL;
484 }
485
486 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
487 {
488     HTMLElement *This = HTMLELEM2_THIS(iface);
489     FIXME("(%p)->(%p)\n", This, pUnk);
490     return E_NOTIMPL;
491 }
492
493 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, long *p)
494 {
495     HTMLElement *This = HTMLELEM2_THIS(iface);
496     FIXME("(%p)->(%p)\n", This, p);
497     return E_NOTIMPL;
498 }
499
500 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, long *p)
501 {
502     HTMLElement *This = HTMLELEM2_THIS(iface);
503     FIXME("(%p)->(%p)\n", This, p);
504     return E_NOTIMPL;
505 }
506
507 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, long *p)
508 {
509     HTMLElement *This = HTMLELEM2_THIS(iface);
510     FIXME("(%p)->(%p)\n", This, p);
511     return E_NOTIMPL;
512 }
513
514 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, long *p)
515 {
516     HTMLElement *This = HTMLELEM2_THIS(iface);
517     FIXME("(%p)->(%p)\n", This, p);
518     return E_NOTIMPL;
519 }
520
521 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
522                                                IDispatch *pDisp, VARIANT_BOOL *pfResult)
523 {
524     HTMLElement *This = HTMLELEM2_THIS(iface);
525     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
526     return E_NOTIMPL;
527 }
528
529 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
530 {
531     HTMLElement *This = HTMLELEM2_THIS(iface);
532     FIXME("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
533     return E_NOTIMPL;
534 }
535
536 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
537 {
538     HTMLElement *This = HTMLELEM2_THIS(iface);
539     FIXME("(%p)->(%p)\n", This, p);
540     return E_NOTIMPL;
541 }
542
543 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
544 {
545     HTMLElement *This = HTMLELEM2_THIS(iface);
546     FIXME("(%p)->()\n", This);
547     return E_NOTIMPL;
548 }
549
550 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
551 {
552     HTMLElement *This = HTMLELEM2_THIS(iface);
553     FIXME("(%p)->(%p)\n", This, p);
554     return E_NOTIMPL;
555 }
556
557 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
558 {
559     HTMLElement *This = HTMLELEM2_THIS(iface);
560     FIXME("(%p)->()\n", This);
561     return E_NOTIMPL;
562 }
563
564 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
565 {
566     HTMLElement *This = HTMLELEM2_THIS(iface);
567     FIXME("(%p)->(%p)\n", This, p);
568     return E_NOTIMPL;
569 }
570
571 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
572 {
573     HTMLElement *This = HTMLELEM2_THIS(iface);
574     FIXME("(%p)->()\n", This);
575     return E_NOTIMPL;
576 }
577
578 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
579 {
580     HTMLElement *This = HTMLELEM2_THIS(iface);
581     FIXME("(%p)->(%p)\n", This, p);
582     return E_NOTIMPL;
583 }
584
585 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
586 {
587     HTMLElement *This = HTMLELEM2_THIS(iface);
588     FIXME("(%p)->()\n", This);
589     return E_NOTIMPL;
590 }
591
592 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
593 {
594     HTMLElement *This = HTMLELEM2_THIS(iface);
595     FIXME("(%p)->(%p)\n", This, p);
596     return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
600 {
601     HTMLElement *This = HTMLELEM2_THIS(iface);
602     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
603     return E_NOTIMPL;
604 }
605
606 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
607 {
608     HTMLElement *This = HTMLELEM2_THIS(iface);
609
610     TRACE("(%p)->(%p)\n", This, p);
611
612     *p = NULL;
613
614     if(This->nselem) {
615         nsAString dir_str;
616         nsresult nsres;
617
618         nsAString_Init(&dir_str, NULL);
619
620         nsres = nsIDOMHTMLElement_GetDir(This->nselem, &dir_str);
621         if(NS_SUCCEEDED(nsres)) {
622             const PRUnichar *dir;
623             nsAString_GetData(&dir_str, &dir);
624             if(*dir)
625                 *p = SysAllocString(dir);
626         }else {
627             ERR("GetDir failed: %08x\n", nsres);
628         }
629
630         nsAString_Finish(&dir_str);
631     }
632
633     TRACE("ret %s\n", debugstr_w(*p));
634     return S_OK;
635 }
636
637 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
638 {
639     HTMLElement *This = HTMLELEM2_THIS(iface);
640     FIXME("(%p)->(%p)\n", This, range);
641     return E_NOTIMPL;
642 }
643
644 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, long *p)
645 {
646     HTMLElement *This = HTMLELEM2_THIS(iface);
647     FIXME("(%p)->(%p)\n", This, p);
648     return E_NOTIMPL;
649 }
650
651 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, long *p)
652 {
653     HTMLElement *This = HTMLELEM2_THIS(iface);
654     FIXME("(%p)->(%p)\n", This, p);
655     return E_NOTIMPL;
656 }
657
658 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
659 {
660     HTMLElement *This = HTMLELEM2_THIS(iface);
661     nsIDOMNSHTMLElement *nselem;
662     nsresult nsres;
663
664     TRACE("(%p)->(%ld)\n", This, v);
665
666     if(!This->nselem) {
667         FIXME("NULL nselem\n");
668         return E_NOTIMPL;
669     }
670
671     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
672     if(NS_SUCCEEDED(nsres)) {
673         nsIDOMNSHTMLElement_SetScrollTop(nselem, v);
674         nsIDOMNSHTMLElement_Release(nselem);
675     }else {
676         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
677     }
678
679     return S_OK;
680 }
681
682 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, long *p)
683 {
684     HTMLElement *This = HTMLELEM2_THIS(iface);
685     FIXME("(%p)->(%p)\n", This, p);
686     return E_NOTIMPL;
687 }
688
689 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)
690 {
691     HTMLElement *This = HTMLELEM2_THIS(iface);
692     nsIDOMNSHTMLElement *nselem;
693     nsresult nsres;
694
695     TRACE("(%p)->(%ld)\n", This, v);
696
697     if(!This->nselem) {
698         FIXME("NULL nselem\n");
699         return E_NOTIMPL;
700     }
701
702     nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
703     if(NS_SUCCEEDED(nsres)) {
704         nsIDOMNSHTMLElement_SetScrollLeft(nselem, v);
705         nsIDOMNSHTMLElement_Release(nselem);
706     }else {
707         ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
708     }
709
710     return S_OK;
711 }
712
713 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, long *p)
714 {
715     HTMLElement *This = HTMLELEM2_THIS(iface);
716     FIXME("(%p)->(%p)\n", This, p);
717     return E_NOTIMPL;
718 }
719
720 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
721 {
722     HTMLElement *This = HTMLELEM2_THIS(iface);
723     FIXME("(%p)\n", This);
724     return E_NOTIMPL;
725 }
726
727 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
728 {
729     HTMLElement *This = HTMLELEM2_THIS(iface);
730     FIXME("(%p)->(%p)\n", This, mergeThis);
731     return E_NOTIMPL;
732 }
733
734 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
735 {
736     HTMLElement *This = HTMLELEM2_THIS(iface);
737     FIXME("(%p)->()\n", This);
738     return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
742 {
743     HTMLElement *This = HTMLELEM2_THIS(iface);
744     FIXME("(%p)->(%p)\n", This, p);
745     return E_NOTIMPL;
746 }
747
748 static HRESULT WINAPI HTMLElement2_insertAdjecentElement(IHTMLElement2 *iface, BSTR where,
749         IHTMLElement *insertedElement, IHTMLElement **inserted)
750 {
751     HTMLElement *This = HTMLELEM2_THIS(iface);
752     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
753     return E_NOTIMPL;
754 }
755
756 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
757                                                 BSTR where, IHTMLElement **applied)
758 {
759     HTMLElement *This = HTMLELEM2_THIS(iface);
760     FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
761     return E_NOTIMPL;
762 }
763
764 static HRESULT WINAPI HTMLElement2_getAdjecentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
765 {
766     HTMLElement *This = HTMLELEM2_THIS(iface);
767     FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
768     return E_NOTIMPL;
769 }
770
771 static HRESULT WINAPI HTMLElement2_replaceAdjecentText(IHTMLElement2 *iface, BSTR where,
772                                                        BSTR newText, BSTR *oldText)
773 {
774     HTMLElement *This = HTMLELEM2_THIS(iface);
775     FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
776     return E_NOTIMPL;
777 }
778
779 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
780 {
781     HTMLElement *This = HTMLELEM2_THIS(iface);
782     FIXME("(%p)->(%p)\n", This, p);
783     return E_NOTIMPL;
784 }
785
786 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
787                                                VARIANT *pvarFactory, long *pCookie)
788 {
789     HTMLElement *This = HTMLELEM2_THIS(iface);
790     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
791     return E_NOTIMPL;
792 }
793
794 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, long cookie,
795                                                   VARIANT_BOOL *pfResult)
796 {
797     HTMLElement *This = HTMLELEM2_THIS(iface);
798     FIXME("(%p)->(%ld %p)\n", This, cookie, pfResult);
799     return E_NOTIMPL;
800 }
801
802 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
803 {
804     HTMLElement *This = HTMLELEM2_THIS(iface);
805     FIXME("(%p)->(%p)\n", This, p);
806     return E_NOTIMPL;
807 }
808
809 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
810 {
811     HTMLElement *This = HTMLELEM2_THIS(iface);
812     FIXME("(%p)->(%p)\n", This, p);
813     return E_NOTIMPL;
814 }
815
816 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
817 {
818     HTMLElement *This = HTMLELEM2_THIS(iface);
819     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
820     return E_NOTIMPL;
821 }
822
823 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
824 {
825     HTMLElement *This = HTMLELEM2_THIS(iface);
826     FIXME("(%p)->(%p)\n", This, p);
827     return E_NOTIMPL;
828 }
829
830 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
831 {
832     HTMLElement *This = HTMLELEM2_THIS(iface);
833     FIXME("(%p)->()\n", This);
834     return E_NOTIMPL;
835 }
836
837 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
838 {
839     HTMLElement *This = HTMLELEM2_THIS(iface);
840     FIXME("(%p)->(%p)\n", This, p);
841     return E_NOTIMPL;
842 }
843
844 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, long *p)
845 {
846     HTMLElement *This = HTMLELEM2_THIS(iface);
847     FIXME("(%p)->(%p)\n", This, p);
848     return E_NOTIMPL;
849 }
850
851 static HRESULT WINAPI HTMLElement2_getElementByTagName(IHTMLElement2 *iface, BSTR v,
852                                                        IHTMLElementCollection **pelColl)
853 {
854     HTMLElement *This = HTMLELEM2_THIS(iface);
855     FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
856     return E_NOTIMPL;
857 }
858
859 #undef HTMLELEM2_THIS
860
861 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
862     HTMLElement2_QueryInterface,
863     HTMLElement2_AddRef,
864     HTMLElement2_Release,
865     HTMLElement2_GetTypeInfoCount,
866     HTMLElement2_GetTypeInfo,
867     HTMLElement2_GetIDsOfNames,
868     HTMLElement2_Invoke,
869     HTMLElement2_get_scopeName,
870     HTMLElement2_setCapture,
871     HTMLElement2_releaseCapture,
872     HTMLElement2_put_onlosecapture,
873     HTMLElement2_get_onlosecapture,
874     HTMLElement2_componentFromPoint,
875     HTMLElement2_doScroll,
876     HTMLElement2_put_onscroll,
877     HTMLElement2_get_onscroll,
878     HTMLElement2_put_ondrag,
879     HTMLElement2_get_ondrag,
880     HTMLElement2_put_ondragend,
881     HTMLElement2_get_ondragend,
882     HTMLElement2_put_ondragenter,
883     HTMLElement2_get_ondragenter,
884     HTMLElement2_put_ondragover,
885     HTMLElement2_get_ondragover,
886     HTMLElement2_put_ondragleave,
887     HTMLElement2_get_ondragleave,
888     HTMLElement2_put_ondrop,
889     HTMLElement2_get_ondrop,
890     HTMLElement2_put_onbeforecut,
891     HTMLElement2_get_onbeforecut,
892     HTMLElement2_put_oncut,
893     HTMLElement2_get_oncut,
894     HTMLElement2_put_onbeforecopy,
895     HTMLElement2_get_onbeforecopy,
896     HTMLElement2_put_oncopy,
897     HTMLElement2_get_oncopy,
898     HTMLElement2_put_onbeforepaste,
899     HTMLElement2_get_onbeforepaste,
900     HTMLElement2_put_onpaste,
901     HTMLElement2_get_onpaste,
902     HTMLElement2_get_currentStyle,
903     HTMLElement2_put_onpropertychange,
904     HTMLElement2_get_onpropertychange,
905     HTMLElement2_getClientRects,
906     HTMLElement2_getBoundingClientRect,
907     HTMLElement2_setExpression,
908     HTMLElement2_getExpression,
909     HTMLElement2_removeExpression,
910     HTMLElement2_put_tabIndex,
911     HTMLElement2_get_tabIndex,
912     HTMLElement2_focus,
913     HTMLElement2_put_accessKey,
914     HTMLElement2_get_accessKey,
915     HTMLElement2_put_onblur,
916     HTMLElement2_get_onblur,
917     HTMLElement2_put_onfocus,
918     HTMLElement2_get_onfocus,
919     HTMLElement2_put_onresize,
920     HTMLElement2_get_onresize,
921     HTMLElement2_blur,
922     HTMLElement2_addFilter,
923     HTMLElement2_removeFilter,
924     HTMLElement2_get_clientHeight,
925     HTMLElement2_get_clientWidth,
926     HTMLElement2_get_clientTop,
927     HTMLElement2_get_clientLeft,
928     HTMLElement2_attachEvent,
929     HTMLElement2_detachEvent,
930     HTMLElement2_get_readyState,
931     HTMLElement2_put_onreadystatechange,
932     HTMLElement2_get_onreadystatechange,
933     HTMLElement2_put_onrowsdelete,
934     HTMLElement2_get_onrowsdelete,
935     HTMLElement2_put_onrowsinserted,
936     HTMLElement2_get_onrowsinserted,
937     HTMLElement2_put_oncellchange,
938     HTMLElement2_get_oncellchange,
939     HTMLElement2_put_dir,
940     HTMLElement2_get_dir,
941     HTMLElement2_createControlRange,
942     HTMLElement2_get_scrollHeight,
943     HTMLElement2_get_scrollWidth,
944     HTMLElement2_put_scrollTop,
945     HTMLElement2_get_scrollTop,
946     HTMLElement2_put_scrollLeft,
947     HTMLElement2_get_scrollLeft,
948     HTMLElement2_clearAttributes,
949     HTMLElement2_mergeAttributes,
950     HTMLElement2_put_oncontextmenu,
951     HTMLElement2_get_oncontextmenu,
952     HTMLElement2_insertAdjecentElement,
953     HTMLElement2_applyElement,
954     HTMLElement2_getAdjecentText,
955     HTMLElement2_replaceAdjecentText,
956     HTMLElement2_get_canHandleChildren,
957     HTMLElement2_addBehavior,
958     HTMLElement2_removeBehavior,
959     HTMLElement2_get_runtimeStyle,
960     HTMLElement2_get_behaviorUrns,
961     HTMLElement2_put_tagUrn,
962     HTMLElement2_get_tagUrn,
963     HTMLElement2_put_onbeforeeditfocus,
964     HTMLElement2_get_onbeforeeditfocus,
965     HTMLElement2_get_readyStateValue,
966     HTMLElement2_getElementByTagName,
967 };
968
969 void HTMLElement2_Init(HTMLElement *This)
970 {
971     This->lpHTMLElement2Vtbl = &HTMLElement2Vtbl;
972 }