mshtml: Add separate task list for tasks dispatching events.
[wine.git] / dlls / mshtml / htmlobject.c
blob60746562692f9225d8caf9e9b5ffda65f3c4e863
1 /*
2 * Copyright 2010 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 "winreg.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "pluginhost.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 struct HTMLObjectElement {
37 HTMLPluginContainer plugin_container;
39 IHTMLObjectElement IHTMLObjectElement_iface;
40 IHTMLObjectElement2 IHTMLObjectElement2_iface;
42 nsIDOMHTMLObjectElement *nsobject;
45 static inline HTMLObjectElement *impl_from_IHTMLObjectElement(IHTMLObjectElement *iface)
47 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement_iface);
50 static HRESULT WINAPI HTMLObjectElement_QueryInterface(IHTMLObjectElement *iface,
51 REFIID riid, void **ppv)
53 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
55 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
56 riid, ppv);
59 static ULONG WINAPI HTMLObjectElement_AddRef(IHTMLObjectElement *iface)
61 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
63 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
66 static ULONG WINAPI HTMLObjectElement_Release(IHTMLObjectElement *iface)
68 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
70 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
73 static HRESULT WINAPI HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement *iface, UINT *pctinfo)
75 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
76 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
77 pctinfo);
80 static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo,
81 LCID lcid, ITypeInfo **ppTInfo)
83 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
84 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
85 iTInfo, lcid, ppTInfo);
88 static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid,
89 LPOLESTR *rgszNames, UINT cNames,
90 LCID lcid, DISPID *rgDispId)
92 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
93 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
94 riid, rgszNames, cNames, lcid, rgDispId);
97 static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember,
98 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
99 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
101 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
102 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
103 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
106 static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p)
108 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
110 TRACE("(%p)->(%p)\n", This, p);
112 return get_plugin_disp(&This->plugin_container, p);
115 static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p)
117 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
119 TRACE("(%p)->(%p)\n", This, p);
121 return IHTMLObjectElement2_get_classid(&This->IHTMLObjectElement2_iface, p);
124 static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p)
126 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
128 TRACE("(%p)->(%p)\n", This, p);
130 return IHTMLObjectElement2_get_data(&This->IHTMLObjectElement2_iface, p);
133 static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v)
135 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
136 FIXME("(%p)->(%p)\n", This, v);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p)
142 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
143 FIXME("(%p)->(%p)\n", This, p);
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v)
149 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
150 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
151 return E_NOTIMPL;
154 static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p)
156 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
157 FIXME("(%p)->(%p)\n", This, p);
158 return E_NOTIMPL;
161 static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
163 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
164 nsAString nsstr;
165 nsresult nsres;
167 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
169 nsAString_InitDepend(&nsstr, v);
170 nsres = nsIDOMHTMLObjectElement_SetName(This->nsobject, &nsstr);
171 nsAString_Finish(&nsstr);
172 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
175 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
177 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
178 nsAString nsstr;
179 nsresult nsres;
181 TRACE("(%p)->(%p)\n", This, p);
183 nsAString_Init(&nsstr, NULL);
184 nsres = nsIDOMHTMLObjectElement_GetName(This->nsobject, &nsstr);
185 return return_nsstr(nsres, &nsstr, p);
188 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
190 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
191 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
197 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
198 FIXME("(%p)->(%p)\n", This, p);
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
204 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
205 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
211 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
218 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
219 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
225 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
226 FIXME("(%p)->(%p)\n", This, p);
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
232 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
233 FIXME("(%p)->(%p)\n", This, p);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
239 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
240 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
246 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
247 FIXME("(%p)->(%p)\n", This, p);
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
253 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
254 FIXME("(%p)->(%p)\n", This, p);
255 return E_NOTIMPL;
258 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
260 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
261 nsAString width_str;
262 PRUnichar buf[12];
263 nsresult nsres;
265 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
267 switch(V_VT(&v)) {
268 case VT_I4: {
269 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
270 break;
272 default:
273 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
274 return E_NOTIMPL;
277 nsAString_InitDepend(&width_str, buf);
278 nsres = nsIDOMHTMLObjectElement_SetWidth(This->nsobject, &width_str);
279 nsAString_Finish(&width_str);
280 if(NS_FAILED(nsres)) {
281 FIXME("SetWidth failed: %08lx\n", nsres);
282 return E_FAIL;
285 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
286 return S_OK;
289 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
291 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
292 nsAString width_str;
293 nsresult nsres;
294 HRESULT hres;
296 TRACE("(%p)->(%p)\n", This, p);
298 nsAString_Init(&width_str, NULL);
299 nsres = nsIDOMHTMLObjectElement_GetWidth(This->nsobject, &width_str);
300 if(NS_SUCCEEDED(nsres)) {
301 const PRUnichar *width;
303 nsAString_GetData(&width_str, &width);
304 V_VT(p) = VT_BSTR;
305 V_BSTR(p) = SysAllocString(width);
306 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
307 }else {
308 ERR("GetWidth failed: %08lx\n", nsres);
309 hres = E_FAIL;
312 nsAString_Finish(&width_str);
313 return hres;
316 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
318 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
319 nsAString height_str;
320 PRUnichar buf[12];
321 nsresult nsres;
323 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
325 switch(V_VT(&v)) {
326 case VT_I4: {
327 swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
328 break;
330 default:
331 FIXME("unimplemented for arg %s\n", debugstr_variant(&v));
332 return E_NOTIMPL;
335 nsAString_InitDepend(&height_str, buf);
336 nsres = nsIDOMHTMLObjectElement_SetHeight(This->nsobject, &height_str);
337 nsAString_Finish(&height_str);
338 if(NS_FAILED(nsres)) {
339 FIXME("SetHeight failed: %08lx\n", nsres);
340 return E_FAIL;
343 notif_container_change(&This->plugin_container, DISPID_UNKNOWN);
344 return S_OK;
347 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
349 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
350 nsAString height_str;
351 nsresult nsres;
352 HRESULT hres;
354 TRACE("(%p)->(%p)\n", This, p);
356 nsAString_Init(&height_str, NULL);
357 nsres = nsIDOMHTMLObjectElement_GetHeight(This->nsobject, &height_str);
358 if(NS_SUCCEEDED(nsres)) {
359 const PRUnichar *height;
361 nsAString_GetData(&height_str, &height);
362 V_VT(p) = VT_BSTR;
363 V_BSTR(p) = SysAllocString(height);
364 hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
365 }else {
366 ERR("GetHeight failed: %08lx\n", nsres);
367 hres = E_FAIL;
370 nsAString_Finish(&height_str);
371 return hres;
374 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
376 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
377 FIXME("(%p)->(%p)\n", This, p);
378 return E_NOTIMPL;
381 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
383 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
384 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
385 return E_NOTIMPL;
388 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
390 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
391 FIXME("(%p)->(%p)\n", This, p);
392 return E_NOTIMPL;
395 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
397 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
398 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
399 return E_NOTIMPL;
402 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
404 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
405 FIXME("(%p)->(%p)\n", This, p);
406 return E_NOTIMPL;
409 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
411 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
412 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
413 return E_NOTIMPL;
416 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
418 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
419 FIXME("(%p)->(%p)\n", This, p);
420 return E_NOTIMPL;
423 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
425 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
426 FIXME("(%p)->(%ld)\n", This, v);
427 return E_NOTIMPL;
430 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
432 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
433 nsresult nsres;
435 TRACE("(%p)->(%p)\n", This, p);
437 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, p);
438 if(NS_FAILED(nsres)) {
439 ERR("GetVspace failed: %08lx\n", nsres);
440 return E_FAIL;
443 return S_OK;
446 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
448 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
449 FIXME("(%p)->(%ld)\n", This, v);
450 return E_NOTIMPL;
453 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
455 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
456 FIXME("(%p)->(%p)\n", This, p);
457 return E_NOTIMPL;
460 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
461 HTMLObjectElement_QueryInterface,
462 HTMLObjectElement_AddRef,
463 HTMLObjectElement_Release,
464 HTMLObjectElement_GetTypeInfoCount,
465 HTMLObjectElement_GetTypeInfo,
466 HTMLObjectElement_GetIDsOfNames,
467 HTMLObjectElement_Invoke,
468 HTMLObjectElement_get_object,
469 HTMLObjectElement_get_classid,
470 HTMLObjectElement_get_data,
471 HTMLObjectElement_put_recordset,
472 HTMLObjectElement_get_recordset,
473 HTMLObjectElement_put_align,
474 HTMLObjectElement_get_align,
475 HTMLObjectElement_put_name,
476 HTMLObjectElement_get_name,
477 HTMLObjectElement_put_codeBase,
478 HTMLObjectElement_get_codeBase,
479 HTMLObjectElement_put_codeType,
480 HTMLObjectElement_get_codeType,
481 HTMLObjectElement_put_code,
482 HTMLObjectElement_get_code,
483 HTMLObjectElement_get_BaseHref,
484 HTMLObjectElement_put_type,
485 HTMLObjectElement_get_type,
486 HTMLObjectElement_get_form,
487 HTMLObjectElement_put_width,
488 HTMLObjectElement_get_width,
489 HTMLObjectElement_put_height,
490 HTMLObjectElement_get_height,
491 HTMLObjectElement_get_readyState,
492 HTMLObjectElement_put_onreadystatechange,
493 HTMLObjectElement_get_onreadystatechange,
494 HTMLObjectElement_put_onerror,
495 HTMLObjectElement_get_onerror,
496 HTMLObjectElement_put_altHtml,
497 HTMLObjectElement_get_altHtml,
498 HTMLObjectElement_put_vspace,
499 HTMLObjectElement_get_vspace,
500 HTMLObjectElement_put_hspace,
501 HTMLObjectElement_get_hspace
504 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
506 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
509 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
510 REFIID riid, void **ppv)
512 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
514 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
515 riid, ppv);
518 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
520 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
522 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
525 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
527 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
529 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
532 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
534 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
535 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
536 pctinfo);
539 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
540 LCID lcid, ITypeInfo **ppTInfo)
542 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
543 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
544 iTInfo, lcid, ppTInfo);
547 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
548 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
550 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
551 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
552 riid, rgszNames, cNames, lcid, rgDispId);
555 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
556 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
557 EXCEPINFO *pExcepInfo, UINT *puArgErr)
559 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
560 return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface,
561 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
564 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
565 VARIANT *hierarchy, IDispatch **ppRecordset)
567 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
568 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
569 return E_NOTIMPL;
572 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
574 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
575 HRESULT hres;
577 FIXME("(%p)->(%s) semi-stub\n", This, debugstr_w(v));
579 hres = elem_string_attr_setter(&This->plugin_container.element, L"classid", v);
580 if(FAILED(hres))
581 return hres;
583 if(This->plugin_container.plugin_host) {
584 FIXME("Host already associated.\n");
585 return E_NOTIMPL;
589 * NOTE:
590 * If the element is not yet in DOM tree, we should embed it as soon as it's added.
591 * However, Gecko for some reason decides not to create NP plugin in this case,
592 * so this won't work.
595 return create_plugin_host(This->plugin_container.element.node.doc, &This->plugin_container);
598 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
600 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
601 FIXME("(%p)->(%p)\n", This, p);
602 return E_NOTIMPL;
605 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
607 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
608 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
609 return E_NOTIMPL;
612 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
614 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
615 FIXME("(%p)->(%p)\n", This, p);
616 return E_NOTIMPL;
619 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
620 HTMLObjectElement2_QueryInterface,
621 HTMLObjectElement2_AddRef,
622 HTMLObjectElement2_Release,
623 HTMLObjectElement2_GetTypeInfoCount,
624 HTMLObjectElement2_GetTypeInfo,
625 HTMLObjectElement2_GetIDsOfNames,
626 HTMLObjectElement2_Invoke,
627 HTMLObjectElement2_namedRecordset,
628 HTMLObjectElement2_put_classid,
629 HTMLObjectElement2_get_classid,
630 HTMLObjectElement2_put_data,
631 HTMLObjectElement2_get_data
634 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
636 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
639 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
641 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
643 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
645 if(IsEqualGUID(&IID_IUnknown, riid)) {
646 *ppv = &This->IHTMLObjectElement_iface;
647 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
648 *ppv = &This->IHTMLObjectElement_iface;
649 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
650 *ppv = &This->IHTMLObjectElement_iface;
651 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
652 *ppv = &This->IHTMLObjectElement2_iface;
653 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
654 /* Special pseudo-interface returning HTMLPluginContainse struct. */
655 *ppv = &This->plugin_container;
656 node_addref(&This->plugin_container.element.node);
657 return S_OK;
658 }else {
659 HRESULT hres;
661 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
662 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
663 IUnknown *plugin_iface, *ret;
665 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
666 if(hres == S_OK) {
667 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
668 IUnknown_Release(plugin_iface);
669 if(FAILED(hres))
670 return hres;
672 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
673 *ppv = ret;
674 return S_OK;
678 return hres;
681 IUnknown_AddRef((IUnknown*)*ppv);
682 return S_OK;
685 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
687 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
689 if(This->plugin_container.plugin_host)
690 detach_plugin_host(This->plugin_container.plugin_host);
692 HTMLElement_destructor(&This->plugin_container.element.node);
695 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
697 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
698 FIXME("(%p)->(%p)\n", This, p);
699 return E_NOTIMPL;
702 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
703 DWORD grfdex, DISPID *pid)
705 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
707 TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), grfdex, pid);
709 return get_plugin_dispid(&This->plugin_container, name, pid);
712 static HRESULT HTMLObjectElement_dispex_get_name(HTMLDOMNode *iface, DISPID id, BSTR *name)
714 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
716 FIXME("(%p)->(%lx %p)\n", This, id, name);
718 return E_NOTIMPL;
721 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
722 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
724 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
726 TRACE("(%p)->(%ld)\n", This, id);
728 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
731 static void HTMLObjectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
733 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
735 if(This->nsobject)
736 note_cc_edge((nsISupports*)This->nsobject, "This->nsobject", cb);
739 static void HTMLObjectElement_unlink(HTMLDOMNode *iface)
741 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
743 if(This->nsobject) {
744 nsIDOMHTMLObjectElement *nsobject = This->nsobject;
746 This->nsobject = NULL;
747 nsIDOMHTMLObjectElement_Release(nsobject);
751 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
752 &CLSID_HTMLObjectElement,
753 HTMLObjectElement_QI,
754 HTMLObjectElement_destructor,
755 HTMLElement_cpc,
756 HTMLElement_clone,
757 HTMLElement_dispatch_nsevent_hook,
758 HTMLElement_handle_event,
759 HTMLElement_get_attr_col,
760 NULL,
761 NULL,
762 NULL,
763 NULL,
764 HTMLObjectElement_get_readystate,
765 HTMLObjectElement_get_dispid,
766 HTMLObjectElement_dispex_get_name,
767 HTMLObjectElement_invoke,
768 NULL,
769 HTMLObjectElement_traverse,
770 HTMLObjectElement_unlink
773 static const tid_t HTMLObjectElement_iface_tids[] = {
774 IHTMLObjectElement2_tid,
775 IHTMLObjectElement_tid,
776 HTMLELEMENT_TIDS,
779 static dispex_static_data_t HTMLObjectElement_dispex = {
780 L"HTMLObjectElement",
781 NULL,
782 DispHTMLObjectElement_tid,
783 HTMLObjectElement_iface_tids,
784 HTMLElement_init_dispex_info
787 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
789 HTMLObjectElement *ret;
790 nsresult nsres;
792 ret = calloc(1, sizeof(*ret));
793 if(!ret)
794 return E_OUTOFMEMORY;
796 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
797 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
798 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
800 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
802 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
803 assert(nsres == NS_OK);
805 *elem = &ret->plugin_container.element;
806 return S_OK;
809 struct HTMLEmbed {
810 HTMLElement element;
812 IHTMLEmbedElement IHTMLEmbedElement_iface;
815 static inline HTMLEmbed *impl_from_IHTMLEmbedElement(IHTMLEmbedElement *iface)
817 return CONTAINING_RECORD(iface, HTMLEmbed, IHTMLEmbedElement_iface);
820 static HRESULT WINAPI HTMLEmbedElement_QueryInterface(IHTMLEmbedElement *iface,
821 REFIID riid, void **ppv)
823 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
825 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
828 static ULONG WINAPI HTMLEmbedElement_AddRef(IHTMLEmbedElement *iface)
830 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
832 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
835 static ULONG WINAPI HTMLEmbedElement_Release(IHTMLEmbedElement *iface)
837 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
839 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
842 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfoCount(IHTMLEmbedElement *iface, UINT *pctinfo)
844 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
845 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
848 static HRESULT WINAPI HTMLEmbedElement_GetTypeInfo(IHTMLEmbedElement *iface, UINT iTInfo,
849 LCID lcid, ITypeInfo **ppTInfo)
851 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
852 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
853 ppTInfo);
856 static HRESULT WINAPI HTMLEmbedElement_GetIDsOfNames(IHTMLEmbedElement *iface, REFIID riid,
857 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
859 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
860 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
861 cNames, lcid, rgDispId);
864 static HRESULT WINAPI HTMLEmbedElement_Invoke(IHTMLEmbedElement *iface, DISPID dispIdMember,
865 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
866 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
868 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
869 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
870 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
873 static HRESULT WINAPI HTMLEmbedElement_put_hidden(IHTMLEmbedElement *iface, BSTR v)
875 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
876 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
877 return E_NOTIMPL;
880 static HRESULT WINAPI HTMLEmbedElement_get_hidden(IHTMLEmbedElement *iface, BSTR *p)
882 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
883 FIXME("(%p)->(%p)\n", This, p);
884 return E_NOTIMPL;
887 static HRESULT WINAPI HTMLEmbedElement_get_palette(IHTMLEmbedElement *iface, BSTR *p)
889 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
890 FIXME("(%p)->(%p)\n", This, p);
891 return E_NOTIMPL;
894 static HRESULT WINAPI HTMLEmbedElement_get_pluginspage(IHTMLEmbedElement *iface, BSTR *p)
896 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
897 FIXME("(%p)->(%p)\n", This, p);
898 return E_NOTIMPL;
901 static HRESULT WINAPI HTMLEmbedElement_put_src(IHTMLEmbedElement *iface, BSTR v)
903 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
904 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
905 return E_NOTIMPL;
908 static HRESULT WINAPI HTMLEmbedElement_get_src(IHTMLEmbedElement *iface, BSTR *p)
910 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
911 FIXME("(%p)->(%p)\n", This, p);
912 return E_NOTIMPL;
915 static HRESULT WINAPI HTMLEmbedElement_put_units(IHTMLEmbedElement *iface, BSTR v)
917 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
918 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
919 return E_NOTIMPL;
922 static HRESULT WINAPI HTMLEmbedElement_get_units(IHTMLEmbedElement *iface, BSTR *p)
924 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
925 FIXME("(%p)->(%p)\n", This, p);
926 return E_NOTIMPL;
929 static HRESULT WINAPI HTMLEmbedElement_put_name(IHTMLEmbedElement *iface, BSTR v)
931 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
932 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
933 return E_NOTIMPL;
936 static HRESULT WINAPI HTMLEmbedElement_get_name(IHTMLEmbedElement *iface, BSTR *p)
938 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
939 FIXME("(%p)->(%p)\n", This, p);
940 return E_NOTIMPL;
943 static HRESULT WINAPI HTMLEmbedElement_put_width(IHTMLEmbedElement *iface, VARIANT v)
945 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
946 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
947 return E_NOTIMPL;
950 static HRESULT WINAPI HTMLEmbedElement_get_width(IHTMLEmbedElement *iface, VARIANT *p)
952 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
953 FIXME("(%p)->(%p)\n", This, p);
954 return E_NOTIMPL;
957 static HRESULT WINAPI HTMLEmbedElement_put_height(IHTMLEmbedElement *iface, VARIANT v)
959 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
960 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
961 return E_NOTIMPL;
964 static HRESULT WINAPI HTMLEmbedElement_get_height(IHTMLEmbedElement *iface, VARIANT *p)
966 HTMLEmbed *This = impl_from_IHTMLEmbedElement(iface);
967 FIXME("(%p)->(%p)\n", This, p);
968 return E_NOTIMPL;
971 static const IHTMLEmbedElementVtbl HTMLEmbedElementVtbl = {
972 HTMLEmbedElement_QueryInterface,
973 HTMLEmbedElement_AddRef,
974 HTMLEmbedElement_Release,
975 HTMLEmbedElement_GetTypeInfoCount,
976 HTMLEmbedElement_GetTypeInfo,
977 HTMLEmbedElement_GetIDsOfNames,
978 HTMLEmbedElement_Invoke,
979 HTMLEmbedElement_put_hidden,
980 HTMLEmbedElement_get_hidden,
981 HTMLEmbedElement_get_palette,
982 HTMLEmbedElement_get_pluginspage,
983 HTMLEmbedElement_put_src,
984 HTMLEmbedElement_get_src,
985 HTMLEmbedElement_put_units,
986 HTMLEmbedElement_get_units,
987 HTMLEmbedElement_put_name,
988 HTMLEmbedElement_get_name,
989 HTMLEmbedElement_put_width,
990 HTMLEmbedElement_get_width,
991 HTMLEmbedElement_put_height,
992 HTMLEmbedElement_get_height
995 static inline HTMLEmbed *embed_from_HTMLDOMNode(HTMLDOMNode *iface)
997 return CONTAINING_RECORD(iface, HTMLEmbed, element.node);
1000 static HRESULT HTMLEmbedElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1002 HTMLEmbed *This = embed_from_HTMLDOMNode(iface);
1004 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1006 if(IsEqualGUID(&IID_IUnknown, riid)) {
1007 *ppv = &This->IHTMLEmbedElement_iface;
1008 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1009 *ppv = &This->IHTMLEmbedElement_iface;
1010 }else if(IsEqualGUID(&IID_IHTMLEmbedElement, riid)) {
1011 *ppv = &This->IHTMLEmbedElement_iface;
1012 }else {
1013 return HTMLElement_QI(&This->element.node, riid, ppv);
1016 IUnknown_AddRef((IUnknown*)*ppv);
1017 return S_OK;
1020 static void HTMLEmbedElement_destructor(HTMLDOMNode *iface)
1022 HTMLEmbed *This = embed_from_HTMLDOMNode(iface);
1024 HTMLElement_destructor(&This->element.node);
1027 static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
1028 &CLSID_HTMLEmbed,
1029 HTMLEmbedElement_QI,
1030 HTMLEmbedElement_destructor,
1031 HTMLElement_cpc,
1032 HTMLElement_clone,
1033 HTMLElement_dispatch_nsevent_hook,
1034 HTMLElement_handle_event,
1035 HTMLElement_get_attr_col
1038 static const tid_t HTMLEmbedElement_iface_tids[] = {
1039 HTMLELEMENT_TIDS,
1040 IHTMLEmbedElement_tid,
1043 static dispex_static_data_t HTMLEmbedElement_dispex = {
1044 L"HTMLEmbedElement",
1045 NULL,
1046 DispHTMLEmbed_tid,
1047 HTMLEmbedElement_iface_tids,
1048 HTMLElement_init_dispex_info
1051 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1053 HTMLEmbed *ret;
1055 ret = calloc(1, sizeof(*ret));
1056 if(!ret)
1057 return E_OUTOFMEMORY;
1059 ret->IHTMLEmbedElement_iface.lpVtbl = &HTMLEmbedElementVtbl;
1060 ret->element.node.vtbl = &HTMLEmbedElementImplVtbl;
1062 HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex);
1063 *elem = &ret->element;
1064 return S_OK;