mshtml: Support retrieving command output in Exec(OLECMDID_OPTICAL_ZOOM).
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
843ccd2d5b
commit
29674a2c34
|
@ -928,6 +928,7 @@ void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
|
||||||
void release_nsio(void) DECLSPEC_HIDDEN;
|
void release_nsio(void) DECLSPEC_HIDDEN;
|
||||||
BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
|
BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
|
||||||
void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
|
void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
|
||||||
|
float get_viewer_zoom(NSContainer*) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void init_node_cc(void) 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);
|
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 {
|
struct nsWeakReference {
|
||||||
nsIWeakReference nsIWeakReference_iface;
|
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);
|
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));
|
FIXME("Unsupported argument %s\n", debugstr_variant(pvaIn));
|
||||||
return E_NOTIMPL;
|
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;
|
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)
|
static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
|
||||||
{
|
{
|
||||||
IOleCommandTarget *cmdtrg;
|
IOleCommandTarget *cmdtrg;
|
||||||
VARIANT v;
|
VARIANT v, out;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
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);
|
SET_EXPECT(GetOverrideKeyPath);
|
||||||
hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
|
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);
|
ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
|
||||||
CLEAR_CALLED(GetOverrideKeyPath);
|
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);
|
IOleCommandTarget_Release(cmdtrg);
|
||||||
|
|
||||||
test_QueryStatus((IUnknown*)doc, NULL, OLECMDID_OPTICAL_ZOOM, 0);
|
test_QueryStatus((IUnknown*)doc, NULL, OLECMDID_OPTICAL_ZOOM, 0);
|
||||||
|
|
Loading…
Reference in New Issue