Commit b271b48d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use create_event_from_nsevent in handle_htmlevent.

parent a52828c8
......@@ -195,7 +195,7 @@ static const event_info_t event_info[] = {
static BOOL use_event_quirks(EventTarget*);
eventid_t str_to_eid(LPCWSTR str)
static eventid_t str_to_eid(const WCHAR *str)
{
int i;
......
......@@ -71,7 +71,6 @@ typedef struct {
BOOL no_event_obj;
} DOMEvent;
eventid_t str_to_eid(LPCWSTR) DECLSPEC_HIDDEN;
void check_event_attr(HTMLDocumentNode*,nsIDOMHTMLElement*) DECLSPEC_HIDDEN;
void release_event_target(EventTarget*) DECLSPEC_HIDDEN;
void fire_event(HTMLDocumentNode*,eventid_t,BOOL,EventTarget*,nsIDOMEvent*) DECLSPEC_HIDDEN;
......
......@@ -288,16 +288,14 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
return nsres;
}
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *event)
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *nsevent)
{
nsEventListener *This = impl_from_nsIDOMEventListener(iface);
HTMLDocumentNode *doc = This->This->doc;
const PRUnichar *type;
nsIDOMEventTarget *event_target;
nsIDOMNode *nsnode;
nsAString type_str;
HTMLDOMNode *node;
eventid_t eid;
DOMEvent *event;
nsresult nsres;
HRESULT hres;
......@@ -308,13 +306,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
return NS_OK;
}
nsAString_Init(&type_str, NULL);
nsIDOMEvent_GetType(event, &type_str);
nsAString_GetData(&type_str, &type);
eid = str_to_eid(type);
nsAString_Finish(&type_str);
nsres = nsIDOMEvent_GetTarget(event, &event_target);
nsres = nsIDOMEvent_GetTarget(nsevent, &event_target);
if(NS_FAILED(nsres) || !event_target) {
ERR("GetEventTarget failed: %08x\n", nsres);
return NS_OK;
......@@ -332,8 +324,14 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
if(FAILED(hres))
return NS_OK;
hres = create_event_from_nsevent(nsevent, &event);
if(FAILED(hres)) {
node_release(node);
return NS_OK;
}
/* If we fine need for more special cases here, we may consider handling it in a more generic way. */
switch(eid) {
switch(event->event_id) {
case EVENTID_FOCUS:
if(doc->event_vector[EVENTID_FOCUSIN])
fire_event(doc, EVENTID_FOCUSIN, TRUE, &node->event_target, NULL);
......@@ -346,8 +344,9 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
break;
}
fire_event(doc, eid, TRUE, &node->event_target, event);
fire_event_obj(&node->event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);
node_release(node);
return NS_OK;
}
......
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