From f95e7a4ed38b8c94ae6443db0b72a61a67496201 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 15 Dec 2014 19:13:23 +0100 Subject: [PATCH] mshtml: Improved IHTMLStyle3::zoom stub. --- dlls/mshtml/htmlstyle3.c | 32 ++++++++++++++++++++++++++------ dlls/mshtml/tests/style.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c index 6532bf473ee..9355bd0b1cb 100644 --- a/dlls/mshtml/htmlstyle3.c +++ b/dlls/mshtml/htmlstyle3.c @@ -103,26 +103,46 @@ static HRESULT WINAPI HTMLStyle3_get_layoutFlow(IHTMLStyle3 *iface, BSTR *p) return E_NOTIMPL; } +static const WCHAR zoomW[] = {'z','o','o','m',0}; + static HRESULT WINAPI HTMLStyle3_put_zoom(IHTMLStyle3 *iface, VARIANT v) { HTMLStyle *This = impl_from_IHTMLStyle3(iface); + VARIANT *var; + HRESULT hres; TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); /* zoom property is IE CSS extension that is mostly used as a hack to workaround IE bugs. * The value is set to 1 then. We can safely ignore setting zoom to 1. */ - if(V_VT(&v) == VT_I4 && V_I4(&v) == 1) - return S_OK; + if(V_VT(&v) != VT_I4 || V_I4(&v) != 1) + WARN("stub for %s\n", debugstr_variant(&v)); - FIXME("stub for %s\n", debugstr_variant(&v)); - return E_NOTIMPL; + hres = dispex_get_dprop_ref(&This->dispex, zoomW, TRUE, &var); + if(FAILED(hres)) + return hres; + + return VariantChangeType(var, &v, 0, VT_BSTR); } static HRESULT WINAPI HTMLStyle3_get_zoom(IHTMLStyle3 *iface, VARIANT *p) { HTMLStyle *This = impl_from_IHTMLStyle3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + VARIANT *var; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + hres = dispex_get_dprop_ref(&This->dispex, zoomW, FALSE, &var); + if(hres == DISP_E_UNKNOWNNAME) { + V_VT(p) = VT_BSTR; + V_BSTR(p) = NULL; + return S_OK; + } + if(FAILED(hres)) + return hres; + + return VariantCopy(p, var); } static HRESULT WINAPI HTMLStyle3_put_wordWrap(IHTMLStyle3 *iface, BSTR v) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 1cdd1c73fbe..fffade02daa 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -453,6 +453,7 @@ static void test_style2(IHTMLStyle2 *style2) static void test_style3(IHTMLStyle3 *style3) { + VARIANT v; BSTR str; HRESULT hres; @@ -471,6 +472,37 @@ static void test_style3(IHTMLStyle3 *style3) ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres); ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str)); SysFreeString(str); + + V_VT(&v) = VT_ERROR; + hres = IHTMLStyle3_get_zoom(style3, &v); + ok(hres == S_OK, "get_zoom failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v)); + ok(!V_BSTR(&v), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("100%"); + hres = IHTMLStyle3_put_zoom(style3, v); + ok(hres == S_OK, "put_zoom failed: %08x\n", hres); + + V_VT(&v) = VT_ERROR; + hres = IHTMLStyle3_get_zoom(style3, &v); + ok(hres == S_OK, "get_zoom failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + + V_VT(&v) = VT_I4; + V_I4(&v) = 1; + hres = IHTMLStyle3_put_zoom(style3, v); + ok(hres == S_OK, "put_zoom failed: %08x\n", hres); + + V_VT(&v) = VT_ERROR; + hres = IHTMLStyle3_get_zoom(style3, &v); + ok(hres == S_OK, "get_zoom failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); } static void test_style4(IHTMLStyle4 *style4) -- 2.11.4.GIT