mshtml: Split parse_complete to handle_load and mutation observer.

This commit is contained in:
Jacek Caban 2009-11-08 15:40:11 +01:00 committed by Alexandre Julliard
parent cf680ed0f2
commit bcfa7c57d6
4 changed files with 82 additions and 73 deletions

View File

@ -683,7 +683,6 @@ HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
IMoniker *get_channelbsc_mon(nsChannelBSC*);
void parse_complete(HTMLDocumentObj*);
void set_ready_state(HTMLWindow*,READYSTATE);
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);

View File

@ -27,6 +27,7 @@
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "shlguid.h"
#include "mshtml_private.h"
#include "htmlevent.h"
@ -353,10 +354,43 @@ static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk)
return nsres;
}
static void parse_complete_proc(task_t *_task)
/* Calls undocumented 69 cmd of CGID_Explorer */
static void call_explorer_69(HTMLDocumentObj *doc)
{
docobj_task_t *task = (docobj_task_t*)_task;
parse_complete(task->doc);
IOleCommandTarget *olecmd;
VARIANT var;
HRESULT hres;
if(!doc->client)
return;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(FAILED(hres))
return;
VariantInit(&var);
hres = IOleCommandTarget_Exec(olecmd, &CGID_Explorer, 69, 0, NULL, &var);
IOleCommandTarget_Release(olecmd);
if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL)
FIXME("handle result\n");
}
static void parse_complete_proc(task_t *task)
{
HTMLDocumentObj *doc = ((docobj_task_t*)task)->doc;
TRACE("(%p)\n", doc);
if(doc->usermode == EDITMODE)
init_editor(&doc->basedoc);
call_explorer_69(doc);
call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
call_explorer_69(doc);
/* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
set_ready_state(doc->basedoc.window, READYSTATE_INTERACTIVE);
}
static void handle_end_load(HTMLDocumentNode *This)

View File

@ -26,6 +26,8 @@
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "mshtmcid.h"
#include "shlguid.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -173,6 +175,36 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
return NS_OK;
}
static void handle_docobj_load(HTMLDocumentObj *doc)
{
IOleCommandTarget *olecmd = NULL;
HRESULT hres;
if(!doc->client)
return;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(SUCCEEDED(hres)) {
VARIANT state, progress;
V_VT(&progress) = VT_I4;
V_I4(&progress) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
&progress, NULL);
V_VT(&state) = VT_I4;
V_I4(&state) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE, OLECMDEXECOPT_DONTPROMPTUSER,
&state, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd);
}
}
static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event)
{
HTMLDocumentNode *doc = NSEVENTLIST_THIS(iface)->This->doc;
@ -195,8 +227,19 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
if(doc_obj->usermode == EDITMODE)
handle_edit_load(&doc_obj->basedoc);
if(doc->basedoc.window->readystate != READYSTATE_COMPLETE)
set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE);
if(doc == doc_obj->basedoc.doc_node)
handle_docobj_load(doc_obj);
set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE);
if(doc == doc_obj->basedoc.doc_node) {
if(doc_obj->frame) {
static const WCHAR wszDone[] = {'D','o','n','e',0};
IOleInPlaceFrame_SetStatusText(doc_obj->frame, wszDone);
}
update_title(doc_obj);
}
if(!doc->nsdoc) {
ERR("NULL nsdoc\n");

View File

@ -27,8 +27,6 @@
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "mshtmcid.h"
#include "shlguid.h"
#include "wine/debug.h"
@ -201,75 +199,10 @@ HRESULT clear_task_timer(HTMLDocument *doc, BOOL interval, DWORD id)
return S_OK;
}
/* Calls undocumented 69 cmd of CGID_Explorer */
static void call_explorer_69(HTMLDocumentObj *doc)
{
IOleCommandTarget *olecmd;
VARIANT var;
HRESULT hres;
if(!doc->client)
return;
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(FAILED(hres))
return;
VariantInit(&var);
hres = IOleCommandTarget_Exec(olecmd, &CGID_Explorer, 69, 0, NULL, &var);
IOleCommandTarget_Release(olecmd);
if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL)
FIXME("handle result\n");
}
void parse_complete(HTMLDocumentObj *doc)
{
IOleCommandTarget *olecmd = NULL;
TRACE("(%p)\n", doc);
if(doc->usermode == EDITMODE)
init_editor(&doc->basedoc);
call_explorer_69(doc);
call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
call_explorer_69(doc);
/* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
set_ready_state(doc->basedoc.window, READYSTATE_INTERACTIVE);
if(doc->client)
IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
if(olecmd) {
VARIANT state, progress;
V_VT(&progress) = VT_I4;
V_I4(&progress) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
&progress, NULL);
V_VT(&state) = VT_I4;
V_I4(&state) = 0;
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE, OLECMDEXECOPT_DONTPROMPTUSER,
&state, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 103, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL);
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL);
IOleCommandTarget_Release(olecmd);
}
set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE);
if(doc->frame) {
static const WCHAR wszDone[] = {'D','o','n','e',0};
IOleInPlaceFrame_SetStatusText(doc->frame, wszDone);
}
update_title(doc);
}
static void call_timer_disp(IDispatch *disp)