diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 9878bea742b..2a7b1fabcd7 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -21,6 +21,7 @@ C_SRCS = \ htmlelem.c \ htmlelem2.c \ htmlevent.c \ + htmlgeneric.c \ htmlimg.c \ htmlinput.c \ htmllocation.c \ diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 189ea43085a..3a457cb2342 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -897,7 +897,7 @@ static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTa return E_FAIL; } - elem = HTMLElement_Create(This, (nsIDOMNode*)nselem); + elem = HTMLElement_Create(This, (nsIDOMNode*)nselem, TRUE); nsIDOMElement_Release(nselem); *newElem = HTMLELEM(elem); diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index b06d6c39123..d4e1d4d129b 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1388,7 +1388,7 @@ void HTMLElement_Init(HTMLElement *This) init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex); } -HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode) +HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_generic) { nsIDOMHTMLElement *nselem; HTMLElement *ret = NULL; @@ -1433,6 +1433,8 @@ HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode) ret = HTMLTable_Create(nselem); else if(!strcmpW(class_name, wszTEXTAREA)) ret = HTMLTextAreaElement_Create(nselem); + else if(use_generic) + ret = HTMLGenericElement_Create(nselem); if(!ret) { ret = heap_alloc_zero(sizeof(HTMLElement)); diff --git a/dlls/mshtml/htmlgeneric.c b/dlls/mshtml/htmlgeneric.c new file mode 100644 index 00000000000..71f434de88d --- /dev/null +++ b/dlls/mshtml/htmlgeneric.c @@ -0,0 +1,172 @@ +/* + * Copyright 2008 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 "ole2.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +typedef struct { + HTMLElement element; + + const IHTMLGenericElementVtbl *lpHTMLGenericElementVtbl; +} HTMLGenericElement; + +#define HTMLGENERIC(x) ((IHTMLGenericElement*) &(x)->lpHTMLGenericElementVtbl) + +#define HTMLGENERIC_THIS(iface) DEFINE_THIS(HTMLGenericElement, HTMLGenericElement, iface) + +static HRESULT WINAPI HTMLGenericElement_QueryInterface(IHTMLGenericElement *iface, REFIID riid, void **ppv) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + + return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); +} + +static ULONG WINAPI HTMLGenericElement_AddRef(IHTMLGenericElement *iface) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + + return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node)); +} + +static ULONG WINAPI HTMLGenericElement_Release(IHTMLGenericElement *iface) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + + return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node)); +} + +static HRESULT WINAPI HTMLGenericElement_GetTypeInfoCount(IHTMLGenericElement *iface, UINT *pctinfo) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%p)\n", This, pctinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLGenericElement_GetTypeInfo(IHTMLGenericElement *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLGenericElement_GetIDsOfNames(IHTMLGenericElement *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, + lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLGenericElement_Invoke(IHTMLGenericElement *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLGenericElement_get_recordset(IHTMLGenericElement *iface, IDispatch **p) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLGenericElement_namedRecordset(IHTMLGenericElement *iface, + BSTR dataMember, VARIANT *hierarchy, IDispatch **ppRecordset) +{ + HTMLGenericElement *This = HTMLGENERIC_THIS(iface); + FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset); + return E_NOTIMPL; +} + +static const IHTMLGenericElementVtbl HTMLGenericElementVtbl = { + HTMLGenericElement_QueryInterface, + HTMLGenericElement_AddRef, + HTMLGenericElement_Release, + HTMLGenericElement_GetTypeInfoCount, + HTMLGenericElement_GetTypeInfo, + HTMLGenericElement_GetIDsOfNames, + HTMLGenericElement_Invoke, + HTMLGenericElement_get_recordset, + HTMLGenericElement_namedRecordset +}; + +#define HTMLGENERIC_NODE_THIS(iface) DEFINE_THIS2(HTMLGenericElement, element.node, iface) + +static HRESULT HTMLGenericElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) +{ + HTMLGenericElement *This = HTMLGENERIC_NODE_THIS(iface); + + *ppv = NULL; + + if(IsEqualGUID(&IID_IHTMLGenericElement, riid)) { + TRACE("(%p)->(IID_IHTMLGenericElement %p)\n", This, ppv); + *ppv = HTMLGENERIC(This); + }else { + return HTMLElement_QI(&This->element.node, riid, ppv); + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static void HTMLGenericElement_destructor(HTMLDOMNode *iface) +{ + HTMLGenericElement *This = HTMLGENERIC_NODE_THIS(iface); + + HTMLElement_destructor(&This->element.node); +} + +#undef HTMLGENERIC_NODE_THIS + +static const NodeImplVtbl HTMLGenericElementImplVtbl = { + HTMLGenericElement_QI, + HTMLGenericElement_destructor +}; + +HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement *nselem) +{ + HTMLGenericElement *ret; + + ret = heap_alloc_zero(sizeof(HTMLGenericElement)); + + ret->lpHTMLGenericElementVtbl = &HTMLGenericElementVtbl; + ret->element.node.vtbl = &HTMLGenericElementImplVtbl; + + HTMLElement_Init(&ret->element); + + return &ret->element; +} diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index b18b09dcafc..afcf363c49b 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -728,7 +728,7 @@ static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode) switch(node_type) { case ELEMENT_NODE: - ret = &HTMLElement_Create(doc, nsnode)->node; + ret = &HTMLElement_Create(doc, nsnode, FALSE)->node; break; case TEXT_NODE: ret = HTMLDOMTextNode_Create(doc, nsnode); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 099f1c3169b..e14d9465673 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -521,7 +521,7 @@ void detach_ranges(HTMLDocument*); HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*); -HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*); +HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL); HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*); HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*); @@ -532,6 +532,7 @@ HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*); HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*); +HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*); void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*); void HTMLElement_Init(HTMLElement*);