Jacek Caban : mshtml: Split parse_complete to handle_load and mutation observer.
Alexandre Julliard
julliard at winehq.org
Mon Nov 9 15:14:16 CST 2009
Module: wine
Branch: master
Commit: bcfa7c57d65c6f640d232e037ee2801a3bde5e11
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bcfa7c57d65c6f640d232e037ee2801a3bde5e11
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Nov 8 15:40:11 2009 +0100
mshtml: Split parse_complete to handle_load and mutation observer.
---
dlls/mshtml/mshtml_private.h | 1 -
dlls/mshtml/mutation.c | 40 +++++++++++++++++++++++--
dlls/mshtml/nsevents.c | 47 ++++++++++++++++++++++++++++-
dlls/mshtml/task.c | 67 ------------------------------------------
4 files changed, 82 insertions(+), 73 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 94d835d..43601ae 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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**);
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index b3cc62a..84c9241 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -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)
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index 096dcb3..7c4c09b 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -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");
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index 08f5534..e6b94a2 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -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)
More information about the wine-cvs
mailing list