Jacek Caban : mshtml: Use helpers for IHTMLStyle:: put_verticalAlign property implementation.
Alexandre Julliard
julliard at winehq.org
Wed Apr 4 13:07:04 CDT 2012
Module: wine
Branch: master
Commit: 3d2d9596fdac0a93f8b6242b6e8be83b73f063b2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3d2d9596fdac0a93f8b6242b6e8be83b73f063b2
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Apr 4 10:30:47 2012 +0200
mshtml: Use helpers for IHTMLStyle::put_verticalAlign property implementation.
---
dlls/mshtml/htmlstyle.c | 20 ++------------------
dlls/mshtml/tests/style.c | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 627d42c..68a2c6b 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -1350,32 +1350,16 @@ static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
- switch(V_VT(&v)) {
- case VT_BSTR:
- return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
- default:
- FIXME("not implemented vt %d\n", V_VT(&v));
- return E_NOTIMPL;
- }
-
- return S_OK;
+ return set_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, &v, ATTR_FIX_PX);
}
static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
{
HTMLStyle *This = impl_from_IHTMLStyle(iface);
- BSTR ret;
- HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
- hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
- if(FAILED(hres))
- return hres;
-
- V_VT(p) = VT_BSTR;
- V_BSTR(p) = ret;
- return S_OK;
+ return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0);
}
static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index bb80df1..9c7da84 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -1022,6 +1022,19 @@ static void test_body_style(IHTMLStyle *style)
ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
+ V_VT(&v) = VT_I4;
+ V_I4(&v) = 100;
+ hres = IHTMLStyle_put_verticalAlign(style, v);
+ ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
+ VariantClear(&v);
+
+ V_VT(&v) = VT_EMPTY;
+ hres = IHTMLStyle_get_verticalAlign(style, &v);
+ ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
+ ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+ ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ VariantClear(&v);
+
str = (void*)0xdeadbeef;
hres = IHTMLStyle_get_textAlign(style, &str);
ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
@@ -2099,7 +2112,7 @@ static void test_current_style(IHTMLCurrentStyle *current_style)
hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
- ok(!strcmp_wa(V_BSTR(&v), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
+ ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
More information about the wine-cvs
mailing list