mshtml: Use default white value in IHTMLDocument2::get_bgColor.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49062 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7f465761c2
commit
d90c1e1c7f
|
@ -711,34 +711,26 @@ static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
|
|||
static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
|
||||
{
|
||||
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
||||
IHTMLElement *element = NULL;
|
||||
IHTMLBodyElement *body;
|
||||
HRESULT hr;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
hr = IHTMLDocument2_get_body(iface, &element);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to get body (0x%08x)\n", hr);
|
||||
return hr;
|
||||
if(!This->doc_node->nsdoc) {
|
||||
WARN("NULL nsdoc\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
if(!element)
|
||||
{
|
||||
FIXME("Empty body element.\n");
|
||||
return hr;
|
||||
nsAString_Init(&nsstr, NULL);
|
||||
nsres = nsIDOMHTMLDocument_GetBgColor(This->doc_node->nsdoc, &nsstr);
|
||||
hres = return_nsstr_variant(nsres, &nsstr, NSSTR_COLOR, p);
|
||||
if(hres == S_OK && V_VT(p) == VT_BSTR && !V_BSTR(p)) {
|
||||
TRACE("default #ffffff");
|
||||
if(!(V_BSTR(p) = SysAllocString(L"#ffffff")))
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = IHTMLElement_QueryInterface(element, &IID_IHTMLBodyElement, (void**)&body);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = IHTMLBodyElement_get_bgColor(body, p);
|
||||
IHTMLBodyElement_Release(body);
|
||||
}
|
||||
IHTMLElement_Release(element);
|
||||
|
||||
return hr;
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
|
||||
|
|
|
@ -6695,6 +6695,10 @@ static void test_body_funs(IHTMLBodyElement *body, IHTMLDocument2 *doc)
|
|||
ok(V_VT(&vDefaultbg) == VT_BSTR, "bstr != NULL\n");
|
||||
ok(!V_BSTR(&vDefaultbg), "V_BSTR(bgColor) = %s\n", wine_dbgstr_w(V_BSTR(&vDefaultbg)));
|
||||
|
||||
hres = IHTMLDocument2_get_bgColor(doc, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vbg) == VT_BSTR && V_BSTR(&vbg) && !wcscmp(V_BSTR(&vbg), L"#ffffff"), "bgColor = %s\n", wine_dbgstr_variant(&vbg));
|
||||
|
||||
V_VT(&vbg) = VT_BSTR;
|
||||
V_BSTR(&vbg) = SysAllocString(L"red");
|
||||
hres = IHTMLBodyElement_put_bgColor(body, vbg);
|
||||
|
@ -6707,6 +6711,10 @@ static void test_body_funs(IHTMLBodyElement *body, IHTMLDocument2 *doc)
|
|||
ok(!lstrcmpW(V_BSTR(&vbg), L"#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg)));
|
||||
VariantClear(&vbg);
|
||||
|
||||
hres = IHTMLDocument2_get_bgColor(doc, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vbg) == VT_BSTR && V_BSTR(&vbg) && !wcscmp(V_BSTR(&vbg), L"#ff0000"), "bgColor = %s\n", wine_dbgstr_variant(&vbg));
|
||||
|
||||
hres = IHTMLDocument2_get_bgColor(doc, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vbg) == VT_BSTR, "V_VT(&vbg) != VT_BSTR\n");
|
||||
|
|
Loading…
Reference in New Issue