Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
29389b87
Commit
29389b87
authored
Feb 08, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 09, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added IHTMLElement2::detachEvent implementation.
parent
07b62a8d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
2 deletions
+73
-2
htmlelem2.c
dlls/mshtml/htmlelem2.c
+4
-2
htmlevent.c
dlls/mshtml/htmlevent.c
+31
-0
htmlevent.h
dlls/mshtml/htmlevent.h
+1
-0
events.c
dlls/mshtml/tests/events.c
+37
-0
No files found.
dlls/mshtml/htmlelem2.c
View file @
29389b87
...
@@ -655,8 +655,10 @@ static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
...
@@ -655,8 +655,10 @@ static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
static
HRESULT
WINAPI
HTMLElement2_detachEvent
(
IHTMLElement2
*
iface
,
BSTR
event
,
IDispatch
*
pDisp
)
static
HRESULT
WINAPI
HTMLElement2_detachEvent
(
IHTMLElement2
*
iface
,
BSTR
event
,
IDispatch
*
pDisp
)
{
{
HTMLElement
*
This
=
HTMLELEM2_THIS
(
iface
);
HTMLElement
*
This
=
HTMLELEM2_THIS
(
iface
);
FIXME
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
event
),
pDisp
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
event
),
pDisp
);
return
detach_event
(
*
get_node_event_target
(
&
This
->
node
),
&
This
->
node
.
doc
->
basedoc
,
event
,
pDisp
);
}
}
static
HRESULT
WINAPI
HTMLElement2_get_readyState
(
IHTMLElement2
*
iface
,
VARIANT
*
p
)
static
HRESULT
WINAPI
HTMLElement2_get_readyState
(
IHTMLElement2
*
iface
,
VARIANT
*
p
)
...
...
dlls/mshtml/htmlevent.c
View file @
29389b87
...
@@ -867,6 +867,9 @@ static void call_event_handlers(HTMLDocumentNode *doc, IHTMLEventObj *event_obj,
...
@@ -867,6 +867,9 @@ static void call_event_handlers(HTMLDocumentNode *doc, IHTMLEventObj *event_obj,
for
(
cp
=
cp_container
->
cp_list
;
cp
;
cp
=
cp
->
next
)
{
for
(
cp
=
cp_container
->
cp_list
;
cp
;
cp
=
cp
->
next
)
{
if
(
cp
->
sinks_size
&&
is_cp_event
(
cp
->
data
,
event_info
[
eid
].
dispid
))
{
if
(
cp
->
sinks_size
&&
is_cp_event
(
cp
->
data
,
event_info
[
eid
].
dispid
))
{
for
(
i
=
0
;
i
<
cp
->
sinks_size
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
sinks_size
;
i
++
)
{
if
(
!
cp
->
sinks
[
i
].
disp
)
continue
;
TRACE
(
"cp %s [%d] >>>
\n
"
,
debugstr_w
(
event_info
[
eid
].
name
),
i
);
TRACE
(
"cp %s [%d] >>>
\n
"
,
debugstr_w
(
event_info
[
eid
].
name
),
i
);
hres
=
call_cp_func
(
cp
->
sinks
[
i
].
disp
,
event_info
[
eid
].
dispid
);
hres
=
call_cp_func
(
cp
->
sinks
[
i
].
disp
,
event_info
[
eid
].
dispid
);
if
(
hres
==
S_OK
)
if
(
hres
==
S_OK
)
...
@@ -1128,6 +1131,34 @@ HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR
...
@@ -1128,6 +1131,34 @@ HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR
return
S_OK
;
return
S_OK
;
}
}
HRESULT
detach_event
(
event_target_t
*
event_target
,
HTMLDocument
*
doc
,
BSTR
name
,
IDispatch
*
disp
)
{
eventid_t
eid
;
DWORD
i
=
0
;
if
(
!
event_target
)
return
S_OK
;
eid
=
attr_to_eid
(
name
);
if
(
eid
==
EVENTID_LAST
)
{
WARN
(
"Unknown event
\n
"
);
return
S_OK
;
}
if
(
!
event_target
->
event_table
[
eid
])
return
S_OK
;
while
(
i
<
event_target
->
event_table
[
eid
]
->
handler_cnt
)
{
if
(
event_target
->
event_table
[
eid
]
->
handlers
[
i
]
==
disp
)
{
IDispatch_Release
(
event_target
->
event_table
[
eid
]
->
handlers
[
i
]);
event_target
->
event_table
[
eid
]
->
handlers
[
i
]
=
NULL
;
}
i
++
;
}
return
S_OK
;
}
void
update_cp_events
(
HTMLWindow
*
window
,
cp_static_data_t
*
cp
)
void
update_cp_events
(
HTMLWindow
*
window
,
cp_static_data_t
*
cp
)
{
{
int
i
;
int
i
;
...
...
dlls/mshtml/htmlevent.h
View file @
29389b87
...
@@ -46,6 +46,7 @@ void fire_event(HTMLDocumentNode*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
...
@@ -46,6 +46,7 @@ void fire_event(HTMLDocumentNode*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
HRESULT
set_event_handler
(
event_target_t
**
,
HTMLDocumentNode
*
,
eventid_t
,
VARIANT
*
);
HRESULT
set_event_handler
(
event_target_t
**
,
HTMLDocumentNode
*
,
eventid_t
,
VARIANT
*
);
HRESULT
get_event_handler
(
event_target_t
**
,
eventid_t
,
VARIANT
*
);
HRESULT
get_event_handler
(
event_target_t
**
,
eventid_t
,
VARIANT
*
);
HRESULT
attach_event
(
event_target_t
**
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
,
VARIANT_BOOL
*
);
HRESULT
attach_event
(
event_target_t
**
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
,
VARIANT_BOOL
*
);
HRESULT
detach_event
(
event_target_t
*
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
);
HRESULT
dispatch_event
(
HTMLDOMNode
*
,
const
WCHAR
*
,
VARIANT
*
,
VARIANT_BOOL
*
);
HRESULT
dispatch_event
(
HTMLDOMNode
*
,
const
WCHAR
*
,
VARIANT
*
,
VARIANT_BOOL
*
);
HRESULT
call_event
(
HTMLDOMNode
*
,
eventid_t
);
HRESULT
call_event
(
HTMLDOMNode
*
,
eventid_t
);
void
update_cp_events
(
HTMLWindow
*
,
cp_static_data_t
*
);
void
update_cp_events
(
HTMLWindow
*
,
cp_static_data_t
*
);
...
...
dlls/mshtml/tests/events.c
View file @
29389b87
...
@@ -675,6 +675,20 @@ static void _elem_attach_event(unsigned line, IUnknown *unk, const char *namea,
...
@@ -675,6 +675,20 @@ static void _elem_attach_event(unsigned line, IUnknown *unk, const char *namea,
ok_
(
__FILE__
,
line
)(
res
==
VARIANT_TRUE
,
"attachEvent returned %x
\n
"
,
res
);
ok_
(
__FILE__
,
line
)(
res
==
VARIANT_TRUE
,
"attachEvent returned %x
\n
"
,
res
);
}
}
#define elem_detach_event(a,b,c) _elem_detach_event(__LINE__,a,b,c)
static
void
_elem_detach_event
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
namea
,
IDispatch
*
disp
)
{
IHTMLElement2
*
elem
=
_get_elem2_iface
(
line
,
unk
);
BSTR
name
;
HRESULT
hres
;
name
=
a2bstr
(
namea
);
hres
=
IHTMLElement2_detachEvent
(
elem
,
name
,
disp
);
IHTMLElement2_Release
(
elem
);
SysFreeString
(
name
);
ok_
(
__FILE__
,
line
)(
hres
==
S_OK
,
"detachEvent failed: %08x
\n
"
,
hres
);
}
static
HRESULT
WINAPI
DispatchEx_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
static
HRESULT
WINAPI
DispatchEx_QueryInterface
(
IDispatchEx
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
{
*
ppv
=
NULL
;
*
ppv
=
NULL
;
...
@@ -1228,6 +1242,29 @@ static void test_onclick(IHTMLDocument2 *doc)
...
@@ -1228,6 +1242,29 @@ static void test_onclick(IHTMLDocument2 *doc)
unregister_cp
((
IUnknown
*
)
doc
,
&
DIID_HTMLDocumentEvents
,
cp_cookie
);
unregister_cp
((
IUnknown
*
)
doc
,
&
DIID_HTMLDocumentEvents
,
cp_cookie
);
V_VT
(
&
v
)
=
VT_NULL
;
hres
=
IHTMLElement_put_onclick
(
div
,
v
);
ok
(
hres
==
S_OK
,
"put_onclick failed: %08x
\n
"
,
hres
);
hres
=
IHTMLElement_get_onclick
(
div
,
&
v
);
ok
(
hres
==
S_OK
,
"get_onclick failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
v
)
==
VT_NULL
,
"get_onclick returned vt %d
\n
"
,
V_VT
(
&
v
));
elem_detach_event
((
IUnknown
*
)
div
,
"onclick"
,
(
IDispatch
*
)
&
div_onclick_disp
);
elem_detach_event
((
IUnknown
*
)
div
,
"onclick"
,
(
IDispatch
*
)
&
div_onclick_disp
);
elem_detach_event
((
IUnknown
*
)
div
,
"test"
,
(
IDispatch
*
)
&
div_onclick_disp
);
SET_EXPECT
(
div_onclick_attached
);
SET_EXPECT
(
body_onclick
);
SET_EXPECT
(
document_onclick
);
hres
=
IHTMLElement_click
(
div
);
ok
(
hres
==
S_OK
,
"click failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
div_onclick_attached
);
CHECK_CALLED
(
body_onclick
);
CHECK_CALLED
(
document_onclick
);
IHTMLElement_Release
(
div
);
IHTMLElement_Release
(
div
);
IHTMLElement_Release
(
body
);
IHTMLElement_Release
(
body
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment