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

mshtml: Added IHTMLMetaElement::get_name implementation.

parent 31bfc380
...@@ -132,8 +132,19 @@ static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v) ...@@ -132,8 +132,19 @@ static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p) static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p)
{ {
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
FIXME("(%p)->(%p)\n", This, p); nsAString name_str, val_str;
return E_NOTIMPL; nsresult nsres;
static const PRUnichar nameW[] = {'n','a','m','e',0};
TRACE("(%p)->(%p)\n", This, p);
nsAString_InitDepend(&name_str, nameW);
nsAString_Init(&val_str, NULL);
nsres = nsIDOMHTMLElement_GetAttribute(This->element.nselem, &name_str, &val_str);
nsAString_Finish(&name_str);
return return_nsstr(nsres, &val_str, p);
} }
static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v) static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v)
......
...@@ -47,7 +47,7 @@ static const char range_test2_str[] = ...@@ -47,7 +47,7 @@ static const char range_test2_str[] =
"<html><body>abc<hr />123<br /><hr />def</body></html>"; "<html><body>abc<hr />123<br /><hr />def</body></html>";
static const char elem_test_str[] = static const char elem_test_str[] =
"<html><head><title>test</title><style id=\"styleid\">.body { margin-right: 0px; }</style>" "<html><head><title>test</title><style id=\"styleid\">.body { margin-right: 0px; }</style>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" "<meta id=\"metaid\" name=\"meta name\" http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"
"<body onload=\"Testing()\">text test<!-- a comment -->" "<body onload=\"Testing()\">text test<!-- a comment -->"
"<a id=\"a\" href=\"http://test\" name=\"x\">link</a>" "<a id=\"a\" href=\"http://test\" name=\"x\">link</a>"
"<input id=\"in\" class=\"testclass\" tabIndex=\"2\" title=\"test title\" />" "<input id=\"in\" class=\"testclass\" tabIndex=\"2\" title=\"test title\" />"
...@@ -839,6 +839,17 @@ static IHTMLStyleElement *_get_style_iface(unsigned line, IUnknown *unk) ...@@ -839,6 +839,17 @@ static IHTMLStyleElement *_get_style_iface(unsigned line, IUnknown *unk)
return obj; return obj;
} }
#define get_metaelem_iface(u) _get_metaelem_iface(__LINE__,u)
static IHTMLMetaElement *_get_metaelem_iface(unsigned line, IUnknown *unk)
{
IHTMLMetaElement *ret;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLMetaElement, (void**)&ret);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLMetaElement: %08x\n", hres);
return ret;
}
#define test_node_name(u,n) _test_node_name(__LINE__,u,n) #define test_node_name(u,n) _test_node_name(__LINE__,u,n)
static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname)
{ {
...@@ -3232,6 +3243,22 @@ static void _test_form_elements(unsigned line, IUnknown *unk) ...@@ -3232,6 +3243,22 @@ static void _test_form_elements(unsigned line, IUnknown *unk)
IHTMLFormElement_Release(form); IHTMLFormElement_Release(form);
} }
#define test_meta_name(a,b) _test_meta_name(__LINE__,a,b)
static void _test_meta_name(unsigned line, IUnknown *unk, const char *exname)
{
IHTMLMetaElement *meta;
BSTR name = NULL;
HRESULT hres;
meta = _get_metaelem_iface(line, unk);
hres = IHTMLMetaElement_get_name(meta, &name);
ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres);
ok_(__FILE__,line)(!strcmp_wa(name, exname), "name = %s, expected %s\n", wine_dbgstr_w(name), exname);
SysFreeString(name);
IHTMLMetaElement_Release(meta);
}
#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)
{ {
...@@ -5259,6 +5286,12 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -5259,6 +5286,12 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
elem = get_doc_elem_by_id(doc, "metaid");
if(elem) {
test_meta_name((IUnknown*)elem, "meta name");
IHTMLElement_Release(elem);
}
elem = doc_get_body(doc); elem = doc_get_body(doc);
node = get_first_child((IUnknown*)elem); node = get_first_child((IUnknown*)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