From 2d206abeac725a15bfb2bb74387d66403d263138 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 2 Apr 2012 15:53:07 +0200 Subject: [PATCH] mshtml: Added IHTMLMetaElement stub implementation. --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/htmlelem.c | 2 + dlls/mshtml/htmlmeta.c | 255 +++++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 3 + dlls/mshtml/tests/dom.c | 15 ++- 5 files changed, 274 insertions(+), 2 deletions(-) create mode 100644 dlls/mshtml/htmlmeta.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 825aeb891b6..db2e1b55fc4 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -32,6 +32,7 @@ C_SRCS = \ htmlimg.c \ htmlinput.c \ htmllocation.c \ + htmlmeta.c \ htmlnode.c \ htmlobject.c \ htmloption.c \ diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 5f33f96e0da..1baf9e2fe45 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -45,6 +45,7 @@ static const WCHAR headW[] = {'H','E','A','D',0}; static const WCHAR iframeW[] = {'I','F','R','A','M','E',0}; static const WCHAR imgW[] = {'I','M','G',0}; static const WCHAR inputW[] = {'I','N','P','U','T',0}; +static const WCHAR metaW[] = {'M','E','T','A',0}; static const WCHAR objectW[] = {'O','B','J','E','C','T',0}; static const WCHAR optionW[] = {'O','P','T','I','O','N',0}; static const WCHAR scriptW[] = {'S','C','R','I','P','T',0}; @@ -71,6 +72,7 @@ static const tag_desc_t tag_descs[] = { {iframeW, HTMLIFrame_Create}, {imgW, HTMLImgElement_Create}, {inputW, HTMLInputElement_Create}, + {metaW, HTMLMetaElement_Create}, {objectW, HTMLObjectElement_Create}, {optionW, HTMLOptionElement_Create}, {scriptW, HTMLScriptElement_Create}, diff --git a/dlls/mshtml/htmlmeta.c b/dlls/mshtml/htmlmeta.c new file mode 100644 index 00000000000..e80ca13278a --- /dev/null +++ b/dlls/mshtml/htmlmeta.c @@ -0,0 +1,255 @@ +/* + * Copyright 2012 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +typedef struct { + HTMLElement element; + + IHTMLMetaElement IHTMLMetaElement_iface; +} HTMLMetaElement; + +static inline HTMLMetaElement *impl_from_IHTMLMetaElement(IHTMLMetaElement *iface) +{ + return CONTAINING_RECORD(iface, HTMLMetaElement, IHTMLMetaElement_iface); +} + +static HRESULT WINAPI HTMLMetaElement_QueryInterface(IHTMLMetaElement *iface, REFIID riid, void **ppv) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLMetaElement_AddRef(IHTMLMetaElement *iface) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLMetaElement_Release(IHTMLMetaElement *iface) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLMetaElement_GetTypeInfoCount(IHTMLMetaElement *iface, UINT *pctinfo) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLMetaElement_GetTypeInfo(IHTMLMetaElement *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLMetaElement_GetIDsOfNames(IHTMLMetaElement *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLMetaElement_Invoke(IHTMLMetaElement *iface, DISPID dispIdMember, REFIID riid, + LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, + UINT *puArgErr) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLMetaElement_put_httpEquiv(IHTMLMetaElement *iface, BSTR v) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_get_httpEquiv(IHTMLMetaElement *iface, BSTR *p) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR v) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p) +{ + HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = { + HTMLMetaElement_QueryInterface, + HTMLMetaElement_AddRef, + HTMLMetaElement_Release, + HTMLMetaElement_GetTypeInfoCount, + HTMLMetaElement_GetTypeInfo, + HTMLMetaElement_GetIDsOfNames, + HTMLMetaElement_Invoke, + HTMLMetaElement_put_httpEquiv, + HTMLMetaElement_get_httpEquiv, + HTMLMetaElement_put_content, + HTMLMetaElement_get_content, + HTMLMetaElement_put_name, + HTMLMetaElement_get_name, + HTMLMetaElement_put_url, + HTMLMetaElement_get_url, + HTMLMetaElement_put_charset, + HTMLMetaElement_get_charset +}; + +static inline HTMLMetaElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLMetaElement, element.node); +} + +static HRESULT HTMLMetaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) +{ + HTMLMetaElement *This = impl_from_HTMLDOMNode(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IHTMLMetaElement_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IHTMLMetaElement_iface; + }else if(IsEqualGUID(&IID_IHTMLMetaElement, riid)) { + TRACE("(%p)->(IID_IHTMLMetaElement %p)\n", This, ppv); + *ppv = &This->IHTMLMetaElement_iface; + }else { + return HTMLElement_QI(&This->element.node, riid, ppv); + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static void HTMLMetaElement_destructor(HTMLDOMNode *iface) +{ + HTMLMetaElement *This = impl_from_HTMLDOMNode(iface); + + HTMLElement_destructor(&This->element.node); +} + +static const NodeImplVtbl HTMLMetaElementImplVtbl = { + HTMLMetaElement_QI, + HTMLMetaElement_destructor, + HTMLElement_clone, + HTMLElement_get_attr_col +}; + +static const tid_t HTMLMetaElement_iface_tids[] = { + HTMLELEMENT_TIDS, + IHTMLMetaElement_tid, + 0 +}; + +static dispex_static_data_t HTMLMetaElement_dispex = { + NULL, + DispHTMLMetaElement_tid, + NULL, + HTMLMetaElement_iface_tids +}; + +HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) +{ + HTMLMetaElement *ret; + + ret = heap_alloc_zero(sizeof(*ret)); + if(!ret) + return E_OUTOFMEMORY; + + ret->IHTMLMetaElement_iface.lpVtbl = &HTMLMetaElementVtbl; + ret->element.node.vtbl = &HTMLMetaElementImplVtbl; + + HTMLElement_Init(&ret->element, doc, nselem, &HTMLMetaElement_dispex); + + *elem = &ret->element; + return S_OK; +} diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 789ffb58aa3..c8551fb6175 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -92,6 +92,7 @@ typedef struct event_target_t event_target_t; XDIID(DispHTMLImg) \ XDIID(DispHTMLInputElement) \ XDIID(DispHTMLLocation) \ + XDIID(DispHTMLMetaElement) \ XDIID(DispHTMLNavigator) \ XDIID(DispHTMLObjectElement) \ XDIID(DispHTMLOptionElement) \ @@ -148,6 +149,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLImgElement) \ XIID(IHTMLInputElement) \ XIID(IHTMLLocation) \ + XIID(IHTMLMetaElement) \ XIID(IHTMLMimeTypesCollection) \ XIID(IHTMLObjectElement) \ XIID(IHTMLObjectElement2) \ @@ -777,6 +779,7 @@ HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DE HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; +HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index adb830f7d3b..37db0921804 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -47,6 +47,7 @@ static const char range_test2_str[] = "abc
123

def"; static const char elem_test_str[] = "test" + "" "text test" "link" "" @@ -113,7 +114,8 @@ typedef enum { ET_FRAME, ET_OBJECT, ET_EMBED, - ET_DIV + ET_DIV, + ET_META } elem_type_t; static const IID * const none_iids[] = { @@ -307,6 +309,13 @@ static const IID * const title_iids[] = { NULL }; +static const IID * const meta_iids[] = { + ELEM_IFACES, + &IID_IHTMLMetaElement, + &IID_IConnectionPointContainer, + NULL +}; + static const IID * const object_iids[] = { ELEM_IFACES, &IID_IHTMLObjectElement, @@ -416,7 +425,8 @@ static const elem_type_info_t elem_type_infos[] = { {"FRAME", frame_iids, &DIID_DispHTMLFrameElement}, {"OBJECT", object_iids, &DIID_DispHTMLObjectElement}, {"EMBED", embed_iids, &DIID_DispHTMLEmbed}, - {"DIV", elem_iids, NULL} + {"DIV", elem_iids, NULL}, + {"META", meta_iids, &DIID_DispHTMLMetaElement} }; static const char *dbgstr_guid(REFIID riid) @@ -4910,6 +4920,7 @@ static void test_elems(IHTMLDocument2 *doc) ET_HEAD, ET_TITLE, ET_STYLE, + ET_META, ET_BODY, ET_COMMENT, ET_A, -- 2.11.4.GIT