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

mshtml: Push TASK_PARSECOMPLETE in load event if Gecko is available.

parent 5c08a14c
...@@ -404,7 +404,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac ...@@ -404,7 +404,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
} }
} }
if(This->doc) { if(This->doc && !This->doc->nscontainer) {
task_t *task = mshtml_alloc(sizeof(task_t)); task_t *task = mshtml_alloc(sizeof(task_t));
task->doc = This->doc; task->doc = This->doc;
...@@ -413,7 +413,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac ...@@ -413,7 +413,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
/* /*
* This should be done in the worker thread that parses HTML, * This should be done in the worker thread that parses HTML,
* but we don't have such thread (Gecko parses HTML for us). * but we don't have such thread.
*/ */
push_task(task); push_task(task);
} }
......
...@@ -628,6 +628,28 @@ void set_ns_editmode(NSContainer *This) ...@@ -628,6 +628,28 @@ void set_ns_editmode(NSContainer *This)
nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This)); nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
} }
static void handle_load_event(NSContainer *This, nsIDOMEvent *event)
{
task_t *task;
TRACE("(%p)\n", This);
if(!This->doc)
return;
task = mshtml_alloc(sizeof(task_t));
task->doc = This->doc;
task->task_id = TASK_PARSECOMPLETE;
task->next = NULL;
/*
* This should be done in the worker thread that parses HTML,
* but we don't have such thread (Gecko parses HTML for us).
*/
push_task(task);
}
void close_gecko(void) void close_gecko(void)
{ {
TRACE("()\n"); TRACE("()\n");
...@@ -1283,11 +1305,24 @@ static nsrefcnt NSAPI nsDOMEventListener_Release(nsIDOMEventListener *iface) ...@@ -1283,11 +1305,24 @@ static nsrefcnt NSAPI nsDOMEventListener_Release(nsIDOMEventListener *iface)
static nsresult NSAPI nsDOMEventListener_HandleEvent(nsIDOMEventListener *iface, nsIDOMEvent *event) static nsresult NSAPI nsDOMEventListener_HandleEvent(nsIDOMEventListener *iface, nsIDOMEvent *event)
{ {
NSContainer *This = NSEVENTLIST_THIS(iface); NSContainer *This = NSEVENTLIST_THIS(iface);
nsAString type_str;
const PRUnichar *type;
TRACE("(%p)->(%p)\n", This, event); static const PRUnichar loadW[] = {'l','o','a','d',0};
if(This->doc->usermode == EDITMODE) nsAString_Init(&type_str, NULL);
handle_edit_event(This->doc, event); nsIDOMEvent_GetType(event, &type_str);
nsAString_GetData(&type_str, &type, NULL);
TRACE("(%p)->(%p) %s\n", This, event, debugstr_w(type));
if(!strcmpW(loadW, type)) {
handle_load_event(This, event);
}else if(This->doc && This->doc->usermode == EDITMODE) {
handle_edit_event(This->doc, event);
}
nsAString_Finish(&type_str);
return NS_OK; return NS_OK;
} }
...@@ -1519,14 +1554,23 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent) ...@@ -1519,14 +1554,23 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
nsres = nsIDOMWindow_QueryInterface(dom_window, &IID_nsIDOMEventTarget, (void**)&target); nsres = nsIDOMWindow_QueryInterface(dom_window, &IID_nsIDOMEventTarget, (void**)&target);
nsIDOMWindow_Release(dom_window); nsIDOMWindow_Release(dom_window);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsAString keypress_str; nsAString keypress_str, load_str;
static const PRUnichar wsz_keypress[] = {'k','e','y','p','r','e','s','s',0}; static const PRUnichar wsz_keypress[] = {'k','e','y','p','r','e','s','s',0};
static const PRUnichar wsz_load[] = {'l','o','a','d',0};
nsAString_Init(&keypress_str, wsz_keypress); nsAString_Init(&keypress_str, wsz_keypress);
nsres = nsIDOMEventTarget_AddEventListener(target, &keypress_str, NSEVENTLIST(ret), TRUE); nsres = nsIDOMEventTarget_AddEventListener(target, &keypress_str, NSEVENTLIST(ret), TRUE);
nsAString_Finish(&keypress_str); nsAString_Finish(&keypress_str);
nsIDOMEventTarget_Release(target);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("AddEventTarget failed: %08x\n", nsres); ERR("AddEventTarget failed: %08x\n", nsres);
nsAString_Init(&load_str, wsz_load);
nsres = nsIDOMEventTarget_AddEventListener(target, &load_str, NSEVENTLIST(ret), TRUE);
nsAString_Finish(&load_str);
if(NS_FAILED(nsres))
ERR("AddEventTarget failed: %08x\n", nsres);
nsIDOMEventTarget_Release(target);
}else { }else {
ERR("Could not get nsIDOMEventTarget interface: %08x\n", nsres); ERR("Could not get nsIDOMEventTarget interface: %08x\n", nsres);
} }
......
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