diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d551693363a..ddc8df53655 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -928,6 +928,7 @@ void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
void release_nsio(void) DECLSPEC_HIDDEN;
BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
+float get_viewer_zoom(NSContainer*) DECLSPEC_HIDDEN;
void init_node_cc(void) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 6aae9c2948f..9acb0d29e8c 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1191,6 +1191,29 @@ void set_viewer_zoom(NSContainer *nscontainer, float factor)
nsIContentViewer_Release(content_viewer);
}
+float get_viewer_zoom(NSContainer *nscontainer)
+{
+ nsIContentViewer *content_viewer;
+ nsIDocShell *doc_shell;
+ nsresult nsres;
+ float factor;
+
+ nsres = get_nsinterface((nsISupports*)nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell);
+ assert(nsres == NS_OK);
+
+ nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer);
+ assert(nsres == NS_OK && content_viewer);
+ nsIDocShell_Release(doc_shell);
+
+ nsres = nsIContentViewer_GetFullZoom(content_viewer, &factor);
+ if(NS_FAILED(nsres))
+ ERR("GetFullZoom failed: %08x\n", nsres);
+ TRACE("Got %f\n", factor);
+
+ nsIContentViewer_Release(content_viewer);
+ return factor;
+}
+
struct nsWeakReference {
nsIWeakReference nsIWeakReference_iface;
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index e5fc474bbe2..2baf715d2aa 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -558,12 +558,17 @@ static HRESULT exec_optical_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT
{
TRACE("(%p)->(%d %s %p)\n", This, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
- if(!pvaIn || V_VT(pvaIn) != VT_I4) {
+ if(pvaIn && V_VT(pvaIn) != VT_I4) {
FIXME("Unsupported argument %s\n", debugstr_variant(pvaIn));
return E_NOTIMPL;
}
- set_viewer_zoom(This->doc_obj->nscontainer, (float)V_I4(pvaIn)/100);
+ if(pvaIn)
+ set_viewer_zoom(This->doc_obj->nscontainer, (float)V_I4(pvaIn)/100);
+ if(pvaOut) {
+ V_VT(pvaOut) = VT_I4;
+ V_I4(pvaOut) = get_viewer_zoom(This->doc_obj->nscontainer)*100;
+ }
return S_OK;
}
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index 3729fc30322..25cdf802b10 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -6702,7 +6702,7 @@ static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
{
IOleCommandTarget *cmdtrg;
- VARIANT v;
+ VARIANT v, out;
HRESULT hres;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
@@ -6715,10 +6715,23 @@ static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
SET_EXPECT(GetOverrideKeyPath);
hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
- OLECMDEXECOPT_DODEFAULT, &v, NULL);
+ OLECMDEXECOPT_DODEFAULT, &v, &out);
ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
CLEAR_CALLED(GetOverrideKeyPath);
+ if(hres != OLECMDERR_E_NOTSUPPORTED) {
+ ok(V_VT(&out) == VT_I4, "V_VT(&out) = %d\n", V_VT(&out));
+ ok(V_I4(&out) == factor, "V_I4(&out) = %d, expected %d\n", V_I4(&out), factor);
+
+ SET_EXPECT(GetOverrideKeyPath);
+ hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
+ OLECMDEXECOPT_DODEFAULT, NULL, &out);
+ ok(hres == S_OK, "Exec failed: %08x\n", hres);
+ ok(V_VT(&out) == VT_I4, "V_VT(&out) = %d\n", V_VT(&out));
+ ok(V_I4(&out) == factor, "V_I4(&out) = %d, expected %d\n", V_I4(&out), factor);
+ CLEAR_CALLED(GetOverrideKeyPath);
+ }
+
IOleCommandTarget_Release(cmdtrg);
test_QueryStatus((IUnknown*)doc, NULL, OLECMDID_OPTICAL_ZOOM, 0);