1 /* 2 * Copyright 2008 Jacek Caban for CodeWeavers 3 * 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. 8 * 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. 13 * 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 17 */ 18 19 #include "mshtml_private.h" 20 21 struct HTMLCommentElement { 22 HTMLElement element; 23 IHTMLCommentElement IHTMLCommentElement_iface; 24 }; 25 26 static inline HTMLCommentElement *impl_from_IHTMLCommentElement(IHTMLCommentElement *iface) 27 { 28 return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLCommentElement_iface); 29 } 30 31 static HRESULT WINAPI HTMLCommentElement_QueryInterface(IHTMLCommentElement *iface, 32 REFIID riid, void **ppv) 33 { 34 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 35 36 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); 37 } 38 39 static ULONG WINAPI HTMLCommentElement_AddRef(IHTMLCommentElement *iface) 40 { 41 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 42 43 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); 44 } 45 46 static ULONG WINAPI HTMLCommentElement_Release(IHTMLCommentElement *iface) 47 { 48 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 49 50 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); 51 } 52 53 static HRESULT WINAPI HTMLCommentElement_GetTypeInfoCount(IHTMLCommentElement *iface, UINT *pctinfo) 54 { 55 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 56 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); 57 } 58 59 static HRESULT WINAPI HTMLCommentElement_GetTypeInfo(IHTMLCommentElement *iface, UINT iTInfo, 60 LCID lcid, ITypeInfo **ppTInfo) 61 { 62 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 63 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, 64 ppTInfo); 65 } 66 67 static HRESULT WINAPI HTMLCommentElement_GetIDsOfNames(IHTMLCommentElement *iface, REFIID riid, 68 LPOLESTR *rgszNames, UINT cNames, 69 LCID lcid, DISPID *rgDispId) 70 { 71 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 72 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, 73 cNames, lcid, rgDispId); 74 } 75 76 static HRESULT WINAPI HTMLCommentElement_Invoke(IHTMLCommentElement *iface, DISPID dispIdMember, 77 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 78 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 79 { 80 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 81 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, 82 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 83 } 84 85 static HRESULT WINAPI HTMLCommentElement_put_text(IHTMLCommentElement *iface, BSTR v) 86 { 87 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 88 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 89 return E_NOTIMPL; 90 } 91 92 static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BSTR *p) 93 { 94 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 95 96 TRACE("(%p)->(%p)\n", This, p); 97 98 return IHTMLElement_get_outerHTML(&This->element.IHTMLElement_iface, p); 99 } 100 101 static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, LONG v) 102 { 103 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 104 FIXME("(%p)->(%d)\n", This, v); 105 return E_NOTIMPL; 106 } 107 108 static HRESULT WINAPI HTMLCommentElement_get_atomic(IHTMLCommentElement *iface, LONG *p) 109 { 110 HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); 111 FIXME("(%p)->(%p)\n", This, p); 112 return E_NOTIMPL; 113 } 114 115 static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = { 116 HTMLCommentElement_QueryInterface, 117 HTMLCommentElement_AddRef, 118 HTMLCommentElement_Release, 119 HTMLCommentElement_GetTypeInfoCount, 120 HTMLCommentElement_GetTypeInfo, 121 HTMLCommentElement_GetIDsOfNames, 122 HTMLCommentElement_Invoke, 123 HTMLCommentElement_put_text, 124 HTMLCommentElement_get_text, 125 HTMLCommentElement_put_atomic, 126 HTMLCommentElement_get_atomic 127 }; 128 129 static inline HTMLCommentElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) 130 { 131 return CONTAINING_RECORD(iface, HTMLCommentElement, element.node); 132 } 133 134 static HRESULT HTMLCommentElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) 135 { 136 HTMLCommentElement *This = impl_from_HTMLDOMNode(iface); 137 138 *ppv = NULL; 139 140 if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) { 141 TRACE("(%p)->(IID_IHTMLCommentElement %p)\n", This, ppv); 142 *ppv = &This->IHTMLCommentElement_iface; 143 }else { 144 return HTMLElement_QI(&This->element.node, riid, ppv); 145 } 146 147 IUnknown_AddRef((IUnknown*)*ppv); 148 return S_OK; 149 } 150 151 static void HTMLCommentElement_destructor(HTMLDOMNode *iface) 152 { 153 HTMLCommentElement *This = impl_from_HTMLDOMNode(iface); 154 155 HTMLElement_destructor(&This->element.node); 156 } 157 158 static const NodeImplVtbl HTMLCommentElementImplVtbl = { 159 HTMLCommentElement_QI, 160 HTMLCommentElement_destructor, 161 HTMLElement_cpc, 162 HTMLElement_clone, 163 HTMLElement_handle_event, 164 HTMLElement_get_attr_col 165 }; 166 167 static const tid_t HTMLCommentElement_iface_tids[] = { 168 HTMLELEMENT_TIDS, 169 IHTMLCommentElement_tid, 170 0 171 }; 172 static dispex_static_data_t HTMLCommentElement_dispex = { 173 NULL, 174 DispHTMLCommentElement_tid, 175 NULL, 176 HTMLCommentElement_iface_tids 177 }; 178 179 HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLElement **elem) 180 { 181 HTMLCommentElement *ret; 182 183 ret = heap_alloc_zero(sizeof(*ret)); 184 if(!ret) 185 return E_OUTOFMEMORY; 186 187 ret->element.node.vtbl = &HTMLCommentElementImplVtbl; 188 ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl; 189 190 HTMLElement_Init(&ret->element, doc, NULL, &HTMLCommentElement_dispex); 191 HTMLDOMNode_Init(doc, &ret->element.node, nsnode); 192 193 *elem = &ret->element; 194 return S_OK; 195 } 196