Jacek Caban : mshtml: Use generic value checks for IHTMLStyle:: put_fontVariant implementation.

Alexandre Julliard julliard at winehq.org
Tue Aug 28 16:53:01 CDT 2018


Module: wine
Branch: master
Commit: ab2bd77c0869517a5bbe225591df9c2fead796ec
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ab2bd77c0869517a5bbe225591df9c2fead796ec

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug 28 12:44:03 2018 +0200

mshtml: Use generic value checks for IHTMLStyle::put_fontVariant implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlstyle.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index a137b56..b89ffbc 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -207,6 +207,7 @@ static const WCHAR word_wrapW[] =
 static const WCHAR z_indexW[] =
     {'z','-','i','n','d','e','x',0};
 
+static const WCHAR capsW[]  = {'s','m','a','l','l','-','c','a','p','s',0};
 static const WCHAR italicW[]  = {'i','t','a','l','i','c',0};
 static const WCHAR normalW[] = {'n','o','r','m','a','l',0};
 static const WCHAR obliqueW[]  = {'o','b','l','i','q','u','e',0};
@@ -218,6 +219,12 @@ static const WCHAR *font_style_values[] = {
     NULL
 };
 
+static const WCHAR *font_variant_values[] = {
+    capsW,
+    normalW,
+    NULL
+};
+
 #define ATTR_FIX_PX         0x0001
 #define ATTR_FIX_URL        0x0002
 #define ATTR_STR_TO_INT     0x0004
@@ -276,7 +283,7 @@ static const style_tbl_entry_t style_tbl[] = {
     {font_familyW,            DISPID_IHTMLSTYLE_FONTFAMILY},
     {font_sizeW,              DISPID_IHTMLSTYLE_FONTSIZE,              ATTR_FIX_PX},
     {font_styleW,             DISPID_IHTMLSTYLE_FONTSTYLE,             0, font_style_values},
-    {font_variantW,           DISPID_IHTMLSTYLE_FONTVARIANT},
+    {font_variantW,           DISPID_IHTMLSTYLE_FONTVARIANT,           0, font_variant_values},
     {font_weightW,            DISPID_IHTMLSTYLE_FONTWEIGHT,            ATTR_STR_TO_INT},
     {heightW,                 DISPID_IHTMLSTYLE_HEIGHT,                ATTR_FIX_PX},
     {leftW,                   DISPID_IHTMLSTYLE_LEFT},
@@ -925,17 +932,10 @@ static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p)
 static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    static const WCHAR szCaps[]  = {'s','m','a','l','l','-','c','a','p','s',0};
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
 
-    /* fontVariant can only be one of the follow values. */
-    if(!v || strcmpiW(normalW, v) == 0 || strcmpiW(szCaps, v) == 0)
-    {
-        return set_style_property(This, STYLEID_FONT_VARIANT, v);
-    }
-
-    return E_INVALIDARG;
+    return set_style_property(This, STYLEID_FONT_VARIANT, v);
 }
 
 static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p)




More information about the wine-cvs mailing list