mshtml: Properly handle NULL value in set_nsstyle_attr.

This commit is contained in:
Jacek Caban 2012-12-06 14:24:14 +01:00 committed by Alexandre Julliard
parent 36a47dd0f2
commit 10a832cc04
2 changed files with 20 additions and 5 deletions

View File

@ -351,16 +351,18 @@ static LPWSTR fix_url_value(LPCWSTR val)
return ret;
}
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, const WCHAR *value, DWORD flags)
{
nsAString str_name, str_value, str_empty;
LPWSTR val = NULL;
nsresult nsres;
if(flags & ATTR_FIX_PX)
val = fix_px_value(value);
if(flags & ATTR_FIX_URL)
val = fix_url_value(value);
if(value) {
if(flags & ATTR_FIX_PX)
val = fix_px_value(value);
if(flags & ATTR_FIX_URL)
val = fix_url_value(value);
}
nsAString_InitDepend(&str_name, style_tbl[sid].name);
nsAString_InitDepend(&str_value, val ? val : value);

View File

@ -1052,6 +1052,19 @@ static void test_body_style(IHTMLStyle *style)
ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = NULL;
hres = IHTMLStyle_put_height(style, v);
ok(hres == S_OK, "put_height failed: %08x\n", hres);
VariantClear(&v);
V_VT(&v) = VT_EMPTY;
hres = IHTMLStyle_get_height(style, &v);
ok(hres == S_OK, "get_height failed: %08x\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
V_VT(&v) = VT_I4;
V_I4(&v) = 64;
hres = IHTMLStyle_put_height(style, v);