Jacek Caban : mshtml: Switch nsWebBrowset to editing mode in
exec_editmod.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 18 05:40:17 CDT 2006
Module: wine
Branch: master
Commit: e3990ddf7bfce090ca4557dce505634a269512a4
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e3990ddf7bfce090ca4557dce505634a269512a4
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Aug 17 21:00:55 2006 +0200
mshtml: Switch nsWebBrowset to editing mode in exec_editmod.
---
dlls/mshtml/nsiface.idl | 17 +++++++++++++++
dlls/mshtml/olecmd.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index ee17638..46e0a23 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -108,6 +108,7 @@ typedef nsISupports nsIDOMHTMLFormElemen
typedef nsISupports nsIDOMHTMLOptionsCollection;
typedef nsISupports nsIDOMHTMLCollection;
typedef nsISupports nsIDOMRange;
+typedef nsISupports nsIEditor;
[
object,
@@ -1157,6 +1158,22 @@ interface nsIWindowWatcher : nsISupports
nsresult SetActiveWindow(nsIDOMWindow *aActiveWindow);
}
+[
+ object,
+ uuid(d39fd2b4-3978-45d2-a4be-ba448171b61b)
+]
+interface nsIEditingSession : nsISupports
+{
+ nsresult GetEditorStatus(PRUint32 *aEditorStatus);
+ nsresult MakeWindowEditable(nsIDOMWindow *window, const char *aEditorType,
+ PRBool doAfterUriLoad);
+ nsresult WindowIsEditable(nsIDOMWindow *window, PRBool *_retval);
+ nsresult GetEditorForWindow(nsIDOMWindow *window, nsIEditor **_retval);
+ nsresult SetupEditorOnWindow(nsIDOMWindow *window);
+ nsresult TearDownEditorOnWindow(nsIDOMWindow *window);
+ nsresult SetEditorOnControllers(nsIDOMWindow *aWindow, nsIEditor *aEditor);
+}
+
/*
* NOTE:
* This is a private Wine interface that is implemented by our implementation
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 1669aaa..a95f5b1 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -247,11 +247,59 @@ static HRESULT exec_browsemode(HTMLDocum
return S_OK;
}
+static void setup_ns_editing(NSContainer *This)
+{
+ nsIInterfaceRequestor *iface_req;
+ nsIEditingSession *editing_session = NULL;
+ nsIURIContentListener *listener = NULL;
+ nsIDOMWindow *dom_window = NULL;
+ nsresult nsres;
+
+ nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
+ &IID_nsIInterfaceRequestor, (void**)&iface_req);
+ if(NS_FAILED(nsres)) {
+ ERR("Could not get nsIInterfaceRequestor: %08lx\n", nsres);
+ return;
+ }
+
+ nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsIEditingSession,
+ (void**)&editing_session);
+ nsIInterfaceRequestor_Release(iface_req);
+ if(NS_FAILED(nsres)) {
+ ERR("Could not get nsIEditingSession: %08lx\n", nsres);
+ return;
+ }
+
+ nsres = nsIWebBrowser_GetContentDOMWindow(This->webbrowser, &dom_window);
+ nsIDOMWindow_Release(dom_window);
+ if(NS_FAILED(nsres)) {
+ ERR("Could not get content DOM window: %08lx\n", nsres);
+ nsIEditingSession_Release(editing_session);
+ return;
+ }
+
+ nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE);
+ nsIEditingSession_Release(editing_session);
+ if(NS_FAILED(nsres)) {
+ ERR("MakeWindowEditable failed: %08lx\n", nsres);
+ return;
+ }
+
+ /* MakeWindowEditable changes WebBrowser's parent URI content listener.
+ * It seams to be a bug in Gecko. To workaround it we set our content
+ * listener again and Gecko's one as its parent.
+ */
+ nsIWebBrowser_GetParentURIContentListener(This->webbrowser, &listener);
+ nsIURIContentListener_SetParentContentListener(NSURICL(This), listener);
+ nsIURIContentListener_Release(listener);
+ nsIWebBrowser_SetParentURIContentListener(This->webbrowser, NSURICL(This));
+}
+
static HRESULT exec_editmode(HTMLDocument *This)
{
HRESULT hres;
- FIXME("(%p)\n", This);
+ TRACE("(%p)\n", This);
This->usermode = EDITMODE;
@@ -306,6 +354,9 @@ static HRESULT exec_editmode(HTMLDocumen
}
}
+ if(This->nscontainer)
+ setup_ns_editing(This->nscontainer);
+
return S_OK;
}
More information about the wine-cvs
mailing list