Commit 352e0ec8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use set_nsstyle_attr_var in IHTMLStyle::put_width implementation.

parent a3ff647c
......@@ -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};
static const WCHAR px_format[] = {'%','d','p','x',0};
wsprintfW(str, format, V_I4(value));
return set_nsstyle_attr(nsstyle, sid, str, flags);
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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment