diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index dffc39e47f5..5bd69b16cf0 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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,
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 67315841923..9d2be6512ac 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -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 */
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index af1b99120a0..b23f63c458f 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.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);
}