Jacek Caban : mshtml: Added IHTMLLinkElement::type property implementation.

Alexandre Julliard julliard at winehq.org
Mon Oct 15 14:29:06 CDT 2012


Module: wine
Branch: master
Commit: 9277bf2e010388997f64445b3a2f1834167f71be
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9277bf2e010388997f64445b3a2f1834167f71be

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct 15 11:17:24 2012 +0200

mshtml: Added IHTMLLinkElement::type property implementation.

---

 dlls/mshtml/htmllink.c  |   22 ++++++++++++++++++----
 dlls/mshtml/tests/dom.c |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c
index 383617a..a200b50 100644
--- a/dlls/mshtml/htmllink.c
+++ b/dlls/mshtml/htmllink.c
@@ -161,15 +161,29 @@ static HRESULT WINAPI HTMLLinkElement_get_rev(IHTMLLinkElement *iface, BSTR *p)
 static HRESULT WINAPI HTMLLinkElement_put_type(IHTMLLinkElement *iface, BSTR v)
 {
     HTMLLinkElement *This = impl_from_IHTMLLinkElement(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 = nsIDOMHTMLLinkElement_SetType(This->nslink, &type_str);
+    nsAString_Finish(&type_str);
+
+    return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
 }
 
 static HRESULT WINAPI HTMLLinkElement_get_type(IHTMLLinkElement *iface, BSTR *p)
 {
     HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString type_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&type_str, NULL);
+    nsres = nsIDOMHTMLLinkElement_GetType(This->nslink, &type_str);
+    return return_nsstr(nsres, &type_str, p);
 }
 
 static HRESULT WINAPI HTMLLinkElement_get_readyState(IHTMLLinkElement *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 30a0f0f..cc6c836 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3484,6 +3484,37 @@ static void _link_put_rel(unsigned line, IHTMLElement *elem, const char *v)
     _test_link_rel(line, elem, v);
 }
 
+#define test_link_type(a,b) _test_link_type(__LINE__,a,b)
+static void _test_link_type(unsigned line, IHTMLElement *elem, const char *v)
+{
+    IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
+    BSTR type;
+    HRESULT hres;
+
+    hres = IHTMLLinkElement_get_type(link, &type);
+    ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
+    if(v)
+        ok_(__FILE__,line)(!strcmp_wa(type, v), "type = %s, expected %s\n", wine_dbgstr_w(type), v);
+    else
+        ok_(__FILE__,line)(!type, "type = %s, expected NULL\n", wine_dbgstr_w(type));
+
+    IHTMLLinkElement_Release(link);
+}
+
+#define link_put_type(a,b) _link_put_type(__LINE__,a,b)
+static void _link_put_type(unsigned line, IHTMLElement *elem, const char *v)
+{
+    IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
+    BSTR str = a2bstr(v);
+    HRESULT hres;
+
+    hres = IHTMLLinkElement_put_type(link, str);
+    ok_(__FILE__,line)(hres == S_OK, "put_disabled failed: %08x\n", hres);
+    SysFreeString(str);
+    IHTMLLinkElement_Release(link);
+    _test_link_type(line, elem, v);
+}
+
 #define get_elem_doc(e) _get_elem_doc(__LINE__,e)
 static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
 {
@@ -5986,8 +6017,10 @@ static void test_elems2(IHTMLDocument2 *doc)
     if(elem) {
         test_link_disabled(elem, VARIANT_FALSE);
         test_link_rel(elem, "stylesheet");
+        test_link_type(elem, "text/css");
         link_put_disabled(elem, VARIANT_TRUE);
         link_put_rel(elem, "prev");
+        link_put_type(elem, "text/plain");
         IHTMLElement_Release(elem);
     }
 




More information about the wine-cvs mailing list