Commit 5711c85a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Expose IDOMMouseEvent to scripts.

parent 05b0c8f7
...@@ -1586,6 +1586,18 @@ static dispex_static_data_t DOMEvent_dispex = { ...@@ -1586,6 +1586,18 @@ static dispex_static_data_t DOMEvent_dispex = {
DOMEvent_iface_tids DOMEvent_iface_tids
}; };
static const tid_t DOMMouseEvent_iface_tids[] = {
IDOMEvent_tid,
IDOMMouseEvent_tid,
0
};
static dispex_static_data_t DOMMouseEvent_dispex = {
NULL,
DispDOMMouseEvent_tid,
DOMMouseEvent_iface_tids
};
static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id) static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
{ {
dispex_static_data_t *dispex_data = &DOMEvent_dispex; dispex_static_data_t *dispex_data = &DOMEvent_dispex;
...@@ -1620,7 +1632,9 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id) ...@@ -1620,7 +1632,9 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
- time_epoch; - time_epoch;
nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMMouseEvent, (void**)&event->mouse_event); nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMMouseEvent, (void**)&event->mouse_event);
if(NS_FAILED(nsres)) if(NS_SUCCEEDED(nsres))
dispex_data = &DOMMouseEvent_dispex;
else
event->mouse_event = NULL; event->mouse_event = NULL;
init_dispex(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data); init_dispex(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data);
......
...@@ -81,6 +81,7 @@ typedef struct EventTarget EventTarget; ...@@ -81,6 +81,7 @@ typedef struct EventTarget EventTarget;
XDIID(DispCPlugins) \ XDIID(DispCPlugins) \
XDIID(DispDOMChildrenCollection) \ XDIID(DispDOMChildrenCollection) \
XDIID(DispDOMEvent) \ XDIID(DispDOMEvent) \
XDIID(DispDOMMouseEvent) \
XDIID(DispHTMLAnchorElement) \ XDIID(DispHTMLAnchorElement) \
XDIID(DispHTMLAreaElement) \ XDIID(DispHTMLAreaElement) \
XDIID(DispHTMLAttributeCollection) \ XDIID(DispHTMLAttributeCollection) \
...@@ -128,6 +129,7 @@ typedef struct EventTarget EventTarget; ...@@ -128,6 +129,7 @@ typedef struct EventTarget EventTarget;
XDIID(HTMLDocumentEvents) \ XDIID(HTMLDocumentEvents) \
XDIID(HTMLElementEvents2) \ XDIID(HTMLElementEvents2) \
XIID(IDOMEvent) \ XIID(IDOMEvent) \
XIID(IDOMMouseEvent) \
XIID(IDocumentEvent) \ XIID(IDocumentEvent) \
XIID(IDocumentSelector) \ XIID(IDocumentSelector) \
XIID(IElementSelector) \ XIID(IElementSelector) \
......
...@@ -592,6 +592,65 @@ function test_time_stamp() { ...@@ -592,6 +592,65 @@ function test_time_stamp() {
next_test(); next_test();
} }
function test_mouse_event() {
var e;
e = document.createEvent("MouseEvent");
ok(e.screenX === 0, "screenX = " + e.screenX);
ok(e.screenY === 0, "screenY = " + e.screenY);
ok(e.clientX === 0, "clientX = " + e.clientX);
ok(e.clientY === 0, "clientY = " + e.clientY);
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.button === 0, "button = " + e.button);
e.initMouseEvent("test", true, true, window, 1, 2, 3, 4, 5, false, false, false, false, 1, document);
ok(e.type === "test", "type = " + e.type);
ok(e.cancelable === true, "cancelable = " + e.cancelable);
ok(e.bubbles === true, "bubbles = " + e.bubbles);
ok(e.screenX === 2, "screenX = " + e.screenX);
ok(e.screenY === 3, "screenY = " + e.screenY);
ok(e.clientX === 4, "clientX = " + e.clientX);
ok(e.clientY === 5, "clientY = " + e.clientY);
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.button === 1, "button = " + e.button);
e.initMouseEvent("test", false, false, window, 9, 8, 7, 6, 5, true, true, true, true, 127, document);
ok(e.type === "test", "type = " + e.type);
ok(e.cancelable === false, "cancelable = " + e.cancelable);
ok(e.bubbles === false, "bubbles = " + e.bubbles);
ok(e.screenX === 8, "screenX = " + e.screenX);
ok(e.screenY === 7, "screenY = " + e.screenY);
ok(e.clientX === 6, "clientX = " + e.clientX);
ok(e.clientY === 5, "clientY = " + e.clientY);
ok(e.ctrlKey === true, "ctrlKey = " + e.ctrlKey);
ok(e.altKey === true, "altKey = " + e.altKey);
ok(e.shiftKey === true, "shiftKey = " + e.shiftKey);
ok(e.metaKey === true, "metaKey = " + e.metaKey);
ok(e.button === 127, "button = " + e.button);
e.initEvent("testevent", true, true);
ok(e.type === "testevent", "type = " + e.type);
ok(e.cancelable === true, "cancelable = " + e.cancelable);
ok(e.bubbles === true, "bubbles = " + e.bubbles);
ok(e.screenX === 8, "screenX = " + e.screenX);
ok(e.screenY === 7, "screenY = " + e.screenY);
ok(e.clientX === 6, "clientX = " + e.clientX);
ok(e.clientY === 5, "clientY = " + e.clientY);
ok(e.ctrlKey === true, "ctrlKey = " + e.ctrlKey);
ok(e.altKey === true, "altKey = " + e.altKey);
ok(e.shiftKey === true, "shiftKey = " + e.shiftKey);
ok(e.metaKey === true, "metaKey = " + e.metaKey);
ok(e.button === 127, "button = " + e.button);
next_test();
}
var tests = [ var tests = [
test_content_loaded, test_content_loaded,
test_add_remove_listener, test_add_remove_listener,
...@@ -605,5 +664,6 @@ var tests = [ ...@@ -605,5 +664,6 @@ var tests = [
test_dispatch_event, test_dispatch_event,
test_recursive_dispatch, test_recursive_dispatch,
test_time_stamp, test_time_stamp,
test_listener_order test_listener_order,
test_mouse_event
]; ];
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