mshtml: Use helpers for IHTMLStyle::put_verticalAlign property implementation.

This commit is contained in:
Jacek Caban 2012-04-04 10:30:47 +02:00 committed by Alexandre Julliard
parent e87cb774d1
commit 3d2d9596fd
2 changed files with 16 additions and 19 deletions

View File

@ -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)

View File

@ -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);