mshtml: Use return_nsstr_variant in IHTMLBodyElement::get_bgColor.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e767e81cc
commit
7f465761c2
|
@ -407,27 +407,14 @@ static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIA
|
|||
static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
|
||||
{
|
||||
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
|
||||
nsAString strColor;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&strColor, NULL);
|
||||
nsres = nsIDOMHTMLBodyElement_GetBgColor(This->nsbody, &strColor);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
const PRUnichar *color;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
nsAString_Finish(&strColor);
|
||||
return hres;
|
||||
nsAString_Init(&nsstr, NULL);
|
||||
nsres = nsIDOMHTMLBodyElement_GetBgColor(This->nsbody, &nsstr);
|
||||
return return_nsstr_variant(nsres, &nsstr, NSSTR_COLOR, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
|
||||
|
|
|
@ -982,6 +982,7 @@ UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
|
|||
void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
|
||||
|
||||
#define NSSTR_IMPLICIT_PX 0x01
|
||||
#define NSSTR_COLOR 0x02
|
||||
|
||||
HRESULT map_nsresult(nsresult) DECLSPEC_HIDDEN;
|
||||
HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -964,14 +964,15 @@ HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p)
|
|||
|
||||
HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, unsigned flags, VARIANT *p)
|
||||
{
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("failed: %08x\n", nsres);
|
||||
nsAString_Finish(nsstr);
|
||||
return E_FAIL;
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
|
||||
if(NS_StringGetIsVoid(nsstr)) {
|
||||
TRACE("ret null\n");
|
||||
V_VT(p) = VT_NULL;
|
||||
}else {
|
||||
const WCHAR *str;
|
||||
|
@ -989,20 +990,23 @@ HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, unsigned flags, V
|
|||
if(iter == str + len && dot) len = dot - str;
|
||||
}
|
||||
}
|
||||
TRACE("ret %s\n", debugstr_wn(str, len));
|
||||
if(*str) {
|
||||
if(flags & NSSTR_COLOR) {
|
||||
hres = nscolor_to_str(str, &V_BSTR(p));
|
||||
}else if(*str) {
|
||||
V_BSTR(p) = SysAllocStringLen(str, len);
|
||||
if(!V_BSTR(p)) {
|
||||
nsAString_Finish(nsstr);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
if(!V_BSTR(p))
|
||||
hres = E_OUTOFMEMORY;
|
||||
}else {
|
||||
V_BSTR(p) = NULL;
|
||||
}
|
||||
V_VT(p) = VT_BSTR;
|
||||
if(SUCCEEDED(hres))
|
||||
V_VT(p) = VT_BSTR;
|
||||
}
|
||||
|
||||
nsAString_Finish(nsstr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
TRACE("ret %s\n", debugstr_variant(p));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue