From 042fbbc5f36f55a8bda79c53b141df40521a1e04 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 6 Sep 2018 16:15:11 +0200 Subject: [PATCH] mshtml: Added IHTMLCSSStyleDeclaration::opacity property implementation. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlstyle.c | 11 +++++++---- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/style.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 6f592502d8c..a467d2e4892 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -156,6 +156,8 @@ static const WCHAR min_heightW[] = {'m','i','n','-','h','e','i','g','h','t',0}; static const WCHAR min_widthW[] = {'m','i','n','-','w','i','d','t','h',0}; +static const WCHAR opacityW[] = + {'o','p','a','c','i','t','y',0}; static const WCHAR outlineW[] = {'o','u','t','l','i','n','e',0}; static const WCHAR overflowW[] = @@ -393,6 +395,7 @@ static const style_tbl_entry_t style_tbl[] = { {max_widthW, DISPID_IHTMLSTYLE5_MAXWIDTH, ATTR_FIX_PX}, {min_heightW, DISPID_IHTMLSTYLE4_MINHEIGHT}, {min_widthW, DISPID_IHTMLSTYLE5_MINWIDTH, ATTR_FIX_PX}, + {opacityW, DISPID_UNKNOWN}, {outlineW, DISPID_IHTMLSTYLE6_OUTLINE, ATTR_NO_NULL}, {overflowW, DISPID_IHTMLSTYLE_OVERFLOW, 0, overflow_values}, {overflow_xW, DISPID_IHTMLSTYLE2_OVERFLOWX}, @@ -6796,15 +6799,15 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_get_fontStretch(IHTMLCSSStyleDecla static HRESULT WINAPI HTMLCSSStyleDeclaration_put_opacity(IHTMLCSSStyleDeclaration *iface, VARIANT v) { HTMLStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return set_style_property_var(This, STYLEID_OPACITY, &v); } static HRESULT WINAPI HTMLCSSStyleDeclaration_get_opacity(IHTMLCSSStyleDeclaration *iface, VARIANT *p) { HTMLStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_style_property_var(This, STYLEID_OPACITY, p); } static HRESULT WINAPI HTMLCSSStyleDeclaration_put_clipPath(IHTMLCSSStyleDeclaration *iface, BSTR v) diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 1a83d4f8e9f..2e5cb27e1dc 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -94,6 +94,7 @@ typedef enum { STYLEID_MAX_WIDTH, STYLEID_MIN_HEIGHT, STYLEID_MIN_WIDTH, + STYLEID_OPACITY, STYLEID_OUTLINE, STYLEID_OVERFLOW, STYLEID_OVERFLOW_X, diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 309ca4029a5..72f36900e38 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -738,6 +738,7 @@ static void test_style6(IHTMLStyle6 *style) static void test_css_style_declaration(IHTMLCSSStyleDeclaration *css_style) { + VARIANT v; BSTR str; HRESULT hres; @@ -754,6 +755,31 @@ static void test_css_style_declaration(IHTMLCSSStyleDeclaration *css_style) ok(hres == S_OK, "get_backgroundClip failed: %08x\n", hres); ok(!strcmp_wa(str, "border-box"), "backgroundClip = %s\n", wine_dbgstr_w(str)); SysFreeString(str); + + hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v); + ok(hres == S_OK, "get_opacity failed: %08x\n", hres); + test_var_bstr(&v, NULL); + + V_VT(&v) = VT_I4; + V_I4(&v) = 0; + hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v); + ok(hres == S_OK, "put_opacity failed: %08x\n", hres); + + hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v); + ok(hres == S_OK, "get_opacity failed: %08x\n", hres); + test_var_bstr(&v, "0"); + VariantClear(&v); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("1"); + hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v); + ok(hres == S_OK, "put_opacity failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v); + ok(hres == S_OK, "get_opacity failed: %08x\n", hres); + test_var_bstr(&v, "1"); + VariantClear(&v); } static void test_body_style(IHTMLStyle *style) @@ -1790,6 +1816,14 @@ static void test_body_style(IHTMLStyle *style) ok(hres == S_OK, "put_filter failed: %08x\n", hres); SysFreeString(str); + hres = IHTMLStyle_put_filter(style, NULL); + ok(hres == S_OK, "put_filter failed: %08x\n", hres); + + str = (void*)0xdeadbeef; + hres = IHTMLStyle_get_filter(style, &str); + ok(hres == S_OK, "get_filter failed: %08x\n", hres); + ok(!str, "filter != NULL\n"); + V_VT(&v) = VT_EMPTY; hres = IHTMLStyle_get_zIndex(style, &v); ok(hres == S_OK, "get_zIndex failed: %08x\n", hres); -- 2.11.4.GIT