Commit 829f24c1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Get rid of no longer needed unk_ref from HTMLElementCollection.

parent c2ca817d
......@@ -213,7 +213,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
}
if(nscoll) {
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)&This->IHTMLDocument2_iface, nscoll);
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -245,7 +245,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme
}
if(nscoll) {
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)&This->IHTMLDocument2_iface, nscoll);
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -277,7 +277,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
}
if(nscoll) {
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)&This->IHTMLDocument2_iface, nscoll);
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -309,7 +309,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
}
if(nscoll) {
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)&This->IHTMLDocument2_iface, nscoll);
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -341,7 +341,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
}
if(nscoll) {
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)&This->IHTMLDocument2_iface, nscoll);
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
nsIDOMElement_Release(nscoll);
}
......
......@@ -572,8 +572,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
return E_FAIL;
}
*pelColl = create_collection_from_nodelist(This->doc_node,
(IUnknown*)&This->IHTMLDocument3_iface, nslist);
*pelColl = create_collection_from_nodelist(This->doc_node, nslist);
nsIDOMNodeList_Release(nslist);
return S_OK;
......
......@@ -1412,8 +1412,7 @@ static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **
return E_FAIL;
}
*p = (IDispatch*)create_collection_from_nodelist(This->node.doc,
(IUnknown*)&This->IHTMLElement_iface, nsnode_list);
*p = (IDispatch*)create_collection_from_nodelist(This->node.doc, nsnode_list);
nsIDOMNodeList_Release(nsnode_list);
return S_OK;
......
......@@ -1252,8 +1252,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS
return E_FAIL;
}
*pelColl = create_collection_from_nodelist(This->node.doc,
(IUnknown*)&This->IHTMLElement_iface, nslist);
*pelColl = create_collection_from_nodelist(This->node.doc, nslist);
nsIDOMNodeList_Release(nslist);
return S_OK;
}
......
......@@ -35,7 +35,6 @@ typedef struct {
DispatchEx dispex;
IHTMLElementCollection IHTMLElementCollection_iface;
IUnknown *ref_unk;
HTMLElement **elems;
DWORD len;
......@@ -54,8 +53,7 @@ static inline HTMLElement *elem_from_HTMLDOMNode(HTMLDOMNode *iface)
return CONTAINING_RECORD(iface, HTMLElement, node);
}
static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
HTMLElement **elems, DWORD len);
static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, DWORD len);
static void elem_vector_add(elem_vector_t *buf, HTMLElement *elem)
{
......@@ -141,9 +139,9 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
for(i=0; i < This->len; i++)
node_release(&This->elems[i]->node);
IUnknown_Release(This->ref_unk);
release_dispex(&This->dispex);
heap_free(This->elems);
release_dispex(&This->dispex);
heap_free(This);
}
......@@ -331,7 +329,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
if(buf.len > 1) {
elem_vector_normalize(&buf);
*pdisp = (IDispatch*)HTMLElementCollection_Create(This->ref_unk, buf.buf, buf.len);
*pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len);
}else {
if(buf.len == 1) {
/* Already AddRef-ed */
......@@ -393,7 +391,7 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
TRACE("fount %d tags\n", buf.len);
*pdisp = (IDispatch*)HTMLElementCollection_Create(This->ref_unk, buf.buf, buf.len);
*pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len);
return S_OK;
}
......@@ -547,10 +545,10 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro
create_all_list(node->doc, node, &buf);
elem_vector_normalize(&buf);
return HTMLElementCollection_Create((IUnknown*)&node->IHTMLDOMNode_iface, buf.buf, buf.len);
return HTMLElementCollection_Create(buf.buf, buf.len);
}
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMNodeList *nslist)
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode *doc, nsIDOMNodeList *nslist)
{
PRUint32 length = 0, i;
HTMLDOMNode *node;
......@@ -582,10 +580,10 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode *doc, I
buf.buf = NULL;
}
return HTMLElementCollection_Create(unk, buf.buf, buf.len);
return HTMLElementCollection_Create(buf.buf, buf.len);
}
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMHTMLCollection *nscol)
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode *doc, nsIDOMHTMLCollection *nscol)
{
PRUint32 length = 0, i;
elem_vector_t buf;
......@@ -617,11 +615,10 @@ IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode *doc, IU
return NULL;
}
return HTMLElementCollection_Create(unk, buf.buf, buf.len);
return HTMLElementCollection_Create(buf.buf, buf.len);
}
static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
HTMLElement **elems, DWORD len)
static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, DWORD len)
{
HTMLElementCollection *ret = heap_alloc_zero(sizeof(HTMLElementCollection));
......@@ -633,9 +630,6 @@ static IHTMLElementCollection *HTMLElementCollection_Create(IUnknown *ref_unk,
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLElementCollection_iface,
&HTMLElementCollection_dispex);
IUnknown_AddRef(ref_unk);
ret->ref_unk = ref_unk;
TRACE("ret=%p len=%d\n", ret, len);
return &ret->IHTMLElementCollection_iface;
......
......@@ -300,8 +300,7 @@ static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollecti
return E_FAIL;
}
*p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)&This->IHTMLTable_iface,
nscol);
*p = create_collection_from_htmlcol(This->element.node.doc, nscol);
nsIDOMHTMLCollection_Release(nscol);
return S_OK;
......
......@@ -210,7 +210,7 @@ static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementC
return E_FAIL;
}
*p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)&This->IHTMLTableRow_iface, nscol);
*p = create_collection_from_htmlcol(This->element.node.doc, nscol);
nsIDOMHTMLCollection_Release(nscol);
return S_OK;
......
......@@ -862,8 +862,8 @@ HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN
HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
/* commands */
typedef struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment