Module: wine Branch: master Commit: 791b868ce7883c254cee007cc759f45efd2ca9eb URL: http://source.winehq.org/git/wine.git/?a=commit;h=791b868ce7883c254cee007cc7...
Author: Jacek Caban jacek@codeweavers.com Date: Sun Jun 10 11:35:11 2007 +0200
mshtml: Move setup_ns_editing to nsembed.c.
---
dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/nsembed.c | 48 ++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/olecmd.c | 50 +----------------------------------------- 3 files changed, 50 insertions(+), 49 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5a0b17b..3f54104 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -383,6 +383,7 @@ typedef struct { extern const cmdtable_t editmode_cmds[];
/* editor */ +void set_ns_editmode(NSContainer*); void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
extern DWORD mshtml_tls; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 2040e03..c2c7318 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -580,6 +580,54 @@ void nsnode_to_nsstring(nsIDOMNode *nsdoc, nsAString *str) nsIContentSerializer_Release(serializer); }
+void set_ns_editmode(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: %08x\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: %08x\n", nsres); + return; + } + + nsres = nsIWebBrowser_GetContentDOMWindow(This->webbrowser, &dom_window); + if(NS_FAILED(nsres)) { + ERR("Could not get content DOM window: %08x\n", nsres); + nsIEditingSession_Release(editing_session); + return; + } + + nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE); + nsIEditingSession_Release(editing_session); + nsIDOMWindow_Release(dom_window); + if(NS_FAILED(nsres)) { + ERR("MakeWindowEditable failed: %08x\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)); +} + void close_gecko(void) { TRACE("()\n"); diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 2c5a8ba..468c401 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -511,54 +511,6 @@ static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in 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: %08x\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: %08x\n", nsres); - return; - } - - nsres = nsIWebBrowser_GetContentDOMWindow(This->webbrowser, &dom_window); - if(NS_FAILED(nsres)) { - ERR("Could not get content DOM window: %08x\n", nsres); - nsIEditingSession_Release(editing_session); - return; - } - - nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE); - nsIEditingSession_Release(editing_session); - nsIDOMWindow_Release(dom_window); - if(NS_FAILED(nsres)) { - ERR("MakeWindowEditable failed: %08x\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, DWORD cmdexecopt, VARIANT *in, VARIANT *out) { IMoniker *mon; @@ -590,7 +542,7 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, }
if(This->nscontainer) - setup_ns_editing(This->nscontainer); + set_ns_editmode(This->nscontainer);
hres = CreateURLMoniker(NULL, wszAboutBlank, &mon); if(FAILED(hres)) {