Commit 29674a2c authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

mshtml: Support retrieving command output in Exec(OLECMDID_OPTICAL_ZOOM).

parent 843ccd2d
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment