mshtml: Allow setting fontWeight to empty string.

This commit is contained in:
Jacek Caban 2014-12-08 13:39:47 +01:00 committed by Alexandre Julliard
parent f51c19b9a5
commit 7eddb864b3
2 changed files with 16 additions and 12 deletions

View File

@ -935,19 +935,13 @@ static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* fontWeight can only be one of the following */
if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(styleBold, v) == 0 ||
strcmpiW(styleBolder, v) == 0 || strcmpiW(styleLighter, v) == 0 ||
strcmpiW(style100, v) == 0 || strcmpiW(style200, v) == 0 ||
strcmpiW(style300, v) == 0 || strcmpiW(style400, v) == 0 ||
strcmpiW(style500, v) == 0 || strcmpiW(style600, v) == 0 ||
strcmpiW(style700, v) == 0 || strcmpiW(style800, v) == 0 ||
strcmpiW(style900, v) == 0
)
{
return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
}
if(v && *v && strcmpiW(szNormal, v) && strcmpiW(styleBold, v) && strcmpiW(styleBolder, v)
&& strcmpiW(styleLighter, v) && strcmpiW(style100, v) && strcmpiW(style200, v)
&& strcmpiW(style300, v) && strcmpiW(style400, v) && strcmpiW(style500, v) && strcmpiW(style600, v)
&& strcmpiW(style700, v) && strcmpiW(style800, v) && strcmpiW(style900, v))
return E_INVALIDARG;
return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
}
static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)

View File

@ -823,6 +823,16 @@ static void test_body_style(IHTMLStyle *style)
ok(!strcmp_wa(str, "900"), "str != style900\n");
SysFreeString(str);
str = a2bstr("");
hres = IHTMLStyle_put_fontWeight(style, str);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(str);
hres = IHTMLStyle_get_fontWeight(style, &str);
ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
ok(!str, "str != NULL\n");
SysFreeString(str);
hres = IHTMLStyle_put_fontWeight(style, sDefault);
ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
SysFreeString(sDefault);