mshtml: Use set_nsstyle_attr_var in IHTMLStyle::put_width implementation.

This commit is contained in:
Jacek Caban 2010-02-08 21:48:31 +01:00 committed by Alexandre Julliard
parent a3ff647c1e
commit 352e0ec893
2 changed files with 18 additions and 12 deletions

View File

@ -345,10 +345,12 @@ HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
case VT_I4: {
WCHAR str[14];
static const WCHAR format[] = {'%','d',0};
wsprintfW(str, format, V_I4(value));
return set_nsstyle_attr(nsstyle, sid, str, flags);
static const WCHAR format[] = {'%','d',0};
static const WCHAR px_format[] = {'%','d','p','x',0};
wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
return set_nsstyle_attr(nsstyle, sid, str, flags & ~ATTR_FIX_PX);
}
default:
FIXME("not implemented vt %d\n", V_VT(value));
@ -1779,15 +1781,7 @@ static HRESULT WINAPI HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v)
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
switch(V_VT(&v)) {
case VT_BSTR:
TRACE("%s\n", debugstr_w(V_BSTR(&v)));
return set_style_attr(This, STYLEID_WIDTH, V_BSTR(&v), 0);
default:
FIXME("unsupported vt %d\n", V_VT(&v));
}
return E_NOTIMPL;
return set_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, &v, ATTR_FIX_PX);
}
static HRESULT WINAPI HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p)

View File

@ -3869,6 +3869,18 @@ static void test_default_style(IHTMLStyle *style)
ok(!strcmp_wa(V_BSTR(&v), "auto"), "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_width(style, v);
ok(hres == S_OK, "put_width failed: %08x\n", hres);
V_VT(&v) = VT_EMPTY;
hres = IHTMLStyle_get_width(style, &v);
ok(hres == S_OK, "get_width 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);
/* margin tests */
str = (void*)0xdeadbeef;
hres = IHTMLStyle_get_margin(style, &str);