mshtml: Initialize HTMLDOMChildrenCollection object with compat mode.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-16 19:57:08 +01:00 committed by Alexandre Julliard
parent c4fe86dabd
commit fe5860e42b
4 changed files with 34 additions and 34 deletions

View File

@ -4349,21 +4349,21 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface
HTMLDocument *This = impl_from_IDocumentSelector(iface);
nsIDOMNodeList *node_list;
nsAString nsstr;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &nsstr, &node_list);
hres = map_nsresult(nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &nsstr, &node_list));
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("QuerySelectorAll failed: %08x\n", nsres);
return E_FAIL;
if(FAILED(hres)) {
ERR("QuerySelectorAll failed: %08x\n", hres);
return hres;
}
*pel = create_child_collection(node_list);
hres = create_child_collection(node_list, dispex_compat_mode(&This->doc_node->node.event_target.dispex), pel);
nsIDOMNodeList_Release(node_list);
return *pel ? S_OK : E_OUTOFMEMORY;
return hres;
}
static const IDocumentSelectorVtbl DocumentSelectorVtbl = {

View File

@ -5740,7 +5740,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
HTMLElement *This = impl_from_IElementSelector(iface);
nsIDOMNodeList *node_list;
nsAString nsstr;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
@ -5750,16 +5750,16 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
}
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list);
hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("QuerySelectorAll failed: %08x\n", nsres);
return E_FAIL;
if(FAILED(hres)) {
ERR("QuerySelectorAll failed: %08x\n", hres);
return hres;
}
*pel = create_child_collection(node_list);
hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel);
nsIDOMNodeList_Release(node_list);
return *pel ? S_OK : E_OUTOFMEMORY;
return hres;
}
static const IElementSelectorVtbl ElementSelectorVtbl = {

View File

@ -436,24 +436,24 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = {
HTMLDOMNode_init_dispex_info
};
IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList *nslist)
HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mode, IHTMLDOMChildrenCollection **ret)
{
HTMLDOMChildrenCollection *ret;
HTMLDOMChildrenCollection *collection;
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return NULL;
if(!(collection = heap_alloc_zero(sizeof(*collection))))
return E_OUTOFMEMORY;
ret->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl;
ret->ref = 1;
collection->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl;
collection->ref = 1;
nsIDOMNodeList_AddRef(nslist);
ret->nslist = nslist;
collection->nslist = nslist;
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLDOMChildrenCollection_iface,
&HTMLDOMChildrenCollection_dispex);
init_dispex_with_compat_mode(&collection->dispex, (IUnknown*)&collection->IHTMLDOMChildrenCollection_iface,
&HTMLDOMChildrenCollection_dispex, compat_mode);
return &ret->IHTMLDOMChildrenCollection_iface;
*ret = &collection->IHTMLDOMChildrenCollection_iface;
return S_OK;
}
static inline HTMLDOMNode *impl_from_IHTMLDOMNode(IHTMLDOMNode *iface)
@ -611,20 +611,20 @@ static HRESULT WINAPI HTMLDOMNode_get_childNodes(IHTMLDOMNode *iface, IDispatch
{
HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
nsIDOMNodeList *nslist;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMNode_GetChildNodes(This->nsnode, &nslist);
if(NS_FAILED(nsres)) {
ERR("GetChildNodes failed: %08x\n", nsres);
return E_FAIL;
hres = map_nsresult(nsIDOMNode_GetChildNodes(This->nsnode, &nslist));
if(FAILED(hres)) {
ERR("GetChildNodes failed: %08x\n", hres);
return hres;
}
*p = (IDispatch*)create_child_collection(nslist);
hres = create_child_collection(nslist, dispex_compat_mode(&This->event_target.dispex),
(IHTMLDOMChildrenCollection**)p);
nsIDOMNodeList_Release(nslist);
return *p ? S_OK : E_OUTOFMEMORY;
return hres;
}
static HRESULT WINAPI HTMLDOMNode_get_attributes(IHTMLDOMNode *iface, IDispatch **p)

View File

@ -1143,7 +1143,7 @@ HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList*) DECLSPEC_HIDDEN;
HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**) DECLSPEC_HIDDEN;
HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;