mirror of
https://github.com/reactos/wine.git
synced 2025-02-05 11:40:06 +00:00
mshtml: Store style filter in HTMLStyle object.
This commit is contained in:
parent
624287499e
commit
0131e0472f
@ -633,6 +633,7 @@ static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
|
||||
if(!ref) {
|
||||
if(This->nsstyle)
|
||||
nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
|
||||
heap_free(This->filter);
|
||||
release_dispex(&This->dispex);
|
||||
heap_free(This);
|
||||
}
|
||||
@ -2547,21 +2548,36 @@ static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
|
||||
static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = impl_from_IHTMLStyle(iface);
|
||||
WCHAR *new_filter = NULL;
|
||||
|
||||
WARN("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
/* FIXME: Handle MS-style filters */
|
||||
return set_style_attr(This, STYLEID_FILTER, v, 0);
|
||||
if(v) {
|
||||
new_filter = heap_strdupW(v);
|
||||
if(!new_filter)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
heap_free(This->filter);
|
||||
This->filter = new_filter;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = impl_from_IHTMLStyle(iface);
|
||||
|
||||
WARN("(%p)->(%p)\n", This, p);
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
/* FIXME: Handle MS-style filters */
|
||||
return get_style_attr(This, STYLEID_FILTER, p);
|
||||
if(This->filter) {
|
||||
*p = SysAllocString(This->filter);
|
||||
if(!*p)
|
||||
return E_OUTOFMEMORY;
|
||||
}else {
|
||||
*p = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName,
|
||||
|
@ -26,6 +26,7 @@ struct HTMLStyle {
|
||||
LONG ref;
|
||||
|
||||
nsIDOMCSSStyleDeclaration *nsstyle;
|
||||
WCHAR *filter;
|
||||
};
|
||||
|
||||
/* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */
|
||||
|
@ -5569,6 +5569,53 @@ static void test_default_style(IHTMLStyle *style)
|
||||
}
|
||||
}
|
||||
|
||||
#define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
|
||||
static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
|
||||
{
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
str = (void*)0xdeadbeef;
|
||||
hres = IHTMLStyle_get_filter(style, &str);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
|
||||
if(exval)
|
||||
ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
|
||||
else
|
||||
ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
|
||||
|
||||
SysFreeString(str);
|
||||
}
|
||||
|
||||
#define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
|
||||
static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
|
||||
{
|
||||
BSTR str = a2bstr(val);
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLStyle_put_filter(style, str);
|
||||
ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
_test_style_filter(line, style, val);
|
||||
}
|
||||
|
||||
static void test_style_filters(IHTMLElement *elem)
|
||||
{
|
||||
IHTMLStyle *style;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLElement_get_style(elem, &style);
|
||||
ok(hres == S_OK, "get_style failed: %08x\n", hres);
|
||||
|
||||
test_style_filter(style, NULL);
|
||||
set_style_filter(style, "alpha(opacity=50.00000)");
|
||||
set_style_filter(style, "alpha(opacity=100)");
|
||||
set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
|
||||
set_style_filter(style, NULL);
|
||||
|
||||
IHTMLStyle_Release(style);
|
||||
}
|
||||
|
||||
static void test_set_csstext(IHTMLStyle *style)
|
||||
{
|
||||
VARIANT v;
|
||||
@ -6770,6 +6817,7 @@ static void test_elems2(IHTMLDocument2 *doc)
|
||||
}
|
||||
|
||||
test_attr(div);
|
||||
test_style_filters(div);
|
||||
|
||||
IHTMLElement_Release(div);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user