From 574becbf87889ae968815bc296c272a47f5f0088 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 28 Mar 2012 13:35:13 +0200 Subject: [PATCH] mshtml: Added IHTMLTableCell interface stub implementation. --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/htmlelem.c | 2 + dlls/mshtml/htmltablecell.c | 375 +++++++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 3 + dlls/mshtml/tests/dom.c | 3 +- 5 files changed, 383 insertions(+), 1 deletion(-) create mode 100644 dlls/mshtml/htmltablecell.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index e5abee1283..825aeb891b 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -44,6 +44,7 @@ C_SRCS = \ htmlstyleelem.c \ htmlstylesheet.c \ htmltable.c \ + htmltablecell.c \ htmltablerow.c \ htmltextarea.c \ htmltextcont.c \ diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 1eab2cdaaa..b82c4dfce9 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -51,6 +51,7 @@ static const WCHAR scriptW[] = {'S','C','R','I','P','T',0}; static const WCHAR selectW[] = {'S','E','L','E','C','T',0}; static const WCHAR styleW[] = {'S','T','Y','L','E',0}; static const WCHAR tableW[] = {'T','A','B','L','E',0}; +static const WCHAR tdW[] = {'T','D',0}; static const WCHAR textareaW[] = {'T','E','X','T','A','R','E','A',0}; static const WCHAR title_tagW[]= {'T','I','T','L','E',0}; static const WCHAR trW[] = {'T','R',0}; @@ -76,6 +77,7 @@ static const tag_desc_t tag_descs[] = { {selectW, HTMLSelectElement_Create}, {styleW, HTMLStyleElement_Create}, {tableW, HTMLTable_Create}, + {tdW, HTMLTableCell_Create}, {textareaW, HTMLTextAreaElement_Create}, {title_tagW, HTMLTitleElement_Create}, {trW, HTMLTableRow_Create} diff --git a/dlls/mshtml/htmltablecell.c b/dlls/mshtml/htmltablecell.c new file mode 100644 index 0000000000..ebdfcbef6c --- /dev/null +++ b/dlls/mshtml/htmltablecell.c @@ -0,0 +1,375 @@ +/* + * Copyright 2012 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; + + IHTMLTableCell IHTMLTableCell_iface; +} HTMLTableCell; + +static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface) +{ + return CONTAINING_RECORD(iface, HTMLTableCell, IHTMLTableCell_iface); +} + +static HRESULT WINAPI HTMLTableCell_QueryInterface(IHTMLTableCell *iface, REFIID riid, void **ppv) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLTableCell_AddRef(IHTMLTableCell *iface) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLTableCell_Release(IHTMLTableCell *iface) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLTableCell_GetTypeInfoCount(IHTMLTableCell *iface, UINT *pctinfo) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLTableCell_GetTypeInfo(IHTMLTableCell *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLTableCell_GetIDsOfNames(IHTMLTableCell *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdMember, REFIID riid, + LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, + UINT *puArgErr) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_vAlign(IHTMLTableCell *iface, BSTR *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_noWrap(IHTMLTableCell *iface, VARIANT_BOOL *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_background(IHTMLTableCell *iface, BSTR v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_background(IHTMLTableCell *iface, BSTR *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_borderColor(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_borderColor(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_borderColorLight(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_borderColorLight(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_borderColorDark(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_height(IHTMLTableCell *iface, VARIANT *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p) +{ + HTMLTableCell *This = impl_from_IHTMLTableCell(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLTableCellVtbl HTMLTableCellVtbl = { + HTMLTableCell_QueryInterface, + HTMLTableCell_AddRef, + HTMLTableCell_Release, + HTMLTableCell_GetTypeInfoCount, + HTMLTableCell_GetTypeInfo, + HTMLTableCell_GetIDsOfNames, + HTMLTableCell_Invoke, + HTMLTableCell_put_rowSpan, + HTMLTableCell_get_rowSpan, + HTMLTableCell_put_colSpan, + HTMLTableCell_get_colSpan, + HTMLTableCell_put_align, + HTMLTableCell_get_align, + HTMLTableCell_put_vAlign, + HTMLTableCell_get_vAlign, + HTMLTableCell_put_bgColor, + HTMLTableCell_get_bgColor, + HTMLTableCell_put_noWrap, + HTMLTableCell_get_noWrap, + HTMLTableCell_put_background, + HTMLTableCell_get_background, + HTMLTableCell_put_borderColor, + HTMLTableCell_get_borderColor, + HTMLTableCell_put_borderColorLight, + HTMLTableCell_get_borderColorLight, + HTMLTableCell_put_borderColorDark, + HTMLTableCell_get_borderColorDark, + HTMLTableCell_put_width, + HTMLTableCell_get_width, + HTMLTableCell_put_height, + HTMLTableCell_get_height, + HTMLTableCell_get_cellIndex +}; + +static inline HTMLTableCell *impl_from_HTMLDOMNode(HTMLDOMNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLTableCell, element.node); +} + +static HRESULT HTMLTableCell_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) +{ + HTMLTableCell *This = impl_from_HTMLDOMNode(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IHTMLTableCell_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IHTMLTableCell_iface; + }else if(IsEqualGUID(&IID_IHTMLTableCell, riid)) { + TRACE("(%p)->(IID_IHTMLTableCell %p)\n", This, ppv); + *ppv = &This->IHTMLTableCell_iface; + }else { + return HTMLElement_QI(&This->element.node, riid, ppv); + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static void HTMLTableCell_destructor(HTMLDOMNode *iface) +{ + HTMLTableCell *This = impl_from_HTMLDOMNode(iface); + + HTMLElement_destructor(&This->element.node); +} + +static const NodeImplVtbl HTMLTableCellImplVtbl = { + HTMLTableCell_QI, + HTMLTableCell_destructor, + HTMLElement_clone, + HTMLElement_get_attr_col +}; + +static const tid_t HTMLTableCell_iface_tids[] = { + HTMLELEMENT_TIDS, + IHTMLTableCell_tid, + 0 +}; + +static dispex_static_data_t HTMLTableCell_dispex = { + NULL, + DispHTMLTableCell_tid, + NULL, + HTMLTableCell_iface_tids +}; + +HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) +{ + HTMLTableCell *ret; + + ret = heap_alloc_zero(sizeof(*ret)); + if(!ret) + return E_OUTOFMEMORY; + + ret->IHTMLTableCell_iface.lpVtbl = &HTMLTableCellVtbl; + ret->element.node.vtbl = &HTMLTableCellImplVtbl; + + HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex); + + *elem = &ret->element; + return S_OK; +} diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 697dcf3cd7..2e4df12663 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -102,6 +102,7 @@ typedef struct event_target_t event_target_t; XDIID(DispHTMLStyleElement) \ XDIID(DispHTMLStyleSheetsCollection) \ XDIID(DispHTMLTable) \ + XDIID(DispHTMLTableCell) \ XDIID(DispHTMLTableRow) \ XDIID(DispHTMLTextAreaElement) \ XDIID(DispHTMLTitleElement) \ @@ -167,6 +168,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLTable) \ XIID(IHTMLTable2) \ XIID(IHTMLTable3) \ + XIID(IHTMLTableCell) \ XIID(IHTMLTableRow) \ XIID(IHTMLTextAreaElement) \ XIID(IHTMLTextContainer) \ @@ -779,6 +781,7 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElemen HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; +HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index a8d0f13ef1..adb830f7d3 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -280,6 +280,7 @@ static const IID * const tr_iids[] = { static const IID * const td_iids[] = { ELEM_IFACES, + &IID_IHTMLTableCell, &IID_IConnectionPointContainer, NULL }; @@ -409,7 +410,7 @@ static const elem_type_info_t elem_type_infos[] = { {"!", comment_iids, &DIID_DispHTMLCommentElement}, {"IMG", img_iids, &DIID_DispHTMLImg}, {"TR", tr_iids, &DIID_DispHTMLTableRow}, - {"TD", td_iids, NULL}, + {"TD", td_iids, &DIID_DispHTMLTableCell}, {"IFRAME", iframe_iids, &DIID_DispHTMLIFrame}, {"FORM", form_iids, &DIID_DispHTMLFormElement}, {"FRAME", frame_iids, &DIID_DispHTMLFrameElement}, -- 2.32.0.93.g670b81a890