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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
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
.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
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
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
.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
,
92 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
93 return IDispatchEx_Invoke(&This
->element
.node
.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
));
104 static HRESULT WINAPI
HTMLMetaElement_get_httpEquiv(IHTMLMetaElement
*iface
, BSTR
*p
)
106 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
107 nsAString httpequiv_str
, val_str
;
110 static const PRUnichar httpEquivW
[] = {'h','t','t','p','-','e','q','u','i','v',0};
112 TRACE("(%p)->(%p)\n", This
, p
);
114 nsAString_InitDepend(&httpequiv_str
, httpEquivW
);
115 nsAString_Init(&val_str
, NULL
);
116 nsres
= nsIDOMHTMLElement_GetAttribute(This
->element
.nselem
, &httpequiv_str
, &val_str
);
117 nsAString_Finish(&httpequiv_str
);
119 return return_nsstr(nsres
, &val_str
, p
);
122 static HRESULT WINAPI
HTMLMetaElement_put_content(IHTMLMetaElement
*iface
, BSTR v
)
124 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
125 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
129 static HRESULT WINAPI
HTMLMetaElement_get_content(IHTMLMetaElement
*iface
, BSTR
*p
)
131 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
132 nsAString content_str
, val_str
;
135 static const PRUnichar contentW
[] = {'c','o','n','t','e','n','t',0};
137 TRACE("(%p)->(%p)\n", This
, p
);
139 nsAString_InitDepend(&content_str
, contentW
);
140 nsAString_Init(&val_str
, NULL
);
141 nsres
= nsIDOMHTMLElement_GetAttribute(This
->element
.nselem
, &content_str
, &val_str
);
142 nsAString_Finish(&content_str
);
144 return return_nsstr(nsres
, &val_str
, p
);
147 static HRESULT WINAPI
HTMLMetaElement_put_name(IHTMLMetaElement
*iface
, BSTR v
)
149 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
150 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
154 static HRESULT WINAPI
HTMLMetaElement_get_name(IHTMLMetaElement
*iface
, BSTR
*p
)
156 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
157 nsAString name_str
, val_str
;
160 static const PRUnichar nameW
[] = {'n','a','m','e',0};
162 TRACE("(%p)->(%p)\n", This
, p
);
164 nsAString_InitDepend(&name_str
, nameW
);
165 nsAString_Init(&val_str
, NULL
);
166 nsres
= nsIDOMHTMLElement_GetAttribute(This
->element
.nselem
, &name_str
, &val_str
);
167 nsAString_Finish(&name_str
);
169 return return_nsstr(nsres
, &val_str
, p
);
172 static HRESULT WINAPI
HTMLMetaElement_put_url(IHTMLMetaElement
*iface
, BSTR v
)
174 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
175 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
179 static HRESULT WINAPI
HTMLMetaElement_get_url(IHTMLMetaElement
*iface
, BSTR
*p
)
181 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
182 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
HTMLMetaElement_put_charset(IHTMLMetaElement
*iface
, BSTR v
)
188 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
189 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
193 static HRESULT WINAPI
HTMLMetaElement_get_charset(IHTMLMetaElement
*iface
, BSTR
*p
)
195 HTMLMetaElement
*This
= impl_from_IHTMLMetaElement(iface
);
196 FIXME("(%p)->(%p)\n", This
, p
);
200 static const IHTMLMetaElementVtbl HTMLMetaElementVtbl
= {
201 HTMLMetaElement_QueryInterface
,
202 HTMLMetaElement_AddRef
,
203 HTMLMetaElement_Release
,
204 HTMLMetaElement_GetTypeInfoCount
,
205 HTMLMetaElement_GetTypeInfo
,
206 HTMLMetaElement_GetIDsOfNames
,
207 HTMLMetaElement_Invoke
,
208 HTMLMetaElement_put_httpEquiv
,
209 HTMLMetaElement_get_httpEquiv
,
210 HTMLMetaElement_put_content
,
211 HTMLMetaElement_get_content
,
212 HTMLMetaElement_put_name
,
213 HTMLMetaElement_get_name
,
214 HTMLMetaElement_put_url
,
215 HTMLMetaElement_get_url
,
216 HTMLMetaElement_put_charset
,
217 HTMLMetaElement_get_charset
220 static inline HTMLMetaElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
222 return CONTAINING_RECORD(iface
, HTMLMetaElement
, element
.node
);
225 static HRESULT
HTMLMetaElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
227 HTMLMetaElement
*This
= impl_from_HTMLDOMNode(iface
);
229 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
230 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
231 *ppv
= &This
->IHTMLMetaElement_iface
;
232 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
233 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
234 *ppv
= &This
->IHTMLMetaElement_iface
;
235 }else if(IsEqualGUID(&IID_IHTMLMetaElement
, riid
)) {
236 TRACE("(%p)->(IID_IHTMLMetaElement %p)\n", This
, ppv
);
237 *ppv
= &This
->IHTMLMetaElement_iface
;
239 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
242 IUnknown_AddRef((IUnknown
*)*ppv
);
246 static void HTMLMetaElement_destructor(HTMLDOMNode
*iface
)
248 HTMLMetaElement
*This
= impl_from_HTMLDOMNode(iface
);
250 HTMLElement_destructor(&This
->element
.node
);
253 static const NodeImplVtbl HTMLMetaElementImplVtbl
= {
255 HTMLMetaElement_destructor
,
257 HTMLElement_get_attr_col
260 static const tid_t HTMLMetaElement_iface_tids
[] = {
262 IHTMLMetaElement_tid
,
266 static dispex_static_data_t HTMLMetaElement_dispex
= {
268 DispHTMLMetaElement_tid
,
270 HTMLMetaElement_iface_tids
273 HRESULT
HTMLMetaElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
275 HTMLMetaElement
*ret
;
277 ret
= heap_alloc_zero(sizeof(*ret
));
279 return E_OUTOFMEMORY
;
281 ret
->IHTMLMetaElement_iface
.lpVtbl
= &HTMLMetaElementVtbl
;
282 ret
->element
.node
.vtbl
= &HTMLMetaElementImplVtbl
;
284 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLMetaElement_dispex
);
286 *elem
= &ret
->element
;