-- v4: mshtml: Make ProgressEvent constructor only available in IE10+ modes. mshtml: Make PageTransitionEvents only available in IE11 mode. mshtml: Expose ie9_char as char for KeyboardEvent. mshtml: Implement get_data for legacy DOCTYPE comment elements. mshtml: Don't expose element props from comment nodes in IE9+ modes. mshtml: Don't expose 'atomic' prop from comment nodes in IE9+ modes. mshtml: Expose IHTMLCommentElement2 interface for comment elements. mshtml: Don't expose toString from text nodes in IE9+ mode. mshtml: Expose the props from the IWineHTMLCharacterData interface for mshtml: Add an internal IWineHTMLCharacterData interface and forward text mshtml: Move htmlcomment.c contents into htmltextnode.c.
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; +}
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 185 ++++++++++++++++++++------- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/mshtml_private_iface.idl | 27 ++++ 3 files changed, 170 insertions(+), 43 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index a0ccf710518..fb908cea18d 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -33,10 +33,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+struct CharacterData { + IWineHTMLCharacterData IWineHTMLCharacterData_iface; + HTMLDOMNode *node; + nsIDOMCharacterData *nschardata; +}; + struct HTMLDOMTextNode { HTMLDOMNode node; IHTMLDOMTextNode IHTMLDOMTextNode_iface; IHTMLDOMTextNode2 IHTMLDOMTextNode2_iface; + struct CharacterData character_data;
nsIDOMText *nstext; }; @@ -46,41 +53,156 @@ struct HTMLCommentElement { IHTMLCommentElement IHTMLCommentElement_iface; };
-static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface) +static inline struct CharacterData *impl_from_IWineHTMLCharacterData(IWineHTMLCharacterData *iface) { - return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode_iface); + return CONTAINING_RECORD(iface, struct CharacterData, IWineHTMLCharacterData_iface); }
-DISPEX_IDISPATCH_IMPL(HTMLDOMTextNode, IHTMLDOMTextNode, - impl_from_IHTMLDOMTextNode(iface)->node.event_target.dispex) +DISPEX_IDISPATCH_IMPL(CharacterData, IWineHTMLCharacterData, + impl_from_IWineHTMLCharacterData(iface)->node->event_target.dispex)
-static HRESULT WINAPI HTMLDOMTextNode_put_data(IHTMLDOMTextNode *iface, BSTR v) +static HRESULT WINAPI CharacterData_put_data(IWineHTMLCharacterData *iface, BSTR v) { - HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); nsAString nsstr; nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMText_SetData(This->nstext, &nsstr); + nsres = nsIDOMCharacterData_SetData(This->nschardata, &nsstr); nsAString_Finish(&nsstr); return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL; }
-static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p) +static HRESULT WINAPI CharacterData_get_data(IWineHTMLCharacterData *iface, BSTR *p) { - HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); nsAString nsstr; nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&nsstr, NULL); - nsres = nsIDOMText_GetData(This->nstext, &nsstr); + nsres = nsIDOMCharacterData_GetData(This->nschardata, &nsstr); return return_nsstr(nsres, &nsstr, p); }
+static HRESULT WINAPI CharacterData_get_length(IWineHTMLCharacterData *iface, LONG *p) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + UINT32 length = 0; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMCharacterData_GetLength(This->nschardata, &length); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + + *p = length; + return S_OK; +} + +static HRESULT WINAPI CharacterData_substringData(IWineHTMLCharacterData *iface, LONG offset, LONG count, BSTR *string) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + + FIXME("(%p)->(%ld %ld %p)\n", This, offset, count, string); + + return E_NOTIMPL; +} + +static HRESULT WINAPI CharacterData_appendData(IWineHTMLCharacterData *iface, BSTR string) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(string)); + + nsAString_InitDepend(&nsstr, string); + nsres = nsIDOMCharacterData_AppendData(This->nschardata, &nsstr); + nsAString_Finish(&nsstr); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + + return S_OK; +} + +static HRESULT WINAPI CharacterData_insertData(IWineHTMLCharacterData *iface, LONG offset, BSTR string) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + + FIXME("(%p)->(%ld %s)\n", This, offset, debugstr_w(string)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI CharacterData_deleteData(IWineHTMLCharacterData *iface, LONG offset, LONG count) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + + FIXME("(%p)->(%ld %ld)\n", This, offset, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI CharacterData_replaceData(IWineHTMLCharacterData *iface, LONG offset, LONG count, BSTR string) +{ + struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + + FIXME("(%p)->(%ld %ld %s)\n", This, offset, count, debugstr_w(string)); + + return E_NOTIMPL; +} + +static const IWineHTMLCharacterDataVtbl CharacterDataVtbl = { + CharacterData_QueryInterface, + CharacterData_AddRef, + CharacterData_Release, + CharacterData_GetTypeInfoCount, + CharacterData_GetTypeInfo, + CharacterData_GetIDsOfNames, + CharacterData_Invoke, + CharacterData_put_data, + CharacterData_get_data, + CharacterData_get_length, + CharacterData_substringData, + CharacterData_appendData, + CharacterData_insertData, + CharacterData_deleteData, + CharacterData_replaceData +}; + +static void init_char_data(HTMLDOMNode *node, nsIDOMCharacterData *nschardata, struct CharacterData *ret) +{ + /* nschardata shares reference with nsnode */ + ret->IWineHTMLCharacterData_iface.lpVtbl = &CharacterDataVtbl; + ret->nschardata = nschardata; + ret->node = node; +} + +static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode_iface); +} + +DISPEX_IDISPATCH_IMPL(HTMLDOMTextNode, IHTMLDOMTextNode, + impl_from_IHTMLDOMTextNode(iface)->node.event_target.dispex) + +static HRESULT WINAPI HTMLDOMTextNode_put_data(IHTMLDOMTextNode *iface, BSTR v) +{ + HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); + return CharacterData_put_data(&This->character_data.IWineHTMLCharacterData_iface, v); +} + +static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p) +{ + HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); + return CharacterData_get_data(&This->character_data.IWineHTMLCharacterData_iface, p); +} + static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *String) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); @@ -99,17 +221,7 @@ static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *St static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *p) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); - UINT32 length = 0; - nsresult nsres; - - TRACE("(%p)->(%p)\n", This, p); - - nsres = nsIDOMText_GetLength(This->nstext, &length); - if(NS_FAILED(nsres)) - ERR("GetLength failed: %08lx\n", nsres); - - *p = length; - return S_OK; + return CharacterData_get_length(&This->character_data.IWineHTMLCharacterData_iface, p); }
static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode) @@ -168,48 +280,31 @@ DISPEX_IDISPATCH_IMPL(HTMLDOMTextNode2, IHTMLDOMTextNode2, static HRESULT WINAPI HTMLDOMTextNode2_substringData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR *string) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - FIXME("(%p)->(%ld %ld %p)\n", This, offset, count, string); - return E_NOTIMPL; + return CharacterData_substringData(&This->character_data.IWineHTMLCharacterData_iface, offset, count, string); }
static HRESULT WINAPI HTMLDOMTextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR string) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - nsAString nsstr; - nsresult nsres; - - TRACE("(%p)->(%s)\n", This, debugstr_w(string)); - - nsAString_InitDepend(&nsstr, string); - nsres = nsIDOMText_AppendData(This->nstext, &nsstr); - nsAString_Finish(&nsstr); - if(NS_FAILED(nsres)) { - ERR("AppendData failed: %08lx\n", nsres); - return E_FAIL; - } - - return S_OK; + return CharacterData_appendData(&This->character_data.IWineHTMLCharacterData_iface, string); }
static HRESULT WINAPI HTMLDOMTextNode2_insertData(IHTMLDOMTextNode2 *iface, LONG offset, BSTR string) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - FIXME("(%p)->(%ld %s)\n", This, offset, debugstr_w(string)); - return E_NOTIMPL; + return CharacterData_insertData(&This->character_data.IWineHTMLCharacterData_iface, offset, string); }
static HRESULT WINAPI HTMLDOMTextNode2_deleteData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - FIXME("(%p)->(%ld %ld)\n", This, offset, count); - return E_NOTIMPL; + return CharacterData_deleteData(&This->character_data.IWineHTMLCharacterData_iface, offset, count); }
static HRESULT WINAPI HTMLDOMTextNode2_replaceData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR string) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface); - FIXME("(%p)->(%ld %ld %s)\n", This, offset, count, debugstr_w(string)); - return E_NOTIMPL; + return CharacterData_replaceData(&This->character_data.IWineHTMLCharacterData_iface, offset, count, string); }
static const IHTMLDOMTextNode2Vtbl HTMLDOMTextNode2Vtbl = { @@ -252,6 +347,8 @@ static void *HTMLDOMTextNode_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLDOMTextNode_iface; if(IsEqualGUID(&IID_IHTMLDOMTextNode2, riid)) return &This->IHTMLDOMTextNode2_iface; + if(IsEqualGUID(&IID_IWineHTMLCharacterData, riid)) + return &This->character_data.IWineHTMLCharacterData_iface;
return HTMLDOMNode_query_interface(&This->node.event_target.dispex, riid); } @@ -312,6 +409,8 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO /* Share reference with nsnode */ nsIDOMNode_Release(ret->node.nsnode);
+ init_char_data(&ret->node, (nsIDOMCharacterData*)ret->nstext, &ret->character_data); + *node = &ret->node; return S_OK; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1f4c6ae4b65..881049c6cd3 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -299,6 +299,7 @@ typedef struct ScriptHost ScriptHost;
#define PRIVATE_TID_LIST \ XIID(IWineDOMTokenList) \ + XIID(IWineHTMLCharacterData) \ XIID(IWineHTMLElementPrivate) \ XIID(IWineHTMLWindowPrivate) \ XIID(IWineHTMLWindowCompatPrivate) \ diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 7be013bcc32..e32687329f9 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -149,6 +149,33 @@ interface IWineHTMLWindowCompatPrivate : IDispatch HRESULT performance([out, retval] VARIANT *p); }
+[ + odl, + oleautomation, + dual, + hidden, + uuid(465908fd-f394-489f-b7a3-4c00fbbe9eeb) +] +interface IWineHTMLCharacterData : IDispatch +{ + [propput, id(32)] + HRESULT data([in] BSTR v); + [propget, id(32)] + HRESULT data([out, retval] BSTR *p); + [propget, id(33)] + HRESULT length([out, retval] LONG *p); + [id(34)] + HRESULT substringData([in] LONG offset, [in] LONG count, [out, retval] BSTR *p); + [id(35)] + HRESULT appendData([in] BSTR string); + [id(36)] + HRESULT insertData([in] LONG offset, [in] BSTR string); + [id(37)] + HRESULT deleteData([in] LONG offset, [in] LONG count); + [id(38)] + HRESULT replaceData([in] LONG offset, [in] LONG count, [in] BSTR string); +} + [ odl, oleautomation,
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 25 +++++++++++++++++++------ dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index fb908cea18d..88ca191af1d 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -175,6 +175,17 @@ static const IWineHTMLCharacterDataVtbl CharacterDataVtbl = { CharacterData_replaceData };
+static void CharacterData_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + dispex_info_add_interface(info, IWineHTMLCharacterData_tid, NULL); +} + +dispex_static_data_t CharacterData_dispex = { + .id = PROT_CharacterData, + .prototype_id = PROT_Node, + .init_info = CharacterData_init_dispex_info, +}; + static void init_char_data(HTMLDOMNode *node, nsIDOMCharacterData *nschardata, struct CharacterData *ret) { /* nschardata shares reference with nsnode */ @@ -360,11 +371,6 @@ static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = { .clone = HTMLDOMTextNode_clone };
-dispex_static_data_t CharacterData_dispex = { - .id = PROT_CharacterData, - .prototype_id = PROT_Node, -}; - static const dispex_static_data_vtbl_t Text_dispex_vtbl = { .query_interface = HTMLDOMTextNode_query_interface, .destructor = HTMLDOMNode_destructor, @@ -372,6 +378,13 @@ static const dispex_static_data_vtbl_t Text_dispex_vtbl = { .unlink = HTMLDOMNode_unlink };
+static void Text_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLDOMNode_init_dispex_info(info, mode); + if(mode >= COMPAT_MODE_IE9) + CharacterData_init_dispex_info(info, mode); +} + static const tid_t Text_iface_tids[] = { IHTMLDOMNode_tid, IHTMLDOMNode2_tid, @@ -385,7 +398,7 @@ dispex_static_data_t Text_dispex = { .vtbl = &Text_dispex_vtbl, .disp_tid = DispHTMLDOMTextNode_tid, .iface_tids = Text_iface_tids, - .init_info = HTMLDOMNode_init_dispex_info, + .init_info = Text_init_dispex_info, };
HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNode **node) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index fea12ce1f1a..d187efd32f0 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -3665,6 +3665,7 @@ sync_test("prototype props", function() { test_own_props(constr.prototype, name, props, todos, flaky); }
+ check(CharacterData, [ "appendData", "data", "deleteData", "insertData", "length", "replaceData", "substringData" ]); check(CSSStyleRule, [ "readOnly", "selectorText", "style" ]); check(CustomEvent, [ "detail", "initCustomEvent" ]); check(DocumentType, [ "entities", "internalSubset", "name", "notations", "publicId", "systemId" ]); @@ -3698,5 +3699,6 @@ sync_test("prototype props", function() { "PROCESSING_INSTRUCTION_NODE", "TEXT_NODE", "hasAttributes", "normalize" ]); check(StorageEvent, [ "initStorageEvent", "key", "newValue", "oldValue", "storageArea", "url" ]); + check(Text, [ "removeNode", "replaceNode", "replaceWholeText", "splitText", "swapNode", "wholeText" ], [ "replaceWholeText", "toString", "wholeText" ]); check(UIEvent, [ "detail", "initUIEvent", "view" ], null, [ "deviceSessionId" ]); });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 15 +++++++++------ dlls/mshtml/tests/documentmode.js | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 88ca191af1d..7ca7737b968 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -25,6 +25,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "mshtmdid.h"
#include "mshtml_private.h" #include "htmlevent.h" @@ -223,10 +224,7 @@ static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *St if(!String) return E_INVALIDARG;
- if(dispex_compat_mode(&This->node.event_target.dispex) < COMPAT_MODE_IE9) - return IHTMLDOMTextNode_get_data(&This->IHTMLDOMTextNode_iface, String); - - return dispex_to_string(&This->node.event_target.dispex, String); + return IHTMLDOMTextNode_get_data(&This->IHTMLDOMTextNode_iface, String); }
static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *p) @@ -380,16 +378,21 @@ static const dispex_static_data_vtbl_t Text_dispex_vtbl = {
static void Text_init_dispex_info(dispex_data_t *info, compat_mode_t mode) { + static const dispex_hook_t textnode_ie9_hooks[] = { + {DISPID_IHTMLDOMTEXTNODE_TOSTRING}, + {DISPID_UNKNOWN} + }; HTMLDOMNode_init_dispex_info(info, mode); if(mode >= COMPAT_MODE_IE9) CharacterData_init_dispex_info(info, mode); + else + dispex_info_add_interface(info, IHTMLDOMTextNode2_tid, NULL); + dispex_info_add_interface(info, IHTMLDOMTextNode_tid, mode >= COMPAT_MODE_IE9 ? textnode_ie9_hooks : NULL); }
static const tid_t Text_iface_tids[] = { IHTMLDOMNode_tid, IHTMLDOMNode2_tid, - IHTMLDOMTextNode_tid, - IHTMLDOMTextNode2_tid, 0 }; dispex_static_data_t Text_dispex = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index d187efd32f0..9f714218cb3 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -614,6 +614,7 @@ sync_test("textnode_props", function() { test_exposed("removeNode", true); test_exposed("replaceNode", true); test_exposed("swapNode", true); + test_exposed("toString", true); test_exposed("compareDocumentPosition", v >= 9); test_exposed("isEqualNode", v >= 9); test_exposed("prefix", v >= 9); @@ -3699,6 +3700,6 @@ sync_test("prototype props", function() { "PROCESSING_INSTRUCTION_NODE", "TEXT_NODE", "hasAttributes", "normalize" ]); check(StorageEvent, [ "initStorageEvent", "key", "newValue", "oldValue", "storageArea", "url" ]); - check(Text, [ "removeNode", "replaceNode", "replaceWholeText", "splitText", "swapNode", "wholeText" ], [ "replaceWholeText", "toString", "wholeText" ]); + check(Text, [ "removeNode", "replaceNode", "replaceWholeText", "splitText", "swapNode", "wholeText" ], [ "replaceWholeText", "wholeText" ]); check(UIEvent, [ "detail", "initUIEvent", "view" ], null, [ "deviceSessionId" ]); });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 122 +++++++++++++++++++++++++++++- dlls/mshtml/tests/documentmode.js | 10 +++ dlls/mshtml/tests/dom.c | 1 + 3 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 7ca7737b968..f653faffcd7 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -52,6 +52,8 @@ struct HTMLDOMTextNode { struct HTMLCommentElement { HTMLElement element; IHTMLCommentElement IHTMLCommentElement_iface; + IHTMLCommentElement2 IHTMLCommentElement2_iface; + struct CharacterData character_data; };
static inline struct CharacterData *impl_from_IWineHTMLCharacterData(IWineHTMLCharacterData *iface) @@ -70,6 +72,11 @@ static HRESULT WINAPI CharacterData_put_data(IWineHTMLCharacterData *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+ if(!This->nschardata) { + FIXME("legacy doctype comment\n"); + return E_NOTIMPL; + } + nsAString_InitDepend(&nsstr, v); nsres = nsIDOMCharacterData_SetData(This->nschardata, &nsstr); nsAString_Finish(&nsstr); @@ -84,6 +91,11 @@ static HRESULT WINAPI CharacterData_get_data(IWineHTMLCharacterData *iface, BSTR
TRACE("(%p)->(%p)\n", This, p);
+ if(!This->nschardata) { + FIXME("legacy doctype comment\n"); + return E_NOTIMPL; + } + nsAString_Init(&nsstr, NULL); nsres = nsIDOMCharacterData_GetData(This->nschardata, &nsstr); return return_nsstr(nsres, &nsstr, p); @@ -97,6 +109,11 @@ static HRESULT WINAPI CharacterData_get_length(IWineHTMLCharacterData *iface, LO
TRACE("(%p)->(%p)\n", This, p);
+ if(!This->nschardata) { + FIXME("legacy doctype comment\n"); + return E_NOTIMPL; + } + nsres = nsIDOMCharacterData_GetLength(This->nschardata, &length); if(NS_FAILED(nsres)) return map_nsresult(nsres); @@ -122,6 +139,11 @@ static HRESULT WINAPI CharacterData_appendData(IWineHTMLCharacterData *iface, BS
TRACE("(%p)->(%s)\n", This, debugstr_w(string));
+ if(!This->nschardata) { + FIXME("legacy doctype comment\n"); + return E_NOTIMPL; + } + nsAString_InitDepend(&nsstr, string); nsres = nsIDOMCharacterData_AppendData(This->nschardata, &nsstr); nsAString_Finish(&nsstr); @@ -483,6 +505,80 @@ static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = { HTMLCommentElement_get_atomic };
+static inline HTMLCommentElement *comment_from_IHTMLCommentElement2(IHTMLCommentElement2 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLCommentElement2_iface); +} + +DISPEX_IDISPATCH_IMPL(HTMLCommentElement2, IHTMLCommentElement2, + comment_from_IHTMLCommentElement2(iface)->element.node.event_target.dispex) + +static HRESULT WINAPI HTMLCommentElement2_put_data(IHTMLCommentElement2 *iface, BSTR v) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_put_data(&This->character_data.IWineHTMLCharacterData_iface, v); +} + +static HRESULT WINAPI HTMLCommentElement2_get_data(IHTMLCommentElement2 *iface, BSTR *p) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_get_data(&This->character_data.IWineHTMLCharacterData_iface, p); +} + +static HRESULT WINAPI HTMLCommentElement2_get_length(IHTMLCommentElement2 *iface, LONG *p) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_get_length(&This->character_data.IWineHTMLCharacterData_iface, p); +} + +static HRESULT WINAPI HTMLCommentElement2_substringData(IHTMLCommentElement2 *iface, LONG offset, LONG count, BSTR *string) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_substringData(&This->character_data.IWineHTMLCharacterData_iface, offset, count, string); +} + +static HRESULT WINAPI HTMLCommentElement2_appendData(IHTMLCommentElement2 *iface, BSTR string) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_appendData(&This->character_data.IWineHTMLCharacterData_iface, string); +} + +static HRESULT WINAPI HTMLCommentElement2_insertData(IHTMLCommentElement2 *iface, LONG offset, BSTR string) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_insertData(&This->character_data.IWineHTMLCharacterData_iface, offset, string); +} + +static HRESULT WINAPI HTMLCommentElement2_deleteData(IHTMLCommentElement2 *iface, LONG offset, LONG count) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_deleteData(&This->character_data.IWineHTMLCharacterData_iface, offset, count); +} + +static HRESULT WINAPI HTMLCommentElement2_replaceData(IHTMLCommentElement2 *iface, LONG offset, LONG count, BSTR string) +{ + HTMLCommentElement *This = comment_from_IHTMLCommentElement2(iface); + return CharacterData_replaceData(&This->character_data.IWineHTMLCharacterData_iface, offset, count, string); +} + +static const IHTMLCommentElement2Vtbl HTMLCommentElement2Vtbl = { + HTMLCommentElement2_QueryInterface, + HTMLCommentElement2_AddRef, + HTMLCommentElement2_Release, + HTMLCommentElement2_GetTypeInfoCount, + HTMLCommentElement2_GetTypeInfo, + HTMLCommentElement2_GetIDsOfNames, + HTMLCommentElement2_Invoke, + HTMLCommentElement2_put_data, + HTMLCommentElement2_get_data, + HTMLCommentElement2_get_length, + HTMLCommentElement2_substringData, + HTMLCommentElement2_appendData, + HTMLCommentElement2_insertData, + HTMLCommentElement2_deleteData, + HTMLCommentElement2_replaceData +}; + static inline HTMLCommentElement *comment_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLCommentElement, element.node); @@ -513,6 +609,10 @@ static void *HTMLCommentElement_query_interface(DispatchEx *dispex, REFIID riid)
if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) return &This->IHTMLCommentElement_iface; + if(IsEqualGUID(&IID_IHTMLCommentElement2, riid)) + return &This->IHTMLCommentElement2_iface; + if(IsEqualGUID(&IID_IWineHTMLCharacterData, riid)) + return &This->character_data.IWineHTMLCharacterData_iface;
return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -536,6 +636,12 @@ static const event_target_vtbl_t HTMLCommentElement_event_target_vtbl = { .handle_event = HTMLElement_handle_event };
+static void Comment_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLElement_init_dispex_info(info, mode); + CharacterData_init_dispex_info(info, mode); +} + static const tid_t Comment_iface_tids[] = { HTMLELEMENT_TIDS, IHTMLCommentElement_tid, @@ -547,12 +653,14 @@ dispex_static_data_t Comment_dispex = { .vtbl = &HTMLCommentElement_event_target_vtbl.dispex_vtbl, .disp_tid = DispHTMLCommentElement_tid, .iface_tids = Comment_iface_tids, - .init_info = HTMLElement_init_dispex_info, + .init_info = Comment_init_dispex_info, };
HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLElement **elem) { + nsIDOMCharacterData *nschardata; HTMLCommentElement *ret; + nsresult nsres;
ret = calloc(1, sizeof(*ret)); if(!ret) @@ -560,10 +668,22 @@ HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTM
ret->element.node.vtbl = &HTMLCommentElementImplVtbl; ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl; + ret->IHTMLCommentElement2_iface.lpVtbl = &HTMLCommentElement2Vtbl;
HTMLElement_Init(&ret->element, doc, NULL, &Comment_dispex); HTMLDOMNode_Init(doc, &ret->element.node, nsnode, &Comment_dispex);
+ nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMCharacterData, (void**)&nschardata); + if(nsres != NS_OK) + nschardata = NULL; + else { + assert((nsIDOMNode*)nschardata == nsnode); + + /* Share reference with nsnode */ + nsIDOMCharacterData_Release(nschardata); + } + init_char_data(&ret->element.node, nschardata, &ret->character_data); + *elem = &ret->element; return S_OK; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 9f714218cb3..f89c155f532 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -535,6 +535,16 @@ sync_test("elem_props", function() { test_exposed("msSetPointerCapture", v >= 10); if (v >= 9) test_exposed("spellcheck", v >= 10);
+ elem = document.createComment(""); + test_exposed("data", true); + test_exposed("length", true); + test_exposed("text", true); + test_exposed("appendData", true); + test_exposed("deleteData", true); + test_exposed("insertData", true); + test_exposed("replaceData", true); + test_exposed("substringData", true); + elem = document.createElement("style"); test_exposed("media", true); test_exposed("type", true); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 0ff11a74d01..c125f2e2ef2 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -338,6 +338,7 @@ static const IID * const window_iids[] = { static const IID * const comment_iids[] = { ELEM_IFACES, &IID_IHTMLCommentElement, + &IID_IHTMLCommentElement2, &IID_IConnectionPointContainer, NULL };
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 13 +++++++------ dlls/mshtml/tests/documentmode.js | 1 + 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index f653faffcd7..635dbda667b 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -638,21 +638,22 @@ static const event_target_vtbl_t HTMLCommentElement_event_target_vtbl = {
static void Comment_init_dispex_info(dispex_data_t *info, compat_mode_t mode) { + static const dispex_hook_t ie9_hooks[] = { + {DISPID_IHTMLCOMMENTELEMENT_ATOMIC}, + {DISPID_UNKNOWN} + }; HTMLElement_init_dispex_info(info, mode); CharacterData_init_dispex_info(info, mode); + + dispex_info_add_interface(info, IHTMLCommentElement_tid, mode >= COMPAT_MODE_IE9 ? ie9_hooks : NULL); }
-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, + .iface_tids = HTMLElement_iface_tids, .init_info = Comment_init_dispex_info, };
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f89c155f532..f81db21b375 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -536,6 +536,7 @@ sync_test("elem_props", function() { if (v >= 9) test_exposed("spellcheck", v >= 10);
elem = document.createComment(""); + test_exposed("atomic", v < 9); test_exposed("data", true); test_exposed("length", true); test_exposed("text", true);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 12 ++++++++++-- dlls/mshtml/tests/documentmode.js | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 635dbda667b..afdee9cdad8 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -642,7 +642,16 @@ static void Comment_init_dispex_info(dispex_data_t *info, compat_mode_t mode) {DISPID_IHTMLCOMMENTELEMENT_ATOMIC}, {DISPID_UNKNOWN} }; - HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE9) + HTMLDOMNode_init_dispex_info(info, mode); + else { + HTMLElement_init_dispex_info(info, mode); + dispex_info_add_interface(info, IHTMLElement_tid, NULL); + dispex_info_add_interface(info, IHTMLElement3_tid, NULL); + dispex_info_add_interface(info, IHTMLElement4_tid, NULL); + dispex_info_add_interface(info, IHTMLUniqueName_tid, NULL); + } CharacterData_init_dispex_info(info, mode);
dispex_info_add_interface(info, IHTMLCommentElement_tid, mode >= COMPAT_MODE_IE9 ? ie9_hooks : NULL); @@ -653,7 +662,6 @@ dispex_static_data_t Comment_dispex = { .prototype_id = PROT_CharacterData, .vtbl = &HTMLCommentElement_event_target_vtbl.dispex_vtbl, .disp_tid = DispHTMLCommentElement_tid, - .iface_tids = HTMLElement_iface_tids, .init_info = Comment_init_dispex_info, };
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f81db21b375..34c8942b418 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -545,6 +545,14 @@ sync_test("elem_props", function() { test_exposed("insertData", true); test_exposed("replaceData", true); test_exposed("substringData", true); + test_exposed("attachEvent", v < 9); + test_exposed("doScroll", v < 9); + test_exposed("readyState", v < 9); + test_exposed("clientTop", v < 9); + test_exposed("title", v < 9); + test_exposed("removeNode", v < 9); + test_exposed("querySelectorAll", v === 8); + test_exposed("hasAttribute", v === 8, v === 8);
elem = document.createElement("style"); test_exposed("media", true); @@ -3678,6 +3686,7 @@ sync_test("prototype props", function() { }
check(CharacterData, [ "appendData", "data", "deleteData", "insertData", "length", "replaceData", "substringData" ]); + check(Comment, [ "text" ]); check(CSSStyleRule, [ "readOnly", "selectorText", "style" ]); check(CustomEvent, [ "detail", "initCustomEvent" ]); check(DocumentType, [ "entities", "internalSubset", "name", "notations", "publicId", "systemId" ]);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 21 +++++++++++++++++++-- dlls/mshtml/tests/dom.c | 29 ++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index afdee9cdad8..8ed5f0b135e 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -86,14 +86,31 @@ static HRESULT WINAPI CharacterData_put_data(IWineHTMLCharacterData *iface, BSTR static HRESULT WINAPI CharacterData_get_data(IWineHTMLCharacterData *iface, BSTR *p) { struct CharacterData *This = impl_from_IWineHTMLCharacterData(iface); + const PRUnichar *str, *end; nsAString nsstr; nsresult nsres; + HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
if(!This->nschardata) { - FIXME("legacy doctype comment\n"); - return E_NOTIMPL; + nsAString_Init(&nsstr, NULL); + hres = nsnode_to_nsstring(This->node->nsnode, &nsstr); + if(FAILED(hres)) + return hres; + + nsAString_GetData(&nsstr, &str); + end = str + wcslen(str); + if(*str == '<') { + end -= (end[-1] == '>'); + str++; + str += (*str == '!'); + } + + if(!(*p = SysAllocStringLen(str, end - str))) + hres = E_OUTOFMEMORY; + nsAString_Finish(&nsstr); + return hres; }
nsAString_Init(&nsstr, NULL); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c125f2e2ef2..65085f8cef5 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -1013,6 +1013,17 @@ static IHTMLCommentElement *_get_comment_iface(unsigned line, IUnknown *unk) return comment; }
+#define get_comment2_iface(u) _get_comment2_iface(__LINE__,u) +static IHTMLCommentElement2 *_get_comment2_iface(unsigned line, IUnknown *unk) +{ + IHTMLCommentElement2 *comment2; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLCommentElement2, (void**)&comment2); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLCommentElement2: %08lx\n", hres); + return comment2; +} + #define get_object_iface(u) _get_object_iface(__LINE__,u) static IHTMLObjectElement *_get_object_iface(unsigned line, IUnknown *unk) { @@ -2045,9 +2056,10 @@ static IHTMLFormElement *_get_textarea_form(unsigned line, IUnknown *unk) return form; }
-#define test_comment_text(c,t) _test_comment_text(__LINE__,c,t) -static void _test_comment_text(unsigned line, IUnknown *unk, const WCHAR *extext) +#define test_comment_text(c,t,d) _test_comment_text(__LINE__,c,t,d) +static void _test_comment_text(unsigned line, IUnknown *unk, const WCHAR *extext, const WCHAR *data) { + IHTMLCommentElement2 *comment2 = _get_comment2_iface(__LINE__,unk); IHTMLCommentElement *comment = _get_comment_iface(__LINE__,unk); const WCHAR *p; BSTR text; @@ -2062,6 +2074,13 @@ static void _test_comment_text(unsigned line, IUnknown *unk, const WCHAR *extext
IHTMLCommentElement_Release(comment); SysFreeString(text); + + hres = IHTMLCommentElement2_get_data(comment2, &text); + ok_(__FILE__,line)(hres == S_OK, "get_data failed: %08lx\n", hres); + ok_(__FILE__,line)(!wcscmp(text, data), "data = "%s", expected "%s"\n", wine_dbgstr_w(text), wine_dbgstr_w(data)); + + IHTMLCommentElement2_Release(comment2); + SysFreeString(text); }
#define create_attr(a,b) _create_attr(__LINE__,a,b) @@ -10504,12 +10523,12 @@ static void test_create_elems(IHTMLDocument2 *doc) test_elem_title((IUnknown*)comment, NULL); test_elem_set_title((IUnknown*)comment, L"comment title"); test_elem_title((IUnknown*)comment, L"comment title"); - test_comment_text((IUnknown*)comment, L"<!--testing-->"); + test_comment_text((IUnknown*)comment, L"<!--testing-->", L"testing"); test_elem_outerhtml((IUnknown*)comment, L"<!--testing-->"); test_comment_attrs((IUnknown*)comment);
node2 = clone_node((IUnknown*)comment, VARIANT_TRUE); - test_comment_text((IUnknown*)node2, L"<!--testing-->"); + test_comment_text((IUnknown*)node2, L"<!--testing-->", L"testing"); IHTMLDOMNode_Release(node2);
test_elem_getelembytag((IUnknown*)comment, ET_COMMENT, 0, NULL); @@ -10603,7 +10622,7 @@ static void test_doctype(IHTMLDocument2 *doc) type = get_node_type((IUnknown*)doctype); ok(type == 8, "type = %d\n", type);
- test_comment_text((IUnknown*)doctype, L"<!DOCTYPE html>"); + test_comment_text((IUnknown*)doctype, L"<!DOCTYPE html>", L"DOCTYPE html"); test_elem_type((IUnknown*)doctype, ET_COMMENT); IHTMLDOMNode_Release(doctype); }
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 11 ++++++++++- dlls/mshtml/tests/documentmode.js | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 222a3cca9b5..4525ec52b07 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -3638,10 +3638,18 @@ static const dispex_static_data_vtbl_t DOMKeyboardEvent_dispex_vtbl = { .unlink = DOMKeyboardEvent_unlink };
+static void KeyboardEvent_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t hooks[] = { + {DISPID_IDOMKEYBOARDEVENT_IE9_CHAR, NULL, L"char"}, + {DISPID_UNKNOWN} + }; + dispex_info_add_interface(info, IDOMKeyboardEvent_tid, hooks); +} + static const tid_t KeyboardEvent_iface_tids[] = { IDOMEvent_tid, IDOMUIEvent_tid, - IDOMKeyboardEvent_tid, 0 };
@@ -3651,6 +3659,7 @@ dispex_static_data_t KeyboardEvent_dispex = { .vtbl = &DOMKeyboardEvent_dispex_vtbl, .disp_tid = DispDOMKeyboardEvent_tid, .iface_tids = KeyboardEvent_iface_tids, + .init_info = KeyboardEvent_init_dispex_info, };
static void DOMPageTransitionEvent_init_dispex_info(dispex_data_t *info, compat_mode_t mode) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 34c8942b418..b1d09273b17 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -3696,6 +3696,15 @@ sync_test("prototype props", function() { "stopImmediatePropagation", "stopPropagation", "target", "timeStamp", "type" ], [ "AT_TARGET", "BUBBLING_PHASE", "CAPTURING_PHASE" ]); check(HTMLUnknownElement, [ "namedRecordset", "recordset" ]); + check(KeyboardEvent, [ + "DOM_KEY_LOCATION_JOYSTICK", "DOM_KEY_LOCATION_LEFT", "DOM_KEY_LOCATION_MOBILE", + "DOM_KEY_LOCATION_NUMPAD", "DOM_KEY_LOCATION_RIGHT", "DOM_KEY_LOCATION_STANDARD", + "altKey", "char", "charCode", "ctrlKey", "getModifierState", "initKeyboardEvent", + "key", "keyCode", "locale", "location", "metaKey", "repeat", "shiftKey", "which" + ], [ + "DOM_KEY_LOCATION_JOYSTICK", "DOM_KEY_LOCATION_LEFT", "DOM_KEY_LOCATION_MOBILE", + "DOM_KEY_LOCATION_NUMPAD", "DOM_KEY_LOCATION_RIGHT", "DOM_KEY_LOCATION_STANDARD" + ]); check(MessageEvent, [ "data", "initMessageEvent", "origin", ["ports",10], "source" ], [ ["ports",10] ]); check(MouseEvent, [ "altKey", "button", "buttons", "clientX", "clientY", "ctrlKey", "fromElement", "getModifierState",
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 18 +++++++++--------- dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 4525ec52b07..a88f6a43ae9 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -3664,8 +3664,7 @@ dispex_static_data_t KeyboardEvent_dispex = {
static void DOMPageTransitionEvent_init_dispex_info(dispex_data_t *info, compat_mode_t mode) { - if(mode >= COMPAT_MODE_IE11) - dispex_info_add_interface(info, IWinePageTransitionEvent_tid, NULL); + dispex_info_add_interface(info, IWinePageTransitionEvent_tid, NULL); }
static const dispex_static_data_vtbl_t DOMPageTransitionEvent_dispex_vtbl = { @@ -3676,12 +3675,13 @@ static const dispex_static_data_vtbl_t DOMPageTransitionEvent_dispex_vtbl = { };
dispex_static_data_t PageTransitionEvent_dispex = { - .id = PROT_PageTransitionEvent, - .prototype_id = PROT_Event, - .vtbl = &DOMPageTransitionEvent_dispex_vtbl, - .disp_tid = DispDOMEvent_tid, - .iface_tids = Event_iface_tids, - .init_info = DOMPageTransitionEvent_init_dispex_info, + .id = PROT_PageTransitionEvent, + .prototype_id = PROT_Event, + .vtbl = &DOMPageTransitionEvent_dispex_vtbl, + .disp_tid = DispDOMEvent_tid, + .iface_tids = Event_iface_tids, + .init_info = DOMPageTransitionEvent_init_dispex_info, + .min_compat_mode = COMPAT_MODE_IE11, };
static const dispex_static_data_vtbl_t DOMCustomEvent_dispex_vtbl = { @@ -3899,7 +3899,7 @@ static const struct { [EVENT_TYPE_CLIPBOARD] = { NULL, generic_event_ctor }, [EVENT_TYPE_FOCUS] = { NULL, generic_event_ctor }, [EVENT_TYPE_DRAG] = { NULL, generic_event_ctor }, - [EVENT_TYPE_PAGETRANSITION] = { NULL, page_transition_event_ctor }, + [EVENT_TYPE_PAGETRANSITION] = { NULL, page_transition_event_ctor, COMPAT_MODE_IE11 }, [EVENT_TYPE_CUSTOM] = { &IID_nsIDOMCustomEvent, custom_event_ctor }, [EVENT_TYPE_PROGRESS] = { &IID_nsIDOMProgressEvent, progress_event_ctor, COMPAT_MODE_IE10 }, [EVENT_TYPE_MESSAGE] = { NULL, message_event_ctor }, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index b1d09273b17..00ddb7e9a0d 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -673,6 +673,7 @@ sync_test("window_props", function() { test_exposed("console", v >= 10); test_exposed("matchMedia", v >= 10); test_exposed("MutationObserver", v >= 11); + test_exposed("PageTransitionEvent", v >= 11); });
sync_test("domimpl_props", function() { @@ -3728,6 +3729,8 @@ sync_test("prototype props", function() { "DOCUMENT_TYPE_NODE", "ELEMENT_NODE", "ENTITY_NODE", "ENTITY_REFERENCE_NODE", "NOTATION_NODE", "PROCESSING_INSTRUCTION_NODE", "TEXT_NODE", "hasAttributes", "normalize" ]); + if(v >= 11) + check(PageTransitionEvent, [ "persisted" ]); check(StorageEvent, [ "initStorageEvent", "key", "newValue", "oldValue", "storageArea", "url" ]); check(Text, [ "removeNode", "replaceNode", "replaceWholeText", "splitText", "swapNode", "wholeText" ], [ "replaceWholeText", "wholeText" ]); check(UIEvent, [ "detail", "initUIEvent", "view" ], null, [ "deviceSessionId" ]);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 11 ++++++----- dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index a88f6a43ae9..d1c39a10519 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -3735,11 +3735,12 @@ static const tid_t ProgressEvent_iface_tids[] = { };
dispex_static_data_t ProgressEvent_dispex = { - .id = PROT_ProgressEvent, - .prototype_id = PROT_Event, - .vtbl = &DOMProgressEvent_dispex_vtbl, - .disp_tid = DispDOMProgressEvent_tid, - .iface_tids = ProgressEvent_iface_tids, + .id = PROT_ProgressEvent, + .prototype_id = PROT_Event, + .vtbl = &DOMProgressEvent_dispex_vtbl, + .disp_tid = DispDOMProgressEvent_tid, + .iface_tids = ProgressEvent_iface_tids, + .min_compat_mode = COMPAT_MODE_IE10, };
static const dispex_static_data_vtbl_t DOMStorageEvent_dispex_vtbl = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 00ddb7e9a0d..2cd4623f06e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -674,6 +674,7 @@ sync_test("window_props", function() { test_exposed("matchMedia", v >= 10); test_exposed("MutationObserver", v >= 11); test_exposed("PageTransitionEvent", v >= 11); + test_exposed("ProgressEvent", v >= 10); });
sync_test("domimpl_props", function() { @@ -3731,6 +3732,8 @@ sync_test("prototype props", function() { ]); if(v >= 11) check(PageTransitionEvent, [ "persisted" ]); + if(v >= 10) + check(ProgressEvent, [ "initProgressEvent", "lengthComputable", "loaded", "total" ]); check(StorageEvent, [ "initStorageEvent", "key", "newValue", "oldValue", "storageArea", "url" ]); check(Text, [ "removeNode", "replaceNode", "replaceWholeText", "splitText", "swapNode", "wholeText" ], [ "replaceWholeText", "wholeText" ]); check(UIEvent, [ "detail", "initUIEvent", "view" ], null, [ "deviceSessionId" ]);
Jacek Caban (@jacek) commented about dlls/mshtml/htmltextnode.c:
{DISPID_IHTMLCOMMENTELEMENT_ATOMIC}, {DISPID_UNKNOWN} };
- HTMLElement_init_dispex_info(info, mode);
- if(mode >= COMPAT_MODE_IE9)
HTMLDOMNode_init_dispex_info(info, mode);
- else {
HTMLElement_init_dispex_info(info, mode);
dispex_info_add_interface(info, IHTMLElement_tid, NULL);
dispex_info_add_interface(info, IHTMLElement3_tid, NULL);
dispex_info_add_interface(info, IHTMLElement4_tid, NULL);
dispex_info_add_interface(info, IHTMLUniqueName_tid, NULL);
I will approve as it's not a blocker now, but I hope that we will get rid of it ultimately (take care of that in `HTMLElement_init_dispex_info` instead of `HTMLELEMENT_TIDS` or something like that).
This merge request was approved by Jacek Caban.