Commit 169fde0d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Expose IDOMKeyboardEvent to scripts.

parent 4947c70f
......@@ -1924,6 +1924,19 @@ static dispex_static_data_t DOMMouseEvent_dispex = {
DOMMouseEvent_iface_tids
};
static const tid_t DOMKeyboardEvent_iface_tids[] = {
IDOMEvent_tid,
IDOMUIEvent_tid,
IDOMKeyboardEvent_tid,
0
};
static dispex_static_data_t DOMKeyboardEvent_dispex = {
NULL,
DispDOMKeyboardEvent_tid,
DOMKeyboardEvent_iface_tids
};
static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
{
dispex_static_data_t *dispex_data = &DOMEvent_dispex;
......@@ -1972,7 +1985,9 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
event->mouse_event = NULL;
nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMKeyEvent, (void**)&event->keyboard_event);
if(NS_FAILED(nsres))
if(NS_SUCCEEDED(nsres))
dispex_data = &DOMKeyboardEvent_dispex;
else
event->keyboard_event = NULL;
init_dispex(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data);
......
......@@ -81,6 +81,7 @@ typedef struct EventTarget EventTarget;
XDIID(DispCPlugins) \
XDIID(DispDOMChildrenCollection) \
XDIID(DispDOMEvent) \
XDIID(DispDOMKeyboardEvent) \
XDIID(DispDOMMouseEvent) \
XDIID(DispDOMUIEvent) \
XDIID(DispHTMLAnchorElement) \
......@@ -130,6 +131,7 @@ typedef struct EventTarget EventTarget;
XDIID(HTMLDocumentEvents) \
XDIID(HTMLElementEvents2) \
XIID(IDOMEvent) \
XIID(IDOMKeyboardEvent) \
XIID(IDOMMouseEvent) \
XIID(IDOMUIEvent) \
XIID(IDocumentEvent) \
......
......@@ -684,6 +684,25 @@ function test_ui_event() {
next_test();
}
function test_keyboard_event() {
var e;
e = document.createEvent("KeyboardEvent");
e.initEvent("test", true, true);
ok(e.key === "", "key = " + e.key);
ok(e.keyCode === 0, "keyCode = " + e.keyCode);
ok(e.charCode === 0, "charCode = " + e.charCode);
ok(e.repeat === false, "repeat = " + e.repeat);
ok(e.ctrlKey === false, "ctrlKey = " + e.ctrlKey);
ok(e.altKey === false, "altKey = " + e.altKey);
ok(e.shiftKey === false, "shiftKey = " + e.shiftKey);
ok(e.metaKey === false, "metaKey = " + e.metaKey);
ok(e.detail === 0, "detail = " + e.detail);
next_test();
}
var tests = [
test_content_loaded,
test_add_remove_listener,
......@@ -698,6 +717,7 @@ var tests = [
test_recursive_dispatch,
test_ui_event,
test_mouse_event,
test_keyboard_event,
test_time_stamp,
test_listener_order
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment