Commit 8c475300 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

mshtml: Implement IHTMLStyle get/put minHeight.

parent 63075222
......@@ -83,6 +83,8 @@ static const WCHAR attrMarginLeft[] =
{'m','a','r','g','i','n','-','l','e','f','t',0};
static const WCHAR attrMarginRight[] =
{'m','a','r','g','i','n','-','r','i','g','h','t',0};
static const WCHAR attrMinHeight[] =
{'m','i','n','-','h','e','i','g','h','t',0};
static const WCHAR attrOverflow[] =
{'o','v','e','r','f','l','o','w',0};
static const WCHAR attrPaddingLeft[] =
......@@ -132,6 +134,7 @@ static const struct{
{attrMargin, DISPID_IHTMLSTYLE_MARGIN},
{attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
{attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
{attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT},
{attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
{attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
{attrPosition, DISPID_IHTMLSTYLE2_POSITION},
......@@ -242,7 +245,7 @@ HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCW
return S_OK;
}
static HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags)
{
switch(V_VT(value)) {
case VT_NULL:
......@@ -308,7 +311,7 @@ HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR
return S_OK;
}
static HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
{
nsAString str_value;
const PRUnichar *value;
......
......@@ -59,6 +59,7 @@ typedef enum {
STYLEID_MARGIN,
STYLEID_MARGIN_LEFT,
STYLEID_MARGIN_RIGHT,
STYLEID_MIN_HEIGHT,
STYLEID_OVERFLOW,
STYLEID_PADDING_LEFT,
STYLEID_POSITION,
......@@ -76,3 +77,6 @@ void HTMLStyle3_Init(HTMLStyle*);
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*);
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD);
HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags);
HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags);
......@@ -409,15 +409,19 @@ static HRESULT WINAPI HTMLStyle4_get_textOverflow(IHTMLStyle4 *iface, BSTR *p)
static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v)
{
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
return set_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_HEIGHT, &v, 0);
}
static HRESULT WINAPI HTMLStyle4_get_minHeight(IHTMLStyle4 *iface, VARIANT *p)
{
HTMLStyle *This = HTMLSTYLE4_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return get_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_HEIGHT, p, 0);
}
static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = {
......
......@@ -2403,9 +2403,35 @@ static void test_style2(IHTMLStyle2 *style2)
SysFreeString(str);
}
static void test_style4(IHTMLStyle4 *style4)
{
HRESULT hres;
VARIANT v;
VARIANT vdefault;
hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr("10px");
hres = IHTMLStyle4_put_minHeight(style4, v);
ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
VariantClear(&v);
hres = IHTMLStyle4_get_minHeight(style4, &v);
ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", dbgstr_w(V_BSTR(&v)));
hres = IHTMLStyle4_put_minHeight(style4, vdefault);
ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
VariantClear(&vdefault);
}
static void test_default_style(IHTMLStyle *style)
{
IHTMLStyle2 *style2;
IHTMLStyle4 *style4;
VARIANT_BOOL b;
VARIANT v;
BSTR str;
......@@ -3034,6 +3060,13 @@ static void test_default_style(IHTMLStyle *style)
test_style2(style2);
IHTMLStyle2_Release(style2);
}
hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
if(SUCCEEDED(hres)) {
test_style4(style4);
IHTMLStyle4_Release(style4);
}
}
static void test_default_selection(IHTMLDocument2 *doc)
......
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