mshtml: Added IHTMLMetaElement::get_content implementation.

This commit is contained in:
Jacek Caban 2012-04-03 12:03:50 +02:00 committed by Alexandre Julliard
parent f4c20b02db
commit 5bbcdf7b9e
2 changed files with 30 additions and 2 deletions

View File

@ -118,8 +118,19 @@ static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR
static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p) static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p)
{ {
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
FIXME("(%p)->(%p)\n", This, p); nsAString content_str, val_str;
return E_NOTIMPL; nsresult nsres;
static const PRUnichar contentW[] = {'c','o','n','t','e','n','t',0};
TRACE("(%p)->(%p)\n", This, p);
nsAString_InitDepend(&content_str, contentW);
nsAString_Init(&val_str, NULL);
nsres = nsIDOMHTMLElement_GetAttribute(This->element.nselem, &content_str, &val_str);
nsAString_Finish(&content_str);
return return_nsstr(nsres, &val_str, p);
} }
static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v) static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)

View File

@ -3259,6 +3259,22 @@ static void _test_meta_name(unsigned line, IUnknown *unk, const char *exname)
IHTMLMetaElement_Release(meta); IHTMLMetaElement_Release(meta);
} }
#define test_meta_content(a,b) _test_meta_content(__LINE__,a,b)
static void _test_meta_content(unsigned line, IUnknown *unk, const char *excontent)
{
IHTMLMetaElement *meta;
BSTR content = NULL;
HRESULT hres;
meta = _get_metaelem_iface(line, unk);
hres = IHTMLMetaElement_get_content(meta, &content);
ok_(__FILE__,line)(hres == S_OK, "get_content failed: %08x\n", hres);
ok_(__FILE__,line)(!strcmp_wa(content, excontent), "content = %s, expected %s\n", wine_dbgstr_w(content), excontent);
SysFreeString(content);
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)
{ {
@ -5289,6 +5305,7 @@ static void test_elems(IHTMLDocument2 *doc)
elem = get_doc_elem_by_id(doc, "metaid"); elem = get_doc_elem_by_id(doc, "metaid");
if(elem) { if(elem) {
test_meta_name((IUnknown*)elem, "meta name"); test_meta_name((IUnknown*)elem, "meta name");
test_meta_content((IUnknown*)elem, "text/html; charset=utf-8");
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }