mshtml: Implement IHTMLStyle get/put overflow.

This commit is contained in:
Alistair Leslie-Hughes 2008-11-25 21:04:11 +11:00 committed by Alexandre Julliard
parent 2392214427
commit 9305cb3cfe
3 changed files with 70 additions and 4 deletions

View File

@ -73,6 +73,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 attrOverflow[] =
{'o','v','e','r','f','l','o','w',0};
static const WCHAR attrPaddingLeft[] =
{'p','a','d','d','i','n','g','-','l','e','f','t',0};
static const WCHAR attrPosition[] =
@ -115,6 +117,7 @@ static const struct{
{attrMargin, DISPID_IHTMLSTYLE_MARGIN},
{attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
{attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
{attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
{attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
{attrPosition, DISPID_IHTMLSTYLE2_POSITION},
{attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
@ -1733,15 +1736,34 @@ static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
static const WCHAR szAuto[] = {'a','u','t','o',0};
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* overflow can only be one of the follow values. */
if(!v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
{
return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
}
return E_INVALIDARG;
}
static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_INVALIDARG;
return get_style_attr(This, STYLEID_OVERFLOW, p);
}
static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)

View File

@ -50,6 +50,7 @@ typedef enum {
STYLEID_MARGIN,
STYLEID_MARGIN_LEFT,
STYLEID_MARGIN_RIGHT,
STYLEID_OVERFLOW,
STYLEID_PADDING_LEFT,
STYLEID_POSITION,
STYLEID_TEXT_ALIGN,

View File

@ -2293,6 +2293,7 @@ static void test_default_style(IHTMLStyle *style)
BSTR str;
HRESULT hres;
float f;
BSTR sOverflowDefault;
test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
test_ifaces((IUnknown*)style, style_iids);
@ -2601,6 +2602,48 @@ static void test_default_style(IHTMLStyle *style)
ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
VariantClear(&v);
/* overflow */
hres = IHTMLStyle_get_overflow(style, NULL);
ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
str = a2bstr("test");
hres = IHTMLStyle_put_overflow(style, str);
ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("visible");
hres = IHTMLStyle_put_overflow(style, str);
ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("scroll");
hres = IHTMLStyle_put_overflow(style, str);
ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("hidden");
hres = IHTMLStyle_put_overflow(style, str);
ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
SysFreeString(str);
str = a2bstr("auto");
hres = IHTMLStyle_put_overflow(style, str);
ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
SysFreeString(str);
hres = IHTMLStyle_get_overflow(style, &str);
ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
ok(!strcmp_wa(str, "auto"), "str=%s\n", dbgstr_w(str));
SysFreeString(str);
/* restore overflow default */
hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
SysFreeString(sOverflowDefault);
hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
if(SUCCEEDED(hres)) {