Jacek Caban : mshtml: Added IHTMLStyleElement::type property implementation .
Alexandre Julliard
julliard at winehq.org
Fri Dec 17 11:30:47 CST 2010
Module: wine
Branch: master
Commit: 98e1433779e5db8e387a66723d7b230c691082f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=98e1433779e5db8e387a66723d7b230c691082f6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Dec 17 03:39:36 2010 +0100
mshtml: Added IHTMLStyleElement::type property implementation.
---
dlls/mshtml/htmlstyleelem.c | 26 ++++++++++++++++++++++----
dlls/mshtml/tests/dom.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c
index a4cc98e..294a9d5 100644
--- a/dlls/mshtml/htmlstyleelem.c
+++ b/dlls/mshtml/htmlstyleelem.c
@@ -98,15 +98,33 @@ static HRESULT WINAPI HTMLStyleElement_Invoke(IHTMLStyleElement *iface, DISPID d
static HRESULT WINAPI HTMLStyleElement_put_type(IHTMLStyleElement *iface, BSTR v)
{
HTMLStyleElement *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ nsAString type_str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ nsAString_InitDepend(&type_str, v);
+ nsres = nsIDOMHTMLStyleElement_SetType(This->nsstyle, &type_str);
+ nsAString_Finish(&type_str);
+ if(NS_FAILED(nsres)) {
+ ERR("SetType failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLStyleElement_get_type(IHTMLStyleElement *iface, BSTR *p)
{
HTMLStyleElement *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsAString nsstr;
+ nsresult nsres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ nsAString_Init(&nsstr, NULL);
+ nsres = nsIDOMHTMLStyleElement_GetType(This->nsstyle, &nsstr);
+ return return_nsstr(nsres, &nsstr, p);
}
static HRESULT WINAPI HTMLStyleElement_get_readyState(IHTMLStyleElement *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 536d528..6601d2d 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2480,6 +2480,40 @@ static void _test_style_put_media(unsigned line, IUnknown *unk, const char *medi
_test_style_media(line, unk, media);
}
+#define test_style_type(s,m) _test_style_type(__LINE__,s,m)
+static void _test_style_type(unsigned line, IUnknown *unk, const char *extype)
+{
+ IHTMLStyleElement *style = _get_style_iface(line, unk);
+ BSTR type;
+ HRESULT hres;
+
+ hres = IHTMLStyleElement_get_type(style, &type);
+ ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
+ if(extype)
+ ok_(__FILE__,line)(!strcmp_wa(type, extype), "type = %s, expected %s\n", wine_dbgstr_w(type), extype);
+ else
+ ok_(__FILE__,line)(!type, "type = %s, expected NULL\n", wine_dbgstr_w(type));
+
+ IHTMLStyleElement_Release(style);
+ SysFreeString(type);
+}
+
+#define test_style_put_type(s,m) _test_style_put_type(__LINE__,s,m)
+static void _test_style_put_type(unsigned line, IUnknown *unk, const char *type)
+{
+ IHTMLStyleElement *style = _get_style_iface(line, unk);
+ BSTR str;
+ HRESULT hres;
+
+ str = a2bstr(type);
+ hres = IHTMLStyleElement_put_type(style, str);
+ ok_(__FILE__,line)(hres == S_OK, "put_type failed: %08x\n", hres);
+ IHTMLStyleElement_Release(style);
+ SysFreeString(str);
+
+ _test_style_type(line, unk, type);
+}
+
#define test_elem_filters(u) _test_elem_filters(__LINE__,u)
static void _test_elem_filters(unsigned line, IUnknown *unk)
{
@@ -6328,6 +6362,8 @@ static void test_elems(IHTMLDocument2 *doc)
if(elem) {
test_style_media((IUnknown*)elem, NULL);
test_style_put_media((IUnknown*)elem, "screen");
+ test_style_type((IUnknown*)elem, NULL);
+ test_style_put_type((IUnknown*)elem, "text/css");
IHTMLElement_Release(elem);
}
More information about the wine-cvs
mailing list