Jacek Caban : mshtml: Added IDOMKeyboardEvent::which and IDOMMouseEvent:: which properties implementation.

Alexandre Julliard julliard at winehq.org
Fri Feb 16 13:41:31 CST 2018


Module: wine
Branch: master
Commit: abd27e0926f01ca3a82f18ba6e00ad08cb046544
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=abd27e0926f01ca3a82f18ba6e00ad08cb046544

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Feb 16 16:36:14 2018 +0100

mshtml: Added IDOMKeyboardEvent::which and IDOMMouseEvent::which properties implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlevent.c     | 26 ++++++++++++++++++++++----
 dlls/mshtml/tests/events.js |  4 ++++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 413ca2d..3a83e47 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -1619,8 +1619,17 @@ static HRESULT WINAPI DOMMouseEvent_get_layerY(IDOMMouseEvent *iface, LONG *p)
 static HRESULT WINAPI DOMMouseEvent_get_which(IDOMMouseEvent *iface, USHORT *p)
 {
     DOMEvent *This = impl_from_IDOMMouseEvent(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    UINT32 r;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMMouseEvent_GetWhich(This->mouse_event, &r);
+    if(NS_FAILED(nsres))
+        return E_FAIL;
+
+    *p = r;
+    return S_OK;
 }
 
 static const IDOMMouseEventVtbl DOMMouseEventVtbl = {
@@ -1874,8 +1883,17 @@ static HRESULT WINAPI DOMKeyboardEvent_get_charCode(IDOMKeyboardEvent *iface, LO
 static HRESULT WINAPI DOMKeyboardEvent_get_which(IDOMKeyboardEvent *iface, LONG *p)
 {
     DOMEvent *This = impl_from_IDOMKeyboardEvent(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    UINT32 r;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMKeyEvent_GetWhich(This->keyboard_event, &r);
+    if(NS_FAILED(nsres))
+        return E_FAIL;
+
+    *p = r;
+    return S_OK;
 }
 
 static HRESULT WINAPI DOMKeyboardEvent_get_char(IDOMKeyboardEvent *iface, VARIANT *p)
diff --git a/dlls/mshtml/tests/events.js b/dlls/mshtml/tests/events.js
index c5030d0..f645e37 100644
--- a/dlls/mshtml/tests/events.js
+++ b/dlls/mshtml/tests/events.js
@@ -628,6 +628,7 @@ function test_mouse_event() {
     ok(e.buttons === 0, "buttons = " + e.buttons);
     ok(e.pageX === 0, "pageX = " + e.pageX);
     ok(e.pageY === 0, "pageY = " + e.pageY);
+    ok(e.which === 1, "which = " + e.which);
 
     e.initMouseEvent("test", true, true, window, 1, 2, 3, 4, 5, false, false, false, false, 1, document);
     ok(e.type === "test", "type = " + e.type);
@@ -646,6 +647,7 @@ function test_mouse_event() {
     ok(e.metaKey === false, "metaKey = " + e.metaKey);
     ok(e.button === 1, "button = " + e.button);
     ok(e.buttons === 0, "buttons = " + e.buttons);
+    ok(e.which === 2, "which = " + e.which);
 
     e.initMouseEvent("test", false, false, window, 9, 8, 7, 6, 5, true, true, true, true, 127, document);
     ok(e.type === "test", "type = " + e.type);
@@ -661,6 +663,7 @@ function test_mouse_event() {
     ok(e.shiftKey === true, "shiftKey = " + e.shiftKey);
     ok(e.metaKey === true, "metaKey = " + e.metaKey);
     ok(e.button === 127, "button = " + e.button);
+    ok(e.which === 128, "which = " + e.which);
 
     e.initEvent("testevent", true, true);
     ok(e.type === "testevent", "type = " + e.type);
@@ -728,6 +731,7 @@ function test_keyboard_event() {
     ok(e.metaKey === false, "metaKey = " + e.metaKey);
     ok(e.location === 0, "location = " + e.location);
     ok(e.detail === 0, "detail = " + e.detail);
+    ok(e.which === 0, "which = " + e.which);
 
     next_test();
 }




More information about the wine-cvs mailing list