Commit c11c695b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLLinkElement::rel property implementation.

parent 9608714d
...@@ -119,15 +119,29 @@ static HRESULT WINAPI HTMLLinkElement_get_href(IHTMLLinkElement *iface, BSTR *p) ...@@ -119,15 +119,29 @@ static HRESULT WINAPI HTMLLinkElement_get_href(IHTMLLinkElement *iface, BSTR *p)
static HRESULT WINAPI HTMLLinkElement_put_rel(IHTMLLinkElement *iface, BSTR v) static HRESULT WINAPI HTMLLinkElement_put_rel(IHTMLLinkElement *iface, BSTR v)
{ {
HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface); HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v)); nsAString rel_str;
return E_NOTIMPL; nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&rel_str, v);
nsres = nsIDOMHTMLLinkElement_SetRel(This->nslink, &rel_str);
nsAString_Finish(&rel_str);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
} }
static HRESULT WINAPI HTMLLinkElement_get_rel(IHTMLLinkElement *iface, BSTR *p) static HRESULT WINAPI HTMLLinkElement_get_rel(IHTMLLinkElement *iface, BSTR *p)
{ {
HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface); HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
FIXME("(%p)->(%p)\n", This, p); nsAString rel_str;
return E_NOTIMPL; nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&rel_str, NULL);
nsres = nsIDOMHTMLLinkElement_GetRel(This->nslink, &rel_str);
return return_nsstr(nsres, &rel_str, p);
} }
static HRESULT WINAPI HTMLLinkElement_put_rev(IHTMLLinkElement *iface, BSTR v) static HRESULT WINAPI HTMLLinkElement_put_rev(IHTMLLinkElement *iface, BSTR v)
......
...@@ -3453,6 +3453,37 @@ static void _link_put_disabled(unsigned line, IHTMLElement *elem, VARIANT_BOOL v ...@@ -3453,6 +3453,37 @@ static void _link_put_disabled(unsigned line, IHTMLElement *elem, VARIANT_BOOL v
_test_link_disabled(line, elem, v); _test_link_disabled(line, elem, v);
} }
#define test_link_rel(a,b) _test_link_rel(__LINE__,a,b)
static void _test_link_rel(unsigned line, IHTMLElement *elem, const char *v)
{
IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
BSTR rel;
HRESULT hres;
hres = IHTMLLinkElement_get_rel(link, &rel);
ok_(__FILE__,line)(hres == S_OK, "get_rel failed: %08x\n", hres);
if(v)
ok_(__FILE__,line)(!strcmp_wa(rel, v), "rel = %s, expected %s\n", wine_dbgstr_w(rel), v);
else
ok_(__FILE__,line)(!rel, "rel = %s, expected NULL\n", wine_dbgstr_w(rel));
IHTMLLinkElement_Release(link);
}
#define link_put_rel(a,b) _link_put_rel(__LINE__,a,b)
static void _link_put_rel(unsigned line, IHTMLElement *elem, const char *v)
{
IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
BSTR str = a2bstr(v);
HRESULT hres;
hres = IHTMLLinkElement_put_rel(link, str);
ok_(__FILE__,line)(hres == S_OK, "put_disabled failed: %08x\n", hres);
SysFreeString(str);
IHTMLLinkElement_Release(link);
_test_link_rel(line, elem, v);
}
#define get_elem_doc(e) _get_elem_doc(__LINE__,e) #define get_elem_doc(e) _get_elem_doc(__LINE__,e)
static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk) static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
{ {
...@@ -5954,7 +5985,9 @@ static void test_elems2(IHTMLDocument2 *doc) ...@@ -5954,7 +5985,9 @@ static void test_elems2(IHTMLDocument2 *doc)
elem = get_elem_by_id(doc, "linkid", TRUE); elem = get_elem_by_id(doc, "linkid", TRUE);
if(elem) { if(elem) {
test_link_disabled(elem, VARIANT_FALSE); test_link_disabled(elem, VARIANT_FALSE);
test_link_rel(elem, "stylesheet");
link_put_disabled(elem, VARIANT_TRUE); link_put_disabled(elem, VARIANT_TRUE);
link_put_rel(elem, "prev");
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment