Module: wine Branch: master Commit: 8e984bcc6127484eeb4f57741b2db8e580308cb7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e984bcc6127484eeb4f57741b...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Thu Dec 11 22:37:18 2008 +1100
mshtml: Implement IHTMLStyle get/put fontVariant.
---
dlls/mshtml/htmlstyle.c | 24 ++++++++++++++++++++---- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/dom.c | 26 ++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 208b6fb..c8f8594 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -61,6 +61,8 @@ static const WCHAR attrFontSize[] = {'f','o','n','t','-','s','i','z','e',0}; static const WCHAR attrFontStyle[] = {'f','o','n','t','-','s','t','y','l','e',0}; +static const WCHAR attrFontVariant[] = + {'f','o','n','t','-','v','a','r','i','a','n','t',0}; static const WCHAR attrFontWeight[] = {'f','o','n','t','-','w','e','i','g','h','t',0}; static const WCHAR attrHeight[] = @@ -111,6 +113,7 @@ static const struct{ {attrFontFamily, DISPID_IHTMLSTYLE_FONTFAMILY}, {attrFontSize, DISPID_IHTMLSTYLE_FONTSIZE}, {attrFontStyle, DISPID_IHTMLSTYLE_FONTSTYLE}, + {attrFontVariant, DISPID_IHTMLSTYLE_FONTVARIANT}, {attrFontWeight, DISPID_IHTMLSTYLE_FONTWEIGHT}, {attrHeight, DISPID_IHTMLSTYLE_HEIGHT}, {attrLeft, DISPID_IHTMLSTYLE_LEFT}, @@ -544,15 +547,28 @@ static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + 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(szNormal, v) == 0 || strcmpiW(szCaps, v) == 0) + { + return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, v, 0); + } + + return E_INVALIDARG; }
static HRESULT WINAPI HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + + if(!p) + return E_INVALIDARG; + + return get_style_attr(This, STYLEID_FONT_VARIANT, p); }
static HRESULT WINAPI HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v) diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 6c45553..5fe1f24 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -44,6 +44,7 @@ typedef enum { STYLEID_FONT_FAMILY, STYLEID_FONT_SIZE, STYLEID_FONT_STYLE, + STYLEID_FONT_VARIANT, STYLEID_FONT_WEIGHT, STYLEID_HEIGHT, STYLEID_LEFT, diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7410687..4378be1 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2309,6 +2309,32 @@ static void test_default_style(IHTMLStyle *style) ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres); ok(!str, "fontWeight = %s\n", dbgstr_w(str));
+ /* font Variant */ + hres = IHTMLStyle_get_fontVariant(style, NULL); + ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres); + + hres = IHTMLStyle_get_fontVariant(style, &sDefault); + ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres); + + str = a2bstr("test"); + hres = IHTMLStyle_put_fontVariant(style, str); + ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("small-caps"); + hres = IHTMLStyle_put_fontVariant(style, str); + ok(hres == S_OK, "fontVariant failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("normal"); + hres = IHTMLStyle_put_fontVariant(style, str); + ok(hres == S_OK, "fontVariant failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_put_fontVariant(style, sDefault); + ok(hres == S_OK, "fontVariant failed: %08x\n", hres); + SysFreeString(sDefault); + str = (void*)0xdeadbeef; hres = IHTMLStyle_get_display(style, &str); ok(hres == S_OK, "get_display failed: %08x\n", hres);