2 * Copyright 2008 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
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
41 const IHTMLScriptElementVtbl *lpHTMLScriptElementVtbl;
43 nsIDOMHTMLScriptElement *nsscript;
46 #define HTMLSCRIPT(x) ((IHTMLScriptElement*) &(x)->lpHTMLScriptElementVtbl)
48 #define HTMLSCRIPT_THIS(iface) DEFINE_THIS(HTMLScriptElement, HTMLScriptElement, iface)
50 static HRESULT WINAPI HTMLScriptElement_QueryInterface(IHTMLScriptElement *iface,
51 REFIID riid, void **ppv)
53 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
55 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
58 static ULONG WINAPI HTMLScriptElement_AddRef(IHTMLScriptElement *iface)
60 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
62 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
65 static ULONG WINAPI HTMLScriptElement_Release(IHTMLScriptElement *iface)
67 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
69 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
72 static HRESULT WINAPI HTMLScriptElement_GetTypeInfoCount(IHTMLScriptElement *iface, UINT *pctinfo)
74 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
75 FIXME("(%p)->(%p)\n", This, pctinfo);
79 static HRESULT WINAPI HTMLScriptElement_GetTypeInfo(IHTMLScriptElement *iface, UINT iTInfo,
80 LCID lcid, ITypeInfo **ppTInfo)
82 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
83 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
87 static HRESULT WINAPI HTMLScriptElement_GetIDsOfNames(IHTMLScriptElement *iface, REFIID riid,
88 LPOLESTR *rgszNames, UINT cNames,
89 LCID lcid, DISPID *rgDispId)
91 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
92 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
97 static HRESULT WINAPI HTMLScriptElement_Invoke(IHTMLScriptElement *iface, DISPID dispIdMember,
98 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
99 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
101 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
102 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
103 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
107 static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR v)
109 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
110 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
114 static HRESULT WINAPI HTMLScriptElement_get_src(IHTMLScriptElement *iface, BSTR *p)
116 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
117 FIXME("(%p)->(%p)\n", This, p);
121 static HRESULT WINAPI HTMLScriptElement_put_htmlFor(IHTMLScriptElement *iface, BSTR v)
123 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
124 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
128 static HRESULT WINAPI HTMLScriptElement_get_htmlFor(IHTMLScriptElement *iface, BSTR *p)
130 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
131 FIXME("(%p)->(%p)\n", This, p);
135 static HRESULT WINAPI HTMLScriptElement_put_event(IHTMLScriptElement *iface, BSTR v)
137 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
138 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
142 static HRESULT WINAPI HTMLScriptElement_get_event(IHTMLScriptElement *iface, BSTR *p)
144 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
145 FIXME("(%p)->(%p)\n", This, p);
149 static HRESULT WINAPI HTMLScriptElement_put_text(IHTMLScriptElement *iface, BSTR v)
151 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
152 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
156 static HRESULT WINAPI HTMLScriptElement_get_text(IHTMLScriptElement *iface, BSTR *p)
158 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
159 FIXME("(%p)->(%p)\n", This, p);
163 static HRESULT WINAPI HTMLScriptElement_put_defer(IHTMLScriptElement *iface, VARIANT_BOOL v)
165 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
166 FIXME("(%p)->(%x)\n", This, v);
170 static HRESULT WINAPI HTMLScriptElement_get_defer(IHTMLScriptElement *iface, VARIANT_BOOL *p)
172 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
173 FIXME("(%p)->(%p)\n", This, p);
177 static HRESULT WINAPI HTMLScriptElement_get_readyState(IHTMLScriptElement *iface, BSTR *p)
179 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
180 FIXME("(%p)->(%p)\n", This, p);
184 static HRESULT WINAPI HTMLScriptElement_put_onerror(IHTMLScriptElement *iface, VARIANT v)
186 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
187 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
191 static HRESULT WINAPI HTMLScriptElement_get_onerror(IHTMLScriptElement *iface, VARIANT *p)
193 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
194 FIXME("(%p)->(%p)\n", This, p);
198 static HRESULT WINAPI HTMLScriptElement_put_type(IHTMLScriptElement *iface, BSTR v)
200 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
201 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
205 static HRESULT WINAPI HTMLScriptElement_get_type(IHTMLScriptElement *iface, BSTR *p)
207 HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
208 const PRUnichar *nstype;
209 nsAString nstype_str;
212 TRACE("(%p)->(%p)\n", This, p);
214 nsAString_Init(&nstype_str, NULL);
215 nsres = nsIDOMHTMLScriptElement_GetType(This->nsscript, &nstype_str);
217 ERR("GetType failed: %08x\n", nsres);
219 nsAString_GetData(&nstype_str, &nstype);
220 *p = *nstype ? SysAllocString(nstype) : NULL;
221 nsAString_Finish(&nstype_str);
226 static const IHTMLScriptElementVtbl HTMLScriptElementVtbl = {
227 HTMLScriptElement_QueryInterface,
228 HTMLScriptElement_AddRef,
229 HTMLScriptElement_Release,
230 HTMLScriptElement_GetTypeInfoCount,
231 HTMLScriptElement_GetTypeInfo,
232 HTMLScriptElement_GetIDsOfNames,
233 HTMLScriptElement_Invoke,
234 HTMLScriptElement_put_src,
235 HTMLScriptElement_get_src,
236 HTMLScriptElement_put_htmlFor,
237 HTMLScriptElement_get_htmlFor,
238 HTMLScriptElement_put_event,
239 HTMLScriptElement_get_event,
240 HTMLScriptElement_put_text,
241 HTMLScriptElement_get_text,
242 HTMLScriptElement_put_defer,
243 HTMLScriptElement_get_defer,
244 HTMLScriptElement_get_readyState,
245 HTMLScriptElement_put_onerror,
246 HTMLScriptElement_get_onerror,
247 HTMLScriptElement_put_type,
248 HTMLScriptElement_get_type
251 #undef HTMLSCRIPT_THIS
253 #define HTMLSCRIPT_NODE_THIS(iface) DEFINE_THIS2(HTMLScriptElement, element.node, iface)
255 static HRESULT HTMLScriptElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
257 HTMLScriptElement *This = HTMLSCRIPT_NODE_THIS(iface);
261 if(IsEqualGUID(&IID_IUnknown, riid)) {
262 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
263 *ppv = HTMLSCRIPT(This);
264 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
265 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
266 *ppv = HTMLSCRIPT(This);
267 }else if(IsEqualGUID(&IID_IHTMLScriptElement, riid)) {
268 TRACE("(%p)->(IID_IHTMLScriptElement %p)\n", This, ppv);
269 *ppv = HTMLSCRIPT(This);
273 IUnknown_AddRef((IUnknown*)*ppv);
277 return HTMLElement_QI(&This->element.node, riid, ppv);
280 static void HTMLScriptElement_destructor(HTMLDOMNode *iface)
282 HTMLScriptElement *This = HTMLSCRIPT_NODE_THIS(iface);
283 HTMLElement_destructor(&This->element.node);
286 #undef HTMLSCRIPT_NODE_THIS
288 static const NodeImplVtbl HTMLScriptElementImplVtbl = {
289 HTMLScriptElement_QI,
290 HTMLScriptElement_destructor
293 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement *nselem)
295 HTMLScriptElement *ret = heap_alloc(sizeof(HTMLScriptElement));
298 HTMLElement_Init(&ret->element);
300 ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl;
301 ret->element.node.vtbl = &HTMLScriptElementImplVtbl;
303 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript);
305 ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
307 return &ret->element;