Commit 81cdfc61 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLFrameBase::marginWidth property implementation.

parent 00d3126c
......@@ -273,15 +273,68 @@ static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARI
static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
{
HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
if(V_VT(&v) != VT_BSTR) {
FIXME("unsupported %s\n", debugstr_variant(&v));
return E_NOTIMPL;
}
nsAString_InitDepend(&nsstr, V_BSTR(&v));
if(This->nsframe)
nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
else
nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
nsAString_Finish(&nsstr);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
}
static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
{
HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
HRESULT hres = S_OK;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&nsstr, NULL);
if(This->nsframe)
nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
else
nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *str, *end;
nsAString_GetData(&nsstr, &str);
if(*str) {
BSTR ret;
end = strstrW(str, pxW);
if(!end)
end = str+strlenW(str);
ret = SysAllocStringLen(str, end-str);
if(ret) {
V_VT(p) = VT_BSTR;
V_BSTR(p) = ret;
}else {
hres = E_OUTOFMEMORY;
}
}else {
V_VT(p) = VT_BSTR;
V_BSTR(p) = NULL;
}
}else {
ERR("GetMarginWidth failed: %08x\n", nsres);
hres = E_FAIL;
}
nsAString_Finish(&nsstr);
return hres;
}
static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
......
......@@ -4476,6 +4476,36 @@ static void _set_framebase_marginheight(unsigned line, IHTMLFrameBase *framebase
ok_(__FILE__,line)(hres == S_OK, "put_marginHeight failed: %08x\n", hres);
VariantClear(&v);
}
#define test_framebase_marginwidth(a,b) _test_framebase_marginwidth(__LINE__,a,b)
static void _test_framebase_marginwidth(unsigned line, IHTMLFrameBase *framebase, const char *exval)
{
VARIANT v;
HRESULT hres;
hres = IHTMLFrameBase_get_marginWidth(framebase, &v);
ok_(__FILE__,line)(hres == S_OK, "get_marginWidth failed: %08x\n", hres);
ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(marginWidth) = %d\n", V_VT(&v));
if(exval)
ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exval), "marginWidth = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exval);
else
ok_(__FILE__,line)(!V_BSTR(&v), "marginWidth = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
}
#define set_framebase_marginwidth(a,b) _set_framebase_marginwidth(__LINE__,a,b)
static void _set_framebase_marginwidth(unsigned line, IHTMLFrameBase *framebase, const char *val)
{
VARIANT v;
HRESULT hres;
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr(val);
hres = IHTMLFrameBase_put_marginWidth(framebase, v);
ok_(__FILE__,line)(hres == S_OK, "put_marginWidth failed: %08x\n", hres);
VariantClear(&v);
}
static void test_framebase(IUnknown *unk)
{
IHTMLFrameBase *fbase;
......@@ -4529,6 +4559,10 @@ static void test_framebase(IUnknown *unk)
set_framebase_marginheight(fbase, "1px");
test_framebase_marginheight(fbase, "1");
test_framebase_marginwidth(fbase, NULL);
set_framebase_marginwidth(fbase, "2px");
test_framebase_marginwidth(fbase, "2");
IHTMLFrameBase_Release(fbase);
}
......
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