From 6d13dd697c99ebf6fa603c637234a09b14315720 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 30 Sep 2013 16:05:34 +0200 Subject: [PATCH] mshtml: Added IHTMLStyle6::outline property implementation. --- dlls/mshtml/htmlstyle.c | 5 ++++- dlls/mshtml/htmlstyle.h | 2 ++ dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 053c32623bf..5ed2f93ed47 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -135,6 +135,8 @@ static const WCHAR attrMarginTop[] = {'m','a','r','g','i','n','-','t','o','p',0}; static const WCHAR attrMinHeight[] = {'m','i','n','-','h','e','i','g','h','t',0}; +static const WCHAR attrOutline[] = + {'o','u','t','l','i','n','e',0}; static const WCHAR attrOverflow[] = {'o','v','e','r','f','l','o','w',0}; static const WCHAR attrOverflowX[] = @@ -241,6 +243,7 @@ static const style_tbl_entry_t style_tbl[] = { {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT}, {attrMarginTop, DISPID_IHTMLSTYLE_MARGINTOP}, {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT}, + {attrOutline, DISPID_IHTMLSTYLE6_OUTLINE}, {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW}, {attrOverflowX, DISPID_IHTMLSTYLE2_OVERFLOWX}, {attrOverflowY, DISPID_IHTMLSTYLE2_OVERFLOWY}, @@ -464,7 +467,7 @@ static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p) DWORD len; if(!*val) { - *p = NULL; + *p = (flags & ATTR_NO_NULL) ? SysAllocStringLen(NULL, 0) : NULL; return S_OK; } diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 4f2e5ab3421..646375f8e02 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -83,6 +83,7 @@ typedef enum { STYLEID_MARGIN_RIGHT, STYLEID_MARGIN_TOP, STYLEID_MIN_HEIGHT, + STYLEID_OUTLINE, STYLEID_OVERFLOW, STYLEID_OVERFLOW_X, STYLEID_OVERFLOW_Y, @@ -123,3 +124,4 @@ HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, #define ATTR_STR_TO_INT 0x0004 #define ATTR_HEX_INT 0x0008 #define ATTR_REMOVE_COMMA 0x0010 +#define ATTR_NO_NULL 0x0020 diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c index 912d80c5fa8..116181cf01f 100644 --- a/dlls/mshtml/htmlstyle3.c +++ b/dlls/mshtml/htmlstyle3.c @@ -702,15 +702,19 @@ static HRESULT WINAPI HTMLStyle6_get_counterReset(IHTMLStyle6 *iface, BSTR *p) static HRESULT WINAPI HTMLStyle6_put_outline(IHTMLStyle6 *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle6(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_nsstyle_attr(This->nsstyle, STYLEID_OUTLINE, v, 0); } static HRESULT WINAPI HTMLStyle6_get_outline(IHTMLStyle6 *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr(This->nsstyle, STYLEID_OUTLINE, p, ATTR_NO_NULL); } static HRESULT WINAPI HTMLStyle6_put_outlineWidth(IHTMLStyle6 *iface, VARIANT v) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index e42bcb78a51..71eb955c223 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -37,6 +37,13 @@ static int strcmp_wa(LPCWSTR strw, const char *stra) return lstrcmpA(stra, buf); } +static BOOL wstr_contains(const WCHAR *strw, const char *stra) +{ + CHAR buf[512]; + WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL); + return strstr(buf, stra) != NULL; +} + static BSTR a2bstr(const char *str) { BSTR ret; @@ -464,11 +471,35 @@ static void test_style4(IHTMLStyle4 *style4) VariantClear(&vdefault); } +static void test_style6(IHTMLStyle6 *style) +{ + BSTR str; + HRESULT hres; + + str = (void*)0xdeadbeef; + hres = IHTMLStyle6_get_outline(style, &str); + ok(hres == S_OK, "get_outline failed: %08x\n", hres); + ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + str = a2bstr("1px"); + hres = IHTMLStyle6_put_outline(style, str); + ok(hres == S_OK, "put_outline failed: %08x\n", hres); + SysFreeString(str); + + str = (void*)0xdeadbeef; + hres = IHTMLStyle6_get_outline(style, &str); + ok(hres == S_OK, "get_outline failed: %08x\n", hres); + ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); +} + static void test_body_style(IHTMLStyle *style) { IHTMLStyle2 *style2; IHTMLStyle3 *style3; IHTMLStyle4 *style4; + IHTMLStyle6 *style6; VARIANT_BOOL b; VARIANT v; BSTR str; @@ -2064,6 +2095,14 @@ static void test_body_style(IHTMLStyle *style) test_style4(style4); IHTMLStyle4_Release(style4); } + + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6); + if(SUCCEEDED(hres)) { + test_style6(style6); + IHTMLStyle6_Release(style6); + }else { + win_skip("IHTMLStyle6 not available\n"); + } } #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b) -- 2.11.4.GIT