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
5cdb4a27
Commit
5cdb4a27
authored
Oct 01, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support for 'document' and 'window' script for attribute values.
parent
c30923f2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
20 deletions
+42
-20
htmlevent.c
dlls/mshtml/htmlevent.c
+3
-3
htmlevent.h
dlls/mshtml/htmlevent.h
+1
-1
script.c
dlls/mshtml/script.c
+31
-15
events.html
dlls/mshtml/tests/events.html
+7
-1
No files found.
dlls/mshtml/htmlevent.c
View file @
5cdb4a27
...
...
@@ -1510,11 +1510,11 @@ HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name,
return
S_OK
;
}
void
bind_
elem_event
(
HTMLDocumentNode
*
doc
,
HTMLElement
*
elem
,
const
WCHAR
*
event
,
IDispatch
*
disp
)
void
bind_
node_event
(
HTMLDocumentNode
*
doc
,
event_target_t
**
event_target
,
HTMLDOMNode
*
node
,
const
WCHAR
*
event
,
IDispatch
*
disp
)
{
eventid_t
eid
;
TRACE
(
"(%p %p %
s %p)
\n
"
,
doc
,
elem
,
debugstr_w
(
event
),
disp
);
TRACE
(
"(%p %p %
p %s %p)
\n
"
,
doc
,
event_target
,
node
,
debugstr_w
(
event
),
disp
);
eid
=
attr_to_eid
(
event
);
if
(
eid
==
EVENTID_LAST
)
{
...
...
@@ -1522,7 +1522,7 @@ void bind_elem_event(HTMLDocumentNode *doc, HTMLElement *elem, const WCHAR *even
return
;
}
set_event_handler_disp
(
&
elem
->
node
.
event_target
,
elem
->
node
.
nsnode
,
doc
,
eid
,
disp
);
set_event_handler_disp
(
event_target
,
node
?
node
->
nsnode
:
NULL
,
doc
,
eid
,
disp
);
}
void
update_cp_events
(
HTMLInnerWindow
*
window
,
event_target_t
**
event_target_ptr
,
cp_static_data_t
*
cp
,
nsIDOMNode
*
nsnode
)
...
...
dlls/mshtml/htmlevent.h
View file @
5cdb4a27
...
...
@@ -62,7 +62,7 @@ void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*,nsIDOM
HRESULT
doc_init_events
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_events
(
HTMLDocumentNode
*
doc
)
DECLSPEC_HIDDEN
;
HRESULT
create_event_obj
(
IHTMLEventObj
**
)
DECLSPEC_HIDDEN
;
void
bind_
elem_event
(
HTMLDocumentNode
*
,
HTMLElement
*
,
const
WCHAR
*
,
IDispatch
*
)
DECLSPEC_HIDDEN
;
void
bind_
node_event
(
HTMLDocumentNode
*
,
event_target_t
**
,
HTMLDOMNode
*
,
const
WCHAR
*
,
IDispatch
*
)
DECLSPEC_HIDDEN
;
void
init_nsevents
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
release_nsevents
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/mshtml/script.c
View file @
5cdb4a27
...
...
@@ -1046,11 +1046,12 @@ IDispatch *get_script_disp(ScriptHost *script_host)
return
disp
;
}
static
HTMLElement
*
find_event_target
(
HTMLDocumentNode
*
doc
,
HTMLScriptElement
*
script_elem
)
static
event_target_t
**
find_event_target
(
HTMLDocumentNode
*
doc
,
HTMLScriptElement
*
script_elem
,
HTMLDOMNode
**
ret_target_node
)
{
HTMLDOMNode
*
target_node
=
NULL
;
event_target_t
**
target
=
NULL
;
const
PRUnichar
*
target_id
;
nsAString
target_id_str
;
HTMLElement
*
elem
;
nsresult
nsres
;
HRESULT
hres
;
...
...
@@ -1063,17 +1064,27 @@ static HTMLElement *find_event_target(HTMLDocumentNode *doc, HTMLScriptElement *
}
nsAString_GetData
(
&
target_id_str
,
&
target_id
);
if
(
!*
target_id
||
!
strcmpW
(
target_id
,
documentW
)
||
!
strcmpW
(
target_id
,
windowW
))
{
FIXME
(
"for %s not supported
\n
"
,
debugstr_w
(
target_id
));
elem
=
NULL
;
if
(
!*
target_id
)
{
FIXME
(
"Empty for attribute
\n
"
);
}
else
if
(
!
strcmpW
(
target_id
,
documentW
))
{
target
=
&
doc
->
node
.
event_target
;
target_node
=
&
doc
->
node
;
IHTMLDOMNode_AddRef
(
&
target_node
->
IHTMLDOMNode_iface
);
}
else
if
(
!
strcmpW
(
target_id
,
windowW
))
{
target
=
&
doc
->
body_event_target
;
}
else
{
hres
=
get_doc_elem_by_id
(
doc
,
target_id
,
&
elem
);
if
(
FAILED
(
hres
))
elem
=
NULL
;
HTMLElement
*
target_elem
;
hres
=
get_doc_elem_by_id
(
doc
,
target_id
,
&
target_elem
);
if
(
SUCCEEDED
(
hres
)
&&
target_elem
)
{
target_node
=
&
target_elem
->
node
;
target
=
&
target_elem
->
node
.
event_target
;
}
}
nsAString_Finish
(
&
target_id_str
);
return
elem
;
*
ret_target_node
=
target_node
;
return
target
;
}
static
BOOL
parse_event_str
(
WCHAR
*
event
,
const
WCHAR
**
args
)
...
...
@@ -1168,8 +1179,9 @@ void bind_event_scripts(HTMLDocumentNode *doc)
HTMLPluginContainer
*
plugin_container
;
nsIDOMHTMLScriptElement
*
nsscript
;
HTMLScriptElement
*
script_elem
;
HTMLElement
*
event_target
;
event_target_t
*
*
event_target
;
nsIDOMNodeList
*
node_list
;
HTMLDOMNode
*
target_node
;
nsIDOMNode
*
script_node
;
nsAString
selector_str
;
IDispatch
*
event_disp
;
...
...
@@ -1216,17 +1228,21 @@ void bind_event_scripts(HTMLDocumentNode *doc)
event_disp
=
parse_event_elem
(
doc
,
script_elem
,
&
event
);
if
(
event_disp
)
{
event_target
=
find_event_target
(
doc
,
script_elem
);
event_target
=
find_event_target
(
doc
,
script_elem
,
&
target_node
);
if
(
event_target
)
{
hres
=
IHTMLElement_QueryInterface
(
&
event_target
->
IHTMLElement_iface
,
&
IID_HTMLPluginContainer
,
(
void
**
)
&
plugin_container
);
if
(
target_node
)
hres
=
IHTMLDOMNode_QueryInterface
(
&
target_node
->
IHTMLDOMNode_iface
,
&
IID_HTMLPluginContainer
,
(
void
**
)
&
plugin_container
);
else
hres
=
E_NOINTERFACE
;
if
(
SUCCEEDED
(
hres
))
bind_activex_event
(
doc
,
plugin_container
,
event
,
event_disp
);
else
bind_
elem_event
(
doc
,
event_target
,
event
,
event_disp
);
bind_
node_event
(
doc
,
event_target
,
target_node
,
event
,
event_disp
);
IHTMLElement_Release
(
&
event_target
->
IHTMLElement_iface
);
if
(
target_node
)
IHTMLDOMNode_Release
(
&
target_node
->
IHTMLDOMNode_iface
);
}
heap_free
(
event
);
...
...
dlls/mshtml/tests/events.html
View file @
5cdb4a27
<html>
<head>
<script>
var
testevent_divid2_called
=
false
,
cnt
=
0
;
var
testevent_divid2_called
=
false
,
testevent_document_called
=
false
,
cnt
=
0
;
function
ok
(
b
,
m
)
{
return
external
.
ok
(
b
,
m
);
...
...
@@ -71,8 +71,11 @@ function test_scriptfor() {
ok
(
"onclick"
in
div
,
"testevent not in div"
);
ok
(
typeof
(
div
.
onclick
)
===
"function"
,
"typeof(div.onclick) = "
+
typeof
(
div
.
onclick
));
ok
(
testevent_divid2_called
===
false
,
"testevent_divid2_called = "
+
testevent_divid2_called
);
ok
(
typeof
(
document
.
onclick
)
===
"function"
,
"typeof(document.onclick) = "
+
typeof
(
document
.
onclick
));
ok
(
testevent_document_called
===
false
,
"testevent_document_called = "
+
testevent_document_called
);
div
.
click
();
ok
(
testevent_divid2_called
===
true
,
"testevent_divid2_called = "
+
testevent_divid2_called
);
ok
(
testevent_document_called
===
true
,
"testevent_document_called = "
+
testevent_document_called
);
ok
(
!
(
"ontest"
in
div
),
"testevent in div"
);
ok
(
typeof
(
div
.
ontest
)
===
"undefined"
,
"typeof(div.ontest) = "
+
typeof
(
div
.
ontest
));
...
...
@@ -136,6 +139,9 @@ function runTests(t) {
<script
event=
"onclick"
for=
"divid2"
>
testevent_divid2_called
=
true
;
</script>
<script
event=
"onclick"
for=
"document"
>
testevent_document_called
=
true
;
</script>
<script
event=
"ontest"
for=
"divid2"
>
ok
(
false
,
"unexpected ontest"
);
</script>
...
...
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