winex11: Store the DC bounds rectangle as a pointer.
[wine/multimedia.git] / dlls / mshtml / htmlobject.c
blob6f171c66b58a311733cd64d1ac7d23529c410b5d
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 typedef struct {
37 HTMLPluginContainer plugin_container;
39 IHTMLObjectElement IHTMLObjectElement_iface;
40 IHTMLObjectElement2 IHTMLObjectElement2_iface;
42 nsIDOMHTMLObjectElement *nsobject;
43 } HTMLObjectElement;
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.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.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.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.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->IHTMLObjectElement_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->IHTMLObjectElement_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 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
170 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
171 FIXME("(%p)->(%p)\n", This, p);
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
177 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
178 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
179 return E_NOTIMPL;
182 static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p)
184 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
185 FIXME("(%p)->(%p)\n", This, p);
186 return E_NOTIMPL;
189 static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v)
191 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
192 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
193 return E_NOTIMPL;
196 static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p)
198 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
199 FIXME("(%p)->(%p)\n", This, p);
200 return E_NOTIMPL;
203 static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v)
205 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
206 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
207 return E_NOTIMPL;
210 static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p)
212 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
213 FIXME("(%p)->(%p)\n", This, p);
214 return E_NOTIMPL;
217 static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p)
219 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
220 FIXME("(%p)->(%p)\n", This, p);
221 return E_NOTIMPL;
224 static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v)
226 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
227 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
228 return E_NOTIMPL;
231 static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p)
233 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
234 FIXME("(%p)->(%p)\n", This, p);
235 return E_NOTIMPL;
238 static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p)
240 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
241 FIXME("(%p)->(%p)\n", This, p);
242 return E_NOTIMPL;
245 static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v)
247 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
248 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
249 return E_NOTIMPL;
252 static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p)
254 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
255 FIXME("(%p)->(%p)\n", This, p);
256 return E_NOTIMPL;
259 static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v)
261 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
262 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p)
268 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
269 FIXME("(%p)->(%p)\n", This, p);
270 return E_NOTIMPL;
273 static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p)
275 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
276 FIXME("(%p)->(%p)\n", This, p);
277 return E_NOTIMPL;
280 static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v)
282 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
283 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
284 return E_NOTIMPL;
287 static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p)
289 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
290 FIXME("(%p)->(%p)\n", This, p);
291 return E_NOTIMPL;
294 static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v)
296 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
297 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
298 return E_NOTIMPL;
301 static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p)
303 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
304 FIXME("(%p)->(%p)\n", This, p);
305 return E_NOTIMPL;
308 static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v)
310 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
311 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
312 return E_NOTIMPL;
315 static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p)
317 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
318 FIXME("(%p)->(%p)\n", This, p);
319 return E_NOTIMPL;
322 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
324 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
325 FIXME("(%p)->(%d)\n", This, v);
326 return E_NOTIMPL;
329 static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p)
331 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
332 PRInt32 vspace;
333 nsresult nsres;
335 TRACE("(%p)->(%p)\n", This, p);
337 nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, &vspace);
338 if(NS_FAILED(nsres)) {
339 ERR("GetVspace failed: %08x\n", nsres);
340 return E_FAIL;
343 *p = vspace;
344 return S_OK;
347 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
349 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
350 FIXME("(%p)->(%d)\n", This, v);
351 return E_NOTIMPL;
354 static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p)
356 HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
357 FIXME("(%p)->(%p)\n", This, p);
358 return E_NOTIMPL;
361 static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = {
362 HTMLObjectElement_QueryInterface,
363 HTMLObjectElement_AddRef,
364 HTMLObjectElement_Release,
365 HTMLObjectElement_GetTypeInfoCount,
366 HTMLObjectElement_GetTypeInfo,
367 HTMLObjectElement_GetIDsOfNames,
368 HTMLObjectElement_Invoke,
369 HTMLObjectElement_get_object,
370 HTMLObjectElement_get_classid,
371 HTMLObjectElement_get_data,
372 HTMLObjectElement_put_recordset,
373 HTMLObjectElement_get_recordset,
374 HTMLObjectElement_put_align,
375 HTMLObjectElement_get_align,
376 HTMLObjectElement_put_name,
377 HTMLObjectElement_get_name,
378 HTMLObjectElement_put_codeBase,
379 HTMLObjectElement_get_codeBase,
380 HTMLObjectElement_put_codeType,
381 HTMLObjectElement_get_codeType,
382 HTMLObjectElement_put_code,
383 HTMLObjectElement_get_code,
384 HTMLObjectElement_get_BaseHref,
385 HTMLObjectElement_put_type,
386 HTMLObjectElement_get_type,
387 HTMLObjectElement_get_form,
388 HTMLObjectElement_put_width,
389 HTMLObjectElement_get_width,
390 HTMLObjectElement_put_height,
391 HTMLObjectElement_get_height,
392 HTMLObjectElement_get_readyState,
393 HTMLObjectElement_put_onreadystatechange,
394 HTMLObjectElement_get_onreadystatechange,
395 HTMLObjectElement_put_onerror,
396 HTMLObjectElement_get_onerror,
397 HTMLObjectElement_put_altHtml,
398 HTMLObjectElement_get_altHtml,
399 HTMLObjectElement_put_vspace,
400 HTMLObjectElement_get_vspace,
401 HTMLObjectElement_put_hspace,
402 HTMLObjectElement_get_hspace
405 static inline HTMLObjectElement *impl_from_IHTMLObjectElement2(IHTMLObjectElement2 *iface)
407 return CONTAINING_RECORD(iface, HTMLObjectElement, IHTMLObjectElement2_iface);
410 static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface,
411 REFIID riid, void **ppv)
413 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
415 return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface,
416 riid, ppv);
419 static ULONG WINAPI HTMLObjectElement2_AddRef(IHTMLObjectElement2 *iface)
421 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
423 return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface);
426 static ULONG WINAPI HTMLObjectElement2_Release(IHTMLObjectElement2 *iface)
428 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
430 return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface);
433 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfoCount(IHTMLObjectElement2 *iface, UINT *pctinfo)
435 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
436 return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
437 pctinfo);
440 static HRESULT WINAPI HTMLObjectElement2_GetTypeInfo(IHTMLObjectElement2 *iface, UINT iTInfo,
441 LCID lcid, ITypeInfo **ppTInfo)
443 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
444 return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
445 iTInfo, lcid, ppTInfo);
448 static HRESULT WINAPI HTMLObjectElement2_GetIDsOfNames(IHTMLObjectElement2 *iface, REFIID riid,
449 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
451 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
452 return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
453 riid, rgszNames, cNames, lcid, rgDispId);
456 static HRESULT WINAPI HTMLObjectElement2_Invoke(IHTMLObjectElement2 *iface, DISPID dispIdMember,
457 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
458 EXCEPINFO *pExcepInfo, UINT *puArgErr)
460 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
461 return IDispatchEx_Invoke(&This->plugin_container.element.node.dispex.IDispatchEx_iface,
462 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
465 static HRESULT WINAPI HTMLObjectElement2_namedRecordset(IHTMLObjectElement2 *iface, BSTR dataMember,
466 VARIANT *hierarchy, IDispatch **ppRecordset)
468 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
469 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
470 return E_NOTIMPL;
473 static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface, BSTR v)
475 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
476 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
477 return E_NOTIMPL;
480 static HRESULT WINAPI HTMLObjectElement2_get_classid(IHTMLObjectElement2 *iface, BSTR *p)
482 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
483 FIXME("(%p)->(%p)\n", This, p);
484 return E_NOTIMPL;
487 static HRESULT WINAPI HTMLObjectElement2_put_data(IHTMLObjectElement2 *iface, BSTR v)
489 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
490 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLObjectElement2_get_data(IHTMLObjectElement2 *iface, BSTR *p)
496 HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
501 static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = {
502 HTMLObjectElement2_QueryInterface,
503 HTMLObjectElement2_AddRef,
504 HTMLObjectElement2_Release,
505 HTMLObjectElement2_GetTypeInfoCount,
506 HTMLObjectElement2_GetTypeInfo,
507 HTMLObjectElement2_GetIDsOfNames,
508 HTMLObjectElement2_Invoke,
509 HTMLObjectElement2_namedRecordset,
510 HTMLObjectElement2_put_classid,
511 HTMLObjectElement2_get_classid,
512 HTMLObjectElement2_put_data,
513 HTMLObjectElement2_get_data
516 static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
518 return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node);
521 static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
523 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
525 if(IsEqualGUID(&IID_IUnknown, riid)) {
526 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
527 *ppv = &This->IHTMLObjectElement_iface;
528 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
529 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
530 *ppv = &This->IHTMLObjectElement_iface;
531 }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) {
532 TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv);
533 *ppv = &This->IHTMLObjectElement_iface;
534 }else if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) {
535 TRACE("(%p)->(IID_IHTMLObjectElement2 %p)\n", This, ppv);
536 *ppv = &This->IHTMLObjectElement2_iface;
537 }else if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) {
538 TRACE("(%p)->(IID_HTMLPluginContainer %p)\n", This, ppv);
539 *ppv = &This->plugin_container;
540 return S_OK;
541 }else {
542 HRESULT hres;
544 hres = HTMLElement_QI(&This->plugin_container.element.node, riid, ppv);
545 if(hres == E_NOINTERFACE && This->plugin_container.plugin_host && This->plugin_container.plugin_host->plugin_unk) {
546 IUnknown *plugin_iface, *ret;
548 hres = IUnknown_QueryInterface(This->plugin_container.plugin_host->plugin_unk, riid, (void**)&plugin_iface);
549 if(hres == S_OK) {
550 hres = wrap_iface(plugin_iface, (IUnknown*)&This->IHTMLObjectElement_iface, &ret);
551 IUnknown_Release(plugin_iface);
552 if(FAILED(hres))
553 return hres;
555 TRACE("returning plugin iface %p wrapped to %p\n", plugin_iface, ret);
556 *ppv = ret;
557 return S_OK;
561 return hres;
564 IUnknown_AddRef((IUnknown*)*ppv);
565 return S_OK;
568 static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
570 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
572 if(This->plugin_container.plugin_host)
573 detach_plugin_host(This->plugin_container.plugin_host);
574 if(This->nsobject)
575 nsIDOMHTMLObjectElement_Release(This->nsobject);
577 HTMLElement_destructor(&This->plugin_container.element.node);
580 static HRESULT HTMLObjectElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
582 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
583 FIXME("(%p)->(%p)\n", This, p);
584 return E_NOTIMPL;
587 static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
588 DWORD grfdex, DISPID *pid)
590 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
592 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
594 return get_plugin_dispid(&This->plugin_container, name, pid);
597 static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
598 WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
600 HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
602 TRACE("(%p)->(%d)\n", This, id);
604 return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
607 static const NodeImplVtbl HTMLObjectElementImplVtbl = {
608 HTMLObjectElement_QI,
609 HTMLObjectElement_destructor,
610 HTMLElement_clone,
611 HTMLElement_get_attr_col,
612 NULL,
613 NULL,
614 NULL,
615 NULL,
616 NULL,
617 NULL,
618 HTMLObjectElement_get_readystate,
619 HTMLObjectElement_get_dispid,
620 HTMLObjectElement_invoke
623 static const tid_t HTMLObjectElement_iface_tids[] = {
624 HTMLELEMENT_TIDS,
625 IHTMLObjectElement_tid,
626 IHTMLObjectElement2_tid,
629 static dispex_static_data_t HTMLObjectElement_dispex = {
630 NULL,
631 DispHTMLObjectElement_tid,
632 NULL,
633 HTMLObjectElement_iface_tids
636 HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
638 HTMLObjectElement *ret;
639 nsresult nsres;
641 ret = heap_alloc_zero(sizeof(*ret));
642 if(!ret)
643 return E_OUTOFMEMORY;
645 ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl;
646 ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
647 ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
649 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
650 if(NS_FAILED(nsres)) {
651 ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
652 heap_free(ret);
653 return E_FAIL;
656 HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
658 *elem = &ret->plugin_container.element;
659 return S_OK;