mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 05:00:30 +00:00
mshtml: Added IHTMLTableRow::bgColor property implementation.
This commit is contained in:
parent
0d2ff50e22
commit
946378a1b2
@ -124,7 +124,7 @@ static int loose_hex_to_rgb(const WCHAR *hex)
|
||||
| comp_value(hex+2*dpc, dpc);
|
||||
}
|
||||
|
||||
static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
|
||||
HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
|
||||
{
|
||||
unsigned int i;
|
||||
int rgb = -1;
|
||||
@ -155,7 +155,7 @@ static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
|
||||
BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
|
||||
{
|
||||
switch(V_VT(v)) {
|
||||
case VT_BSTR:
|
||||
|
@ -170,15 +170,48 @@ static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
|
||||
static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
|
||||
{
|
||||
HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
nsAString val;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
nsAString_InitDepend(&val, V_BSTR(&v));
|
||||
variant_to_nscolor(&v, &val);
|
||||
nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val);
|
||||
nsAString_Finish(&val);
|
||||
|
||||
if (NS_FAILED(nsres)){
|
||||
ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
|
||||
{
|
||||
HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString strColor;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
const PRUnichar *color;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&strColor, NULL);
|
||||
nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor);
|
||||
nsAString_Finish(&strColor);
|
||||
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsAString_GetData(&strColor, &color);
|
||||
V_VT(p) = VT_BSTR;
|
||||
hres = nscolor_to_str(color, &V_BSTR(p));
|
||||
}else {
|
||||
ERR("SetBgColor failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
|
||||
|
@ -862,6 +862,10 @@ HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HI
|
||||
|
||||
HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
|
||||
HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
|
||||
|
||||
|
||||
struct HTMLAttributeCollection {
|
||||
DispatchEx dispex;
|
||||
IHTMLAttributeCollection IHTMLAttributeCollection_iface;
|
||||
|
@ -5578,6 +5578,7 @@ static void test_tr_elem(IHTMLElement *elem)
|
||||
HRESULT hres;
|
||||
BSTR bstr;
|
||||
LONG lval;
|
||||
VARIANT vbg, vDefaultbg;
|
||||
|
||||
static const elem_type_t cell_types[] = {ET_TD,ET_TD};
|
||||
|
||||
@ -5628,6 +5629,40 @@ static void test_tr_elem(IHTMLElement *elem)
|
||||
ok(hres == S_OK, "get_sectionRowIndex failed: %08x\n", hres);
|
||||
ok(lval == 1, "get_sectionRowIndex returned %d\n", lval);
|
||||
|
||||
hres = IHTMLTableRow_get_bgColor(row, &vDefaultbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "bstr != NULL\n");
|
||||
ok(!V_BSTR(&vDefaultbg), "V_BSTR(bgColor) = %s\n", wine_dbgstr_w(V_BSTR(&vDefaultbg)));
|
||||
|
||||
V_VT(&vbg) = VT_BSTR;
|
||||
V_BSTR(&vbg) = a2bstr("red");
|
||||
hres = IHTMLTableRow_put_bgColor(row, vbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vbg);
|
||||
|
||||
hres = IHTMLTableRow_get_bgColor(row, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n");
|
||||
ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg)));
|
||||
VariantClear(&vbg);
|
||||
|
||||
V_VT(&vbg) = VT_I4;
|
||||
V_I4(&vbg) = 0xff0000;
|
||||
hres = IHTMLTableRow_put_bgColor(row, vbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vbg);
|
||||
|
||||
hres = IHTMLTableRow_get_bgColor(row, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n");
|
||||
ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg)));
|
||||
VariantClear(&vbg);
|
||||
|
||||
/* Restore Originial */
|
||||
hres = IHTMLTableRow_put_bgColor(row, vDefaultbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vDefaultbg);
|
||||
|
||||
IHTMLTableRow_Release(row);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user