Commit e03de990 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLElement2::insertAdjacentElement implementation.

parent 6d55379f
......@@ -1087,7 +1087,7 @@ static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
return E_NOTIMPL;
}
static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDOMNode *nsnode)
HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDOMNode *nsnode, HTMLDOMNode **ret_node)
{
nsIDOMNode *ret_nsnode;
nsresult nsres;
......@@ -1153,6 +1153,8 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
if (NS_FAILED(nsres))
return E_FAIL;
if(ret_node)
hres = get_node(This->node.doc, ret_nsnode, TRUE, ret_node);
nsIDOMNode_Release(ret_nsnode);
return hres;
}
......@@ -1194,7 +1196,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
return E_FAIL;
}
hr = insert_adjacent_node(This, where, nsnode);
hr = insert_adjacent_node(This, where, nsnode, NULL);
nsIDOMNode_Release(nsnode);
return hr;
}
......@@ -1226,7 +1228,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
return E_FAIL;
}
hr = insert_adjacent_node(This, where, nsnode);
hr = insert_adjacent_node(This, where, nsnode, NULL);
nsIDOMNode_Release(nsnode);
return hr;
......
......@@ -1120,8 +1120,23 @@ static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, B
IHTMLElement *insertedElement, IHTMLElement **inserted)
{
HTMLElement *This = impl_from_IHTMLElement2(iface);
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
return E_NOTIMPL;
HTMLDOMNode *ret_node;
HTMLElement *elem;
HRESULT hres;
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted);
elem = unsafe_impl_from_IHTMLElement(insertedElement);
if(!elem)
return E_INVALIDARG;
hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node);
if(FAILED(hres))
return hres;
hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted);
IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface);
return hres;
}
static HRESULT WINAPI HTMLElement2_applyElement(IHTMLElement2 *iface, IHTMLElement *apply,
......
......@@ -831,6 +831,8 @@ void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
HRESULT insert_adjacent_node(HTMLElement*,const WCHAR*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
......
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