Jacek Caban : mshtml: Added IDOMEvent::initEvent implementation.

Alexandre Julliard julliard at winehq.org
Mon Dec 4 14:58:21 CST 2017


Module: wine
Branch: master
Commit: 30e2762b823c802f0c2e20fbbd2539b5a96d0c5b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30e2762b823c802f0c2e20fbbd2539b5a96d0c5b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec  4 18:01:23 2017 +0100

mshtml: Added IDOMEvent::initEvent implementation.

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

---

 dlls/mshtml/htmlevent.c      | 33 ++++++++++++++++++++++++++++++---
 dlls/mshtml/mshtml_private.h |  4 ++++
 dlls/mshtml/nsembed.c        |  1 -
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index c06d062..fba04b5 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -218,7 +218,6 @@ static eventid_t str_to_eid(const WCHAR *str)
             return i;
     }
 
-    ERR("unknown type %s\n", debugstr_w(str));
     return EVENTID_LAST;
 }
 
@@ -1062,11 +1061,39 @@ static HRESULT WINAPI DOMEvent_get_type(IDOMEvent *iface, BSTR *p)
     return S_OK;
 }
 
+#ifdef __i386__
+#define nsIDOMEvent_InitEvent(_this,type,bubbles,cancelable) \
+    ((void (WINAPI*)(void*,nsIDOMEvent*,const nsAString*,cpp_bool,cpp_bool)) \
+     &call_thiscall_func)((_this)->lpVtbl->InitEvent,_this,type,bubbles,cancelable)
+
+#endif
+
 static HRESULT WINAPI DOMEvent_initEvent(IDOMEvent *iface, BSTR type, VARIANT_BOOL can_bubble, VARIANT_BOOL cancelable)
 {
     DOMEvent *This = impl_from_IDOMEvent(iface);
-    FIXME("(%p)->()\n", This);
-    return E_NOTIMPL;
+    nsAString nsstr;
+
+    TRACE("(%p)->(%s %x %x)\n", This, debugstr_w(type), can_bubble, cancelable);
+
+    if(This->target) {
+        TRACE("called on already dispatched event\n");
+        return S_OK;
+    }
+
+    heap_free(This->type);
+    This->type = heap_strdupW(type);
+    if(!This->type)
+        return E_OUTOFMEMORY;
+    This->event_id = str_to_eid(type);
+
+    This->bubbles = !!can_bubble;
+    This->cancelable = !!cancelable;
+
+    nsAString_InitDepend(&nsstr, type);
+    nsIDOMEvent_InitEvent(This->nsevent, &nsstr, This->bubbles, This->cancelable);
+    nsAString_Finish(&nsstr);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI DOMEvent_preventDefault(IDOMEvent *iface)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f55f064..2387372 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -1341,6 +1341,10 @@ static inline VARIANT_BOOL variant_bool(BOOL b)
     return b ? VARIANT_TRUE : VARIANT_FALSE;
 }
 
+#ifdef __i386__
+extern void *call_thiscall_func;
+#endif
+
 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
 HDC get_display_dc(void) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 4db61dc..8782ece 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -2200,7 +2200,6 @@ void NSContainer_Release(NSContainer *This)
  * This will be removed after the next Gecko update, that will change calling convention on Gecko side.
  */
 #ifdef __i386__
-extern void *call_thiscall_func;
 __ASM_GLOBAL_FUNC(call_thiscall_func,
         "popl %eax\n\t"
         "popl %edx\n\t"




More information about the wine-cvs mailing list