1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * Copyright 2012 Jacek Caban for CodeWeavers
3*c2c66affSColin Finck *
4*c2c66affSColin Finck * This library is free software; you can redistribute it and/or
5*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
6*c2c66affSColin Finck * License as published by the Free Software Foundation; either
7*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
8*c2c66affSColin Finck *
9*c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
10*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12*c2c66affSColin Finck * Lesser General Public License for more details.
13*c2c66affSColin Finck *
14*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
15*c2c66affSColin Finck * License along with this library; if not, write to the Free Software
16*c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17*c2c66affSColin Finck */
18*c2c66affSColin Finck
19*c2c66affSColin Finck #include "mshtml_private.h"
20*c2c66affSColin Finck
21*c2c66affSColin Finck typedef struct {
22*c2c66affSColin Finck HTMLElement element;
23*c2c66affSColin Finck
24*c2c66affSColin Finck IHTMLMetaElement IHTMLMetaElement_iface;
25*c2c66affSColin Finck } HTMLMetaElement;
26*c2c66affSColin Finck
impl_from_IHTMLMetaElement(IHTMLMetaElement * iface)27*c2c66affSColin Finck static inline HTMLMetaElement *impl_from_IHTMLMetaElement(IHTMLMetaElement *iface)
28*c2c66affSColin Finck {
29*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLMetaElement, IHTMLMetaElement_iface);
30*c2c66affSColin Finck }
31*c2c66affSColin Finck
HTMLMetaElement_QueryInterface(IHTMLMetaElement * iface,REFIID riid,void ** ppv)32*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_QueryInterface(IHTMLMetaElement *iface, REFIID riid, void **ppv)
33*c2c66affSColin Finck {
34*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
35*c2c66affSColin Finck
36*c2c66affSColin Finck return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
37*c2c66affSColin Finck }
38*c2c66affSColin Finck
HTMLMetaElement_AddRef(IHTMLMetaElement * iface)39*c2c66affSColin Finck static ULONG WINAPI HTMLMetaElement_AddRef(IHTMLMetaElement *iface)
40*c2c66affSColin Finck {
41*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
42*c2c66affSColin Finck
43*c2c66affSColin Finck return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
44*c2c66affSColin Finck }
45*c2c66affSColin Finck
HTMLMetaElement_Release(IHTMLMetaElement * iface)46*c2c66affSColin Finck static ULONG WINAPI HTMLMetaElement_Release(IHTMLMetaElement *iface)
47*c2c66affSColin Finck {
48*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
49*c2c66affSColin Finck
50*c2c66affSColin Finck return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
51*c2c66affSColin Finck }
52*c2c66affSColin Finck
HTMLMetaElement_GetTypeInfoCount(IHTMLMetaElement * iface,UINT * pctinfo)53*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_GetTypeInfoCount(IHTMLMetaElement *iface, UINT *pctinfo)
54*c2c66affSColin Finck {
55*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
56*c2c66affSColin Finck return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
57*c2c66affSColin Finck }
58*c2c66affSColin Finck
HTMLMetaElement_GetTypeInfo(IHTMLMetaElement * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)59*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_GetTypeInfo(IHTMLMetaElement *iface, UINT iTInfo,
60*c2c66affSColin Finck LCID lcid, ITypeInfo **ppTInfo)
61*c2c66affSColin Finck {
62*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
63*c2c66affSColin Finck return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
64*c2c66affSColin Finck ppTInfo);
65*c2c66affSColin Finck }
66*c2c66affSColin Finck
HTMLMetaElement_GetIDsOfNames(IHTMLMetaElement * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)67*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_GetIDsOfNames(IHTMLMetaElement *iface, REFIID riid,
68*c2c66affSColin Finck LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
69*c2c66affSColin Finck {
70*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
71*c2c66affSColin Finck return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
72*c2c66affSColin Finck cNames, lcid, rgDispId);
73*c2c66affSColin Finck }
74*c2c66affSColin Finck
HTMLMetaElement_Invoke(IHTMLMetaElement * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)75*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_Invoke(IHTMLMetaElement *iface, DISPID dispIdMember, REFIID riid,
76*c2c66affSColin Finck LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
77*c2c66affSColin Finck UINT *puArgErr)
78*c2c66affSColin Finck {
79*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
80*c2c66affSColin Finck return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
81*c2c66affSColin Finck lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
82*c2c66affSColin Finck }
83*c2c66affSColin Finck
HTMLMetaElement_put_httpEquiv(IHTMLMetaElement * iface,BSTR v)84*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_put_httpEquiv(IHTMLMetaElement *iface, BSTR v)
85*c2c66affSColin Finck {
86*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
87*c2c66affSColin Finck FIXME("(%p)->(%s)\n", This, debugstr_w(v));
88*c2c66affSColin Finck return E_NOTIMPL;
89*c2c66affSColin Finck }
90*c2c66affSColin Finck
HTMLMetaElement_get_httpEquiv(IHTMLMetaElement * iface,BSTR * p)91*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_get_httpEquiv(IHTMLMetaElement *iface, BSTR *p)
92*c2c66affSColin Finck {
93*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
94*c2c66affSColin Finck static const PRUnichar httpEquivW[] = {'h','t','t','p','-','e','q','u','i','v',0};
95*c2c66affSColin Finck
96*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, p);
97*c2c66affSColin Finck
98*c2c66affSColin Finck return elem_string_attr_getter(&This->element, httpEquivW, TRUE, p);
99*c2c66affSColin Finck }
100*c2c66affSColin Finck
HTMLMetaElement_put_content(IHTMLMetaElement * iface,BSTR v)101*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR v)
102*c2c66affSColin Finck {
103*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
104*c2c66affSColin Finck FIXME("(%p)->(%s)\n", This, debugstr_w(v));
105*c2c66affSColin Finck return E_NOTIMPL;
106*c2c66affSColin Finck }
107*c2c66affSColin Finck
HTMLMetaElement_get_content(IHTMLMetaElement * iface,BSTR * p)108*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p)
109*c2c66affSColin Finck {
110*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
111*c2c66affSColin Finck static const PRUnichar contentW[] = {'c','o','n','t','e','n','t',0};
112*c2c66affSColin Finck
113*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, p);
114*c2c66affSColin Finck
115*c2c66affSColin Finck return elem_string_attr_getter(&This->element, contentW, TRUE, p);
116*c2c66affSColin Finck }
117*c2c66affSColin Finck
HTMLMetaElement_put_name(IHTMLMetaElement * iface,BSTR v)118*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
119*c2c66affSColin Finck {
120*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
121*c2c66affSColin Finck FIXME("(%p)->(%s)\n", This, debugstr_w(v));
122*c2c66affSColin Finck return E_NOTIMPL;
123*c2c66affSColin Finck }
124*c2c66affSColin Finck
HTMLMetaElement_get_name(IHTMLMetaElement * iface,BSTR * p)125*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p)
126*c2c66affSColin Finck {
127*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
128*c2c66affSColin Finck static const PRUnichar nameW[] = {'n','a','m','e',0};
129*c2c66affSColin Finck
130*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, p);
131*c2c66affSColin Finck
132*c2c66affSColin Finck return elem_string_attr_getter(&This->element, nameW, TRUE, p);
133*c2c66affSColin Finck }
134*c2c66affSColin Finck
HTMLMetaElement_put_url(IHTMLMetaElement * iface,BSTR v)135*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v)
136*c2c66affSColin Finck {
137*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
138*c2c66affSColin Finck FIXME("(%p)->(%s)\n", This, debugstr_w(v));
139*c2c66affSColin Finck return E_NOTIMPL;
140*c2c66affSColin Finck }
141*c2c66affSColin Finck
HTMLMetaElement_get_url(IHTMLMetaElement * iface,BSTR * p)142*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p)
143*c2c66affSColin Finck {
144*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
145*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, p);
146*c2c66affSColin Finck return E_NOTIMPL;
147*c2c66affSColin Finck }
148*c2c66affSColin Finck
149*c2c66affSColin Finck static const WCHAR charsetW[] = {'c','h','a','r','s','e','t',0};
150*c2c66affSColin Finck
HTMLMetaElement_put_charset(IHTMLMetaElement * iface,BSTR v)151*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v)
152*c2c66affSColin Finck {
153*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
154*c2c66affSColin Finck
155*c2c66affSColin Finck TRACE("(%p)->(%s)\n", This, debugstr_w(v));
156*c2c66affSColin Finck
157*c2c66affSColin Finck return elem_string_attr_setter(&This->element, charsetW, v);
158*c2c66affSColin Finck }
159*c2c66affSColin Finck
HTMLMetaElement_get_charset(IHTMLMetaElement * iface,BSTR * p)160*c2c66affSColin Finck static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p)
161*c2c66affSColin Finck {
162*c2c66affSColin Finck HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
163*c2c66affSColin Finck
164*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, p);
165*c2c66affSColin Finck
166*c2c66affSColin Finck return elem_string_attr_getter(&This->element, charsetW, TRUE, p);
167*c2c66affSColin Finck }
168*c2c66affSColin Finck
169*c2c66affSColin Finck static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = {
170*c2c66affSColin Finck HTMLMetaElement_QueryInterface,
171*c2c66affSColin Finck HTMLMetaElement_AddRef,
172*c2c66affSColin Finck HTMLMetaElement_Release,
173*c2c66affSColin Finck HTMLMetaElement_GetTypeInfoCount,
174*c2c66affSColin Finck HTMLMetaElement_GetTypeInfo,
175*c2c66affSColin Finck HTMLMetaElement_GetIDsOfNames,
176*c2c66affSColin Finck HTMLMetaElement_Invoke,
177*c2c66affSColin Finck HTMLMetaElement_put_httpEquiv,
178*c2c66affSColin Finck HTMLMetaElement_get_httpEquiv,
179*c2c66affSColin Finck HTMLMetaElement_put_content,
180*c2c66affSColin Finck HTMLMetaElement_get_content,
181*c2c66affSColin Finck HTMLMetaElement_put_name,
182*c2c66affSColin Finck HTMLMetaElement_get_name,
183*c2c66affSColin Finck HTMLMetaElement_put_url,
184*c2c66affSColin Finck HTMLMetaElement_get_url,
185*c2c66affSColin Finck HTMLMetaElement_put_charset,
186*c2c66affSColin Finck HTMLMetaElement_get_charset
187*c2c66affSColin Finck };
188*c2c66affSColin Finck
impl_from_HTMLDOMNode(HTMLDOMNode * iface)189*c2c66affSColin Finck static inline HTMLMetaElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
190*c2c66affSColin Finck {
191*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLMetaElement, element.node);
192*c2c66affSColin Finck }
193*c2c66affSColin Finck
HTMLMetaElement_QI(HTMLDOMNode * iface,REFIID riid,void ** ppv)194*c2c66affSColin Finck static HRESULT HTMLMetaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
195*c2c66affSColin Finck {
196*c2c66affSColin Finck HTMLMetaElement *This = impl_from_HTMLDOMNode(iface);
197*c2c66affSColin Finck
198*c2c66affSColin Finck if(IsEqualGUID(&IID_IUnknown, riid)) {
199*c2c66affSColin Finck TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
200*c2c66affSColin Finck *ppv = &This->IHTMLMetaElement_iface;
201*c2c66affSColin Finck }else if(IsEqualGUID(&IID_IDispatch, riid)) {
202*c2c66affSColin Finck TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
203*c2c66affSColin Finck *ppv = &This->IHTMLMetaElement_iface;
204*c2c66affSColin Finck }else if(IsEqualGUID(&IID_IHTMLMetaElement, riid)) {
205*c2c66affSColin Finck TRACE("(%p)->(IID_IHTMLMetaElement %p)\n", This, ppv);
206*c2c66affSColin Finck *ppv = &This->IHTMLMetaElement_iface;
207*c2c66affSColin Finck }else {
208*c2c66affSColin Finck return HTMLElement_QI(&This->element.node, riid, ppv);
209*c2c66affSColin Finck }
210*c2c66affSColin Finck
211*c2c66affSColin Finck IUnknown_AddRef((IUnknown*)*ppv);
212*c2c66affSColin Finck return S_OK;
213*c2c66affSColin Finck }
214*c2c66affSColin Finck
HTMLMetaElement_destructor(HTMLDOMNode * iface)215*c2c66affSColin Finck static void HTMLMetaElement_destructor(HTMLDOMNode *iface)
216*c2c66affSColin Finck {
217*c2c66affSColin Finck HTMLMetaElement *This = impl_from_HTMLDOMNode(iface);
218*c2c66affSColin Finck
219*c2c66affSColin Finck HTMLElement_destructor(&This->element.node);
220*c2c66affSColin Finck }
221*c2c66affSColin Finck
222*c2c66affSColin Finck static const NodeImplVtbl HTMLMetaElementImplVtbl = {
223*c2c66affSColin Finck HTMLMetaElement_QI,
224*c2c66affSColin Finck HTMLMetaElement_destructor,
225*c2c66affSColin Finck HTMLElement_cpc,
226*c2c66affSColin Finck HTMLElement_clone,
227*c2c66affSColin Finck HTMLElement_handle_event,
228*c2c66affSColin Finck HTMLElement_get_attr_col
229*c2c66affSColin Finck };
230*c2c66affSColin Finck
231*c2c66affSColin Finck static const tid_t HTMLMetaElement_iface_tids[] = {
232*c2c66affSColin Finck HTMLELEMENT_TIDS,
233*c2c66affSColin Finck IHTMLMetaElement_tid,
234*c2c66affSColin Finck 0
235*c2c66affSColin Finck };
236*c2c66affSColin Finck
237*c2c66affSColin Finck static dispex_static_data_t HTMLMetaElement_dispex = {
238*c2c66affSColin Finck NULL,
239*c2c66affSColin Finck DispHTMLMetaElement_tid,
240*c2c66affSColin Finck NULL,
241*c2c66affSColin Finck HTMLMetaElement_iface_tids
242*c2c66affSColin Finck };
243*c2c66affSColin Finck
HTMLMetaElement_Create(HTMLDocumentNode * doc,nsIDOMHTMLElement * nselem,HTMLElement ** elem)244*c2c66affSColin Finck HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
245*c2c66affSColin Finck {
246*c2c66affSColin Finck HTMLMetaElement *ret;
247*c2c66affSColin Finck
248*c2c66affSColin Finck ret = heap_alloc_zero(sizeof(*ret));
249*c2c66affSColin Finck if(!ret)
250*c2c66affSColin Finck return E_OUTOFMEMORY;
251*c2c66affSColin Finck
252*c2c66affSColin Finck ret->IHTMLMetaElement_iface.lpVtbl = &HTMLMetaElementVtbl;
253*c2c66affSColin Finck ret->element.node.vtbl = &HTMLMetaElementImplVtbl;
254*c2c66affSColin Finck
255*c2c66affSColin Finck HTMLElement_Init(&ret->element, doc, nselem, &HTMLMetaElement_dispex);
256*c2c66affSColin Finck
257*c2c66affSColin Finck *elem = &ret->element;
258*c2c66affSColin Finck return S_OK;
259*c2c66affSColin Finck }
260