ReactOS 0.4.15-dev-7907-g95bf896
htmlevent.c
Go to the documentation of this file.
1/*
2 * Copyright 2008-2009 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
21typedef struct {
26
29};
30
31static const WCHAR abortW[] = {'a','b','o','r','t',0};
32static const WCHAR onabortW[] = {'o','n','a','b','o','r','t',0};
33
34static const WCHAR beforeunloadW[] = {'b','e','f','o','r','e','u','n','l','o','a','d',0};
35static const WCHAR onbeforeunloadW[] = {'o','n','b','e','f','o','r','e','u','n','l','o','a','d',0};
36
37static const WCHAR blurW[] = {'b','l','u','r',0};
38static const WCHAR onblurW[] = {'o','n','b','l','u','r',0};
39
40static const WCHAR changeW[] = {'c','h','a','n','g','e',0};
41static const WCHAR onchangeW[] = {'o','n','c','h','a','n','g','e',0};
42
43static const WCHAR clickW[] = {'c','l','i','c','k',0};
44static const WCHAR onclickW[] = {'o','n','c','l','i','c','k',0};
45
46static const WCHAR contextmenuW[] = {'c','o','n','t','e','x','t','m','e','n','u',0};
47static const WCHAR oncontextmenuW[] = {'o','n','c','o','n','t','e','x','t','m','e','n','u',0};
48
49static const WCHAR dataavailableW[] = {'d','a','t','a','a','v','a','i','l','a','b','l','e',0};
50static const WCHAR ondataavailableW[] = {'o','n','d','a','t','a','a','v','a','i','l','a','b','l','e',0};
51
52static const WCHAR dblclickW[] = {'d','b','l','c','l','i','c','k',0};
53static const WCHAR ondblclickW[] = {'o','n','d','b','l','c','l','i','c','k',0};
54
55static const WCHAR dragW[] = {'d','r','a','g',0};
56static const WCHAR ondragW[] = {'o','n','d','r','a','g',0};
57
58static const WCHAR dragstartW[] = {'d','r','a','g','s','t','a','r','t',0};
59static const WCHAR ondragstartW[] = {'o','n','d','r','a','g','s','t','a','r','t',0};
60
61static const WCHAR errorW[] = {'e','r','r','o','r',0};
62static const WCHAR onerrorW[] = {'o','n','e','r','r','o','r',0};
63
64static const WCHAR focusW[] = {'f','o','c','u','s',0};
65static const WCHAR onfocusW[] = {'o','n','f','o','c','u','s',0};
66
67static const WCHAR focusinW[] = {'f','o','c','u','s','i','n',0};
68static const WCHAR onfocusinW[] = {'o','n','f','o','c','u','s','i','n',0};
69
70static const WCHAR helpW[] = {'h','e','l','p',0};
71static const WCHAR onhelpW[] = {'o','n','h','e','l','p',0};
72
73static const WCHAR keydownW[] = {'k','e','y','d','o','w','n',0};
74static const WCHAR onkeydownW[] = {'o','n','k','e','y','d','o','w','n',0};
75
76static const WCHAR keypressW[] = {'k','e','y','p','r','e','s','s',0};
77static const WCHAR onkeypressW[] = {'o','n','k','e','y','p','r','e','s','s',0};
78
79static const WCHAR keyupW[] = {'k','e','y','u','p',0};
80static const WCHAR onkeyupW[] = {'o','n','k','e','y','u','p',0};
81
82static const WCHAR loadW[] = {'l','o','a','d',0};
83static const WCHAR onloadW[] = {'o','n','l','o','a','d',0};
84
85static const WCHAR mousedownW[] = {'m','o','u','s','e','d','o','w','n',0};
86static const WCHAR onmousedownW[] = {'o','n','m','o','u','s','e','d','o','w','n',0};
87
88static const WCHAR mousemoveW[] = {'m','o','u','s','e','m','o','v','e',0};
89static const WCHAR onmousemoveW[] = {'o','n','m','o','u','s','e','m','o','v','e',0};
90
91static const WCHAR mouseoutW[] = {'m','o','u','s','e','o','u','t',0};
92static const WCHAR onmouseoutW[] = {'o','n','m','o','u','s','e','o','u','t',0};
93
94static const WCHAR mouseoverW[] = {'m','o','u','s','e','o','v','e','r',0};
95static const WCHAR onmouseoverW[] = {'o','n','m','o','u','s','e','o','v','e','r',0};
96
97static const WCHAR mouseupW[] = {'m','o','u','s','e','u','p',0};
98static const WCHAR onmouseupW[] = {'o','n','m','o','u','s','e','u','p',0};
99
100static const WCHAR mousewheelW[] = {'m','o','u','s','e','w','h','e','e','l',0};
101static const WCHAR onmousewheelW[] = {'o','n','m','o','u','s','e','w','h','e','e','l',0};
102
103static const WCHAR pasteW[] = {'p','a','s','t','e',0};
104static const WCHAR onpasteW[] = {'o','n','p','a','s','t','e',0};
105
106static const WCHAR readystatechangeW[] = {'r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
107static const WCHAR onreadystatechangeW[] = {'o','n','r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
108
109static const WCHAR resizeW[] = {'r','e','s','i','z','e',0};
110static const WCHAR onresizeW[] = {'o','n','r','e','s','i','z','e',0};
111
112static const WCHAR scrollW[] = {'s','c','r','o','l','l',0};
113static const WCHAR onscrollW[] = {'o','n','s','c','r','o','l','l',0};
114
115static const WCHAR selectstartW[] = {'s','e','l','e','c','t','s','t','a','r','t',0};
116static const WCHAR onselectstartW[] = {'o','n','s','e','l','e','c','t','s','t','a','r','t',0};
117
118static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
119static const WCHAR onsubmitW[] = {'o','n','s','u','b','m','i','t',0};
120
121static const WCHAR HTMLEventsW[] = {'H','T','M','L','E','v','e','n','t','s',0};
122static const WCHAR KeyboardEventW[] = {'K','e','y','b','o','a','r','d','E','v','e','n','t',0};
123static const WCHAR MouseEventW[] = {'M','o','u','s','e','E','v','e','n','t',0};
124
125enum {
131
132static const WCHAR *event_types[] = {
133 NULL,
137};
138
139typedef struct {
146
147#define EVENT_DEFAULTLISTENER 0x0001
148#define EVENT_BUBBLE 0x0002
149#define EVENT_FORWARDBODY 0x0004
150#define EVENT_BIND_TO_BODY 0x0008
151#define EVENT_CANCELABLE 0x0010
152#define EVENT_HASDEFAULTHANDLERS 0x0020
153
154static const event_info_t event_info[] = {
202 0},
206 0},
215};
216
218{
219 int i;
220
221 for(i=0; i < sizeof(event_info)/sizeof(event_info[0]); i++) {
222 if(!strcmpW(event_info[i].name, str))
223 return i;
224 }
225
226 ERR("unknown type %s\n", debugstr_w(str));
227 return EVENTID_LAST;
228}
229
231{
232 int i;
233
234 for(i=0; i < sizeof(event_info)/sizeof(event_info[0]); i++) {
235 if(!strcmpW(event_info[i].attr_name, str))
236 return i;
237 }
238
239 return EVENTID_LAST;
240}
241
244 IHTMLEventObj IHTMLEventObj_iface;
245
247
254};
255
256static inline HTMLEventObj *impl_from_IHTMLEventObj(IHTMLEventObj *iface)
257{
258 return CONTAINING_RECORD(iface, HTMLEventObj, IHTMLEventObj_iface);
259}
260
261static HRESULT WINAPI HTMLEventObj_QueryInterface(IHTMLEventObj *iface, REFIID riid, void **ppv)
262{
264
265 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
266
268 *ppv = &This->IHTMLEventObj_iface;
269 }else if(IsEqualGUID(&IID_IHTMLEventObj, riid)) {
270 *ppv = &This->IHTMLEventObj_iface;
271 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
272 return *ppv ? S_OK : E_NOINTERFACE;
273 }else {
274 *ppv = NULL;
275 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
276 return E_NOINTERFACE;
277 }
278
279 IUnknown_AddRef((IUnknown*)*ppv);
280 return S_OK;
281}
282
283static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface)
284{
287
288 TRACE("(%p) ref=%d\n", This, ref);
289
290 return ref;
291}
292
293static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
294{
297
298 TRACE("(%p) ref=%d\n", This, ref);
299
300 if(!ref) {
301 if(This->target)
302 IHTMLDOMNode_Release(&This->target->IHTMLDOMNode_iface);
303 if(This->nsevent)
304 nsIDOMEvent_Release(This->nsevent);
305 release_dispex(&This->dispex);
307 }
308
309 return ref;
310}
311
312static HRESULT WINAPI HTMLEventObj_GetTypeInfoCount(IHTMLEventObj *iface, UINT *pctinfo)
313{
315 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
316}
317
318static HRESULT WINAPI HTMLEventObj_GetTypeInfo(IHTMLEventObj *iface, UINT iTInfo,
319 LCID lcid, ITypeInfo **ppTInfo)
320{
322 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
323}
324
326 LPOLESTR *rgszNames, UINT cNames,
327 LCID lcid, DISPID *rgDispId)
328{
330 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
331 lcid, rgDispId);
332}
333
334static HRESULT WINAPI HTMLEventObj_Invoke(IHTMLEventObj *iface, DISPID dispIdMember,
335 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
336 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
337{
339 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
340 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
341}
342
343static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p)
344{
346
347 TRACE("(%p)->(%p)\n", This, p);
348
349 *p = NULL;
350 if(This->target)
351 IHTMLDOMNode_QueryInterface(&This->target->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
352 return S_OK;
353}
354
356{
359
360 TRACE("(%p)->(%p)\n", This, p);
361
362 if(This->nsevent) {
364 nsresult nsres;
365
366 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
367 if(NS_SUCCEEDED(nsres)) {
368 nsIDOMKeyEvent_GetAltKey(key_event, &ret);
369 nsIDOMKeyEvent_Release(key_event);
370 }else {
372
373 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
374 if(NS_SUCCEEDED(nsres)) {
375 nsIDOMMouseEvent_GetAltKey(mouse_event, &ret);
376 nsIDOMMouseEvent_Release(mouse_event);
377 }
378 }
379 }
380
381 *p = ret ? VARIANT_TRUE : VARIANT_FALSE;
382 return S_OK;
383}
384
386{
389
390 TRACE("(%p)->(%p)\n", This, p);
391
392 if(This->nsevent) {
394 nsresult nsres;
395
396 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
397 if(NS_SUCCEEDED(nsres)) {
398 nsIDOMKeyEvent_GetCtrlKey(key_event, &ret);
399 nsIDOMKeyEvent_Release(key_event);
400 }else {
402
403 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
404 if(NS_SUCCEEDED(nsres)) {
405 nsIDOMMouseEvent_GetCtrlKey(mouse_event, &ret);
406 nsIDOMMouseEvent_Release(mouse_event);
407 }
408 }
409 }
410
411 *p = ret ? VARIANT_TRUE : VARIANT_FALSE;
412 return S_OK;
413}
414
416{
419
420 TRACE("(%p)->(%p)\n", This, p);
421
422 if(This->nsevent) {
424 nsresult nsres;
425
426 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
427 if(NS_SUCCEEDED(nsres)) {
428 nsIDOMKeyEvent_GetShiftKey(key_event, &ret);
429 nsIDOMKeyEvent_Release(key_event);
430 }else {
432
433 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
434 if(NS_SUCCEEDED(nsres)) {
435 nsIDOMMouseEvent_GetShiftKey(mouse_event, &ret);
436 nsIDOMMouseEvent_Release(mouse_event);
437 }
438 }
439 }
440
441 *p = ret ? VARIANT_TRUE : VARIANT_FALSE;
442 return S_OK;
443}
444
446{
448
449 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
450
451 if(V_VT(&v) != VT_BOOL) {
452 FIXME("unsupported value %s\n", debugstr_variant(&v));
453 return DISP_E_BADVARTYPE;
454 }
455
456 This->return_value = v;
457 if(!V_BOOL(&v))
458 This->prevent_default = TRUE;
459 return S_OK;
460}
461
463{
465
466 TRACE("(%p)->(%p)\n", This, p);
467
468 V_VT(p) = VT_EMPTY;
469 return VariantCopy(p, &This->return_value);
470}
471
473{
475
476 TRACE("(%p)->(%x)\n", This, v);
477
478 This->cancel_bubble = !!v;
479 return S_OK;
480}
481
483{
485
486 TRACE("(%p)->(%p)\n", This, p);
487
488 *p = This->cancel_bubble ? VARIANT_TRUE : VARIANT_FALSE;
489 return S_OK;
490}
491
492static HRESULT WINAPI HTMLEventObj_get_fromElement(IHTMLEventObj *iface, IHTMLElement **p)
493{
495
496 FIXME("(%p)->(%p)\n", This, p);
497
498 *p = NULL;
499 return S_OK;
500}
501
502static HRESULT WINAPI HTMLEventObj_get_toElement(IHTMLEventObj *iface, IHTMLElement **p)
503{
505
506 FIXME("(%p)->(%p)\n", This, p);
507
508 *p = NULL;
509 return S_OK;
510}
511
512static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, LONG v)
513{
515 FIXME("(%p)->(%d)\n", This, v);
516 return E_NOTIMPL;
517}
518
519static HRESULT WINAPI HTMLEventObj_get_keyCode(IHTMLEventObj *iface, LONG *p)
520{
522 UINT32 key_code = 0;
523
524 TRACE("(%p)->(%p)\n", This, p);
525
526 if(This->nsevent) {
528 nsresult nsres;
529
530 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
531 if(NS_SUCCEEDED(nsres)) {
532 nsIDOMKeyEvent_GetKeyCode(key_event, &key_code);
533 nsIDOMKeyEvent_Release(key_event);
534 }
535 }
536
537 *p = key_code;
538 return S_OK;
539}
540
541static HRESULT WINAPI HTMLEventObj_get_button(IHTMLEventObj *iface, LONG *p)
542{
544 INT16 button = 0;
545
546 TRACE("(%p)->(%p)\n", This, p);
547
548 if(This->nsevent) {
550 nsresult nsres;
551
552 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
553 if(NS_SUCCEEDED(nsres)) {
554 nsIDOMMouseEvent_GetButton(mouse_event, &button);
555 nsIDOMMouseEvent_Release(mouse_event);
556 }
557 }
558
559 *p = button;
560 return S_OK;
561}
562
563static HRESULT WINAPI HTMLEventObj_get_type(IHTMLEventObj *iface, BSTR *p)
564{
566
567 TRACE("(%p)->(%p)\n", This, p);
568
569 if(!This->type) {
570 *p = NULL;
571 return S_OK;
572 }
573
574 *p = SysAllocString(This->type->name);
575 return *p ? S_OK : E_OUTOFMEMORY;
576}
577
578static HRESULT WINAPI HTMLEventObj_get_qualifier(IHTMLEventObj *iface, BSTR *p)
579{
581
582 FIXME("(%p)->(%p)\n", This, p);
583
584 *p = NULL;
585 return S_OK;
586}
587
588static HRESULT WINAPI HTMLEventObj_get_reason(IHTMLEventObj *iface, LONG *p)
589{
591
592 FIXME("(%p)->(%p)\n", This, p);
593
594 *p = 0;
595 return S_OK;
596}
597
598static HRESULT WINAPI HTMLEventObj_get_x(IHTMLEventObj *iface, LONG *p)
599{
601 LONG x = 0;
602
603 TRACE("(%p)->(%p)\n", This, p);
604
605 if(This->nsevent) {
606 nsIDOMUIEvent *ui_event;
607 nsresult nsres;
608
609 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMUIEvent, (void**)&ui_event);
610 if(NS_SUCCEEDED(nsres)) {
611 /* NOTE: pageX is not exactly right here. */
612 nsres = nsIDOMUIEvent_GetPageX(ui_event, &x);
613 assert(nsres == NS_OK);
614 nsIDOMUIEvent_Release(ui_event);
615 }
616 }
617
618 *p = x;
619 return S_OK;
620}
621
622static HRESULT WINAPI HTMLEventObj_get_y(IHTMLEventObj *iface, LONG *p)
623{
625 LONG y = 0;
626
627 TRACE("(%p)->(%p)\n", This, p);
628
629 if(This->nsevent) {
630 nsIDOMUIEvent *ui_event;
631 nsresult nsres;
632
633 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMUIEvent, (void**)&ui_event);
634 if(NS_SUCCEEDED(nsres)) {
635 /* NOTE: pageY is not exactly right here. */
636 nsres = nsIDOMUIEvent_GetPageY(ui_event, &y);
637 assert(nsres == NS_OK);
638 nsIDOMUIEvent_Release(ui_event);
639 }
640 }
641
642 *p = y;
643 return S_OK;
644}
645
646static HRESULT WINAPI HTMLEventObj_get_clientX(IHTMLEventObj *iface, LONG *p)
647{
649 LONG x = 0;
650
651 TRACE("(%p)->(%p)\n", This, p);
652
653 if(This->nsevent) {
655 nsresult nsres;
656
657 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
658 if(NS_SUCCEEDED(nsres)) {
659 nsIDOMMouseEvent_GetClientX(mouse_event, &x);
660 nsIDOMMouseEvent_Release(mouse_event);
661 }
662 }
663
664 *p = x;
665 return S_OK;
666}
667
668static HRESULT WINAPI HTMLEventObj_get_clientY(IHTMLEventObj *iface, LONG *p)
669{
671 LONG y = 0;
672
673 TRACE("(%p)->(%p)\n", This, p);
674
675 if(This->nsevent) {
677 nsresult nsres;
678
679 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
680 if(NS_SUCCEEDED(nsres)) {
681 nsIDOMMouseEvent_GetClientY(mouse_event, &y);
682 nsIDOMMouseEvent_Release(mouse_event);
683 }
684 }
685
686 *p = y;
687 return S_OK;
688}
689
690static HRESULT WINAPI HTMLEventObj_get_offsetX(IHTMLEventObj *iface, LONG *p)
691{
693
694 FIXME("(%p)->(%p)\n", This, p);
695
696 *p = 0;
697 return S_OK;
698}
699
700static HRESULT WINAPI HTMLEventObj_get_offsetY(IHTMLEventObj *iface, LONG *p)
701{
703
704 FIXME("(%p)->(%p)\n", This, p);
705
706 *p = 0;
707 return S_OK;
708}
709
710static HRESULT WINAPI HTMLEventObj_get_screenX(IHTMLEventObj *iface, LONG *p)
711{
713 LONG x = 0;
714
715 TRACE("(%p)->(%p)\n", This, p);
716
717 if(This->nsevent) {
719 nsresult nsres;
720
721 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
722 if(NS_SUCCEEDED(nsres)) {
723 nsIDOMMouseEvent_GetScreenX(mouse_event, &x);
724 nsIDOMMouseEvent_Release(mouse_event);
725 }
726 }
727
728 *p = x;
729 return S_OK;
730}
731
732static HRESULT WINAPI HTMLEventObj_get_screenY(IHTMLEventObj *iface, LONG *p)
733{
735 LONG y = 0;
736
737 TRACE("(%p)->(%p)\n", This, p);
738
739 if(This->nsevent) {
741 nsresult nsres;
742
743 nsres = nsIDOMEvent_QueryInterface(This->nsevent, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
744 if(NS_SUCCEEDED(nsres)) {
745 nsIDOMMouseEvent_GetScreenY(mouse_event, &y);
746 nsIDOMMouseEvent_Release(mouse_event);
747 }
748 }
749
750 *p = y;
751 return S_OK;
752}
753
754static HRESULT WINAPI HTMLEventObj_get_srcFilter(IHTMLEventObj *iface, IDispatch **p)
755{
757
758 FIXME("(%p)->(%p)\n", This, p);
759
760 *p = NULL;
761 return S_OK;
762}
763
764static const IHTMLEventObjVtbl HTMLEventObjVtbl = {
797};
798
799static inline HTMLEventObj *unsafe_impl_from_IHTMLEventObj(IHTMLEventObj *iface)
800{
801 return iface->lpVtbl == &HTMLEventObjVtbl ? impl_from_IHTMLEventObj(iface) : NULL;
802}
803
805 IHTMLEventObj_tid,
806 0
807};
808
810 NULL,
811 DispCEventObj_tid,
812 NULL,
814};
815
817{
819
820 ret = heap_alloc_zero(sizeof(*ret));
821 if(!ret)
822 return NULL;
823
824 ret->IHTMLEventObj_iface.lpVtbl = &HTMLEventObjVtbl;
825 ret->ref = 1;
826
827 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLEventObj_iface, &HTMLEventObj_dispex);
828
829 return ret;
830}
831
833{
834 event->type = event_info+eid;
835 event->nsevent = nsevent;
836
837 if(nsevent) {
838 nsIDOMEvent_AddRef(nsevent);
839 }else if(event_types[event_info[eid].type]) {
840 nsAString type_str;
841 nsresult nsres;
842
844 nsres = nsIDOMHTMLDocument_CreateEvent(target->doc->nsdoc, &type_str, &event->nsevent);
845 nsAString_Finish(&type_str);
846 if(NS_FAILED(nsres)) {
847 ERR("Could not create event: %08x\n", nsres);
848 return E_FAIL;
849 }
850 }
851
852 event->target = target;
853 if(target)
854 IHTMLDOMNode_AddRef(&target->IHTMLDOMNode_iface);
855 return S_OK;
856}
857
859{
861
862 event = create_event();
863 if(!event)
864 return E_OUTOFMEMORY;
865
866 *ret = &event->IHTMLEventObj_iface;
867 return S_OK;
868}
869
871{
873
874 ptr = event_target->dispex.data->vtbl && event_target->dispex.data->vtbl->get_event_target_ptr
875 ? event_target->dispex.data->vtbl->get_event_target_ptr(&event_target->dispex)
876 : &event_target->ptr;
877 if(*ptr || !alloc)
878 return *ptr;
879
880 return *ptr = heap_alloc_zero(sizeof(event_target_t));
881}
882
883static HRESULT call_disp_func(IDispatch *disp, DISPPARAMS *dp, VARIANT *retv)
884{
885 IDispatchEx *dispex;
886 EXCEPINFO ei;
888
889 memset(&ei, 0, sizeof(ei));
890
891 hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
892 if(SUCCEEDED(hres)) {
893 hres = IDispatchEx_InvokeEx(dispex, 0, GetUserDefaultLCID(), DISPATCH_METHOD, dp, retv, &ei, NULL);
894 IDispatchEx_Release(dispex);
895 }else {
896 TRACE("Could not get IDispatchEx interface: %08x\n", hres);
897 hres = IDispatch_Invoke(disp, 0, &IID_NULL, GetUserDefaultLCID(), DISPATCH_METHOD,
898 dp, retv, &ei, NULL);
899 }
900
901 return hres;
902}
903
904static HRESULT call_cp_func(IDispatch *disp, DISPID dispid, HTMLEventObj *event_obj, VARIANT *retv)
905{
906 DISPPARAMS dp = {NULL,NULL,0,0};
907 VARIANT event_arg;
908 ULONG argerr;
909 EXCEPINFO ei;
910
911 if(event_obj) {
912 V_VT(&event_arg) = VT_DISPATCH;
913 V_DISPATCH(&event_arg) = (IDispatch*)&event_obj->IHTMLEventObj_iface;
914 dp.rgvarg = &event_arg;
915 dp.cArgs = 1;
916 }
917
918 memset(&ei, 0, sizeof(ei));
919 return IDispatch_Invoke(disp, dispid, &IID_NULL, 0, DISPATCH_METHOD, &dp, retv, &ei, &argerr);
920}
921
923{
924 int min, max, i;
926
927 if(!data)
928 return FALSE;
929
930 if(!data->ids) {
931 hres = get_dispids(data->tid, &data->id_cnt, &data->ids);
932 if(FAILED(hres))
933 return FALSE;
934 }
935
936 min = 0;
937 max = data->id_cnt-1;
938 while(min <= max) {
939 i = (min+max)/2;
940 if(data->ids[i] == dispid)
941 return TRUE;
942
943 if(data->ids[i] < dispid)
944 min = i+1;
945 else
946 max = i-1;
947 }
948
949 return FALSE;
950}
951
953 ConnectionPointContainer *cp_container, eventid_t eid, IDispatch *this_obj)
954{
956 const BOOL cancelable = event_info[eid].flags & EVENT_CANCELABLE;
957 VARIANT v;
959
960 if(data && data->event_table[eid] && data->event_table[eid]->handler_prop) {
961 DISPID named_arg = DISPID_THIS;
963 DISPPARAMS dp = {&arg, &named_arg, 1, 1};
964
965 V_VT(&arg) = VT_DISPATCH;
966 V_DISPATCH(&arg) = this_obj;
967 V_VT(&v) = VT_EMPTY;
968
969 TRACE("%s >>>\n", debugstr_w(event_info[eid].name));
970 hres = call_disp_func(data->event_table[eid]->handler_prop, &dp, &v);
971 if(hres == S_OK) {
972 TRACE("%s <<< %s\n", debugstr_w(event_info[eid].name), debugstr_variant(&v));
973
974 if(cancelable) {
975 if(V_VT(&v) == VT_BOOL) {
976 if(!V_BOOL(&v))
977 event_obj->prevent_default = TRUE;
978 }else if(V_VT(&v) != VT_EMPTY) {
979 FIXME("unhandled result %s\n", debugstr_variant(&v));
980 }
981 }
982 VariantClear(&v);
983 }else {
984 WARN("%s <<< %08x\n", debugstr_w(event_info[eid].name), hres);
985 }
986 }
987
988 if(data && data->event_table[eid] && data->event_table[eid]->handler_cnt) {
990 DISPPARAMS dp = {&arg, NULL, 1, 0};
991 int i;
992
993 V_VT(&arg) = VT_DISPATCH;
994 V_DISPATCH(&arg) = (IDispatch*)event_obj;
995
996 i = data->event_table[eid]->handler_cnt;
997 while(i--) {
998 if(data->event_table[eid]->handlers[i]) {
999 V_VT(&v) = VT_EMPTY;
1000
1001 TRACE("%s [%d] >>>\n", debugstr_w(event_info[eid].name), i);
1002 hres = call_disp_func(data->event_table[eid]->handlers[i], &dp, &v);
1003 if(hres == S_OK) {
1004 TRACE("%s [%d] <<<\n", debugstr_w(event_info[eid].name), i);
1005
1006 if(cancelable) {
1007 if(V_VT(&v) == VT_BOOL) {
1008 if(!V_BOOL(&v))
1009 event_obj->prevent_default = TRUE;
1010 }else if(V_VT(&v) != VT_EMPTY) {
1011 FIXME("unhandled result %s\n", debugstr_variant(&v));
1012 }
1013 }
1014 VariantClear(&v);
1015 }else {
1016 WARN("%s [%d] <<< %08x\n", debugstr_w(event_info[eid].name), i, hres);
1017 }
1018 }
1019 }
1020 }
1021
1022 /*
1023 * NOTE: CP events may require doc_obj reference, which we don't own. We make sure that
1024 * it's safe to call event handler by checking nsevent_listener, which is NULL for
1025 * detached documents.
1026 */
1027 if(cp_container && cp_container->forward_container)
1028 cp_container = cp_container->forward_container;
1029 if(cp_container && cp_container->cps && doc->nsevent_listener) {
1031 unsigned i, j;
1032
1033 for(j=0; cp_container->cp_entries[j].riid; j++) {
1034 cp = cp_container->cps + j;
1035 if(!cp->sinks_size || !is_cp_event(cp->data, event_info[eid].dispid))
1036 continue;
1037
1038 for(i=0; doc->nsevent_listener && i < cp->sinks_size; i++) {
1039 if(!cp->sinks[i].disp)
1040 continue;
1041
1042 V_VT(&v) = VT_EMPTY;
1043
1044 TRACE("cp %s [%u] >>>\n", debugstr_w(event_info[eid].name), i);
1045 hres = call_cp_func(cp->sinks[i].disp, event_info[eid].dispid,
1046 cp->data->pass_event_arg ? event_obj : NULL, &v);
1047 if(hres == S_OK) {
1048 TRACE("cp %s [%u] <<<\n", debugstr_w(event_info[eid].name), i);
1049
1050 if(cancelable) {
1051 if(V_VT(&v) == VT_BOOL) {
1052 if(!V_BOOL(&v))
1053 event_obj->prevent_default = TRUE;
1054 }else if(V_VT(&v) != VT_EMPTY) {
1055 FIXME("unhandled result %s\n", debugstr_variant(&v));
1056 }
1057 }
1058 VariantClear(&v);
1059 }else {
1060 WARN("cp %s [%u] <<< %08x\n", debugstr_w(event_info[eid].name), i, hres);
1061 }
1062 }
1063
1064 if(!doc->nsevent_listener)
1065 break;
1066 }
1067 }
1068}
1069
1070static void fire_event_obj(HTMLDocumentNode *doc, eventid_t eid, HTMLEventObj *event_obj,
1071 nsIDOMNode *target, IDispatch *script_this)
1072{
1073 IHTMLEventObj *prev_event;
1074 nsIDOMNode *parent, *nsnode;
1075 BOOL prevent_default = FALSE;
1078 UINT16 node_type;
1079 nsresult nsres;
1080 HRESULT hres;
1081
1082 TRACE("(%p) %s\n", doc, debugstr_w(event_info[eid].name));
1083
1084 window = doc->window;
1085 if(!window) {
1086 WARN("NULL window\n");
1087 return;
1088 }
1089
1090 htmldoc_addref(&doc->basedoc);
1091
1092 prev_event = window->event;
1093 window->event = event_obj ? &event_obj->IHTMLEventObj_iface : NULL;
1094
1095 nsIDOMNode_GetNodeType(target, &node_type);
1096 nsnode = target;
1097 nsIDOMNode_AddRef(nsnode);
1098
1099 switch(node_type) {
1100 case ELEMENT_NODE:
1101 do {
1102 hres = get_node(doc, nsnode, FALSE, &node);
1103 if(SUCCEEDED(hres) && node) {
1104 call_event_handlers(doc, event_obj, &node->event_target, node->cp_container, eid,
1105 script_this ? script_this : (IDispatch*)&node->IHTMLDOMNode_iface);
1107 }
1108
1109 if(!(event_info[eid].flags & EVENT_BUBBLE) || (event_obj && event_obj->cancel_bubble))
1110 break;
1111
1112 nsIDOMNode_GetParentNode(nsnode, &parent);
1113 nsIDOMNode_Release(nsnode);
1114 nsnode = parent;
1115 if(!nsnode)
1116 break;
1117
1118 nsIDOMNode_GetNodeType(nsnode, &node_type);
1119 }while(node_type == ELEMENT_NODE);
1120
1121 if(!(event_info[eid].flags & EVENT_BUBBLE) || (event_obj && event_obj->cancel_bubble))
1122 break;
1123
1124 case DOCUMENT_NODE:
1126 nsIDOMHTMLElement *nsbody;
1127 nsresult nsres;
1128
1129 nsres = nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
1130 if(NS_SUCCEEDED(nsres) && nsbody) {
1131 hres = get_node(doc, (nsIDOMNode*)nsbody, FALSE, &node);
1132 if(SUCCEEDED(hres) && node) {
1133 call_event_handlers(doc, event_obj, &node->event_target, node->cp_container, eid,
1134 script_this ? script_this : (IDispatch*)&node->IHTMLDOMNode_iface);
1136 }
1137 nsIDOMHTMLElement_Release(nsbody);
1138 }else {
1139 ERR("Could not get body: %08x\n", nsres);
1140 }
1141 }
1142
1143 call_event_handlers(doc, event_obj, &doc->node.event_target, &doc->basedoc.cp_container, eid,
1144 script_this ? script_this : (IDispatch*)&doc->basedoc.IHTMLDocument2_iface);
1145 break;
1146
1147 default:
1148 FIXME("unimplemented node type %d\n", node_type);
1149 }
1150
1151 if(nsnode)
1152 nsIDOMNode_Release(nsnode);
1153
1154 if(event_obj && event_obj->prevent_default)
1155 prevent_default = TRUE;
1156 window->event = prev_event;
1157
1158 if(!prevent_default && (event_info[eid].flags & EVENT_HASDEFAULTHANDLERS)) {
1159 nsIDOMNode_AddRef(target);
1160 nsnode = target;
1161
1162 do {
1163 hres = get_node(doc, nsnode, TRUE, &node);
1164 if(FAILED(hres))
1165 break;
1166
1167 if(node) {
1168 if(node->vtbl->handle_event)
1169 hres = node->vtbl->handle_event(node, eid, event_obj ? event_obj->nsevent : NULL, &prevent_default);
1171 if(FAILED(hres) || prevent_default || (event_obj && event_obj->cancel_bubble))
1172 break;
1173 }
1174
1175 nsres = nsIDOMNode_GetParentNode(nsnode, &parent);
1176 if(NS_FAILED(nsres))
1177 break;
1178
1179 nsIDOMNode_Release(nsnode);
1180 nsnode = parent;
1181 } while(nsnode);
1182
1183 if(nsnode)
1184 nsIDOMNode_Release(nsnode);
1185 }
1186
1187 if(prevent_default && event_obj && event_obj->nsevent) {
1188 TRACE("calling PreventDefault\n");
1189 nsIDOMEvent_PreventDefault(event_obj->nsevent);
1190 }
1191
1192 htmldoc_release(&doc->basedoc);
1193}
1194
1196 IDispatch *script_this)
1197{
1198 HTMLEventObj *event_obj = NULL;
1200 HRESULT hres;
1201
1202 if(set_event) {
1203 hres = get_node(doc, target, TRUE, &node);
1204 if(FAILED(hres))
1205 return;
1206
1207 event_obj = create_event();
1209 if(!event_obj)
1210 return;
1211
1212 hres = set_event_info(event_obj, node, eid, nsevent);
1213 if(FAILED(hres)) {
1214 IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
1215 return;
1216 }
1217 }
1218
1219 fire_event_obj(doc, eid, event_obj, target, script_this);
1220
1221 if(event_obj)
1222 IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
1223}
1224
1225HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *event_var, VARIANT_BOOL *cancelled)
1226{
1227 HTMLEventObj *event_obj = NULL;
1228 eventid_t eid;
1229 HRESULT hres;
1230
1231 eid = attr_to_eid(event_name);
1232 if(eid == EVENTID_LAST) {
1233 WARN("unknown event %s\n", debugstr_w(event_name));
1234 return E_INVALIDARG;
1235 }
1236
1237 if(event_var && V_VT(event_var) != VT_EMPTY && V_VT(event_var) != VT_ERROR) {
1238 if(V_VT(event_var) != VT_DISPATCH) {
1239 FIXME("event_var %s not supported\n", debugstr_variant(event_var));
1240 return E_NOTIMPL;
1241 }
1242
1243 if(V_DISPATCH(event_var)) {
1244 IHTMLEventObj *event_iface;
1245
1246 hres = IDispatch_QueryInterface(V_DISPATCH(event_var), &IID_IHTMLEventObj, (void**)&event_iface);
1247 if(FAILED(hres)) {
1248 FIXME("No IHTMLEventObj iface\n");
1249 return hres;
1250 }
1251
1252 event_obj = unsafe_impl_from_IHTMLEventObj(event_iface);
1253 if(!event_obj) {
1254 ERR("Not our IHTMLEventObj?\n");
1255 IHTMLEventObj_Release(event_iface);
1256 return E_FAIL;
1257 }
1258 }
1259 }
1260
1261 if(event_obj) {
1262 hres = set_event_info(event_obj, node, eid, NULL);
1263 if(SUCCEEDED(hres))
1264 fire_event_obj(node->doc, eid, event_obj, node->nsnode, NULL);
1265
1266 IHTMLEventObj_Release(&event_obj->IHTMLEventObj_iface);
1267 if(FAILED(hres))
1268 return hres;
1269 }else {
1270 if(!(event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
1271 FIXME("not EVENT_DEFAULTEVENTHANDLER\n");
1272 return E_NOTIMPL;
1273 }
1274
1275 fire_event(node->doc, eid, TRUE, node->nsnode, NULL, NULL);
1276 }
1277
1278 *cancelled = VARIANT_TRUE; /* FIXME */
1279 return S_OK;
1280}
1281
1283{
1284 HRESULT hres;
1285
1286 if(node->vtbl->fire_event) {
1287 BOOL handled = FALSE;
1288
1289 hres = node->vtbl->fire_event(node, eid, &handled);
1290 if(handled)
1291 return hres;
1292 }
1293
1294 fire_event(node->doc, eid, TRUE, node->nsnode, NULL, NULL);
1295 return S_OK;
1296}
1297
1298static BOOL alloc_handler_vector(event_target_t *event_target, eventid_t eid, int cnt)
1299{
1300 handler_vector_t *new_vector, *handler_vector = event_target->event_table[eid];
1301
1302 if(handler_vector) {
1303 if(cnt <= handler_vector->handler_cnt)
1304 return TRUE;
1305
1306 new_vector = heap_realloc_zero(handler_vector, sizeof(handler_vector_t) + sizeof(IDispatch*)*cnt);
1307 }else {
1308 new_vector = heap_alloc_zero(sizeof(handler_vector_t) + sizeof(IDispatch*)*cnt);
1309 }
1310
1311 if(!new_vector)
1312 return FALSE;
1313
1314 new_vector->handler_cnt = cnt;
1315 event_target->event_table[eid] = new_vector;
1316 return TRUE;
1317}
1318
1320{
1321 nsIDOMNode *nsnode = NULL;
1322
1323 TRACE("%s\n", debugstr_w(event_info[eid].name));
1324
1325 if(!doc->nsdoc || doc->event_vector[eid] || !(event_info[eid].flags & (EVENT_DEFAULTLISTENER|EVENT_BIND_TO_BODY)))
1326 return S_OK;
1327
1329 nsnode = doc->node.nsnode;
1330 nsIDOMNode_AddRef(nsnode);
1331 }
1332
1333 doc->event_vector[eid] = TRUE;
1334 add_nsevent_listener(doc, nsnode, event_info[eid].name);
1335
1336 if(nsnode)
1337 nsIDOMNode_Release(nsnode);
1338 return S_OK;
1339}
1340
1342{
1343 if(doc->event_vector) {
1344 int i;
1345
1346 for(i=0; i < EVENTID_LAST; i++) {
1347 if(doc->event_vector[i]) {
1349 doc->event_vector[i] = FALSE;
1350 }
1351 }
1352 }
1353
1354 release_nsevents(doc);
1355}
1356
1357static void bind_event(EventTarget *event_target, eventid_t eid)
1358{
1359 if(event_target->dispex.data->vtbl->bind_event)
1360 event_target->dispex.data->vtbl->bind_event(&event_target->dispex, eid);
1361 else
1362 FIXME("Unsupported event binding on target %p\n", event_target);
1363}
1364
1365static void remove_event_handler(EventTarget *event_target, eventid_t eid)
1366{
1368 VARIANT *store;
1369 HRESULT hres;
1370
1371 hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, FALSE, &store);
1372 if(SUCCEEDED(hres))
1373 VariantClear(store);
1374
1375 data = get_event_target_data(event_target, FALSE);
1376 if(data && data->event_table[eid] && data->event_table[eid]->handler_prop) {
1377 IDispatch_Release(data->event_table[eid]->handler_prop);
1378 data->event_table[eid]->handler_prop = NULL;
1379 }
1380}
1381
1383{
1385
1386 remove_event_handler(event_target, eid);
1387 if(!disp)
1388 return S_OK;
1389
1390 data = get_event_target_data(event_target, TRUE);
1391 if(!data)
1392 return E_OUTOFMEMORY;
1393
1394 if(!alloc_handler_vector(data, eid, 0))
1395 return E_OUTOFMEMORY;
1396
1397 data->event_table[eid]->handler_prop = disp;
1398 IDispatch_AddRef(disp);
1399
1400 bind_event(event_target, eid);
1401 return S_OK;
1402}
1403
1405{
1406 switch(V_VT(var)) {
1407 case VT_NULL:
1408 remove_event_handler(event_target, eid);
1409 return S_OK;
1410
1411 case VT_DISPATCH:
1412 return set_event_handler_disp(event_target, eid, V_DISPATCH(var));
1413
1414 case VT_BSTR: {
1415 VARIANT *v;
1416 HRESULT hres;
1417
1418 /*
1419 * Setting event handler to string is a rare case and we don't want to
1420 * complicate nor increase memory of event_target_t for that. Instead,
1421 * we store the value in DispatchEx, which can already handle custom
1422 * properties.
1423 */
1424 remove_event_handler(event_target, eid);
1425
1426 hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, TRUE, &v);
1427 if(FAILED(hres))
1428 return hres;
1429
1431 if(!V_BSTR(v))
1432 return E_OUTOFMEMORY;
1433 V_VT(v) = VT_BSTR;
1434 return S_OK;
1435 }
1436
1437 default:
1438 FIXME("not handler %s\n", debugstr_variant(var));
1439 /* fall through */
1440 case VT_EMPTY:
1441 return E_NOTIMPL;
1442 }
1443
1444 return S_OK;
1445}
1446
1448{
1450 VARIANT *v;
1451 HRESULT hres;
1452
1453 hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, FALSE, &v);
1454 if(SUCCEEDED(hres) && V_VT(v) != VT_EMPTY)
1455 return VariantCopy(var, v);
1456
1457 data = get_event_target_data(event_target, FALSE);
1458 if(data && data->event_table[eid] && data->event_table[eid]->handler_prop) {
1459 V_VT(var) = VT_DISPATCH;
1460 V_DISPATCH(var) = data->event_table[eid]->handler_prop;
1461 IDispatch_AddRef(V_DISPATCH(var));
1462 }else {
1463 V_VT(var) = VT_NULL;
1464 }
1465
1466 return S_OK;
1467}
1468
1470{
1472 eventid_t eid;
1473 DWORD i = 0;
1474
1475 eid = attr_to_eid(name);
1476 if(eid == EVENTID_LAST) {
1477 WARN("Unknown event\n");
1478 *res = VARIANT_TRUE;
1479 return S_OK;
1480 }
1481
1482 data = get_event_target_data(event_target, TRUE);
1483 if(!data)
1484 return E_OUTOFMEMORY;
1485
1486 if(data->event_table[eid]) {
1487 while(i < data->event_table[eid]->handler_cnt && data->event_table[eid]->handlers[i])
1488 i++;
1489 if(i == data->event_table[eid]->handler_cnt && !alloc_handler_vector(data, eid, i+1))
1490 return E_OUTOFMEMORY;
1491 }else if(!alloc_handler_vector(data, eid, i+1)) {
1492 return E_OUTOFMEMORY;
1493 }
1494
1495 IDispatch_AddRef(disp);
1496 data->event_table[eid]->handlers[i] = disp;
1497
1498 bind_event(event_target, eid);
1499
1500 *res = VARIANT_TRUE;
1501 return S_OK;
1502}
1503
1505{
1507 eventid_t eid;
1508 DWORD i = 0;
1509
1510 eid = attr_to_eid(name);
1511 if(eid == EVENTID_LAST) {
1512 WARN("Unknown event\n");
1513 return S_OK;
1514 }
1515
1516 data = get_event_target_data(event_target, FALSE);
1517 if(!data)
1518 return S_OK;
1519
1520 if(!data->event_table[eid])
1521 return S_OK;
1522
1523 while(i < data->event_table[eid]->handler_cnt) {
1524 if(data->event_table[eid]->handlers[i] == disp) {
1525 IDispatch_Release(data->event_table[eid]->handlers[i]);
1526 data->event_table[eid]->handlers[i] = NULL;
1527 }
1528 i++;
1529 }
1530
1531 return S_OK;
1532}
1533
1534void bind_target_event(HTMLDocumentNode *doc, EventTarget *event_target, const WCHAR *event, IDispatch *disp)
1535{
1536 eventid_t eid;
1537
1538 TRACE("(%p %p %s %p)\n", doc, event_target, debugstr_w(event), disp);
1539
1540 eid = attr_to_eid(event);
1541 if(eid == EVENTID_LAST) {
1542 WARN("Unsupported event %s\n", debugstr_w(event));
1543 return;
1544 }
1545
1546 set_event_handler_disp(event_target, eid, disp);
1547}
1548
1550{
1551 int i;
1552
1553 for(i=0; i < EVENTID_LAST; i++) {
1556 }
1557}
1558
1560{
1561 const PRUnichar *attr_value;
1562 nsAString attr_value_str;
1563 IDispatch *disp;
1565 int i;
1566 nsresult nsres;
1567 HRESULT hres;
1568
1569 for(i=0; i < EVENTID_LAST; i++) {
1570 nsres = get_elem_attr_value(nselem, event_info[i].attr_name, &attr_value_str, &attr_value);
1571 if(NS_SUCCEEDED(nsres)) {
1572 if(!*attr_value)
1573 continue;
1574
1575 TRACE("%p.%s = %s\n", nselem, debugstr_w(event_info[i].attr_name), debugstr_w(attr_value));
1576
1577 disp = script_parse_event(doc->window, attr_value);
1578 if(disp) {
1579 hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node);
1580 if(SUCCEEDED(hres)) {
1581 set_event_handler_disp(&node->event_target, i, disp);
1583 }
1584 IDispatch_Release(disp);
1585 }
1586 nsAString_Finish(&attr_value_str);
1587 }
1588 }
1589}
1590
1592{
1593 unsigned i;
1594 HRESULT hres;
1595
1596 doc->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
1597 if(!doc->event_vector)
1598 return E_OUTOFMEMORY;
1599
1600 init_nsevents(doc);
1601
1602 for(i=0; i < EVENTID_LAST; i++) {
1605 if(FAILED(hres))
1606 return hres;
1607 }
1608 }
1609
1610 return S_OK;
1611}
1612
1614{
1615 int i;
1616 unsigned int j;
1617
1618 for(i=0; i < EVENTID_LAST; i++) {
1619 if(event_target->event_table[i]) {
1620 if(event_target->event_table[i]->handler_prop)
1621 IDispatch_Release(event_target->event_table[i]->handler_prop);
1622 for(j=0; j < event_target->event_table[i]->handler_cnt; j++)
1623 if(event_target->event_table[i]->handlers[j])
1624 IDispatch_Release(event_target->event_table[i]->handlers[j]);
1625 }
1626 }
1627
1628 heap_free(event_target);
1629}
unsigned short UINT16
signed short INT16
unsigned int UINT32
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned char cpp_bool
Definition: atl.c:38
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_ERROR
Definition: compat.h:2305
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
#define assert(x)
Definition: debug.h:53
r parent
Definition: btrfs.c:3010
static xmlCharEncodingHandlerPtr * handlers
Definition: encoding.c:1317
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _cl_event * event
Definition: glext.h:7739
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
nsresult get_elem_attr_value(nsIDOMHTMLElement *nselem, const WCHAR *name, nsAString *val_str, const PRUnichar **val)
Definition: htmlelem.c:143
static const WCHAR onclickW[]
Definition: htmlevent.c:44
#define EVENT_DEFAULTLISTENER
Definition: htmlevent.c:147
static HRESULT call_disp_func(IDispatch *disp, DISPPARAMS *dp, VARIANT *retv)
Definition: htmlevent.c:883
static const WCHAR helpW[]
Definition: htmlevent.c:70
static const WCHAR onselectstartW[]
Definition: htmlevent.c:116
static const WCHAR dragstartW[]
Definition: htmlevent.c:58
#define EVENT_FORWARDBODY
Definition: htmlevent.c:149
static const WCHAR onmouseoverW[]
Definition: htmlevent.c:95
static HRESULT WINAPI HTMLEventObj_get_offsetY(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:700
static HTMLEventObj * impl_from_IHTMLEventObj(IHTMLEventObj *iface)
Definition: htmlevent.c:256
static const WCHAR abortW[]
Definition: htmlevent.c:31
static const WCHAR HTMLEventsW[]
Definition: htmlevent.c:121
static void fire_event_obj(HTMLDocumentNode *doc, eventid_t eid, HTMLEventObj *event_obj, nsIDOMNode *target, IDispatch *script_this)
Definition: htmlevent.c:1070
static const WCHAR submitW[]
Definition: htmlevent.c:118
static HRESULT WINAPI HTMLEventObj_get_type(IHTMLEventObj *iface, BSTR *p)
Definition: htmlevent.c:563
static BOOL alloc_handler_vector(event_target_t *event_target, eventid_t eid, int cnt)
Definition: htmlevent.c:1298
static const WCHAR onchangeW[]
Definition: htmlevent.c:41
static HRESULT WINAPI HTMLEventObj_GetTypeInfoCount(IHTMLEventObj *iface, UINT *pctinfo)
Definition: htmlevent.c:312
static const WCHAR onfocusW[]
Definition: htmlevent.c:65
static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, LONG v)
Definition: htmlevent.c:512
static HRESULT WINAPI HTMLEventObj_QueryInterface(IHTMLEventObj *iface, REFIID riid, void **ppv)
Definition: htmlevent.c:261
#define EVENT_CANCELABLE
Definition: htmlevent.c:151
static const WCHAR onerrorW[]
Definition: htmlevent.c:62
static const WCHAR errorW[]
Definition: htmlevent.c:61
static const WCHAR onloadW[]
Definition: htmlevent.c:83
static const WCHAR readystatechangeW[]
Definition: htmlevent.c:106
static const WCHAR onmouseupW[]
Definition: htmlevent.c:98
static const WCHAR onabortW[]
Definition: htmlevent.c:32
static HRESULT WINAPI HTMLEventObj_get_shiftKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
Definition: htmlevent.c:415
void bind_target_event(HTMLDocumentNode *doc, EventTarget *event_target, const WCHAR *event, IDispatch *disp)
Definition: htmlevent.c:1534
static const WCHAR ondragstartW[]
Definition: htmlevent.c:59
static HRESULT WINAPI HTMLEventObj_get_ctrlKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
Definition: htmlevent.c:385
static const WCHAR onkeyupW[]
Definition: htmlevent.c:80
static HRESULT WINAPI HTMLEventObj_get_returnValue(IHTMLEventObj *iface, VARIANT *p)
Definition: htmlevent.c:462
static const WCHAR onblurW[]
Definition: htmlevent.c:38
static const WCHAR onresizeW[]
Definition: htmlevent.c:110
static const WCHAR ondragW[]
Definition: htmlevent.c:56
static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
Definition: htmlevent.c:355
static const WCHAR onsubmitW[]
Definition: htmlevent.c:119
static const WCHAR onbeforeunloadW[]
Definition: htmlevent.c:35
static HRESULT WINAPI HTMLEventObj_get_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL *p)
Definition: htmlevent.c:482
static const tid_t HTMLEventObj_iface_tids[]
Definition: htmlevent.c:804
static const WCHAR focusinW[]
Definition: htmlevent.c:67
static HRESULT WINAPI HTMLEventObj_get_qualifier(IHTMLEventObj *iface, BSTR *p)
Definition: htmlevent.c:578
static const WCHAR onfocusinW[]
Definition: htmlevent.c:68
static const WCHAR onreadystatechangeW[]
Definition: htmlevent.c:107
static HRESULT WINAPI HTMLEventObj_get_offsetX(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:690
static HRESULT WINAPI HTMLEventObj_get_button(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:541
HRESULT doc_init_events(HTMLDocumentNode *doc)
Definition: htmlevent.c:1591
static HRESULT WINAPI HTMLEventObj_get_srcFilter(IHTMLEventObj *iface, IDispatch **p)
Definition: htmlevent.c:754
eventid_t str_to_eid(LPCWSTR str)
Definition: htmlevent.c:217
static const WCHAR mousemoveW[]
Definition: htmlevent.c:88
static dispex_static_data_t HTMLEventObj_dispex
Definition: htmlevent.c:809
static const WCHAR scrollW[]
Definition: htmlevent.c:112
static HRESULT WINAPI HTMLEventObj_get_y(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:622
static const WCHAR selectstartW[]
Definition: htmlevent.c:115
static const WCHAR ondblclickW[]
Definition: htmlevent.c:53
HRESULT detach_event(EventTarget *event_target, BSTR name, IDispatch *disp)
Definition: htmlevent.c:1504
static HRESULT set_event_handler_disp(EventTarget *event_target, eventid_t eid, IDispatch *disp)
Definition: htmlevent.c:1382
HRESULT get_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var)
Definition: htmlevent.c:1447
static HRESULT set_event_info(HTMLEventObj *event, HTMLDOMNode *target, eventid_t eid, nsIDOMEvent *nsevent)
Definition: htmlevent.c:832
static const WCHAR onmousewheelW[]
Definition: htmlevent.c:101
#define EVENT_BIND_TO_BODY
Definition: htmlevent.c:150
static const WCHAR contextmenuW[]
Definition: htmlevent.c:46
static HRESULT WINAPI HTMLEventObj_get_keyCode(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:519
static const WCHAR onscrollW[]
Definition: htmlevent.c:113
static const IHTMLEventObjVtbl HTMLEventObjVtbl
Definition: htmlevent.c:764
static const WCHAR mouseoutW[]
Definition: htmlevent.c:91
void update_doc_cp_events(HTMLDocumentNode *doc, cp_static_data_t *cp)
Definition: htmlevent.c:1549
static const WCHAR keypressW[]
Definition: htmlevent.c:76
static const WCHAR MouseEventW[]
Definition: htmlevent.c:123
static BOOL is_cp_event(cp_static_data_t *data, DISPID dispid)
Definition: htmlevent.c:922
static HRESULT WINAPI HTMLEventObj_get_clientY(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:668
static HRESULT WINAPI HTMLEventObj_put_returnValue(IHTMLEventObj *iface, VARIANT v)
Definition: htmlevent.c:445
static const WCHAR onkeydownW[]
Definition: htmlevent.c:74
static const WCHAR beforeunloadW[]
Definition: htmlevent.c:34
void call_event_handlers(HTMLDocumentNode *doc, HTMLEventObj *event_obj, EventTarget *event_target, ConnectionPointContainer *cp_container, eventid_t eid, IDispatch *this_obj)
Definition: htmlevent.c:952
static HRESULT WINAPI HTMLEventObj_get_screenY(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:732
static HRESULT WINAPI HTMLEventObj_put_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL v)
Definition: htmlevent.c:472
static const WCHAR ondataavailableW[]
Definition: htmlevent.c:50
static const WCHAR blurW[]
Definition: htmlevent.c:37
static void remove_event_handler(EventTarget *event_target, eventid_t eid)
Definition: htmlevent.c:1365
static HRESULT WINAPI HTMLEventObj_get_x(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:598
static const WCHAR onmouseoutW[]
Definition: htmlevent.c:92
static const WCHAR * event_types[]
Definition: htmlevent.c:132
static const WCHAR onmousedownW[]
Definition: htmlevent.c:86
void fire_event(HTMLDocumentNode *doc, eventid_t eid, BOOL set_event, nsIDOMNode *target, nsIDOMEvent *nsevent, IDispatch *script_this)
Definition: htmlevent.c:1195
static const WCHAR KeyboardEventW[]
Definition: htmlevent.c:122
static HRESULT WINAPI HTMLEventObj_get_reason(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:588
static const WCHAR resizeW[]
Definition: htmlevent.c:109
static event_target_t * get_event_target_data(EventTarget *event_target, BOOL alloc)
Definition: htmlevent.c:870
#define EVENT_BUBBLE
Definition: htmlevent.c:148
static const WCHAR mouseoverW[]
Definition: htmlevent.c:94
static HRESULT WINAPI HTMLEventObj_GetTypeInfo(IHTMLEventObj *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlevent.c:318
static const WCHAR dataavailableW[]
Definition: htmlevent.c:49
static const WCHAR keydownW[]
Definition: htmlevent.c:73
static const WCHAR clickW[]
Definition: htmlevent.c:43
void release_event_target(event_target_t *event_target)
Definition: htmlevent.c:1613
HRESULT set_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var)
Definition: htmlevent.c:1404
static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p)
Definition: htmlevent.c:343
static HRESULT WINAPI HTMLEventObj_get_clientX(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:646
static const event_info_t event_info[]
Definition: htmlevent.c:154
static const WCHAR onkeypressW[]
Definition: htmlevent.c:77
static const WCHAR onpasteW[]
Definition: htmlevent.c:104
static HRESULT WINAPI HTMLEventObj_get_screenX(IHTMLEventObj *iface, LONG *p)
Definition: htmlevent.c:710
HRESULT call_fire_event(HTMLDOMNode *node, eventid_t eid)
Definition: htmlevent.c:1282
HRESULT create_event_obj(IHTMLEventObj **ret)
Definition: htmlevent.c:858
static const WCHAR loadW[]
Definition: htmlevent.c:82
static HRESULT WINAPI HTMLEventObj_get_toElement(IHTMLEventObj *iface, IHTMLElement **p)
Definition: htmlevent.c:502
static const WCHAR dblclickW[]
Definition: htmlevent.c:52
#define EVENT_HASDEFAULTHANDLERS
Definition: htmlevent.c:152
static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface)
Definition: htmlevent.c:283
@ EVENTT_MOUSE
Definition: htmlevent.c:129
@ EVENTT_HTML
Definition: htmlevent.c:127
@ EVENTT_KEY
Definition: htmlevent.c:128
@ EVENTT_NONE
Definition: htmlevent.c:126
static const WCHAR mousewheelW[]
Definition: htmlevent.c:100
HRESULT attach_event(EventTarget *event_target, BSTR name, IDispatch *disp, VARIANT_BOOL *res)
Definition: htmlevent.c:1469
static const WCHAR mouseupW[]
Definition: htmlevent.c:97
void check_event_attr(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
Definition: htmlevent.c:1559
static const WCHAR oncontextmenuW[]
Definition: htmlevent.c:47
static HTMLEventObj * unsafe_impl_from_IHTMLEventObj(IHTMLEventObj *iface)
Definition: htmlevent.c:799
static void bind_event(EventTarget *event_target, eventid_t eid)
Definition: htmlevent.c:1357
static const WCHAR mousedownW[]
Definition: htmlevent.c:85
static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
Definition: htmlevent.c:293
void detach_events(HTMLDocumentNode *doc)
Definition: htmlevent.c:1341
HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *event_var, VARIANT_BOOL *cancelled)
Definition: htmlevent.c:1225
static HRESULT WINAPI HTMLEventObj_get_fromElement(IHTMLEventObj *iface, IHTMLElement **p)
Definition: htmlevent.c:492
static const WCHAR changeW[]
Definition: htmlevent.c:40
static eventid_t attr_to_eid(LPCWSTR str)
Definition: htmlevent.c:230
static const WCHAR keyupW[]
Definition: htmlevent.c:79
static const WCHAR pasteW[]
Definition: htmlevent.c:103
static HTMLEventObj * create_event(void)
Definition: htmlevent.c:816
static HRESULT call_cp_func(IDispatch *disp, DISPID dispid, HTMLEventObj *event_obj, VARIANT *retv)
Definition: htmlevent.c:904
static const WCHAR onmousemoveW[]
Definition: htmlevent.c:89
static const WCHAR focusW[]
Definition: htmlevent.c:64
static const WCHAR dragW[]
Definition: htmlevent.c:55
static HRESULT WINAPI HTMLEventObj_GetIDsOfNames(IHTMLEventObj *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlevent.c:325
HRESULT ensure_doc_nsevent_handler(HTMLDocumentNode *doc, eventid_t eid)
Definition: htmlevent.c:1319
static const WCHAR onhelpW[]
Definition: htmlevent.c:71
static HRESULT WINAPI HTMLEventObj_Invoke(IHTMLEventObj *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlevent.c:334
void release_nsevents(HTMLDocumentNode *) DECLSPEC_HIDDEN
Definition: nsevents.c:394
eventid_t
Definition: htmlevent.h:21
@ EVENTID_LAST
Definition: htmlevent.h:52
void init_nsevents(HTMLDocumentNode *) DECLSPEC_HIDDEN
Definition: nsevents.c:413
void add_nsevent_listener(HTMLDocumentNode *, nsIDOMNode *, LPCWSTR) DECLSPEC_HIDDEN
Definition: nsevents.c:346
void detach_nsevent(HTMLDocumentNode *, const WCHAR *) DECLSPEC_HIDDEN
Definition: nsevents.c:389
HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret)
Definition: htmlnode.c:1339
IDispatch * script_parse_event(HTMLInnerWindow *, LPCWSTR) DECLSPEC_HIDDEN
Definition: script.c:1184
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
#define debugstr_w
Definition: kernel32.h:32
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:778
POINT cp
Definition: magnifier.c:59
static PVOID ptr
Definition: dispmode.c:27
DWORD button
Definition: button.c:166
const char * var
Definition: shader.c:5666
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT hres
Definition: protocol.c:465
static IHTMLWindow2 * window
Definition: events.c:77
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
#define min(a, b)
Definition: monoChain.cc:55
#define DISPID_EVMETH_ONPASTE
Definition: mshtmdid.h:770
#define DISPID_EVMETH_ONRESIZE
Definition: mshtmdid.h:749
#define DISPID_EVMETH_ONMOUSEOUT
Definition: mshtmdid.h:716
#define DISPID_EVMETH_ONFOCUSIN
Definition: mshtmdid.h:803
#define DISPID_EVMETH_ONMOUSEDOWN
Definition: mshtmdid.h:717
#define DISPID_EVMETH_ONKEYPRESS
Definition: mshtmdid.h:722
#define DISPID_EVMETH_ONREADYSTATECHANGE
Definition: mshtmdid.h:738
#define DISPID_EVMETH_ONDRAGSTART
Definition: mshtmdid.h:748
#define DISPID_EVMETH_ONCONTEXTMENU
Definition: mshtmdid.h:778
#define DISPID_EVMETH_ONCHANGE
Definition: mshtmdid.h:743
#define DISPID_EVMETH_ONSELECTSTART
Definition: mshtmdid.h:750
#define DISPID_EVMETH_ONDATAAVAILABLE
Definition: mshtmdid.h:754
#define DISPID_EVMETH_ONKEYUP
Definition: mshtmdid.h:721
#define DISPID_EVMETH_ONKEYDOWN
Definition: mshtmdid.h:720
#define DISPID_EVMETH_ONDRAG
Definition: mshtmdid.h:762
#define DISPID_EVMETH_ONABORT
Definition: mshtmdid.h:741
#define DISPID_EVMETH_ONCLICK
Definition: mshtmdid.h:723
#define DISPID_EVMETH_ONBEFOREUNLOAD
Definition: mshtmdid.h:752
#define DISPID_EVMETH_ONMOUSEOVER
Definition: mshtmdid.h:715
#define DISPID_EVMETH_ONMOUSEWHEEL
Definition: mshtmdid.h:788
#define DISPID_EVMETH_ONMOUSEMOVE
Definition: mshtmdid.h:719
#define DISPID_EVMETH_ONSUBMIT
Definition: mshtmdid.h:726
#define DISPID_EVMETH_ONFOCUS
Definition: mshtmdid.h:729
#define DISPID_EVMETH_ONMOUSEUP
Definition: mshtmdid.h:718
#define DISPID_EVMETH_ONSCROLL
Definition: mshtmdid.h:744
#define DISPID_EVMETH_ONHELP
Definition: mshtmdid.h:728
#define DISPID_EVMETH_ONBLUR
Definition: mshtmdid.h:730
#define DISPID_EVMETH_ONLOAD
Definition: mshtmdid.h:745
#define DISPID_EVMETH_ONERROR
Definition: mshtmdid.h:742
#define DISPID_EVMETH_ONDBLCLICK
Definition: mshtmdid.h:724
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
HRESULT get_dispids(tid_t tid, DWORD *ret_size, DISPID **ret)
Definition: dispex.c:389
HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VARIANT **ret)
Definition: dispex.c:555
#define NS_OK
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
static void node_release(HTMLDOMNode *node)
static ULONG htmldoc_addref(HTMLDocument *This)
static ULONG htmldoc_release(HTMLDocument *This)
#define NS_SUCCEEDED(res)
#define NS_FAILED(res)
unsigned int UINT
Definition: ndis.h:50
WCHAR PRUnichar
Definition: nsiface.idl:48
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define V_BOOL(A)
Definition: oleauto.h:224
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define DISPID_THIS
Definition: olectl.h:395
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
#define strcmpW(s1, s2)
Definition: unicode.h:38
#define alloc
Definition: rosglue.h:13
const WCHAR * str
DWORD LCID
Definition: nls.h:13
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
ConnectionPoint * cps
struct ConnectionPointContainer * forward_container
const cpc_entry_t * cp_entries
dispex_static_data_t * data
event_target_t * ptr
DispatchEx dispex
nsIDOMNode * nsnode
EventTarget event_target
HTMLDOMNode node
nsIDOMHTMLDocument * nsdoc
HTMLDocument basedoc
HTMLInnerWindow * window
nsDocumentEventListener * nsevent_listener
IHTMLDocument2 IHTMLDocument2_iface
ConnectionPointContainer cp_container
HTMLDOMNode * target
Definition: htmlevent.c:248
const event_info_t * type
Definition: htmlevent.c:249
nsIDOMEvent * nsevent
Definition: htmlevent.c:250
VARIANT return_value
Definition: htmlevent.c:251
IHTMLEventObj IHTMLEventObj_iface
Definition: htmlevent.c:244
BOOL cancel_bubble
Definition: htmlevent.c:253
DispatchEx dispex
Definition: htmlevent.c:243
BOOL prevent_default
Definition: htmlevent.c:252
const IID * riid
const dispex_static_data_vtbl_t * vtbl
event_target_t **(* get_event_target_ptr)(DispatchEx *)
void(* bind_event)(DispatchEx *, int)
DWORD type
Definition: htmlevent.c:142
LPCWSTR attr_name
Definition: htmlevent.c:141
DWORD flags
Definition: htmlevent.c:144
DISPID dispid
Definition: htmlevent.c:143
LPCWSTR name
Definition: htmlevent.c:140
handler_vector_t * event_table[EVENTID_LAST]
Definition: htmlevent.c:28
IDispatch * handlers[0]
Definition: htmlevent.c:24
IDispatch * handler_prop
Definition: htmlevent.c:22
DWORD handler_cnt
Definition: htmlevent.c:23
Definition: name.c:39
Definition: send.c:48
#define max(a, b)
Definition: svc.c:63
void key_event(int scancode, int pressed)
Definition: svgawin.c:773
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: dlist.c:348
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:748
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
void * arg
Definition: msvc.h:10
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185