Module: wine Branch: master Commit: f82df0ac6313cbfb82f0ee07459c43ae0537b1a7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f82df0ac6313cbfb82f0ee0745...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Thu Dec 11 22:16:28 2008 +1100
mshtml: Implement IHTMLStyle put_fontStyle.
---
dlls/mshtml/htmlstyle.c | 17 +++++++++++++++-- dlls/mshtml/tests/dom.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 4d7fd1a..208b6fb 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -133,6 +133,8 @@ static const WCHAR valLineThrough[] = {'l','i','n','e','-','t','h','r','o','u','g','h',0}; static const WCHAR valUnderline[] = {'u','n','d','e','r','l','i','n','e',0}; +static const WCHAR szNormal[] = + {'n','o','r','m','a','l',0};
static const WCHAR px_formatW[] = {'%','d','p','x',0}; static const WCHAR emptyW[] = {0}; @@ -515,8 +517,19 @@ static HRESULT WINAPI HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + static const WCHAR szItalic[] = {'i','t','a','l','i','c',0}; + static const WCHAR szOblique[] = {'o','b','l','i','q','u','e',0}; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + /* fontStyle can only be one of the follow values. */ + if(!v || strcmpiW(szNormal, v) == 0 || strcmpiW(szItalic, v) == 0 || + strcmpiW(szOblique, v) == 0) + { + return set_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, v, 0); + } + + return E_INVALIDARG; }
static HRESULT WINAPI HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c1f5105..7410687 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2294,6 +2294,7 @@ static void test_default_style(IHTMLStyle *style) HRESULT hres; float f; BSTR sOverflowDefault; + BSTR sDefault;
test_disp((IUnknown*)style, &DIID_DispHTMLStyle); test_ifaces((IUnknown*)style, style_iids); @@ -2636,6 +2637,33 @@ static void test_default_style(IHTMLStyle *style) ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v)); VariantClear(&v);
+ /* fontStyle */ + hres = IHTMLStyle_get_fontStyle(style, &sDefault); + ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres); + + str = a2bstr("test"); + hres = IHTMLStyle_put_fontStyle(style, str); + ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("italic"); + hres = IHTMLStyle_put_fontStyle(style, str); + ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("oblique"); + hres = IHTMLStyle_put_fontStyle(style, str); + ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres); + SysFreeString(str); + + str = a2bstr("normal"); + hres = IHTMLStyle_put_fontStyle(style, str); + ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_put_fontStyle(style, sDefault); + ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres); + /* overflow */ hres = IHTMLStyle_get_overflow(style, NULL); ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);