From: Jacek Caban Subject: mshtml: Added Exec(OLECMDID_OPTICAL_ZOOM) implementation. Message-Id: <54C24EC8.3000807@codeweavers.com> Date: Fri, 23 Jan 2015 14:38:16 +0100 --- dlls/mshtml/mshtml_private.h | 3 ++- dlls/mshtml/nsembed.c | 22 ++++++++++++++++++++++ dlls/mshtml/olecmd.c | 11 +++++++++-- dlls/mshtml/oleobj.c | 22 ++-------------------- dlls/mshtml/tests/htmldoc.c | 2 +- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index a53fcec..5c3c1ec 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -818,8 +818,9 @@ void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDD void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN; void release_nsio(void) DECLSPEC_HIDDEN; BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN; +void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN; -void init_node_cc(void); +void init_node_cc(void) DECLSPEC_HIDDEN; HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 2854ac3..8f3fceb 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -1149,6 +1149,28 @@ BOOL is_gecko_path(const char *path) return ret; } +void set_viewer_zoom(NSContainer *nscontainer, float factor) +{ + nsIContentViewer *content_viewer; + nsIDocShell *doc_shell; + nsresult nsres; + + TRACE("Setting to %f\n", 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_SetFullZoom(content_viewer, factor); + if(NS_FAILED(nsres)) + ERR("SetFullZoom failed: %08x\n", nsres); + + nsIContentViewer_Release(content_viewer); +} + struct nsWeakReference { nsIWeakReference nsIWeakReference_iface; diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 5916010..f4bf002 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -548,8 +548,15 @@ static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VA static HRESULT exec_optical_zoom(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) { - FIXME("(%p)->(%d %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut); - return E_NOTIMPL; + TRACE("(%p)->(%d %s %p)\n", This, nCmdexecopt, debugstr_variant(pvaIn), pvaOut); + + 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); + return S_OK; } static HRESULT query_mshtml_copy(HTMLDocument *This, OLECMD *cmd) diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index aeb83a0..7809eb0 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -229,12 +229,9 @@ void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate) static void load_settings(HTMLDocumentObj *doc) { - nsIContentViewer *content_viewer; - nsIDocShell *doc_shell; HKEY settings_key; DWORD val, size; LONG res; - nsresult nsres; static const WCHAR ie_keyW[] = { 'S','O','F','T','W','A','R','E','\\', @@ -250,23 +247,8 @@ static void load_settings(HTMLDocumentObj *doc) size = sizeof(val); res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size); RegCloseKey(settings_key); - if(res != ERROR_SUCCESS) - return; - - TRACE("Setting ZoomFactor to %u\n", val); - - nsres = get_nsinterface((nsISupports*)doc->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_SetFullZoom(content_viewer, (float)val/100000); - if(NS_FAILED(nsres)) - ERR("SetFullZoom failed: %08x\n", nsres); - - nsIContentViewer_Release(content_viewer); + if(res == ERROR_SUCCESS) + set_viewer_zoom(doc->nscontainer, (float)val/100000); } static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite) diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 16d6b45..3b332d1 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -6641,7 +6641,7 @@ 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); - todo_wine 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); IOleCommandTarget_Release(cmdtrg);