Jacek Caban : mshtml: Allow setting fontWeight to empty string.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 8 16:10:36 CST 2014


Module: wine
Branch: master
Commit: 7eddb864b36d159fa6e6807f65e117ca0a81485c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7eddb864b36d159fa6e6807f65e117ca0a81485c

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec  8 13:39:47 2014 +0100

mshtml: Allow setting fontWeight to empty string.

---

 dlls/mshtml/htmlstyle.c   | 18 ++++++------------
 dlls/mshtml/tests/style.c | 10 ++++++++++
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 45e5b9a..0e74899 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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 E_INVALIDARG;
+    return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_WEIGHT, v, 0);
 }
 
 static HRESULT WINAPI HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index ec66a71..0eea1c5 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -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);




More information about the wine-cvs mailing list