2 * Copyright 2006-2010 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
30 #include "wine/debug.h"
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
34 #include "htmlstyle.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 IHTMLRect IHTMLRect_iface;
44 nsIDOMClientRect *nsrect;
47 static inline HTMLRect *impl_from_IHTMLRect(IHTMLRect *iface)
49 return CONTAINING_RECORD(iface, HTMLRect, IHTMLRect_iface);
52 static HRESULT WINAPI HTMLRect_QueryInterface(IHTMLRect *iface, REFIID riid, void **ppv)
54 HTMLRect *This = impl_from_IHTMLRect(iface);
56 if(IsEqualGUID(&IID_IUnknown, riid)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58 *ppv = &This->IHTMLRect_iface;
59 }else if(IsEqualGUID(&IID_IHTMLRect, riid)) {
60 TRACE("(%p)->(IID_IHTMLRect %p)\n", This, ppv);
61 *ppv = &This->IHTMLRect_iface;
62 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
63 return *ppv ? S_OK : E_NOINTERFACE;
65 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
70 IUnknown_AddRef((IUnknown*)*ppv);
74 static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
76 HTMLRect *This = impl_from_IHTMLRect(iface);
77 LONG ref = InterlockedIncrement(&This->ref);
79 TRACE("(%p) ref=%d\n", This, ref);
84 static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
86 HTMLRect *This = impl_from_IHTMLRect(iface);
87 LONG ref = InterlockedDecrement(&This->ref);
89 TRACE("(%p) ref=%d\n", This, ref);
93 nsIDOMClientRect_Release(This->nsrect);
100 static HRESULT WINAPI HTMLRect_GetTypeInfoCount(IHTMLRect *iface, UINT *pctinfo)
102 HTMLRect *This = impl_from_IHTMLRect(iface);
103 FIXME("(%p)->(%p)\n", This, pctinfo);
107 static HRESULT WINAPI HTMLRect_GetTypeInfo(IHTMLRect *iface, UINT iTInfo,
108 LCID lcid, ITypeInfo **ppTInfo)
110 HTMLRect *This = impl_from_IHTMLRect(iface);
112 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
115 static HRESULT WINAPI HTMLRect_GetIDsOfNames(IHTMLRect *iface, REFIID riid,
116 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
118 HTMLRect *This = impl_from_IHTMLRect(iface);
120 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
124 static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
125 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
126 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
128 HTMLRect *This = impl_from_IHTMLRect(iface);
130 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
131 pDispParams, pVarResult, pExcepInfo, puArgErr);
134 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
136 HTMLRect *This = impl_from_IHTMLRect(iface);
137 FIXME("(%p)->(%d)\n", This, v);
141 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
143 HTMLRect *This = impl_from_IHTMLRect(iface);
147 TRACE("(%p)->(%p)\n", This, p);
149 nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
150 if(NS_FAILED(nsres)) {
151 ERR("GetLeft failed: %08x\n", nsres);
155 *p = floor(left+0.5);
159 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
161 HTMLRect *This = impl_from_IHTMLRect(iface);
162 FIXME("(%p)->(%d)\n", This, v);
166 static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
168 HTMLRect *This = impl_from_IHTMLRect(iface);
172 TRACE("(%p)->(%p)\n", This, p);
174 nsres = nsIDOMClientRect_GetTop(This->nsrect, &top);
175 if(NS_FAILED(nsres)) {
176 ERR("GetTop failed: %08x\n", nsres);
184 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
186 HTMLRect *This = impl_from_IHTMLRect(iface);
187 FIXME("(%p)->(%d)\n", This, v);
191 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
193 HTMLRect *This = impl_from_IHTMLRect(iface);
197 TRACE("(%p)->(%p)\n", This, p);
199 nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
200 if(NS_FAILED(nsres)) {
201 ERR("GetRight failed: %08x\n", nsres);
205 *p = floor(right+0.5);
209 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
211 HTMLRect *This = impl_from_IHTMLRect(iface);
212 FIXME("(%p)->(%d)\n", This, v);
216 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
218 HTMLRect *This = impl_from_IHTMLRect(iface);
222 TRACE("(%p)->(%p)\n", This, p);
224 nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
225 if(NS_FAILED(nsres)) {
226 ERR("GetBottom failed: %08x\n", nsres);
230 *p = floor(bottom+0.5);
234 static const IHTMLRectVtbl HTMLRectVtbl = {
235 HTMLRect_QueryInterface,
238 HTMLRect_GetTypeInfoCount,
239 HTMLRect_GetTypeInfo,
240 HTMLRect_GetIDsOfNames,
252 static const tid_t HTMLRect_iface_tids[] = {
256 static dispex_static_data_t HTMLRect_dispex = {
263 static HRESULT create_html_rect(nsIDOMClientRect *nsrect, IHTMLRect **ret)
267 rect = heap_alloc_zero(sizeof(HTMLRect));
269 return E_OUTOFMEMORY;
271 rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl;
274 init_dispex(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex);
276 nsIDOMClientRect_AddRef(nsrect);
277 rect->nsrect = nsrect;
279 *ret = &rect->IHTMLRect_iface;
283 static inline HTMLElement *impl_from_IHTMLElement2(IHTMLElement2 *iface)
285 return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement2_iface);
288 static HRESULT WINAPI HTMLElement2_QueryInterface(IHTMLElement2 *iface,
289 REFIID riid, void **ppv)
291 HTMLElement *This = impl_from_IHTMLElement2(iface);
292 return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
295 static ULONG WINAPI HTMLElement2_AddRef(IHTMLElement2 *iface)
297 HTMLElement *This = impl_from_IHTMLElement2(iface);
298 return IHTMLElement_AddRef(&This->IHTMLElement_iface);
301 static ULONG WINAPI HTMLElement2_Release(IHTMLElement2 *iface)
303 HTMLElement *This = impl_from_IHTMLElement2(iface);
304 return IHTMLElement_Release(&This->IHTMLElement_iface);
307 static HRESULT WINAPI HTMLElement2_GetTypeInfoCount(IHTMLElement2 *iface, UINT *pctinfo)
309 HTMLElement *This = impl_from_IHTMLElement2(iface);
310 return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
313 static HRESULT WINAPI HTMLElement2_GetTypeInfo(IHTMLElement2 *iface, UINT iTInfo,
314 LCID lcid, ITypeInfo **ppTInfo)
316 HTMLElement *This = impl_from_IHTMLElement2(iface);
317 return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
320 static HRESULT WINAPI HTMLElement2_GetIDsOfNames(IHTMLElement2 *iface, REFIID riid,
321 LPOLESTR *rgszNames, UINT cNames,
322 LCID lcid, DISPID *rgDispId)
324 HTMLElement *This = impl_from_IHTMLElement2(iface);
325 return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
329 static HRESULT WINAPI HTMLElement2_Invoke(IHTMLElement2 *iface, DISPID dispIdMember,
330 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
331 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
333 HTMLElement *This = impl_from_IHTMLElement2(iface);
334 return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
335 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
338 static HRESULT WINAPI HTMLElement2_get_scopeName(IHTMLElement2 *iface, BSTR *p)
340 HTMLElement *This = impl_from_IHTMLElement2(iface);
341 FIXME("(%p)->(%p)\n", This, p);
345 static HRESULT WINAPI HTMLElement2_setCapture(IHTMLElement2 *iface, VARIANT_BOOL containerCapture)
347 HTMLElement *This = impl_from_IHTMLElement2(iface);
348 FIXME("(%p)->(%x)\n", This, containerCapture);
352 static HRESULT WINAPI HTMLElement2_releaseCapture(IHTMLElement2 *iface)
354 HTMLElement *This = impl_from_IHTMLElement2(iface);
355 FIXME("(%p)\n", This);
359 static HRESULT WINAPI HTMLElement2_put_onlosecapture(IHTMLElement2 *iface, VARIANT v)
361 HTMLElement *This = impl_from_IHTMLElement2(iface);
362 FIXME("(%p)->()\n", This);
366 static HRESULT WINAPI HTMLElement2_get_onlosecapture(IHTMLElement2 *iface, VARIANT *p)
368 HTMLElement *This = impl_from_IHTMLElement2(iface);
369 FIXME("(%p)->(%p)\n", This, p);
373 static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
374 LONG x, LONG y, BSTR *component)
376 HTMLElement *This = impl_from_IHTMLElement2(iface);
377 FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
381 static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
383 HTMLElement *This = impl_from_IHTMLElement2(iface);
385 TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
387 if(!This->node.doc->content_ready
388 || !This->node.doc->basedoc.doc_obj->in_place_active)
395 static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)
397 HTMLElement *This = impl_from_IHTMLElement2(iface);
398 FIXME("(%p)->()\n", This);
402 static HRESULT WINAPI HTMLElement2_get_onscroll(IHTMLElement2 *iface, VARIANT *p)
404 HTMLElement *This = impl_from_IHTMLElement2(iface);
405 FIXME("(%p)->(%p)\n", This, p);
409 static HRESULT WINAPI HTMLElement2_put_ondrag(IHTMLElement2 *iface, VARIANT v)
411 HTMLElement *This = impl_from_IHTMLElement2(iface);
413 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
415 return set_node_event(&This->node, EVENTID_DRAG, &v);
418 static HRESULT WINAPI HTMLElement2_get_ondrag(IHTMLElement2 *iface, VARIANT *p)
420 HTMLElement *This = impl_from_IHTMLElement2(iface);
422 TRACE("(%p)->(%p)\n", This, p);
424 return get_node_event(&This->node, EVENTID_DRAG, p);
427 static HRESULT WINAPI HTMLElement2_put_ondragend(IHTMLElement2 *iface, VARIANT v)
429 HTMLElement *This = impl_from_IHTMLElement2(iface);
430 FIXME("(%p)->()\n", This);
434 static HRESULT WINAPI HTMLElement2_get_ondragend(IHTMLElement2 *iface, VARIANT *p)
436 HTMLElement *This = impl_from_IHTMLElement2(iface);
437 FIXME("(%p)->(%p)\n", This, p);
441 static HRESULT WINAPI HTMLElement2_put_ondragenter(IHTMLElement2 *iface, VARIANT v)
443 HTMLElement *This = impl_from_IHTMLElement2(iface);
444 FIXME("(%p)->()\n", This);
448 static HRESULT WINAPI HTMLElement2_get_ondragenter(IHTMLElement2 *iface, VARIANT *p)
450 HTMLElement *This = impl_from_IHTMLElement2(iface);
451 FIXME("(%p)->(%p)\n", This, p);
455 static HRESULT WINAPI HTMLElement2_put_ondragover(IHTMLElement2 *iface, VARIANT v)
457 HTMLElement *This = impl_from_IHTMLElement2(iface);
458 FIXME("(%p)->()\n", This);
462 static HRESULT WINAPI HTMLElement2_get_ondragover(IHTMLElement2 *iface, VARIANT *p)
464 HTMLElement *This = impl_from_IHTMLElement2(iface);
465 FIXME("(%p)->(%p)\n", This, p);
469 static HRESULT WINAPI HTMLElement2_put_ondragleave(IHTMLElement2 *iface, VARIANT v)
471 HTMLElement *This = impl_from_IHTMLElement2(iface);
472 FIXME("(%p)->()\n", This);
476 static HRESULT WINAPI HTMLElement2_get_ondragleave(IHTMLElement2 *iface, VARIANT *p)
478 HTMLElement *This = impl_from_IHTMLElement2(iface);
479 FIXME("(%p)->(%p)\n", This, p);
483 static HRESULT WINAPI HTMLElement2_put_ondrop(IHTMLElement2 *iface, VARIANT v)
485 HTMLElement *This = impl_from_IHTMLElement2(iface);
486 FIXME("(%p)->()\n", This);
490 static HRESULT WINAPI HTMLElement2_get_ondrop(IHTMLElement2 *iface, VARIANT *p)
492 HTMLElement *This = impl_from_IHTMLElement2(iface);
493 FIXME("(%p)->(%p)\n", This, p);
497 static HRESULT WINAPI HTMLElement2_put_onbeforecut(IHTMLElement2 *iface, VARIANT v)
499 HTMLElement *This = impl_from_IHTMLElement2(iface);
500 FIXME("(%p)->()\n", This);
504 static HRESULT WINAPI HTMLElement2_get_onbeforecut(IHTMLElement2 *iface, VARIANT *p)
506 HTMLElement *This = impl_from_IHTMLElement2(iface);
507 FIXME("(%p)->(%p)\n", This, p);
511 static HRESULT WINAPI HTMLElement2_put_oncut(IHTMLElement2 *iface, VARIANT v)
513 HTMLElement *This = impl_from_IHTMLElement2(iface);
514 FIXME("(%p)->()\n", This);
518 static HRESULT WINAPI HTMLElement2_get_oncut(IHTMLElement2 *iface, VARIANT *p)
520 HTMLElement *This = impl_from_IHTMLElement2(iface);
521 FIXME("(%p)->(%p)\n", This, p);
525 static HRESULT WINAPI HTMLElement2_put_onbeforecopy(IHTMLElement2 *iface, VARIANT v)
527 HTMLElement *This = impl_from_IHTMLElement2(iface);
528 FIXME("(%p)->()\n", This);
532 static HRESULT WINAPI HTMLElement2_get_onbeforecopy(IHTMLElement2 *iface, VARIANT *p)
534 HTMLElement *This = impl_from_IHTMLElement2(iface);
535 FIXME("(%p)->(%p)\n", This, p);
539 static HRESULT WINAPI HTMLElement2_put_oncopy(IHTMLElement2 *iface, VARIANT v)
541 HTMLElement *This = impl_from_IHTMLElement2(iface);
542 FIXME("(%p)->()\n", This);
546 static HRESULT WINAPI HTMLElement2_get_oncopy(IHTMLElement2 *iface, VARIANT *p)
548 HTMLElement *This = impl_from_IHTMLElement2(iface);
549 FIXME("(%p)->(%p)\n", This, p);
553 static HRESULT WINAPI HTMLElement2_put_onbeforepaste(IHTMLElement2 *iface, VARIANT v)
555 HTMLElement *This = impl_from_IHTMLElement2(iface);
556 FIXME("(%p)->()\n", This);
560 static HRESULT WINAPI HTMLElement2_get_onbeforepaste(IHTMLElement2 *iface, VARIANT *p)
562 HTMLElement *This = impl_from_IHTMLElement2(iface);
563 FIXME("(%p)->(%p)\n", This, p);
567 static HRESULT WINAPI HTMLElement2_put_onpaste(IHTMLElement2 *iface, VARIANT v)
569 HTMLElement *This = impl_from_IHTMLElement2(iface);
571 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
573 return set_node_event(&This->node, EVENTID_PASTE, &v);
576 static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p)
578 HTMLElement *This = impl_from_IHTMLElement2(iface);
580 TRACE("(%p)->(%p)\n", This, p);
582 return get_node_event(&This->node, EVENTID_PASTE, p);
585 static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p)
587 HTMLElement *This = impl_from_IHTMLElement2(iface);
589 TRACE("(%p)->(%p)\n", This, p);
591 return HTMLCurrentStyle_Create(This, p);
594 static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v)
596 HTMLElement *This = impl_from_IHTMLElement2(iface);
597 FIXME("(%p)->()\n", This);
601 static HRESULT WINAPI HTMLElement2_get_onpropertychange(IHTMLElement2 *iface, VARIANT *p)
603 HTMLElement *This = impl_from_IHTMLElement2(iface);
604 FIXME("(%p)->(%p)\n", This, p);
608 static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRectCollection **pRectCol)
610 HTMLElement *This = impl_from_IHTMLElement2(iface);
611 FIXME("(%p)->(%p)\n", This, pRectCol);
615 static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, IHTMLRect **pRect)
617 HTMLElement *This = impl_from_IHTMLElement2(iface);
618 nsIDOMClientRect *nsrect;
622 TRACE("(%p)->(%p)\n", This, pRect);
624 nsres = nsIDOMHTMLElement_GetBoundingClientRect(This->nselem, &nsrect);
625 if(NS_FAILED(nsres) || !nsrect) {
626 ERR("GetBoindingClientRect failed: %08x\n", nsres);
630 hres = create_html_rect(nsrect, pRect);
632 nsIDOMClientRect_Release(nsrect);
636 static HRESULT WINAPI HTMLElement2_setExpression(IHTMLElement2 *iface, BSTR propname,
637 BSTR expression, BSTR language)
639 HTMLElement *This = impl_from_IHTMLElement2(iface);
640 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression),
641 debugstr_w(language));
645 static HRESULT WINAPI HTMLElement2_getExpression(IHTMLElement2 *iface, BSTR propname,
648 HTMLElement *This = impl_from_IHTMLElement2(iface);
649 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), expression);
653 static HRESULT WINAPI HTMLElement2_removeExpression(IHTMLElement2 *iface, BSTR propname,
654 VARIANT_BOOL *pfSuccess)
656 HTMLElement *This = impl_from_IHTMLElement2(iface);
657 FIXME("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess);
661 static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
663 HTMLElement *This = impl_from_IHTMLElement2(iface);
666 TRACE("(%p)->(%d)\n", This, v);
668 nsres = nsIDOMHTMLElement_SetTabIndex(This->nselem, v);
670 ERR("GetTabIndex failed: %08x\n", nsres);
675 static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
677 HTMLElement *This = impl_from_IHTMLElement2(iface);
681 TRACE("(%p)->(%p)\n", This, p);
683 nsres = nsIDOMHTMLElement_GetTabIndex(This->nselem, &index);
684 if(NS_FAILED(nsres)) {
685 ERR("GetTabIndex failed: %08x\n", nsres);
693 static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
695 HTMLElement *This = impl_from_IHTMLElement2(iface);
698 TRACE("(%p)\n", This);
700 nsres = nsIDOMHTMLElement_Focus(This->nselem);
702 ERR("Focus failed: %08x\n", nsres);
707 static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
709 HTMLElement *This = impl_from_IHTMLElement2(iface);
712 static WCHAR accessKeyW[] = {'a','c','c','e','s','s','K','e','y',0};
714 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
716 V_VT(&var) = VT_BSTR;
718 return IHTMLElement_setAttribute(&This->IHTMLElement_iface, accessKeyW, var, 0);
721 static HRESULT WINAPI HTMLElement2_get_accessKey(IHTMLElement2 *iface, BSTR *p)
723 HTMLElement *This = impl_from_IHTMLElement2(iface);
724 FIXME("(%p)->(%p)\n", This, p);
728 static HRESULT WINAPI HTMLElement2_put_onblur(IHTMLElement2 *iface, VARIANT v)
730 HTMLElement *This = impl_from_IHTMLElement2(iface);
732 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
734 return set_node_event(&This->node, EVENTID_BLUR, &v);
737 static HRESULT WINAPI HTMLElement2_get_onblur(IHTMLElement2 *iface, VARIANT *p)
739 HTMLElement *This = impl_from_IHTMLElement2(iface);
741 TRACE("(%p)->(%p)\n", This, p);
743 return get_node_event(&This->node, EVENTID_BLUR, p);
746 static HRESULT WINAPI HTMLElement2_put_onfocus(IHTMLElement2 *iface, VARIANT v)
748 HTMLElement *This = impl_from_IHTMLElement2(iface);
750 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
752 return set_node_event(&This->node, EVENTID_FOCUS, &v);
755 static HRESULT WINAPI HTMLElement2_get_onfocus(IHTMLElement2 *iface, VARIANT *p)
757 HTMLElement *This = impl_from_IHTMLElement2(iface);
759 TRACE("(%p)->(%p)\n", This, p);
761 return get_node_event(&This->node, EVENTID_FOCUS, p);
764 static HRESULT WINAPI HTMLElement2_put_onresize(IHTMLElement2 *iface, VARIANT v)
766 HTMLElement *This = impl_from_IHTMLElement2(iface);
767 FIXME("(%p)->()\n", This);
771 static HRESULT WINAPI HTMLElement2_get_onresize(IHTMLElement2 *iface, VARIANT *p)
773 HTMLElement *This = impl_from_IHTMLElement2(iface);
774 FIXME("(%p)->(%p)\n", This, p);
778 static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
780 HTMLElement *This = impl_from_IHTMLElement2(iface);
783 TRACE("(%p)\n", This);
785 nsres = nsIDOMHTMLElement_Blur(This->nselem);
786 if(NS_FAILED(nsres)) {
787 ERR("Blur failed: %08x\n", nsres);
794 static HRESULT WINAPI HTMLElement2_addFilter(IHTMLElement2 *iface, IUnknown *pUnk)
796 HTMLElement *This = impl_from_IHTMLElement2(iface);
797 FIXME("(%p)->(%p)\n", This, pUnk);
801 static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *pUnk)
803 HTMLElement *This = impl_from_IHTMLElement2(iface);
804 FIXME("(%p)->(%p)\n", This, pUnk);
808 static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, LONG *p)
810 HTMLElement *This = impl_from_IHTMLElement2(iface);
813 TRACE("(%p)->(%p)\n", This, p);
815 nsres = nsIDOMHTMLElement_GetClientHeight(This->nselem, p);
816 assert(nsres == NS_OK);
820 static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, LONG *p)
822 HTMLElement *This = impl_from_IHTMLElement2(iface);
825 TRACE("(%p)->(%p)\n", This, p);
827 nsres = nsIDOMHTMLElement_GetClientWidth(This->nselem, p);
828 assert(nsres == NS_OK);
832 static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
834 HTMLElement *This = impl_from_IHTMLElement2(iface);
837 TRACE("(%p)->(%p)\n", This, p);
839 nsres = nsIDOMHTMLElement_GetClientTop(This->nselem, p);
840 assert(nsres == NS_OK);
842 TRACE("*p = %d\n", *p);
846 static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
848 HTMLElement *This = impl_from_IHTMLElement2(iface);
851 TRACE("(%p)->(%p)\n", This, p);
853 nsres = nsIDOMHTMLElement_GetClientLeft(This->nselem, p);
854 assert(nsres == NS_OK);
856 TRACE("*p = %d\n", *p);
860 static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
861 IDispatch *pDisp, VARIANT_BOOL *pfResult)
863 HTMLElement *This = impl_from_IHTMLElement2(iface);
865 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
867 return attach_event(get_node_event_target(&This->node), This->node.nsnode, &This->node.doc->basedoc, event, pDisp, pfResult);
870 static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
872 HTMLElement *This = impl_from_IHTMLElement2(iface);
874 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
876 return detach_event(*get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp);
879 static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
881 HTMLElement *This = impl_from_IHTMLElement2(iface);
884 TRACE("(%p)->(%p)\n", This, p);
886 if(This->node.vtbl->get_readystate) {
889 hres = This->node.vtbl->get_readystate(&This->node, &str);
893 static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
895 str = SysAllocString(completeW);
897 return E_OUTOFMEMORY;
905 static HRESULT WINAPI HTMLElement2_put_onreadystatechange(IHTMLElement2 *iface, VARIANT v)
907 HTMLElement *This = impl_from_IHTMLElement2(iface);
909 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
911 return set_node_event(&This->node, EVENTID_READYSTATECHANGE, &v);
914 static HRESULT WINAPI HTMLElement2_get_onreadystatechange(IHTMLElement2 *iface, VARIANT *p)
916 HTMLElement *This = impl_from_IHTMLElement2(iface);
918 TRACE("(%p)->(%p)\n", This, p);
920 return get_node_event(&This->node, EVENTID_READYSTATECHANGE, p);
923 static HRESULT WINAPI HTMLElement2_put_onrowsdelete(IHTMLElement2 *iface, VARIANT v)
925 HTMLElement *This = impl_from_IHTMLElement2(iface);
926 FIXME("(%p)->()\n", This);
930 static HRESULT WINAPI HTMLElement2_get_onrowsdelete(IHTMLElement2 *iface, VARIANT *p)
932 HTMLElement *This = impl_from_IHTMLElement2(iface);
933 FIXME("(%p)->(%p)\n", This, p);
937 static HRESULT WINAPI HTMLElement2_put_onrowsinserted(IHTMLElement2 *iface, VARIANT v)
939 HTMLElement *This = impl_from_IHTMLElement2(iface);
940 FIXME("(%p)->()\n", This);
944 static HRESULT WINAPI HTMLElement2_get_onrowsinserted(IHTMLElement2 *iface, VARIANT *p)
946 HTMLElement *This = impl_from_IHTMLElement2(iface);
947 FIXME("(%p)->(%p)\n", This, p);
951 static HRESULT WINAPI HTMLElement2_put_oncellchange(IHTMLElement2 *iface, VARIANT v)
953 HTMLElement *This = impl_from_IHTMLElement2(iface);
954 FIXME("(%p)->()\n", This);
958 static HRESULT WINAPI HTMLElement2_get_oncellchange(IHTMLElement2 *iface, VARIANT *p)
960 HTMLElement *This = impl_from_IHTMLElement2(iface);
961 FIXME("(%p)->(%p)\n", This, p);
965 static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
967 HTMLElement *This = impl_from_IHTMLElement2(iface);
968 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
972 static HRESULT WINAPI HTMLElement2_get_dir(IHTMLElement2 *iface, BSTR *p)
974 HTMLElement *This = impl_from_IHTMLElement2(iface);
978 TRACE("(%p)->(%p)\n", This, p);
985 nsres = nsIDOMHTMLElement_GetDir(This->nselem, &dir_str);
986 return return_nsstr(nsres, &dir_str, p);
989 static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDispatch **range)
991 HTMLElement *This = impl_from_IHTMLElement2(iface);
992 FIXME("(%p)->(%p)\n", This, range);
996 static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *p)
998 HTMLElement *This = impl_from_IHTMLElement2(iface);
1001 TRACE("(%p)->(%p)\n", This, p);
1003 nsres = nsIDOMHTMLElement_GetScrollHeight(This->nselem, p);
1004 assert(nsres == NS_OK);
1006 TRACE("*p = %d\n", *p);
1010 static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p)
1012 HTMLElement *This = impl_from_IHTMLElement2(iface);
1015 TRACE("(%p)->(%p)\n", This, p);
1017 nsres = nsIDOMHTMLElement_GetScrollWidth(This->nselem, p);
1018 assert(nsres == NS_OK);
1020 TRACE("*p = %d\n", *p);
1024 static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
1026 HTMLElement *This = impl_from_IHTMLElement2(iface);
1028 TRACE("(%p)->(%d)\n", This, v);
1031 FIXME("NULL nselem\n");
1035 nsIDOMHTMLElement_SetScrollTop(This->nselem, v);
1039 static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
1041 HTMLElement *This = impl_from_IHTMLElement2(iface);
1044 TRACE("(%p)->(%p)\n", This, p);
1046 nsres = nsIDOMHTMLElement_GetScrollTop(This->nselem, p);
1047 assert(nsres == NS_OK);
1049 TRACE("*p = %d\n", *p);
1053 static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
1055 HTMLElement *This = impl_from_IHTMLElement2(iface);
1057 TRACE("(%p)->(%d)\n", This, v);
1060 FIXME("NULL nselem\n");
1064 nsIDOMHTMLElement_SetScrollLeft(This->nselem, v);
1068 static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
1070 HTMLElement *This = impl_from_IHTMLElement2(iface);
1073 TRACE("(%p)->(%p)\n", This, p);
1076 return E_INVALIDARG;
1080 FIXME("NULL nselem\n");
1084 nsres = nsIDOMHTMLElement_GetScrollLeft(This->nselem, p);
1085 assert(nsres == NS_OK);
1087 TRACE("*p = %d\n", *p);
1091 static HRESULT WINAPI HTMLElement2_clearAttributes(IHTMLElement2 *iface)
1093 HTMLElement *This = impl_from_IHTMLElement2(iface);
1094 FIXME("(%p)\n", This);
1098 static HRESULT WINAPI HTMLElement2_mergeAttributes(IHTMLElement2 *iface, IHTMLElement *mergeThis)
1100 HTMLElement *This = impl_from_IHTMLElement2(iface);
1101 FIXME("(%p)->(%p)\n", This, mergeThis);
1105 static HRESULT WINAPI HTMLElement2_put_oncontextmenu(IHTMLElement2 *iface, VARIANT v)
1107 HTMLElement *This = impl_from_IHTMLElement2(iface);
1108 FIXME("(%p)->()\n", This);
1112 static HRESULT WINAPI HTMLElement2_get_oncontextmenu(IHTMLElement2 *iface, VARIANT *p)
1114 HTMLElement *This = impl_from_IHTMLElement2(iface);
1115 FIXME("(%p)->(%p)\n", This, p);
1119 static HRESULT WINAPI HTMLElement2_insertAdjecentElement(IHTMLElement2 *iface, BSTR where,
1120 IHTMLElement *insertedElement, IHTMLElement **inserted)
1122 HTMLElement *This = impl_from_IHTMLElement2(iface);
1123 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
1127 static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
1128 BSTR where, IHTMLElement **applied)
1130 HTMLElement *This = impl_from_IHTMLElement2(iface);
1131 FIXME("(%p)->(%p %s %p)\n", This, apply, debugstr_w(where), applied);
1135 static HRESULT WINAPI HTMLElement2_getAdjecentText(IHTMLElement2 *iface, BSTR where, BSTR *text)
1137 HTMLElement *This = impl_from_IHTMLElement2(iface);
1138 FIXME("(%p)->(%s %p)\n", This, debugstr_w(where), text);
1142 static HRESULT WINAPI HTMLElement2_replaceAdjecentText(IHTMLElement2 *iface, BSTR where,
1143 BSTR newText, BSTR *oldText)
1145 HTMLElement *This = impl_from_IHTMLElement2(iface);
1146 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(where), debugstr_w(newText), oldText);
1150 static HRESULT WINAPI HTMLElement2_get_canHandleChildren(IHTMLElement2 *iface, VARIANT_BOOL *p)
1152 HTMLElement *This = impl_from_IHTMLElement2(iface);
1153 FIXME("(%p)->(%p)\n", This, p);
1157 static HRESULT WINAPI HTMLElement2_addBehavior(IHTMLElement2 *iface, BSTR bstrUrl,
1158 VARIANT *pvarFactory, LONG *pCookie)
1160 HTMLElement *This = impl_from_IHTMLElement2(iface);
1161 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrUrl), pvarFactory, pCookie);
1165 static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG cookie,
1166 VARIANT_BOOL *pfResult)
1168 HTMLElement *This = impl_from_IHTMLElement2(iface);
1169 FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
1173 static HRESULT WINAPI HTMLElement2_get_runtimeStyle(IHTMLElement2 *iface, IHTMLStyle **p)
1175 HTMLElement *This = impl_from_IHTMLElement2(iface);
1177 FIXME("(%p)->(%p): hack\n", This, p);
1179 /* We can't implement correct behavior on top of Gecko (although we could
1180 try a bit harder). Making runtimeStyle behave like regular style is
1181 enough for most use cases. */
1182 if(!This->runtime_style) {
1185 hres = HTMLStyle_Create(This, &This->runtime_style);
1190 *p = &This->runtime_style->IHTMLStyle_iface;
1191 IHTMLStyle_AddRef(*p);
1195 static HRESULT WINAPI HTMLElement2_get_behaviorUrns(IHTMLElement2 *iface, IDispatch **p)
1197 HTMLElement *This = impl_from_IHTMLElement2(iface);
1198 FIXME("(%p)->(%p)\n", This, p);
1202 static HRESULT WINAPI HTMLElement2_put_tagUrn(IHTMLElement2 *iface, BSTR v)
1204 HTMLElement *This = impl_from_IHTMLElement2(iface);
1205 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1209 static HRESULT WINAPI HTMLElement2_get_tagUrn(IHTMLElement2 *iface, BSTR *p)
1211 HTMLElement *This = impl_from_IHTMLElement2(iface);
1212 FIXME("(%p)->(%p)\n", This, p);
1216 static HRESULT WINAPI HTMLElement2_put_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT vv)
1218 HTMLElement *This = impl_from_IHTMLElement2(iface);
1219 FIXME("(%p)->()\n", This);
1223 static HRESULT WINAPI HTMLElement2_get_onbeforeeditfocus(IHTMLElement2 *iface, VARIANT *p)
1225 HTMLElement *This = impl_from_IHTMLElement2(iface);
1226 FIXME("(%p)->(%p)\n", This, p);
1230 static HRESULT WINAPI HTMLElement2_get_readyStateValue(IHTMLElement2 *iface, LONG *p)
1232 HTMLElement *This = impl_from_IHTMLElement2(iface);
1233 FIXME("(%p)->(%p)\n", This, p);
1237 static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BSTR v,
1238 IHTMLElementCollection **pelColl)
1240 HTMLElement *This = impl_from_IHTMLElement2(iface);
1241 nsIDOMNodeList *nslist;
1245 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
1247 nsAString_InitDepend(&tag_str, v);
1248 nsres = nsIDOMHTMLElement_GetElementsByTagName(This->nselem, &tag_str, &nslist);
1249 nsAString_Finish(&tag_str);
1250 if(NS_FAILED(nsres)) {
1251 ERR("GetElementByTagName failed: %08x\n", nsres);
1255 *pelColl = create_collection_from_nodelist(This->node.doc, nslist);
1256 nsIDOMNodeList_Release(nslist);
1260 static const IHTMLElement2Vtbl HTMLElement2Vtbl = {
1261 HTMLElement2_QueryInterface,
1262 HTMLElement2_AddRef,
1263 HTMLElement2_Release,
1264 HTMLElement2_GetTypeInfoCount,
1265 HTMLElement2_GetTypeInfo,
1266 HTMLElement2_GetIDsOfNames,
1267 HTMLElement2_Invoke,
1268 HTMLElement2_get_scopeName,
1269 HTMLElement2_setCapture,
1270 HTMLElement2_releaseCapture,
1271 HTMLElement2_put_onlosecapture,
1272 HTMLElement2_get_onlosecapture,
1273 HTMLElement2_componentFromPoint,
1274 HTMLElement2_doScroll,
1275 HTMLElement2_put_onscroll,
1276 HTMLElement2_get_onscroll,
1277 HTMLElement2_put_ondrag,
1278 HTMLElement2_get_ondrag,
1279 HTMLElement2_put_ondragend,
1280 HTMLElement2_get_ondragend,
1281 HTMLElement2_put_ondragenter,
1282 HTMLElement2_get_ondragenter,
1283 HTMLElement2_put_ondragover,
1284 HTMLElement2_get_ondragover,
1285 HTMLElement2_put_ondragleave,
1286 HTMLElement2_get_ondragleave,
1287 HTMLElement2_put_ondrop,
1288 HTMLElement2_get_ondrop,
1289 HTMLElement2_put_onbeforecut,
1290 HTMLElement2_get_onbeforecut,
1291 HTMLElement2_put_oncut,
1292 HTMLElement2_get_oncut,
1293 HTMLElement2_put_onbeforecopy,
1294 HTMLElement2_get_onbeforecopy,
1295 HTMLElement2_put_oncopy,
1296 HTMLElement2_get_oncopy,
1297 HTMLElement2_put_onbeforepaste,
1298 HTMLElement2_get_onbeforepaste,
1299 HTMLElement2_put_onpaste,
1300 HTMLElement2_get_onpaste,
1301 HTMLElement2_get_currentStyle,
1302 HTMLElement2_put_onpropertychange,
1303 HTMLElement2_get_onpropertychange,
1304 HTMLElement2_getClientRects,
1305 HTMLElement2_getBoundingClientRect,
1306 HTMLElement2_setExpression,
1307 HTMLElement2_getExpression,
1308 HTMLElement2_removeExpression,
1309 HTMLElement2_put_tabIndex,
1310 HTMLElement2_get_tabIndex,
1312 HTMLElement2_put_accessKey,
1313 HTMLElement2_get_accessKey,
1314 HTMLElement2_put_onblur,
1315 HTMLElement2_get_onblur,
1316 HTMLElement2_put_onfocus,
1317 HTMLElement2_get_onfocus,
1318 HTMLElement2_put_onresize,
1319 HTMLElement2_get_onresize,
1321 HTMLElement2_addFilter,
1322 HTMLElement2_removeFilter,
1323 HTMLElement2_get_clientHeight,
1324 HTMLElement2_get_clientWidth,
1325 HTMLElement2_get_clientTop,
1326 HTMLElement2_get_clientLeft,
1327 HTMLElement2_attachEvent,
1328 HTMLElement2_detachEvent,
1329 HTMLElement2_get_readyState,
1330 HTMLElement2_put_onreadystatechange,
1331 HTMLElement2_get_onreadystatechange,
1332 HTMLElement2_put_onrowsdelete,
1333 HTMLElement2_get_onrowsdelete,
1334 HTMLElement2_put_onrowsinserted,
1335 HTMLElement2_get_onrowsinserted,
1336 HTMLElement2_put_oncellchange,
1337 HTMLElement2_get_oncellchange,
1338 HTMLElement2_put_dir,
1339 HTMLElement2_get_dir,
1340 HTMLElement2_createControlRange,
1341 HTMLElement2_get_scrollHeight,
1342 HTMLElement2_get_scrollWidth,
1343 HTMLElement2_put_scrollTop,
1344 HTMLElement2_get_scrollTop,
1345 HTMLElement2_put_scrollLeft,
1346 HTMLElement2_get_scrollLeft,
1347 HTMLElement2_clearAttributes,
1348 HTMLElement2_mergeAttributes,
1349 HTMLElement2_put_oncontextmenu,
1350 HTMLElement2_get_oncontextmenu,
1351 HTMLElement2_insertAdjecentElement,
1352 HTMLElement2_applyElement,
1353 HTMLElement2_getAdjecentText,
1354 HTMLElement2_replaceAdjecentText,
1355 HTMLElement2_get_canHandleChildren,
1356 HTMLElement2_addBehavior,
1357 HTMLElement2_removeBehavior,
1358 HTMLElement2_get_runtimeStyle,
1359 HTMLElement2_get_behaviorUrns,
1360 HTMLElement2_put_tagUrn,
1361 HTMLElement2_get_tagUrn,
1362 HTMLElement2_put_onbeforeeditfocus,
1363 HTMLElement2_get_onbeforeeditfocus,
1364 HTMLElement2_get_readyStateValue,
1365 HTMLElement2_getElementsByTagName,
1368 void HTMLElement2_Init(HTMLElement *This)
1370 This->IHTMLElement2_iface.lpVtbl = &HTMLElement2Vtbl;