mshtml: Use proper helpers in IHTMLStyle::backgroundColor implementation.
This commit is contained in:
parent
1cd6da2612
commit
27555a52d8
|
@ -921,30 +921,16 @@ static HRESULT WINAPI HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||||
|
|
||||||
switch(V_VT(&v)) {
|
return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, &v, ATTR_HEX_INT);
|
||||||
case VT_BSTR:
|
|
||||||
return set_style_attr(This, STYLEID_BACKGROUND_COLOR, V_BSTR(&v), 0);
|
|
||||||
case VT_I4: {
|
|
||||||
WCHAR value[10];
|
|
||||||
static const WCHAR format[] = {'#','%','0','6','x',0};
|
|
||||||
|
|
||||||
wsprintfW(value, format, V_I4(&v));
|
|
||||||
return set_style_attr(This, STYLEID_BACKGROUND_COLOR, value, 0);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
FIXME("unsupported vt %d\n", V_VT(&v));
|
|
||||||
}
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
|
static HRESULT WINAPI HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p)
|
||||||
{
|
{
|
||||||
HTMLStyle *This = impl_from_IHTMLStyle(iface);
|
HTMLStyle *This = impl_from_IHTMLStyle(iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, p);
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
V_VT(p) = VT_BSTR;
|
return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_COLOR, p, 0);
|
||||||
return get_style_attr(This, STYLEID_BACKGROUND_COLOR, &V_BSTR(p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
|
static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
|
||||||
|
|
|
@ -1256,6 +1256,18 @@ static void test_body_style(IHTMLStyle *style)
|
||||||
ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
|
ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
|
||||||
VariantClear(&v);
|
VariantClear(&v);
|
||||||
|
|
||||||
|
V_VT(&v) = VT_BSTR;
|
||||||
|
V_BSTR(&v) = a2bstr("red");
|
||||||
|
hres = IHTMLStyle_put_backgroundColor(style, v);
|
||||||
|
ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
|
||||||
|
VariantClear(&v);
|
||||||
|
|
||||||
|
hres = IHTMLStyle_get_backgroundColor(style, &v);
|
||||||
|
ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
|
||||||
|
ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
|
||||||
|
ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
|
||||||
|
VariantClear(&v);
|
||||||
|
|
||||||
/* padding */
|
/* padding */
|
||||||
hres = IHTMLStyle_get_padding(style, &str);
|
hres = IHTMLStyle_get_padding(style, &str);
|
||||||
ok(hres == S_OK, "get_padding failed: %08x\n", hres);
|
ok(hres == S_OK, "get_padding failed: %08x\n", hres);
|
||||||
|
|
Loading…
Reference in New Issue