reg/tests: Use a helper function to delete registry values.
[wine.git] / dlls / mshtml / htmlmeta.c
blob2611dcb91f4a4652051ff670179f4a519e6ea345
1 /*
2 * Copyright 2012 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 struct HTMLMetaElement {
35 HTMLElement element;
37 IHTMLMetaElement IHTMLMetaElement_iface;
40 static inline HTMLMetaElement *impl_from_IHTMLMetaElement(IHTMLMetaElement *iface)
42 return CONTAINING_RECORD(iface, HTMLMetaElement, IHTMLMetaElement_iface);
45 static HRESULT WINAPI HTMLMetaElement_QueryInterface(IHTMLMetaElement *iface, REFIID riid, void **ppv)
47 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
49 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
52 static ULONG WINAPI HTMLMetaElement_AddRef(IHTMLMetaElement *iface)
54 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
56 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
59 static ULONG WINAPI HTMLMetaElement_Release(IHTMLMetaElement *iface)
61 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
63 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
66 static HRESULT WINAPI HTMLMetaElement_GetTypeInfoCount(IHTMLMetaElement *iface, UINT *pctinfo)
68 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
69 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
72 static HRESULT WINAPI HTMLMetaElement_GetTypeInfo(IHTMLMetaElement *iface, UINT iTInfo,
73 LCID lcid, ITypeInfo **ppTInfo)
75 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
76 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
77 ppTInfo);
80 static HRESULT WINAPI HTMLMetaElement_GetIDsOfNames(IHTMLMetaElement *iface, REFIID riid,
81 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
83 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
84 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
85 cNames, lcid, rgDispId);
88 static HRESULT WINAPI HTMLMetaElement_Invoke(IHTMLMetaElement *iface, DISPID dispIdMember, REFIID riid,
89 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
90 UINT *puArgErr)
92 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
93 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
94 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
97 static HRESULT WINAPI HTMLMetaElement_put_httpEquiv(IHTMLMetaElement *iface, BSTR v)
99 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
100 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
101 return E_NOTIMPL;
104 static HRESULT WINAPI HTMLMetaElement_get_httpEquiv(IHTMLMetaElement *iface, BSTR *p)
106 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
107 static const PRUnichar httpEquivW[] = {'h','t','t','p','-','e','q','u','i','v',0};
109 TRACE("(%p)->(%p)\n", This, p);
111 return elem_string_attr_getter(&This->element, httpEquivW, TRUE, p);
114 static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR v)
116 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
117 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p)
123 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
124 static const PRUnichar contentW[] = {'c','o','n','t','e','n','t',0};
126 TRACE("(%p)->(%p)\n", This, p);
128 return elem_string_attr_getter(&This->element, contentW, TRUE, p);
131 static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
133 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
134 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
135 return E_NOTIMPL;
138 static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p)
140 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
141 static const PRUnichar nameW[] = {'n','a','m','e',0};
143 TRACE("(%p)->(%p)\n", This, p);
145 return elem_string_attr_getter(&This->element, nameW, TRUE, p);
148 static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v)
150 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
151 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
152 return E_NOTIMPL;
155 static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p)
157 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
158 FIXME("(%p)->(%p)\n", This, p);
159 return E_NOTIMPL;
162 static const WCHAR charsetW[] = {'c','h','a','r','s','e','t',0};
164 static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v)
166 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
168 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
170 return elem_string_attr_setter(&This->element, charsetW, v);
173 static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p)
175 HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
177 TRACE("(%p)->(%p)\n", This, p);
179 return elem_string_attr_getter(&This->element, charsetW, TRUE, p);
182 static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = {
183 HTMLMetaElement_QueryInterface,
184 HTMLMetaElement_AddRef,
185 HTMLMetaElement_Release,
186 HTMLMetaElement_GetTypeInfoCount,
187 HTMLMetaElement_GetTypeInfo,
188 HTMLMetaElement_GetIDsOfNames,
189 HTMLMetaElement_Invoke,
190 HTMLMetaElement_put_httpEquiv,
191 HTMLMetaElement_get_httpEquiv,
192 HTMLMetaElement_put_content,
193 HTMLMetaElement_get_content,
194 HTMLMetaElement_put_name,
195 HTMLMetaElement_get_name,
196 HTMLMetaElement_put_url,
197 HTMLMetaElement_get_url,
198 HTMLMetaElement_put_charset,
199 HTMLMetaElement_get_charset
202 static inline HTMLMetaElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
204 return CONTAINING_RECORD(iface, HTMLMetaElement, element.node);
207 static HRESULT HTMLMetaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
209 HTMLMetaElement *This = impl_from_HTMLDOMNode(iface);
211 if(IsEqualGUID(&IID_IUnknown, riid)) {
212 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
213 *ppv = &This->IHTMLMetaElement_iface;
214 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
215 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
216 *ppv = &This->IHTMLMetaElement_iface;
217 }else if(IsEqualGUID(&IID_IHTMLMetaElement, riid)) {
218 TRACE("(%p)->(IID_IHTMLMetaElement %p)\n", This, ppv);
219 *ppv = &This->IHTMLMetaElement_iface;
220 }else {
221 return HTMLElement_QI(&This->element.node, riid, ppv);
224 IUnknown_AddRef((IUnknown*)*ppv);
225 return S_OK;
228 static void HTMLMetaElement_destructor(HTMLDOMNode *iface)
230 HTMLMetaElement *This = impl_from_HTMLDOMNode(iface);
232 HTMLElement_destructor(&This->element.node);
235 static const NodeImplVtbl HTMLMetaElementImplVtbl = {
236 &CLSID_HTMLMetaElement,
237 HTMLMetaElement_QI,
238 HTMLMetaElement_destructor,
239 HTMLElement_cpc,
240 HTMLElement_clone,
241 HTMLElement_handle_event,
242 HTMLElement_get_attr_col
245 static const tid_t HTMLMetaElement_iface_tids[] = {
246 HTMLELEMENT_TIDS,
247 IHTMLMetaElement_tid,
251 static dispex_static_data_t HTMLMetaElement_dispex = {
252 NULL,
253 DispHTMLMetaElement_tid,
254 HTMLMetaElement_iface_tids,
255 HTMLElement_init_dispex_info
258 HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
260 HTMLMetaElement *ret;
262 ret = heap_alloc_zero(sizeof(*ret));
263 if(!ret)
264 return E_OUTOFMEMORY;
266 ret->IHTMLMetaElement_iface.lpVtbl = &HTMLMetaElementVtbl;
267 ret->element.node.vtbl = &HTMLMetaElementImplVtbl;
269 HTMLElement_Init(&ret->element, doc, nselem, &HTMLMetaElement_dispex);
271 *elem = &ret->element;
272 return S_OK;