2 * Copyright 2008 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
29 #include "mshtml_private.h"
30 #include "htmlevent.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 struct HTMLCommentElement
{
38 IHTMLCommentElement IHTMLCommentElement_iface
;
41 static inline HTMLCommentElement
*impl_from_IHTMLCommentElement(IHTMLCommentElement
*iface
)
43 return CONTAINING_RECORD(iface
, HTMLCommentElement
, IHTMLCommentElement_iface
);
46 DISPEX_IDISPATCH_IMPL(HTMLCommentElement
, IHTMLCommentElement
,
47 impl_from_IHTMLCommentElement(iface
)->element
.node
.event_target
.dispex
)
49 static HRESULT WINAPI
HTMLCommentElement_put_text(IHTMLCommentElement
*iface
, BSTR v
)
51 HTMLCommentElement
*This
= impl_from_IHTMLCommentElement(iface
);
52 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
56 static HRESULT WINAPI
HTMLCommentElement_get_text(IHTMLCommentElement
*iface
, BSTR
*p
)
58 HTMLCommentElement
*This
= impl_from_IHTMLCommentElement(iface
);
60 TRACE("(%p)->(%p)\n", This
, p
);
62 return IHTMLElement_get_outerHTML(&This
->element
.IHTMLElement_iface
, p
);
65 static HRESULT WINAPI
HTMLCommentElement_put_atomic(IHTMLCommentElement
*iface
, LONG v
)
67 HTMLCommentElement
*This
= impl_from_IHTMLCommentElement(iface
);
68 FIXME("(%p)->(%ld)\n", This
, v
);
72 static HRESULT WINAPI
HTMLCommentElement_get_atomic(IHTMLCommentElement
*iface
, LONG
*p
)
74 HTMLCommentElement
*This
= impl_from_IHTMLCommentElement(iface
);
75 FIXME("(%p)->(%p)\n", This
, p
);
79 static const IHTMLCommentElementVtbl HTMLCommentElementVtbl
= {
80 HTMLCommentElement_QueryInterface
,
81 HTMLCommentElement_AddRef
,
82 HTMLCommentElement_Release
,
83 HTMLCommentElement_GetTypeInfoCount
,
84 HTMLCommentElement_GetTypeInfo
,
85 HTMLCommentElement_GetIDsOfNames
,
86 HTMLCommentElement_Invoke
,
87 HTMLCommentElement_put_text
,
88 HTMLCommentElement_get_text
,
89 HTMLCommentElement_put_atomic
,
90 HTMLCommentElement_get_atomic
93 static inline HTMLCommentElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
95 return CONTAINING_RECORD(iface
, HTMLCommentElement
, element
.node
);
98 static HRESULT
HTMLCommentElement_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
100 HTMLCommentElement
*This
= impl_from_HTMLDOMNode(iface
);
101 HTMLElement
*new_elem
;
104 hres
= HTMLCommentElement_Create(This
->element
.node
.doc
, nsnode
, &new_elem
);
108 *ret
= &new_elem
->node
;
112 static inline HTMLCommentElement
*impl_from_DispatchEx(DispatchEx
*iface
)
114 return CONTAINING_RECORD(iface
, HTMLCommentElement
, element
.node
.event_target
.dispex
);
117 static void *HTMLCommentElement_query_interface(DispatchEx
*dispex
, REFIID riid
)
119 HTMLCommentElement
*This
= impl_from_DispatchEx(dispex
);
121 if(IsEqualGUID(&IID_IHTMLCommentElement
, riid
))
122 return &This
->IHTMLCommentElement_iface
;
124 return HTMLElement_query_interface(&This
->element
.node
.event_target
.dispex
, riid
);
127 static const NodeImplVtbl HTMLCommentElementImplVtbl
= {
128 .clsid
= &CLSID_HTMLCommentElement
,
129 .cpc_entries
= HTMLElement_cpc
,
130 .clone
= HTMLCommentElement_clone
,
131 .get_attr_col
= HTMLElement_get_attr_col
134 static const event_target_vtbl_t HTMLCommentElement_event_target_vtbl
= {
136 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
137 .query_interface
= HTMLCommentElement_query_interface
,
138 .destructor
= HTMLElement_destructor
,
139 .traverse
= HTMLElement_traverse
,
140 .unlink
= HTMLElement_unlink
142 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
143 .handle_event
= HTMLElement_handle_event
146 static const tid_t HTMLCommentElement_iface_tids
[] = {
148 IHTMLCommentElement_tid
,
151 static dispex_static_data_t HTMLCommentElement_dispex
= {
153 &HTMLCommentElement_event_target_vtbl
.dispex_vtbl
,
154 DispHTMLCommentElement_tid
,
155 HTMLCommentElement_iface_tids
,
156 HTMLElement_init_dispex_info
159 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, HTMLElement
**elem
)
161 HTMLCommentElement
*ret
;
163 ret
= calloc(1, sizeof(*ret
));
165 return E_OUTOFMEMORY
;
167 ret
->element
.node
.vtbl
= &HTMLCommentElementImplVtbl
;
168 ret
->IHTMLCommentElement_iface
.lpVtbl
= &HTMLCommentElementVtbl
;
170 HTMLElement_Init(&ret
->element
, doc
, NULL
, &HTMLCommentElement_dispex
);
171 HTMLDOMNode_Init(doc
, &ret
->element
.node
, nsnode
, &HTMLCommentElement_dispex
);
173 *elem
= &ret
->element
;