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