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
9c45b34c
Commit
9c45b34c
authored
Mar 11, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Bind events not sent to default view to body element instead of directly to target.
parent
a05dcd91
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
58 deletions
+44
-58
htmldoc.c
dlls/mshtml/htmldoc.c
+1
-1
htmldoc3.c
dlls/mshtml/htmldoc3.c
+1
-1
htmlelem2.c
dlls/mshtml/htmlelem2.c
+1
-1
htmlevent.c
dlls/mshtml/htmlevent.c
+34
-48
htmlevent.h
dlls/mshtml/htmlevent.h
+5
-5
htmlwindow.c
dlls/mshtml/htmlwindow.c
+2
-2
No files found.
dlls/mshtml/htmldoc.c
View file @
9c45b34c
...
...
@@ -1688,7 +1688,7 @@ static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
HTMLDocument
*
This
=
impl_from_IHTMLDocument2
((
IHTMLDocument2
*
)
iface
);
if
(
This
->
window
)
update_cp_events
(
This
->
window
->
base
.
inner_window
,
&
This
->
doc_node
->
node
.
event_target
,
cp
,
This
->
doc_node
->
node
.
nsnode
);
update_cp_events
(
This
->
window
->
base
.
inner_window
,
&
This
->
doc_node
->
node
.
event_target
,
cp
);
}
static
inline
HTMLDocument
*
impl_from_ISupportErrorInfo
(
ISupportErrorInfo
*
iface
)
...
...
dlls/mshtml/htmldoc3.c
View file @
9c45b34c
...
...
@@ -267,7 +267,7 @@ static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR even
TRACE
(
"(%p)->(%s %p %p)
\n
"
,
This
,
debugstr_w
(
event
),
pDisp
,
pfResult
);
return
attach_event
(
&
This
->
doc_node
->
node
.
event_target
,
This
->
doc_node
->
node
.
nsnode
,
This
,
event
,
pDisp
,
pfResult
);
return
attach_event
(
&
This
->
doc_node
->
node
.
event_target
,
This
,
event
,
pDisp
,
pfResult
);
}
static
HRESULT
WINAPI
HTMLDocument3_detachEvent
(
IHTMLDocument3
*
iface
,
BSTR
event
,
...
...
dlls/mshtml/htmlelem2.c
View file @
9c45b34c
...
...
@@ -864,7 +864,7 @@ static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
TRACE
(
"(%p)->(%s %p %p)
\n
"
,
This
,
debugstr_w
(
event
),
pDisp
,
pfResult
);
return
attach_event
(
get_node_event_target
(
&
This
->
node
),
This
->
node
.
nsnode
,
&
This
->
node
.
doc
->
basedoc
,
event
,
pDisp
,
pfResult
);
return
attach_event
(
get_node_event_target
(
&
This
->
node
),
&
This
->
node
.
doc
->
basedoc
,
event
,
pDisp
,
pfResult
);
}
static
HRESULT
WINAPI
HTMLElement2_detachEvent
(
IHTMLElement2
*
iface
,
BSTR
event
,
IDispatch
*
pDisp
)
...
...
dlls/mshtml/htmlevent.c
View file @
9c45b34c
...
...
@@ -42,7 +42,6 @@ typedef struct {
}
handler_vector_t
;
struct
event_target_t
{
DWORD
node_handlers_mask
;
handler_vector_t
*
event_table
[
EVENTID_LAST
];
};
...
...
@@ -159,13 +158,13 @@ typedef struct {
#define EVENT_DEFAULTLISTENER 0x0001
#define EVENT_BUBBLE 0x0002
#define EVENT_FORWARDBODY 0x0004
#define EVENT_
NODEHANDLER
0x0008
#define EVENT_
BIND_TO_BODY
0x0008
#define EVENT_CANCELABLE 0x0010
#define EVENT_HASDEFAULTHANDLERS 0x0020
static
const
event_info_t
event_info
[]
=
{
{
abortW
,
onabortW
,
EVENTT_NONE
,
DISPID_EVMETH_ONABORT
,
EVENT_
NODEHANDLER
},
EVENT_
BIND_TO_BODY
},
{
beforeunloadW
,
onbeforeunloadW
,
EVENTT_NONE
,
DISPID_EVMETH_ONBEFOREUNLOAD
,
EVENT_DEFAULTLISTENER
|
EVENT_FORWARDBODY
},
{
blurW
,
onblurW
,
EVENTT_HTML
,
DISPID_EVMETH_ONBLUR
,
...
...
@@ -185,7 +184,7 @@ static const event_info_t event_info[] = {
{
dragstartW
,
ondragstartW
,
EVENTT_MOUSE
,
DISPID_EVMETH_ONDRAGSTART
,
EVENT_CANCELABLE
},
{
errorW
,
onerrorW
,
EVENTT_NONE
,
DISPID_EVMETH_ONERROR
,
EVENT_
NODEHANDLER
},
EVENT_
BIND_TO_BODY
},
{
focusW
,
onfocusW
,
EVENTT_HTML
,
DISPID_EVMETH_ONFOCUS
,
EVENT_DEFAULTLISTENER
},
{
helpW
,
onhelpW
,
EVENTT_KEY
,
DISPID_EVMETH_ONHELP
,
...
...
@@ -197,7 +196,7 @@ static const event_info_t event_info[] = {
{
keyupW
,
onkeyupW
,
EVENTT_KEY
,
DISPID_EVMETH_ONKEYUP
,
EVENT_DEFAULTLISTENER
|
EVENT_BUBBLE
},
{
loadW
,
onloadW
,
EVENTT_HTML
,
DISPID_EVMETH_ONLOAD
,
EVENT_
NODEHANDLER
},
EVENT_
BIND_TO_BODY
},
{
mousedownW
,
onmousedownW
,
EVENTT_MOUSE
,
DISPID_EVMETH_ONMOUSEDOWN
,
EVENT_DEFAULTLISTENER
|
EVENT_BUBBLE
},
{
mousemoveW
,
onmousemoveW
,
EVENTT_MOUSE
,
DISPID_EVMETH_ONMOUSEMOVE
,
...
...
@@ -222,8 +221,6 @@ static const event_info_t event_info[] = {
EVENT_DEFAULTLISTENER
|
EVENT_BUBBLE
|
EVENT_CANCELABLE
}
};
static
const
eventid_t
node_handled_list
[]
=
{
EVENTID_ABORT
,
EVENTID_ERROR
,
EVENTID_LOAD
};
eventid_t
str_to_eid
(
LPCWSTR
str
)
{
int
i
;
...
...
@@ -249,19 +246,6 @@ static eventid_t attr_to_eid(LPCWSTR str)
return
EVENTID_LAST
;
}
static
DWORD
get_node_handler_mask
(
eventid_t
eid
)
{
DWORD
i
;
for
(
i
=
0
;
i
<
sizeof
(
node_handled_list
)
/
sizeof
(
*
node_handled_list
);
i
++
)
{
if
(
node_handled_list
[
i
]
==
eid
)
return
1
<<
i
;
}
ERR
(
"Invalid eid %d
\n
"
,
eid
);
return
~
0
;
}
typedef
struct
{
DispatchEx
dispex
;
IHTMLEventObj
IHTMLEventObj_iface
;
...
...
@@ -1337,31 +1321,33 @@ static BOOL alloc_handler_vector(event_target_t *event_target, eventid_t eid, in
return
TRUE
;
}
static
HRESULT
ensure_nsevent_handler
(
HTMLDocumentNode
*
doc
,
event_target_t
*
event_target
,
nsIDOMNode
*
nsnode
,
eventid_t
eid
)
static
HRESULT
ensure_nsevent_handler
(
HTMLDocumentNode
*
doc
,
event_target_t
*
event_target
,
eventid_t
eid
)
{
if
(
!
doc
->
nsdoc
)
return
S_OK
;
if
(
event_info
[
eid
].
flags
&
EVENT_NODEHANDLER
)
{
DWORD
mask
;
nsIDOMNode
*
nsnode
=
NULL
;
mask
=
get_node_handler_mask
(
eid
);
if
(
event_target
->
node_handlers_mask
&
mask
)
return
S_OK
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
event_info
[
eid
].
name
));
add_nsevent_listener
(
doc
,
nsnode
,
event_info
[
eid
].
name
);
event_target
->
node_handlers_mask
|=
mask
;
if
(
!
doc
->
nsdoc
||
doc
->
event_vector
[
eid
]
||
!
(
event_info
[
eid
].
flags
&
(
EVENT_DEFAULTLISTENER
|
EVENT_BIND_TO_BODY
)))
return
S_OK
;
}
if
(
!
(
event_info
[
eid
].
flags
&
EVENT_DEFAULTLISTENER
))
return
S_OK
;
if
(
event_info
[
eid
].
flags
&
EVENT_BIND_TO_BODY
)
{
nsIDOMHTMLElement
*
nsbody
;
nsresult
nsres
;
if
(
!
doc
->
event_vector
[
eid
])
{
doc
->
event_vector
[
eid
]
=
TRUE
;
add_nsevent_listener
(
doc
,
NULL
,
event_info
[
eid
].
name
);
nsres
=
nsIDOMHTMLDocument_GetBody
(
doc
->
nsdoc
,
&
nsbody
);
if
(
NS_SUCCEEDED
(
nsres
)
&&
nsbody
)
{
nsnode
=
(
nsIDOMNode
*
)
nsbody
;
}
else
{
ERR
(
"GetBody failed: %08x
\n
"
,
nsres
);
return
E_UNEXPECTED
;
}
}
doc
->
event_vector
[
eid
]
=
TRUE
;
add_nsevent_listener
(
doc
,
nsnode
,
event_info
[
eid
].
name
);
if
(
nsnode
)
nsIDOMNode_Release
(
nsnode
);
return
S_OK
;
}
...
...
@@ -1392,7 +1378,7 @@ static HRESULT remove_event_handler(event_target_t **event_target, eventid_t eid
return
S_OK
;
}
static
HRESULT
set_event_handler_disp
(
event_target_t
**
event_target_ptr
,
nsIDOMNode
*
nsnode
,
HTMLDocumentNode
*
doc
,
static
HRESULT
set_event_handler_disp
(
event_target_t
**
event_target_ptr
,
HTMLDocumentNode
*
doc
,
eventid_t
eid
,
IDispatch
*
disp
)
{
event_target_t
*
event_target
;
...
...
@@ -1413,17 +1399,17 @@ static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, nsIDOMN
event_target
->
event_table
[
eid
]
->
handler_prop
=
disp
;
IDispatch_AddRef
(
disp
);
return
ensure_nsevent_handler
(
doc
,
event_target
,
nsnode
,
eid
);
return
ensure_nsevent_handler
(
doc
,
event_target
,
eid
);
}
HRESULT
set_event_handler
(
event_target_t
**
event_target
,
nsIDOMNode
*
nsnode
,
HTMLDocumentNode
*
doc
,
eventid_t
eid
,
VARIANT
*
var
)
HRESULT
set_event_handler
(
event_target_t
**
event_target
,
HTMLDocumentNode
*
doc
,
eventid_t
eid
,
VARIANT
*
var
)
{
switch
(
V_VT
(
var
))
{
case
VT_NULL
:
return
remove_event_handler
(
event_target
,
eid
);
case
VT_DISPATCH
:
return
set_event_handler_disp
(
event_target
,
nsnode
,
doc
,
eid
,
V_DISPATCH
(
var
));
return
set_event_handler_disp
(
event_target
,
doc
,
eid
,
V_DISPATCH
(
var
));
default:
FIXME
(
"not handler %s
\n
"
,
debugstr_variant
(
var
));
...
...
@@ -1448,7 +1434,7 @@ HRESULT get_event_handler(event_target_t **event_target, eventid_t eid, VARIANT
return
S_OK
;
}
HRESULT
attach_event
(
event_target_t
**
event_target_ptr
,
nsIDOMNode
*
nsnode
,
HTMLDocument
*
doc
,
BSTR
name
,
HRESULT
attach_event
(
event_target_t
**
event_target_ptr
,
HTMLDocument
*
doc
,
BSTR
name
,
IDispatch
*
disp
,
VARIANT_BOOL
*
res
)
{
event_target_t
*
event_target
;
...
...
@@ -1479,7 +1465,7 @@ HRESULT attach_event(event_target_t **event_target_ptr, nsIDOMNode *nsnode, HTML
event_target
->
event_table
[
eid
]
->
handlers
[
i
]
=
disp
;
*
res
=
VARIANT_TRUE
;
return
ensure_nsevent_handler
(
doc
->
doc_node
,
event_target
,
nsnode
,
eid
);
return
ensure_nsevent_handler
(
doc
->
doc_node
,
event_target
,
eid
);
}
HRESULT
detach_event
(
event_target_t
*
event_target
,
HTMLDocument
*
doc
,
BSTR
name
,
IDispatch
*
disp
)
...
...
@@ -1522,10 +1508,10 @@ void bind_node_event(HTMLDocumentNode *doc, event_target_t **event_target, HTMLD
return
;
}
set_event_handler_disp
(
event_target
,
node
?
node
->
nsnode
:
NULL
,
doc
,
eid
,
disp
);
set_event_handler_disp
(
event_target
,
doc
,
eid
,
disp
);
}
void
update_cp_events
(
HTMLInnerWindow
*
window
,
event_target_t
**
event_target_ptr
,
cp_static_data_t
*
cp
,
nsIDOMNode
*
nsnode
)
void
update_cp_events
(
HTMLInnerWindow
*
window
,
event_target_t
**
event_target_ptr
,
cp_static_data_t
*
cp
)
{
event_target_t
*
event_target
;
int
i
;
...
...
@@ -1536,7 +1522,7 @@ void update_cp_events(HTMLInnerWindow *window, event_target_t **event_target_ptr
for
(
i
=
0
;
i
<
EVENTID_LAST
;
i
++
)
{
if
((
event_info
[
i
].
flags
&
EVENT_DEFAULTLISTENER
)
&&
is_cp_event
(
cp
,
event_info
[
i
].
dispid
))
ensure_nsevent_handler
(
window
->
doc
,
event_target
,
nsnode
,
i
);
ensure_nsevent_handler
(
window
->
doc
,
event_target
,
i
);
}
}
...
...
@@ -1567,7 +1553,7 @@ void check_event_attr(HTMLDocumentNode *doc, nsIDOMElement *nselem)
if
(
disp
)
{
hres
=
get_node
(
doc
,
(
nsIDOMNode
*
)
nselem
,
TRUE
,
&
node
);
if
(
SUCCEEDED
(
hres
))
{
set_event_handler_disp
(
get_node_event_target
(
node
),
node
->
nsnode
,
node
->
doc
,
i
,
disp
);
set_event_handler_disp
(
get_node_event_target
(
node
),
node
->
doc
,
i
,
disp
);
node_release
(
node
);
}
IDispatch_Release
(
disp
);
...
...
@@ -1592,7 +1578,7 @@ HRESULT doc_init_events(HTMLDocumentNode *doc)
for
(
i
=
0
;
i
<
EVENTID_LAST
;
i
++
)
{
if
(
event_info
[
i
].
flags
&
EVENT_HASDEFAULTHANDLERS
)
{
hres
=
ensure_nsevent_handler
(
doc
,
NULL
,
NULL
,
i
);
hres
=
ensure_nsevent_handler
(
doc
,
NULL
,
i
);
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
dlls/mshtml/htmlevent.h
View file @
9c45b34c
...
...
@@ -51,14 +51,14 @@ typedef enum {
eventid_t
str_to_eid
(
LPCWSTR
)
DECLSPEC_HIDDEN
;
void
check_event_attr
(
HTMLDocumentNode
*
,
nsIDOMElement
*
)
DECLSPEC_HIDDEN
;
void
release_event_target
(
event_target_t
*
)
DECLSPEC_HIDDEN
;
void
fire_event
(
HTMLDocumentNode
*
,
eventid_t
,
BOOL
,
nsIDOMNode
*
,
nsIDOMEvent
*
,
IDispatch
*
)
DECLSPEC_HIDDEN
;
HRESULT
set_event_handler
(
event_target_t
**
,
nsIDOMNode
*
,
HTMLDocumentNode
*
,
eventid_t
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
void
fire_event
(
HTMLDocumentNode
*
,
eventid_t
,
BOOL
,
nsIDOMNode
*
,
nsIDOMEvent
*
,
IDispatch
*
)
DECLSPEC_HIDDEN
;
HRESULT
set_event_handler
(
event_target_t
**
,
HTMLDocumentNode
*
,
eventid_t
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_event_handler
(
event_target_t
**
,
eventid_t
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
HRESULT
attach_event
(
event_target_t
**
,
nsIDOMNode
*
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
attach_event
(
event_target_t
**
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
detach_event
(
event_target_t
*
,
HTMLDocument
*
,
BSTR
,
IDispatch
*
)
DECLSPEC_HIDDEN
;
HRESULT
dispatch_event
(
HTMLDOMNode
*
,
const
WCHAR
*
,
VARIANT
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
call_fire_event
(
HTMLDOMNode
*
,
eventid_t
)
DECLSPEC_HIDDEN
;
void
update_cp_events
(
HTMLInnerWindow
*
,
event_target_t
**
,
cp_static_data_t
*
,
nsIDOMNode
*
)
DECLSPEC_HIDDEN
;
void
update_cp_events
(
HTMLInnerWindow
*
,
event_target_t
**
,
cp_static_data_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
doc_init_events
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_events
(
HTMLDocumentNode
*
doc
)
DECLSPEC_HIDDEN
;
HRESULT
create_event_obj
(
IHTMLEventObj
**
)
DECLSPEC_HIDDEN
;
...
...
@@ -76,7 +76,7 @@ static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
static
inline
HRESULT
set_node_event
(
HTMLDOMNode
*
node
,
eventid_t
eid
,
VARIANT
*
var
)
{
return
set_event_handler
(
get_node_event_target
(
node
),
node
->
nsnode
,
node
->
doc
,
eid
,
var
);
return
set_event_handler
(
get_node_event_target
(
node
),
node
->
doc
,
eid
,
var
);
}
static
inline
HRESULT
get_node_event
(
HTMLDOMNode
*
node
,
eventid_t
eid
,
VARIANT
*
var
)
...
...
dlls/mshtml/htmlwindow.c
View file @
9c45b34c
...
...
@@ -95,7 +95,7 @@ static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIAN
return
E_FAIL
;
}
return
set_event_handler
(
&
window
->
inner_window
->
doc
->
body_event_target
,
NULL
,
window
->
inner_window
->
doc
,
eid
,
var
);
return
set_event_handler
(
&
window
->
inner_window
->
doc
->
body_event_target
,
window
->
inner_window
->
doc
,
eid
,
var
);
}
static
inline
HRESULT
get_window_event
(
HTMLWindow
*
window
,
eventid_t
eid
,
VARIANT
*
var
)
...
...
@@ -1617,7 +1617,7 @@ static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, I
return
E_FAIL
;
}
return
attach_event
(
&
window
->
doc
->
body_event_target
,
NULL
,
&
window
->
doc
->
basedoc
,
event
,
pDisp
,
pfResult
);
return
attach_event
(
&
window
->
doc
->
body_event_target
,
&
window
->
doc
->
basedoc
,
event
,
pDisp
,
pfResult
);
}
static
HRESULT
WINAPI
HTMLWindow3_detachEvent
(
IHTMLWindow3
*
iface
,
BSTR
event
,
IDispatch
*
pDisp
)
...
...
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