From 13079c56961bffdb83ce8205b7ed6fcb2d5cf9e4 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 17 Mar 2016 11:49:26 +0100 Subject: [PATCH] mshtml: Fixed cloning comment nodes. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlcomment.c | 16 +++++++++++++++- dlls/mshtml/tests/dom.c | 7 ++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index 23bbc8274f7..abb71a814b4 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -169,11 +169,25 @@ static void HTMLCommentElement_destructor(HTMLDOMNode *iface) HTMLElement_destructor(&This->element.node); } +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 const NodeImplVtbl HTMLCommentElementImplVtbl = { HTMLCommentElement_QI, HTMLCommentElement_destructor, HTMLElement_cpc, - HTMLElement_clone, + HTMLCommentElement_clone, HTMLElement_handle_event, HTMLElement_get_attr_col }; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 15a30276224..4206e9cf94d 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -6244,12 +6244,10 @@ static void test_unique_id(IHTMLDocument2 *doc, IHTMLElement *elem) hres = IHTMLUniqueName_get_uniqueID(unique_name, &id); ok(hres == S_OK, "get_uniqueName failed: %08x\n", hres); - trace("id %s\n", wine_dbgstr_w(id)); hres = IHTMLUniqueName_get_uniqueID(unique_name, &id2); ok(hres == S_OK, "get_uniqueName failed: %08x\n", hres); ok(!lstrcmpW(id, id2), "unique names differ\n"); - trace("id %s\n", wine_dbgstr_w(id2)); hres = IHTMLUniqueName_get_uniqueNumber(unique_name, &num); ok(hres == S_OK, "get_uniqueName failed: %08x\n", hres); @@ -6257,7 +6255,6 @@ static void test_unique_id(IHTMLDocument2 *doc, IHTMLElement *elem) sprintf(buf, "ms__id%u", num); ok(!strcmp_wa(id, buf), "unexpected id %s\n", wine_dbgstr_w(id)); - trace("num %d\n", num); SysFreeString(id); SysFreeString(id2); @@ -8907,6 +8904,10 @@ static void test_create_elems(IHTMLDocument2 *doc) test_elem_outerhtml((IUnknown*)comment, ""); test_comment_attrs((IUnknown*)comment); + node2 = clone_node((IUnknown*)comment, VARIANT_TRUE); + test_comment_text((IUnknown*)node2, ""); + IHTMLDOMNode_Release(node2); + IHTMLDOMNode_Release(comment); }