Module: wine Branch: master Commit: e03de990ef3fef92ca57dbe89e1d7df00993cd25 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e03de990ef3fef92ca57dbe89e...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Mar 1 15:44:57 2013 +0100
mshtml: Added IHTMLElement2::insertAdjacentElement implementation.
---
dlls/mshtml/htmlelem.c | 8 +++++--- dlls/mshtml/htmlelem2.c | 19 +++++++++++++++++-- dlls/mshtml/mshtml_private.h | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 581669c..f0789f8 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -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; diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c index dc3ad7f..24aaba5 100644 --- a/dlls/mshtml/htmlelem2.c +++ b/dlls/mshtml/htmlelem2.c @@ -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, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index dab68d7..c515e6c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -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;