From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/Makefile.in | 1 - dlls/mshtml/htmlcomment.c | 176 ------------------------------------- dlls/mshtml/htmltextnode.c | 143 ++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 177 deletions(-) delete mode 100644 dlls/mshtml/htmlcomment.c
diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 1e509a62e85..bc712a202c5 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -11,7 +11,6 @@ SOURCES = \ htmlarea.c \ htmlattr.c \ htmlbody.c \ - htmlcomment.c \ htmlcurstyle.c \ htmldoc.c \ htmlelem.c \ diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c deleted file mode 100644 index b2507385623..00000000000 --- a/dlls/mshtml/htmlcomment.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 <stdarg.h> - -#define COBJMACROS - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "ole2.h" - -#include "mshtml_private.h" -#include "htmlevent.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(mshtml); - -struct HTMLCommentElement { - HTMLElement element; - IHTMLCommentElement IHTMLCommentElement_iface; -}; - -static inline HTMLCommentElement *impl_from_IHTMLCommentElement(IHTMLCommentElement *iface) -{ - return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLCommentElement_iface); -} - -DISPEX_IDISPATCH_IMPL(HTMLCommentElement, IHTMLCommentElement, - impl_from_IHTMLCommentElement(iface)->element.node.event_target.dispex) - -static HRESULT WINAPI HTMLCommentElement_put_text(IHTMLCommentElement *iface, BSTR v) -{ - HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BSTR *p) -{ - HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); - - TRACE("(%p)->(%p)\n", This, p); - - return IHTMLElement_get_outerHTML(&This->element.IHTMLElement_iface, p); -} - -static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, LONG v) -{ - HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); - FIXME("(%p)->(%ld)\n", This, v); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLCommentElement_get_atomic(IHTMLCommentElement *iface, LONG *p) -{ - HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = { - HTMLCommentElement_QueryInterface, - HTMLCommentElement_AddRef, - HTMLCommentElement_Release, - HTMLCommentElement_GetTypeInfoCount, - HTMLCommentElement_GetTypeInfo, - HTMLCommentElement_GetIDsOfNames, - HTMLCommentElement_Invoke, - HTMLCommentElement_put_text, - HTMLCommentElement_get_text, - HTMLCommentElement_put_atomic, - HTMLCommentElement_get_atomic -}; - -static inline HTMLCommentElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) -{ - return CONTAINING_RECORD(iface, HTMLCommentElement, element.node); -} - -static HRESULT HTMLCommentElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) -{ - HTMLCommentElement *This = impl_from_HTMLDOMNode(iface); - HTMLElement *new_elem; - HRESULT hres; - - hres = HTMLCommentElement_Create(This->element.node.doc, nsnode, &new_elem); - if(FAILED(hres)) - return hres; - - *ret = &new_elem->node; - return S_OK; -} - -static inline HTMLCommentElement *impl_from_DispatchEx(DispatchEx *iface) -{ - return CONTAINING_RECORD(iface, HTMLCommentElement, element.node.event_target.dispex); -} - -static void *HTMLCommentElement_query_interface(DispatchEx *dispex, REFIID riid) -{ - HTMLCommentElement *This = impl_from_DispatchEx(dispex); - - if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) - return &This->IHTMLCommentElement_iface; - - return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); -} - -static const NodeImplVtbl HTMLCommentElementImplVtbl = { - .clsid = &CLSID_HTMLCommentElement, - .cpc_entries = HTMLElement_cpc, - .clone = HTMLCommentElement_clone, - .get_attr_col = HTMLElement_get_attr_col -}; - -static const event_target_vtbl_t HTMLCommentElement_event_target_vtbl = { - { - HTMLELEMENT_DISPEX_VTBL_ENTRIES, - .query_interface= HTMLCommentElement_query_interface, - .destructor = HTMLElement_destructor, - .traverse = HTMLElement_traverse, - .unlink = HTMLElement_unlink - }, - HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES, - .handle_event = HTMLElement_handle_event -}; - -static const tid_t Comment_iface_tids[] = { - HTMLELEMENT_TIDS, - IHTMLCommentElement_tid, - 0 -}; -dispex_static_data_t Comment_dispex = { - .id = PROT_Comment, - .prototype_id = PROT_CharacterData, - .vtbl = &HTMLCommentElement_event_target_vtbl.dispex_vtbl, - .disp_tid = DispHTMLCommentElement_tid, - .iface_tids = Comment_iface_tids, - .init_info = HTMLElement_init_dispex_info, -}; - -HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLElement **elem) -{ - HTMLCommentElement *ret; - - ret = calloc(1, sizeof(*ret)); - if(!ret) - return E_OUTOFMEMORY; - - ret->element.node.vtbl = &HTMLCommentElementImplVtbl; - ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl; - - HTMLElement_Init(&ret->element, doc, NULL, &Comment_dispex); - HTMLDOMNode_Init(doc, &ret->element.node, nsnode, &Comment_dispex); - - *elem = &ret->element; - return S_OK; -} diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 7169e7f91db..a0ccf710518 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -27,6 +27,7 @@ #include "ole2.h"
#include "mshtml_private.h" +#include "htmlevent.h"
#include "wine/debug.h"
@@ -40,6 +41,11 @@ struct HTMLDOMTextNode { nsIDOMText *nstext; };
+struct HTMLCommentElement { + HTMLElement element; + IHTMLCommentElement IHTMLCommentElement_iface; +}; + static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface) { return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode_iface); @@ -309,3 +315,140 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO *node = &ret->node; return S_OK; } + +static inline HTMLCommentElement *comment_from_IHTMLCommentElement(IHTMLCommentElement *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLCommentElement_iface); +} + +DISPEX_IDISPATCH_IMPL(HTMLCommentElement, IHTMLCommentElement, + comment_from_IHTMLCommentElement(iface)->element.node.event_target.dispex) + +static HRESULT WINAPI HTMLCommentElement_put_text(IHTMLCommentElement *iface, BSTR v) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BSTR *p) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return IHTMLElement_get_outerHTML(&This->element.IHTMLElement_iface, p); +} + +static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, LONG v) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement(iface); + FIXME("(%p)->(%ld)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_get_atomic(IHTMLCommentElement *iface, LONG *p) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = { + HTMLCommentElement_QueryInterface, + HTMLCommentElement_AddRef, + HTMLCommentElement_Release, + HTMLCommentElement_GetTypeInfoCount, + HTMLCommentElement_GetTypeInfo, + HTMLCommentElement_GetIDsOfNames, + HTMLCommentElement_Invoke, + HTMLCommentElement_put_text, + HTMLCommentElement_get_text, + HTMLCommentElement_put_atomic, + HTMLCommentElement_get_atomic +}; + +static inline HTMLCommentElement *comment_from_HTMLDOMNode(HTMLDOMNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, element.node); +} + +static HRESULT HTMLCommentElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) +{ + HTMLCommentElement *This = comment_from_HTMLDOMNode(iface); + HTMLElement *new_elem; + HRESULT hres; + + hres = HTMLCommentElement_Create(This->element.node.doc, nsnode, &new_elem); + if(FAILED(hres)) + return hres; + + *ret = &new_elem->node; + return S_OK; +} + +static inline HTMLCommentElement *comment_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, element.node.event_target.dispex); +} + +static void *HTMLCommentElement_query_interface(DispatchEx *dispex, REFIID riid) +{ + HTMLCommentElement *This = comment_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) + return &This->IHTMLCommentElement_iface; + + return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); +} + +static const NodeImplVtbl HTMLCommentElementImplVtbl = { + .clsid = &CLSID_HTMLCommentElement, + .cpc_entries = HTMLElement_cpc, + .clone = HTMLCommentElement_clone, + .get_attr_col = HTMLElement_get_attr_col +}; + +static const event_target_vtbl_t HTMLCommentElement_event_target_vtbl = { + { + HTMLELEMENT_DISPEX_VTBL_ENTRIES, + .query_interface= HTMLCommentElement_query_interface, + .destructor = HTMLElement_destructor, + .traverse = HTMLElement_traverse, + .unlink = HTMLElement_unlink + }, + HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES, + .handle_event = HTMLElement_handle_event +}; + +static const tid_t Comment_iface_tids[] = { + HTMLELEMENT_TIDS, + IHTMLCommentElement_tid, + 0 +}; +dispex_static_data_t Comment_dispex = { + .id = PROT_Comment, + .prototype_id = PROT_CharacterData, + .vtbl = &HTMLCommentElement_event_target_vtbl.dispex_vtbl, + .disp_tid = DispHTMLCommentElement_tid, + .iface_tids = Comment_iface_tids, + .init_info = HTMLElement_init_dispex_info, +}; + +HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLElement **elem) +{ + HTMLCommentElement *ret; + + ret = calloc(1, sizeof(*ret)); + if(!ret) + return E_OUTOFMEMORY; + + ret->element.node.vtbl = &HTMLCommentElementImplVtbl; + ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl; + + HTMLElement_Init(&ret->element, doc, NULL, &Comment_dispex); + HTMLDOMNode_Init(doc, &ret->element.node, nsnode, &Comment_dispex); + + *elem = &ret->element; + return S_OK; +}