mshtml: Added IHTMLFrameBase::marginHeight property implementation.
This commit is contained in:
parent
bb4a31a8ed
commit
00d3126c23
|
@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|||
static const WCHAR autoW[] = {'a','u','t','o',0};
|
||||
static const WCHAR yesW[] = {'y','e','s',0};
|
||||
static const WCHAR noW[] = {'n','o',0};
|
||||
static const WCHAR pxW[] = {'p','x',0};
|
||||
|
||||
HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
|
||||
{
|
||||
|
@ -286,15 +287,68 @@ static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIA
|
|||
static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
|
||||
{
|
||||
HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
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_SetMarginHeight(This->nsframe, &nsstr);
|
||||
else
|
||||
nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
|
||||
nsAString_Finish(&nsstr);
|
||||
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFrameBase_get_marginHeight(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_GetMarginHeight(This->nsframe, &nsstr);
|
||||
else
|
||||
nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(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("SetMarginHeight failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
nsAString_Finish(&nsstr);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
|
||||
|
|
|
@ -4448,6 +4448,34 @@ static void _test_framebase_put_name(unsigned line, IHTMLElement *elem, const ch
|
|||
IHTMLFrameBase_Release(fbase);
|
||||
}
|
||||
|
||||
#define test_framebase_marginheight(a,b) _test_framebase_marginheight(__LINE__,a,b)
|
||||
static void _test_framebase_marginheight(unsigned line, IHTMLFrameBase *framebase, const char *exval)
|
||||
{
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLFrameBase_get_marginHeight(framebase, &v);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_marginHeight failed: %08x\n", hres);
|
||||
ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(marginHeight) = %d\n", V_VT(&v));
|
||||
if(exval)
|
||||
ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exval), "marginHeight = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exval);
|
||||
else
|
||||
ok_(__FILE__,line)(!V_BSTR(&v), "marginHeight = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
|
||||
VariantClear(&v);
|
||||
}
|
||||
|
||||
#define set_framebase_marginheight(a,b) _set_framebase_marginheight(__LINE__,a,b)
|
||||
static void _set_framebase_marginheight(unsigned line, IHTMLFrameBase *framebase, const char *val)
|
||||
{
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
V_VT(&v) = VT_BSTR;
|
||||
V_BSTR(&v) = a2bstr(val);
|
||||
hres = IHTMLFrameBase_put_marginHeight(framebase, v);
|
||||
ok_(__FILE__,line)(hres == S_OK, "put_marginHeight failed: %08x\n", hres);
|
||||
VariantClear(&v);
|
||||
}
|
||||
static void test_framebase(IUnknown *unk)
|
||||
{
|
||||
IHTMLFrameBase *fbase;
|
||||
|
@ -4497,6 +4525,10 @@ static void test_framebase(IUnknown *unk)
|
|||
ok(hres == S_OK, "get_frameBorder failed: %08x\n", hres);
|
||||
ok(!strcmp_wa(str, "1"), "frameBorder = %s, expected \"1\"\n", wine_dbgstr_w(str));
|
||||
|
||||
test_framebase_marginheight(fbase, NULL);
|
||||
set_framebase_marginheight(fbase, "1px");
|
||||
test_framebase_marginheight(fbase, "1");
|
||||
|
||||
IHTMLFrameBase_Release(fbase);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue