diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index 5f592848938..2c9e01ffc78 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -174,7 +174,7 @@ static void set_ns_align(HTMLDocument *This, const char *align_str) nsparam = create_nscommand_params(); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, align_str); - do_ns_command(This, NSCMD_ALIGN, nsparam); + do_ns_command(This->doc_node, NSCMD_ALIGN, nsparam); nsICommandParams_Release(nsparam); } @@ -506,7 +506,7 @@ static void set_ns_fontname(HTMLDocument *This, const char *fontname) nsICommandParams *nsparam = create_nscommand_params(); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname); - do_ns_command(This, NSCMD_FONTFACE, nsparam); + do_ns_command(This->doc_node, NSCMD_FONTFACE, nsparam); nsICommandParams_Release(nsparam); } @@ -591,7 +591,7 @@ static HRESULT exec_forecolor(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff); nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str); - do_ns_command(This, NSCMD_FONTCOLOR, nsparam); + do_ns_command(This->doc_node, NSCMD_FONTCOLOR, nsparam); nsICommandParams_Release(nsparam); }else { @@ -657,9 +657,7 @@ static HRESULT exec_bold(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARI if(in || out) FIXME("unsupported args\n"); - if(This->doc_obj->nscontainer) - do_ns_command(This, NSCMD_BOLD, NULL); - + do_ns_command(This->doc_node, NSCMD_BOLD, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -671,9 +669,7 @@ static HRESULT exec_italic(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA if(in || out) FIXME("unsupported args\n"); - if(This->doc_obj->nscontainer) - do_ns_command(This, NSCMD_ITALIC, NULL); - + do_ns_command(This->doc_node, NSCMD_ITALIC, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -748,7 +744,7 @@ static HRESULT exec_underline(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_UNDERLINE, NULL); + do_ns_command(This->doc_node, NSCMD_UNDERLINE, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -760,7 +756,7 @@ static HRESULT exec_horizontalline(HTMLDocument *This, DWORD cmdexecopt, VARIANT if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_INSERTHR, NULL); + do_ns_command(This->doc_node, NSCMD_INSERTHR, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -772,7 +768,7 @@ static HRESULT exec_orderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_OL, NULL); + do_ns_command(This->doc_node, NSCMD_OL, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -784,7 +780,7 @@ static HRESULT exec_unorderlist(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_UL, NULL); + do_ns_command(This->doc_node, NSCMD_UL, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -796,7 +792,7 @@ static HRESULT exec_indent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VA if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_INDENT, NULL); + do_ns_command(This->doc_node, NSCMD_INDENT, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } @@ -808,7 +804,7 @@ static HRESULT exec_outdent(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, V if(in || out) FIXME("unsupported args\n"); - do_ns_command(This, NSCMD_OUTDENT, NULL); + do_ns_command(This->doc_node, NSCMD_OUTDENT, NULL); update_doc(This->doc_obj, UPDATE_UI); return S_OK; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 9933a419afe..7bf3cb6f9b9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1121,7 +1121,7 @@ typedef struct { extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN; -void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN; +void do_ns_command(HTMLDocumentNode*,const char*,nsICommandParams*) DECLSPEC_HIDDEN; /* timer */ #define UPDATE_UI 0x0001 diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 9c4aa67d26f..8920a2fafaf 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -40,23 +40,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); #define NSCMD_COPY "cmd_copy" #define NSCMD_SELECTALL "cmd_selectAll" -void do_ns_command(HTMLDocument *This, const char *cmd, nsICommandParams *nsparam) +void do_ns_command(HTMLDocumentNode *doc, const char *cmd, nsICommandParams *nsparam) { nsICommandManager *cmdmgr; nsresult nsres; - TRACE("(%p)\n", This); + TRACE("(%p)\n", doc); - if(!This->doc_obj || !This->doc_obj->nscontainer) + if(!doc->browser || !doc->window) return; - nsres = get_nsinterface((nsISupports*)This->doc_obj->nscontainer->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr); + nsres = get_nsinterface((nsISupports*)doc->browser->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr); if(NS_FAILED(nsres)) { ERR("Could not get nsICommandManager: %08x\n", nsres); return; } - nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, This->window->window_proxy); + nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, doc->window->base.outer_window->window_proxy); if(NS_FAILED(nsres)) ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres); @@ -355,7 +355,7 @@ static HRESULT exec_copy(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, { TRACE("(%p)->(%d %s %p)\n", This, nCmdexecopt, debugstr_variant(pvaIn), pvaOut); - do_ns_command(This, NSCMD_COPY, NULL); + do_ns_command(This->doc_node, NSCMD_COPY, NULL); return S_OK; } @@ -385,15 +385,18 @@ static HRESULT exec_rendo(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, static HRESULT exec_select_all(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *in, VARIANT *out) { + HTMLDocumentNode *doc = This->doc_node; + TRACE("(%p)\n", This); if(in || out) FIXME("unsupported args\n"); - if(This->doc_obj->nscontainer) - do_ns_command(This, NSCMD_SELECTALL, NULL); + if(!doc->browser) + return E_UNEXPECTED; - update_doc(This->doc_obj, UPDATE_UI); + do_ns_command(doc, NSCMD_SELECTALL, NULL); + update_doc(doc->browser->doc, UPDATE_UI); return S_OK; } @@ -586,7 +589,7 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i if(This->doc_node->browser->usermode == EDITMODE) return editor_exec_copy(This, cmdexecopt, in, out); - do_ns_command(This, NSCMD_COPY, NULL); + do_ns_command(This->doc_node, NSCMD_COPY, NULL); return S_OK; }