From ea99533ebfc3433bc6730d9d50046b25a6fd8363 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 27 Oct 2010 23:18:42 +0200 Subject: [PATCH] mshtml: Added IHTMLObjectElement stub implementation. --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/htmlelem.c | 3 + dlls/mshtml/htmlobject.c | 427 +++++++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/dom.c | 21 +- 5 files changed, 450 insertions(+), 3 deletions(-) create mode 100644 dlls/mshtml/htmlobject.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 7c25dbbd39..181bc1a793 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -30,6 +30,7 @@ C_SRCS = \ htmlinput.c \ htmllocation.c \ htmlnode.c \ + htmlobject.c \ htmloption.c \ htmlscreen.c \ htmlscript.c \ diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index e5ca73d229..b6cb53579f 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1659,6 +1659,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL static const WCHAR wszIFRAME[] = {'I','F','R','A','M','E',0}; static const WCHAR wszIMG[] = {'I','M','G',0}; static const WCHAR wszINPUT[] = {'I','N','P','U','T',0}; + static const WCHAR wszOBJECT[] = {'O','B','J','E','C','T',0}; static const WCHAR wszOPTION[] = {'O','P','T','I','O','N',0}; static const WCHAR wszSCRIPT[] = {'S','C','R','I','P','T',0}; static const WCHAR wszSELECT[] = {'S','E','L','E','C','T',0}; @@ -1689,6 +1690,8 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL ret = HTMLImgElement_Create(doc, nselem); else if(!strcmpW(class_name, wszINPUT)) ret = HTMLInputElement_Create(doc, nselem); + else if(!strcmpW(class_name, wszOBJECT)) + ret = HTMLObjectElement_Create(doc, nselem); else if(!strcmpW(class_name, wszOPTION)) ret = HTMLOptionElement_Create(doc, nselem); else if(!strcmpW(class_name, wszSCRIPT)) diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c new file mode 100644 index 0000000000..fb5ef58506 --- /dev/null +++ b/dlls/mshtml/htmlobject.c @@ -0,0 +1,427 @@ +/* + * Copyright 2010 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +typedef struct { + HTMLElement element; + + const IHTMLObjectElementVtbl *lpIHTMLObjectElementVtbl; +} HTMLObjectElement; + +#define HTMLOBJECT(x) (&(x)->lpIHTMLObjectElementVtbl) + +#define HTMLOBJECT_THIS(iface) DEFINE_THIS(HTMLObjectElement, IHTMLObjectElement, iface) + +static HRESULT WINAPI HTMLObjectElement_QueryInterface(IHTMLObjectElement *iface, + REFIID riid, void **ppv) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + + return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); +} + +static ULONG WINAPI HTMLObjectElement_AddRef(IHTMLObjectElement *iface) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + + return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node)); +} + +static ULONG WINAPI HTMLObjectElement_Release(IHTMLObjectElement *iface) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + + return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node)); +} + +static HRESULT WINAPI HTMLObjectElement_GetTypeInfoCount(IHTMLObjectElement *iface, UINT *pctinfo) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo); +} + +static HRESULT WINAPI HTMLObjectElement_GetTypeInfo(IHTMLObjectElement *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLObjectElement_GetIDsOfNames(IHTMLObjectElement *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLObjectElement_Invoke(IHTMLObjectElement *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams, + pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLObjectElement_get_object(IHTMLObjectElement *iface, IDispatch **p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_classid(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_data(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_recordset(IHTMLObjectElement *iface, IDispatch *v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_recordset(IHTMLObjectElement *iface, IDispatch **p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_align(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_codeBase(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_codeType(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_codeType(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_code(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_code(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_BaseHref(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_type(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_type(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_form(IHTMLObjectElement *iface, IHTMLFormElement **p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VARIANT v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VARIANT *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VARIANT v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VARIANT *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_readyState(IHTMLObjectElement *iface, LONG *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_onreadystatechange(IHTMLObjectElement *iface, VARIANT v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_onreadystatechange(IHTMLObjectElement *iface, VARIANT *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_onerror(IHTMLObjectElement *iface, VARIANT v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_onerror(IHTMLObjectElement *iface, VARIANT *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_altHtml(IHTMLObjectElement *iface, BSTR v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, BSTR *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LONG *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_get_hspace(IHTMLObjectElement *iface, LONG *p) +{ + HTMLObjectElement *This = HTMLOBJECT_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +#undef HTMLOBJECT_THIS + +static const IHTMLObjectElementVtbl HTMLObjectElementVtbl = { + HTMLObjectElement_QueryInterface, + HTMLObjectElement_AddRef, + HTMLObjectElement_Release, + HTMLObjectElement_GetTypeInfoCount, + HTMLObjectElement_GetTypeInfo, + HTMLObjectElement_GetIDsOfNames, + HTMLObjectElement_Invoke, + HTMLObjectElement_get_object, + HTMLObjectElement_get_classid, + HTMLObjectElement_get_data, + HTMLObjectElement_put_recordset, + HTMLObjectElement_get_recordset, + HTMLObjectElement_put_align, + HTMLObjectElement_get_align, + HTMLObjectElement_put_name, + HTMLObjectElement_get_name, + HTMLObjectElement_put_codeBase, + HTMLObjectElement_get_codeBase, + HTMLObjectElement_put_codeType, + HTMLObjectElement_get_codeType, + HTMLObjectElement_put_code, + HTMLObjectElement_get_code, + HTMLObjectElement_get_BaseHref, + HTMLObjectElement_put_type, + HTMLObjectElement_get_type, + HTMLObjectElement_get_form, + HTMLObjectElement_put_width, + HTMLObjectElement_get_width, + HTMLObjectElement_put_height, + HTMLObjectElement_get_height, + HTMLObjectElement_get_readyState, + HTMLObjectElement_put_onreadystatechange, + HTMLObjectElement_get_onreadystatechange, + HTMLObjectElement_put_onerror, + HTMLObjectElement_get_onerror, + HTMLObjectElement_put_altHtml, + HTMLObjectElement_get_altHtml, + HTMLObjectElement_put_vspace, + HTMLObjectElement_get_vspace, + HTMLObjectElement_put_hspace, + HTMLObjectElement_get_hspace +}; + +#define HTMLOBJECT_NODE_THIS(iface) DEFINE_THIS2(HTMLObjectElement, element.node, iface) + +static HRESULT HTMLObjectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) +{ + HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = HTMLOBJECT(This); + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = HTMLOBJECT(This); + }else if(IsEqualGUID(&IID_IHTMLObjectElement, riid)) { + TRACE("(%p)->(IID_IHTMLObjectElement %p)\n", This, ppv); + *ppv = HTMLOBJECT(This); + }else { + return HTMLElement_QI(&This->element.node, riid, ppv); + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static void HTMLObjectElement_destructor(HTMLDOMNode *iface) +{ + HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface); + + HTMLElement_destructor(&This->element.node); +} + +#undef HTMLOBJECT_NODE_THIS + +static const NodeImplVtbl HTMLObjectElementImplVtbl = { + HTMLObjectElement_QI, + HTMLObjectElement_destructor +}; + +HTMLElement *HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) +{ + HTMLObjectElement *ret = heap_alloc_zero(sizeof(*ret)); + + ret->lpIHTMLObjectElementVtbl = &HTMLObjectElementVtbl; + ret->element.node.vtbl = &HTMLObjectElementImplVtbl; + + HTMLElement_Init(&ret->element, doc, nselem, NULL); + return &ret->element; +} diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 6888f00741..0526f5f25c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -810,6 +810,7 @@ HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); +HTMLElement *HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8f4c66cae9..ad7e22478b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -48,7 +48,7 @@ static const char elem_test_str[] = "" "
td1 texttd2 text
" "" - "" + "" "" "" "
" @@ -100,7 +100,8 @@ typedef enum { ET_TD, ET_IFRAME, ET_FORM, - ET_FRAME + ET_FRAME, + ET_OBJECT } elem_type_t; static const IID * const none_iids[] = { @@ -324,6 +325,18 @@ static const IID * const frame_iids[] = { NULL }; +static const IID * const object_iids[] = { + &IID_IHTMLDOMNode, + &IID_IHTMLDOMNode2, + &IID_IHTMLElement, + &IID_IHTMLElement2, + &IID_IHTMLElement3, + &IID_IHTMLObjectElement, + &IID_IDispatchEx, + /* FIXME: No IConnectionPointContainer */ + NULL +}; + static const IID * const iframe_iids[] = { &IID_IHTMLDOMNode, &IID_IHTMLDOMNode2, @@ -421,7 +434,8 @@ static const elem_type_info_t elem_type_infos[] = { {"TD", td_iids, NULL}, {"IFRAME", iframe_iids, &DIID_DispHTMLIFrame}, {"FORM", form_iids, &DIID_DispHTMLFormElement}, - {"FRAME", frame_iids, &DIID_DispHTMLFrameElement} + {"FRAME", frame_iids, &DIID_DispHTMLFrameElement}, + {"OBJECT", object_iids, NULL} }; static const char *dbgstr_guid(REFIID riid) @@ -5784,6 +5798,7 @@ static void test_elems(IHTMLDocument2 *doc) ET_TD, ET_SCRIPT, ET_TEST, + ET_OBJECT, ET_IMG, ET_IFRAME, ET_FORM -- 2.32.0.93.g670b81a890