push 149f0a5527ac85057a8ef03858d34d91c36f97e8
[wine/hacks.git] / dlls / mshtml / htmlelem2.c
blob254ebf8b3349d04cb525e900edb1d7cca01fbdba
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 #define HTMLELEM2_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement2, iface)
38 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
39 REFIID riid, void **ppv)
41 HTMLElement *This = HTMLELEM2_THIS(iface);
42 return IHTMLElement_QueryInterface(HTMLELEM(This), riid, ppv);
45 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
47 HTMLElement *This = HTMLELEM2_THIS(iface);
48 return IHTMLElement_AddRef(HTMLELEM(This));
51 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
53 HTMLElement *This = HTMLELEM2_THIS(iface);
54 return IHTMLElement_Release(HTMLELEM(This));
57 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
59 HTMLElement *This = HTMLELEM2_THIS(iface);
60 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
63 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
64 LCID lcid, ITypeInfo **ppTInfo)
66 HTMLElement *This = HTMLELEM2_THIS(iface);
67 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
70 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
71 LPOLESTR *rgszNames, UINT cNames,
72 LCID lcid, DISPID *rgDispId)
74 HTMLElement *This = HTMLELEM2_THIS(iface);
75 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
78 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
79 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
80 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
82 HTMLElement *This = HTMLELEM2_THIS(iface);
83 return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
84 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
87 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
89 HTMLElement *This = HTMLELEM2_THIS(iface);
90 FIXME("(%p)->(%p)\n", This, p);
91 return E_NOTIMPL;
94 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
96 HTMLElement *This = HTMLELEM2_THIS(iface);
97 FIXME("(%p)->(%x)\n", This, containerCapture);
98 return E_NOTIMPL;
101 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
103 HTMLElement *This = HTMLELEM2_THIS(iface);
104 FIXME("(%p)\n", This);
105 return E_NOTIMPL;
108 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
110 HTMLElement *This = HTMLELEM2_THIS(iface);
111 FIXME("(%p)->()\n", This);
112 return E_NOTIMPL;
115 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
117 HTMLElement *This = HTMLELEM2_THIS(iface);
118 FIXME("(%p)->(%p)\n", This, p);
119 return E_NOTIMPL;
122 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
123 LONG x, LONG y, BSTR *component)
125 HTMLElement *This = HTMLELEM2_THIS(iface);
126 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
127 return E_NOTIMPL;
130 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
132 HTMLElement *This = HTMLELEM2_THIS(iface);
134 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
136 if(!This->node.doc->content_ready
137 || !This->node.doc->basedoc.doc_obj->in_place_active)
138 return E_PENDING;
140 WARN("stub\n");
141 return S_OK;
144 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
146 HTMLElement *This = HTMLELEM2_THIS(iface);
147 FIXME("(%p)->()\n", This);
148 return E_NOTIMPL;
151 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
153 HTMLElement *This = HTMLELEM2_THIS(iface);
154 FIXME("(%p)->(%p)\n", This, p);
155 return E_NOTIMPL;
158 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
160 HTMLElement *This = HTMLELEM2_THIS(iface);
162 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
164 return set_node_event(&This->node, EVENTID_DRAG, &v);
167 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
169 HTMLElement *This = HTMLELEM2_THIS(iface);
171 TRACE("(%p)->(%p)\n", This, p);
173 return get_node_event(&This->node, EVENTID_DRAG, p);
176 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
178 HTMLElement *This = HTMLELEM2_THIS(iface);
179 FIXME("(%p)->()\n", This);
180 return E_NOTIMPL;
183 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
185 HTMLElement *This = HTMLELEM2_THIS(iface);
186 FIXME("(%p)->(%p)\n", This, p);
187 return E_NOTIMPL;
190 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
192 HTMLElement *This = HTMLELEM2_THIS(iface);
193 FIXME("(%p)->()\n", This);
194 return E_NOTIMPL;
197 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
199 HTMLElement *This = HTMLELEM2_THIS(iface);
200 FIXME("(%p)->(%p)\n", This, p);
201 return E_NOTIMPL;
204 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
206 HTMLElement *This = HTMLELEM2_THIS(iface);
207 FIXME("(%p)->()\n", This);
208 return E_NOTIMPL;
211 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
213 HTMLElement *This = HTMLELEM2_THIS(iface);
214 FIXME("(%p)->(%p)\n", This, p);
215 return E_NOTIMPL;
218 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
220 HTMLElement *This = HTMLELEM2_THIS(iface);
221 FIXME("(%p)->()\n", This);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
227 HTMLElement *This = HTMLELEM2_THIS(iface);
228 FIXME("(%p)->(%p)\n", This, p);
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
234 HTMLElement *This = HTMLELEM2_THIS(iface);
235 FIXME("(%p)->()\n", This);
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
241 HTMLElement *This = HTMLELEM2_THIS(iface);
242 FIXME("(%p)->(%p)\n", This, p);
243 return E_NOTIMPL;
246 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
248 HTMLElement *This = HTMLELEM2_THIS(iface);
249 FIXME("(%p)->()\n", This);
250 return E_NOTIMPL;
253 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
255 HTMLElement *This = HTMLELEM2_THIS(iface);
256 FIXME("(%p)->(%p)\n", This, p);
257 return E_NOTIMPL;
260 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
262 HTMLElement *This = HTMLELEM2_THIS(iface);
263 FIXME("(%p)->()\n", This);
264 return E_NOTIMPL;
267 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
269 HTMLElement *This = HTMLELEM2_THIS(iface);
270 FIXME("(%p)->(%p)\n", This, p);
271 return E_NOTIMPL;
274 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
276 HTMLElement *This = HTMLELEM2_THIS(iface);
277 FIXME("(%p)->()\n", This);
278 return E_NOTIMPL;
281 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
283 HTMLElement *This = HTMLELEM2_THIS(iface);
284 FIXME("(%p)->(%p)\n", This, p);
285 return E_NOTIMPL;
288 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
290 HTMLElement *This = HTMLELEM2_THIS(iface);
291 FIXME("(%p)->()\n", This);
292 return E_NOTIMPL;
295 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
297 HTMLElement *This = HTMLELEM2_THIS(iface);
298 FIXME("(%p)->(%p)\n", This, p);
299 return E_NOTIMPL;
302 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
304 HTMLElement *This = HTMLELEM2_THIS(iface);
305 FIXME("(%p)->()\n", This);
306 return E_NOTIMPL;
309 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
311 HTMLElement *This = HTMLELEM2_THIS(iface);
312 FIXME("(%p)->(%p)\n", This, p);
313 return E_NOTIMPL;
316 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
318 HTMLElement *This = HTMLELEM2_THIS(iface);
320 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
322 return set_node_event(&This->node, EVENTID_PASTE, &v);
325 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
327 HTMLElement *This = HTMLELEM2_THIS(iface);
329 TRACE("(%p)->(%p)\n", This, p);
331 return get_node_event(&This->node, EVENTID_PASTE, p);
334 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
336 HTMLElement *This = HTMLELEM2_THIS(iface);
338 TRACE("(%p)->(%p)\n", This, p);
340 return HTMLCurrentStyle_Create(This, p);
343 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
345 HTMLElement *This = HTMLELEM2_THIS(iface);
346 FIXME("(%p)->()\n", This);
347 return E_NOTIMPL;
350 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
352 HTMLElement *This = HTMLELEM2_THIS(iface);
353 FIXME("(%p)->(%p)\n", This, p);
354 return E_NOTIMPL;
357 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
359 HTMLElement *This = HTMLELEM2_THIS(iface);
360 FIXME("(%p)->(%p)\n", This, pRectCol);
361 return E_NOTIMPL;
364 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
366 HTMLElement *This = HTMLELEM2_THIS(iface);
367 FIXME("(%p)->(%p)\n", This, pRect);
368 return E_NOTIMPL;
371 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
372 BSTR expression, BSTR language)
374 HTMLElement *This = HTMLELEM2_THIS(iface);
375 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
376 debugstr_w(language));
377 return E_NOTIMPL;
380 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
381 VARIANT *expression)
383 HTMLElement *This = HTMLELEM2_THIS(iface);
384 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
385 return E_NOTIMPL;
388 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
389 VARIANT_BOOL *pfSuccess)
391 HTMLElement *This = HTMLELEM2_THIS(iface);
392 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
393 return E_NOTIMPL;
396 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
398 HTMLElement *This = HTMLELEM2_THIS(iface);
399 nsIDOMNSHTMLElement *nselem;
400 nsresult nsres;
402 TRACE("(%p)->(%d)\n", This, v);
404 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
405 if(NS_FAILED(nsres)) {
406 ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
407 return S_OK;
410 nsres = nsIDOMNSHTMLElement_SetTabIndex(nselem, v);
411 nsIDOMNSHTMLElement_Release(nselem);
412 if(NS_FAILED(nsres))
413 ERR("GetTabIndex failed: %08x\n", nsres);
415 return S_OK;
418 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
420 HTMLElement *This = HTMLELEM2_THIS(iface);
421 nsIDOMNSHTMLElement *nselem;
422 PRInt32 index = 0;
423 nsresult nsres;
425 TRACE("(%p)->(%p)\n", This, p);
427 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
428 if(NS_FAILED(nsres)) {
429 ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
430 return E_FAIL;
433 nsres = nsIDOMNSHTMLElement_GetTabIndex(nselem, &index);
434 nsIDOMNSHTMLElement_Release(nselem);
435 if(NS_FAILED(nsres)) {
436 ERR("GetTabIndex failed: %08x\n", nsres);
437 return E_FAIL;
440 *p = index;
441 return S_OK;
444 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
446 HTMLElement *This = HTMLELEM2_THIS(iface);
447 nsIDOMNSHTMLElement *nselem;
448 nsresult nsres;
450 TRACE("(%p)\n", This);
452 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
453 if(NS_SUCCEEDED(nsres)) {
454 nsIDOMNSHTMLElement_focus(nselem);
455 nsIDOMNSHTMLElement_Release(nselem);
456 }else {
457 ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
460 return S_OK;
463 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
465 HTMLElement *This = HTMLELEM2_THIS(iface);
466 VARIANT var;
468 static WCHAR accessKeyW[] = {'a','c','c','e','s','s','K','e','y',0};
470 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
472 V_VT(&var) = VT_BSTR;
473 V_BSTR(&var) = v;
474 return IHTMLElement_setAttribute(HTMLELEM(This), accessKeyW, var, 0);
477 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
479 HTMLElement *This = HTMLELEM2_THIS(iface);
480 FIXME("(%p)->(%p)\n", This, p);
481 return E_NOTIMPL;
484 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
486 HTMLElement *This = HTMLELEM2_THIS(iface);
488 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
490 return set_node_event(&This->node, EVENTID_BLUR, &v);
493 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
495 HTMLElement *This = HTMLELEM2_THIS(iface);
497 TRACE("(%p)->(%p)\n", This, p);
499 return get_node_event(&This->node, EVENTID_BLUR, p);
502 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
504 HTMLElement *This = HTMLELEM2_THIS(iface);
506 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
508 return set_node_event(&This->node, EVENTID_FOCUS, &v);
511 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
513 HTMLElement *This = HTMLELEM2_THIS(iface);
515 TRACE("(%p)->(%p)\n", This, p);
517 return get_node_event(&This->node, EVENTID_FOCUS, p);
520 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
522 HTMLElement *This = HTMLELEM2_THIS(iface);
523 FIXME("(%p)->()\n", This);
524 return E_NOTIMPL;
527 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
529 HTMLElement *This = HTMLELEM2_THIS(iface);
530 FIXME("(%p)->(%p)\n", This, p);
531 return E_NOTIMPL;
534 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
536 HTMLElement *This = HTMLELEM2_THIS(iface);
537 FIXME("(%p)\n", This);
538 return E_NOTIMPL;
541 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
543 HTMLElement *This = HTMLELEM2_THIS(iface);
544 FIXME("(%p)->(%p)\n", This, pUnk);
545 return E_NOTIMPL;
548 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
550 HTMLElement *This = HTMLELEM2_THIS(iface);
551 FIXME("(%p)->(%p)\n", This, pUnk);
552 return E_NOTIMPL;
555 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
557 HTMLElement *This = HTMLELEM2_THIS(iface);
558 nsIDOMNSElement *nselem;
559 PRInt32 height=0;
560 nsresult nsres;
562 TRACE("(%p)->(%p)\n", This, p);
564 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
565 if(NS_SUCCEEDED(nsres)) {
566 nsIDOMNSElement_GetClientHeight(nselem, &height);
567 nsIDOMNSElement_Release(nselem);
568 }else {
569 ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
572 *p = height;
573 return S_OK;
576 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
578 HTMLElement *This = HTMLELEM2_THIS(iface);
579 nsIDOMNSElement *nselem;
580 PRInt32 width=0;
581 nsresult nsres;
583 TRACE("(%p)->(%p)\n", This, p);
585 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
586 if(NS_SUCCEEDED(nsres)) {
587 nsIDOMNSElement_GetClientWidth(nselem, &width);
588 nsIDOMNSElement_Release(nselem);
589 }else {
590 ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
593 *p = width;
594 return S_OK;
597 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
599 HTMLElement *This = HTMLELEM2_THIS(iface);
600 nsIDOMNSElement *nselem;
601 PRInt32 client_top = 0;
602 nsresult nsres;
604 TRACE("(%p)->(%p)\n", This, p);
606 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
607 if(NS_SUCCEEDED(nsres)) {
608 nsres = nsIDOMNSElement_GetClientTop(nselem, &client_top);
609 nsIDOMNSElement_Release(nselem);
610 if(NS_FAILED(nsres))
611 ERR("GetScrollHeight failed: %08x\n", nsres);
612 }else {
613 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
616 *p = client_top;
617 TRACE("*p = %d\n", *p);
618 return S_OK;
621 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
623 HTMLElement *This = HTMLELEM2_THIS(iface);
624 nsIDOMNSElement *nselem;
625 PRInt32 client_left = 0;
626 nsresult nsres;
628 TRACE("(%p)->(%p)\n", This, p);
630 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
631 if(NS_SUCCEEDED(nsres)) {
632 nsres = nsIDOMNSElement_GetClientLeft(nselem, &client_left);
633 nsIDOMNSElement_Release(nselem);
634 if(NS_FAILED(nsres))
635 ERR("GetScrollHeight failed: %08x\n", nsres);
636 }else {
637 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
640 *p = client_left;
641 TRACE("*p = %d\n", *p);
642 return S_OK;
645 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
646 IDispatch *pDisp, VARIANT_BOOL *pfResult)
648 HTMLElement *This = HTMLELEM2_THIS(iface);
650 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
652 return attach_event(get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp, pfResult);
655 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
657 HTMLElement *This = HTMLELEM2_THIS(iface);
658 FIXME("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
659 return E_NOTIMPL;
662 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
664 HTMLElement *This = HTMLELEM2_THIS(iface);
665 BSTR str;
667 TRACE("(%p)->(%p)\n", This, p);
669 if(This->node.vtbl->get_readystate) {
670 HRESULT hres;
672 hres = This->node.vtbl->get_readystate(&This->node, &str);
673 if(FAILED(hres))
674 return hres;
675 }else {
676 static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
678 str = SysAllocString(completeW);
679 if(!str)
680 return E_OUTOFMEMORY;
683 V_VT(p) = VT_BSTR;
684 V_BSTR(p) = str;
685 return S_OK;
688 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
690 HTMLElement *This = HTMLELEM2_THIS(iface);
692 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
694 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
697 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
699 HTMLElement *This = HTMLELEM2_THIS(iface);
701 TRACE("(%p)->(%p)\n", This, p);
703 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
706 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
708 HTMLElement *This = HTMLELEM2_THIS(iface);
709 FIXME("(%p)->()\n", This);
710 return E_NOTIMPL;
713 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
715 HTMLElement *This = HTMLELEM2_THIS(iface);
716 FIXME("(%p)->(%p)\n", This, p);
717 return E_NOTIMPL;
720 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
722 HTMLElement *This = HTMLELEM2_THIS(iface);
723 FIXME("(%p)->()\n", This);
724 return E_NOTIMPL;
727 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
729 HTMLElement *This = HTMLELEM2_THIS(iface);
730 FIXME("(%p)->(%p)\n", This, p);
731 return E_NOTIMPL;
734 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
736 HTMLElement *This = HTMLELEM2_THIS(iface);
737 FIXME("(%p)->()\n", This);
738 return E_NOTIMPL;
741 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
743 HTMLElement *This = HTMLELEM2_THIS(iface);
744 FIXME("(%p)->(%p)\n", This, p);
745 return E_NOTIMPL;
748 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
750 HTMLElement *This = HTMLELEM2_THIS(iface);
751 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
752 return E_NOTIMPL;
755 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
757 HTMLElement *This = HTMLELEM2_THIS(iface);
759 TRACE("(%p)->(%p)\n", This, p);
761 *p = NULL;
763 if(This->nselem) {
764 nsAString dir_str;
765 nsresult nsres;
767 nsAString_Init(&dir_str, NULL);
769 nsres = nsIDOMHTMLElement_GetDir(This->nselem, &dir_str);
770 if(NS_SUCCEEDED(nsres)) {
771 const PRUnichar *dir;
772 nsAString_GetData(&dir_str, &dir);
773 if(*dir)
774 *p = SysAllocString(dir);
775 }else {
776 ERR("GetDir failed: %08x\n", nsres);
779 nsAString_Finish(&dir_str);
782 TRACE("ret %s\n", debugstr_w(*p));
783 return S_OK;
786 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
788 HTMLElement *This = HTMLELEM2_THIS(iface);
789 FIXME("(%p)->(%p)\n", This, range);
790 return E_NOTIMPL;
793 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
795 HTMLElement *This = HTMLELEM2_THIS(iface);
796 nsIDOMNSElement *nselem;
797 PRInt32 height = 0;
798 nsresult nsres;
800 TRACE("(%p)->(%p)\n", This, p);
802 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
803 if(NS_SUCCEEDED(nsres)) {
804 nsres = nsIDOMNSElement_GetScrollHeight(nselem, &height);
805 nsIDOMNSElement_Release(nselem);
806 if(NS_FAILED(nsres))
807 ERR("GetScrollHeight failed: %08x\n", nsres);
808 }else {
809 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
812 *p = height;
813 TRACE("*p = %d\n", *p);
815 return S_OK;
818 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
820 HTMLElement *This = HTMLELEM2_THIS(iface);
821 nsIDOMNSElement *nselem;
822 PRInt32 width = 0;
823 nsresult nsres;
825 TRACE("(%p)->(%p)\n", This, p);
827 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
828 if(NS_SUCCEEDED(nsres)) {
829 nsres = nsIDOMNSElement_GetScrollWidth(nselem, &width);
830 nsIDOMNSElement_Release(nselem);
831 if(NS_FAILED(nsres))
832 ERR("GetScrollWidth failed: %08x\n", nsres);
833 }else {
834 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
837 *p = width;
838 TRACE("*p = %d\n", *p);
840 return S_OK;
843 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
845 HTMLElement *This = HTMLELEM2_THIS(iface);
846 nsIDOMNSElement *nselem;
847 nsresult nsres;
849 TRACE("(%p)->(%d)\n", This, v);
851 if(!This->nselem) {
852 FIXME("NULL nselem\n");
853 return E_NOTIMPL;
856 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
857 if(NS_SUCCEEDED(nsres)) {
858 nsIDOMNSElement_SetScrollTop(nselem, v);
859 nsIDOMNSElement_Release(nselem);
860 }else {
861 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
864 return S_OK;
867 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
869 HTMLElement *This = HTMLELEM2_THIS(iface);
870 nsIDOMNSElement *nselem;
871 PRInt32 top = 0;
872 nsresult nsres;
874 TRACE("(%p)->(%p)\n", This, p);
876 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
877 if(NS_SUCCEEDED(nsres)) {
878 nsres = nsIDOMNSElement_GetScrollTop(nselem, &top);
879 nsIDOMNSElement_Release(nselem);
880 if(NS_FAILED(nsres))
881 ERR("GetScrollTop failed: %08x\n", nsres);
882 }else {
883 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
886 *p = top;
887 TRACE("*p = %d\n", *p);
889 return S_OK;
892 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
894 HTMLElement *This = HTMLELEM2_THIS(iface);
895 nsIDOMNSElement *nselem;
896 nsresult nsres;
898 TRACE("(%p)->(%d)\n", This, v);
900 if(!This->nselem) {
901 FIXME("NULL nselem\n");
902 return E_NOTIMPL;
905 nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
906 if(NS_SUCCEEDED(nsres)) {
907 nsIDOMNSElement_SetScrollLeft(nselem, v);
908 nsIDOMNSElement_Release(nselem);
909 }else {
910 ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
913 return S_OK;
916 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
918 HTMLElement *This = HTMLELEM2_THIS(iface);
919 nsIDOMNSElement *nselem;
920 PRInt32 left = 0;
921 nsresult nsres;
923 TRACE("(%p)->(%p)\n", This, p);
925 if(!p)
926 return E_INVALIDARG;
928 if(!This->nselem)
930 FIXME("NULL nselem\n");
931 return E_NOTIMPL;
934 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
935 if(NS_SUCCEEDED(nsres))
937 nsres = nsIDOMNSElement_GetScrollLeft(nselem, &left);
938 nsIDOMNSElement_Release(nselem);
939 if(NS_FAILED(nsres))
940 left = 0;
943 *p = left;
944 TRACE("*p = %d\n", *p);
946 return S_OK;
949 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
951 HTMLElement *This = HTMLELEM2_THIS(iface);
952 FIXME("(%p)\n", This);
953 return E_NOTIMPL;
956 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
958 HTMLElement *This = HTMLELEM2_THIS(iface);
959 FIXME("(%p)->(%p)\n", This, mergeThis);
960 return E_NOTIMPL;
963 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
965 HTMLElement *This = HTMLELEM2_THIS(iface);
966 FIXME("(%p)->()\n", This);
967 return E_NOTIMPL;
970 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
972 HTMLElement *This = HTMLELEM2_THIS(iface);
973 FIXME("(%p)->(%p)\n", This, p);
974 return E_NOTIMPL;
977 static HRESULT WINAPI HTMLElement2_insertAdjecentElement(IHTMLElement2 *iface, BSTR where,
978 IHTMLElement *insertedElement, IHTMLElement **inserted)
980 HTMLElement *This = HTMLELEM2_THIS(iface);
981 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
982 return E_NOTIMPL;
985 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
986 BSTR where, IHTMLElement **applied)
988 HTMLElement *This = HTMLELEM2_THIS(iface);
989 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
990 return E_NOTIMPL;
993 static HRESULT WINAPI HTMLElement2_getAdjecentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
995 HTMLElement *This = HTMLELEM2_THIS(iface);
996 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
997 return E_NOTIMPL;
1000 static HRESULT WINAPI HTMLElement2_replaceAdjecentText(IHTMLElement2 *iface, BSTR where,
1001 BSTR newText, BSTR *oldText)
1003 HTMLElement *This = HTMLELEM2_THIS(iface);
1004 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
1005 return E_NOTIMPL;
1008 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
1010 HTMLElement *This = HTMLELEM2_THIS(iface);
1011 FIXME("(%p)->(%p)\n", This, p);
1012 return E_NOTIMPL;
1015 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
1016 VARIANT *pvarFactory, LONG *pCookie)
1018 HTMLElement *This = HTMLELEM2_THIS(iface);
1019 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
1020 return E_NOTIMPL;
1023 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
1024 VARIANT_BOOL *pfResult)
1026 HTMLElement *This = HTMLELEM2_THIS(iface);
1027 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
1028 return E_NOTIMPL;
1031 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
1033 HTMLElement *This = HTMLELEM2_THIS(iface);
1034 FIXME("(%p)->(%p)\n", This, p);
1035 return E_NOTIMPL;
1038 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
1040 HTMLElement *This = HTMLELEM2_THIS(iface);
1041 FIXME("(%p)->(%p)\n", This, p);
1042 return E_NOTIMPL;
1045 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
1047 HTMLElement *This = HTMLELEM2_THIS(iface);
1048 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1049 return E_NOTIMPL;
1052 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
1054 HTMLElement *This = HTMLELEM2_THIS(iface);
1055 FIXME("(%p)->(%p)\n", This, p);
1056 return E_NOTIMPL;
1059 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
1061 HTMLElement *This = HTMLELEM2_THIS(iface);
1062 FIXME("(%p)->()\n", This);
1063 return E_NOTIMPL;
1066 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
1068 HTMLElement *This = HTMLELEM2_THIS(iface);
1069 FIXME("(%p)->(%p)\n", This, p);
1070 return E_NOTIMPL;
1073 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
1075 HTMLElement *This = HTMLELEM2_THIS(iface);
1076 FIXME("(%p)->(%p)\n", This, p);
1077 return E_NOTIMPL;
1080 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
1081 IHTMLElementCollection **pelColl)
1083 HTMLElement *This = HTMLELEM2_THIS(iface);
1084 nsIDOMNodeList *nslist;
1085 nsAString tag_str;
1086 nsresult nsres;
1088 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
1090 nsAString_Init(&tag_str, v);
1091 nsres = nsIDOMHTMLElement_GetElementsByTagName(This->nselem, &tag_str, &nslist);
1092 nsAString_Finish(&tag_str);
1093 if(NS_FAILED(nsres)) {
1094 ERR("GetElementByTagName failed: %08x\n", nsres);
1095 return E_FAIL;
1098 *pelColl = create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nslist);
1099 nsIDOMNodeList_Release(nslist);
1100 return S_OK;
1103 #undef HTMLELEM2_THIS
1105 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
1106 HTMLElement2_QueryInterface,
1107 HTMLElement2_AddRef,
1108 HTMLElement2_Release,
1109 HTMLElement2_GetTypeInfoCount,
1110 HTMLElement2_GetTypeInfo,
1111 HTMLElement2_GetIDsOfNames,
1112 HTMLElement2_Invoke,
1113 HTMLElement2_get_scopeName,
1114 HTMLElement2_setCapture,
1115 HTMLElement2_releaseCapture,
1116 HTMLElement2_put_onlosecapture,
1117 HTMLElement2_get_onlosecapture,
1118 HTMLElement2_componentFromPoint,
1119 HTMLElement2_doScroll,
1120 HTMLElement2_put_onscroll,
1121 HTMLElement2_get_onscroll,
1122 HTMLElement2_put_ondrag,
1123 HTMLElement2_get_ondrag,
1124 HTMLElement2_put_ondragend,
1125 HTMLElement2_get_ondragend,
1126 HTMLElement2_put_ondragenter,
1127 HTMLElement2_get_ondragenter,
1128 HTMLElement2_put_ondragover,
1129 HTMLElement2_get_ondragover,
1130 HTMLElement2_put_ondragleave,
1131 HTMLElement2_get_ondragleave,
1132 HTMLElement2_put_ondrop,
1133 HTMLElement2_get_ondrop,
1134 HTMLElement2_put_onbeforecut,
1135 HTMLElement2_get_onbeforecut,
1136 HTMLElement2_put_oncut,
1137 HTMLElement2_get_oncut,
1138 HTMLElement2_put_onbeforecopy,
1139 HTMLElement2_get_onbeforecopy,
1140 HTMLElement2_put_oncopy,
1141 HTMLElement2_get_oncopy,
1142 HTMLElement2_put_onbeforepaste,
1143 HTMLElement2_get_onbeforepaste,
1144 HTMLElement2_put_onpaste,
1145 HTMLElement2_get_onpaste,
1146 HTMLElement2_get_currentStyle,
1147 HTMLElement2_put_onpropertychange,
1148 HTMLElement2_get_onpropertychange,
1149 HTMLElement2_getClientRects,
1150 HTMLElement2_getBoundingClientRect,
1151 HTMLElement2_setExpression,
1152 HTMLElement2_getExpression,
1153 HTMLElement2_removeExpression,
1154 HTMLElement2_put_tabIndex,
1155 HTMLElement2_get_tabIndex,
1156 HTMLElement2_focus,
1157 HTMLElement2_put_accessKey,
1158 HTMLElement2_get_accessKey,
1159 HTMLElement2_put_onblur,
1160 HTMLElement2_get_onblur,
1161 HTMLElement2_put_onfocus,
1162 HTMLElement2_get_onfocus,
1163 HTMLElement2_put_onresize,
1164 HTMLElement2_get_onresize,
1165 HTMLElement2_blur,
1166 HTMLElement2_addFilter,
1167 HTMLElement2_removeFilter,
1168 HTMLElement2_get_clientHeight,
1169 HTMLElement2_get_clientWidth,
1170 HTMLElement2_get_clientTop,
1171 HTMLElement2_get_clientLeft,
1172 HTMLElement2_attachEvent,
1173 HTMLElement2_detachEvent,
1174 HTMLElement2_get_readyState,
1175 HTMLElement2_put_onreadystatechange,
1176 HTMLElement2_get_onreadystatechange,
1177 HTMLElement2_put_onrowsdelete,
1178 HTMLElement2_get_onrowsdelete,
1179 HTMLElement2_put_onrowsinserted,
1180 HTMLElement2_get_onrowsinserted,
1181 HTMLElement2_put_oncellchange,
1182 HTMLElement2_get_oncellchange,
1183 HTMLElement2_put_dir,
1184 HTMLElement2_get_dir,
1185 HTMLElement2_createControlRange,
1186 HTMLElement2_get_scrollHeight,
1187 HTMLElement2_get_scrollWidth,
1188 HTMLElement2_put_scrollTop,
1189 HTMLElement2_get_scrollTop,
1190 HTMLElement2_put_scrollLeft,
1191 HTMLElement2_get_scrollLeft,
1192 HTMLElement2_clearAttributes,
1193 HTMLElement2_mergeAttributes,
1194 HTMLElement2_put_oncontextmenu,
1195 HTMLElement2_get_oncontextmenu,
1196 HTMLElement2_insertAdjecentElement,
1197 HTMLElement2_applyElement,
1198 HTMLElement2_getAdjecentText,
1199 HTMLElement2_replaceAdjecentText,
1200 HTMLElement2_get_canHandleChildren,
1201 HTMLElement2_addBehavior,
1202 HTMLElement2_removeBehavior,
1203 HTMLElement2_get_runtimeStyle,
1204 HTMLElement2_get_behaviorUrns,
1205 HTMLElement2_put_tagUrn,
1206 HTMLElement2_get_tagUrn,
1207 HTMLElement2_put_onbeforeeditfocus,
1208 HTMLElement2_get_onbeforeeditfocus,
1209 HTMLElement2_get_readyStateValue,
1210 HTMLElement2_getElementsByTagName,
1213 void HTMLElement2_Init(HTMLElement *This)
1215 This->lpHTMLElement2Vtbl = &HTMLElement2Vtbl;