Module: wine Branch: master Commit: f9af971bd7d6799d54436ba9f7fa327b7edfbc77 URL: https://gitlab.winehq.org/wine/wine/-/commit/f9af971bd7d6799d54436ba9f7fa327...
Author: Santino Mazza smazza@codeweavers.com Date: Tue Dec 20 13:22:58 2022 -0300
mshtml: Implement MarkupServices_ParseString.
---
dlls/mshtml/htmldoc.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/htmldoc.c | 4 ++-- 2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 45d7740ba11..e761356e05e 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4823,9 +4823,53 @@ static HRESULT WINAPI MarkupServices_ParseString(IMarkupServices *iface, OLECHAR *pchHTML, DWORD dwFlags, IMarkupContainer **ppContainerResult, IMarkupPointer *pPointerStart, IMarkupPointer *pPointerFinish) { + HRESULT hres; + IMarkupContainer *container; + IHTMLDocument2 *doc; + IHTMLDOMNode *node, *html_node, *new_html_node = NULL; + IHTMLElement *html, *body; HTMLDocumentNode *This = impl_from_IMarkupServices(iface); - FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This, debugstr_w(pchHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish); - return E_NOTIMPL; + TRACE("(%p)->(%s,%lx,%p,%p,%p)\n", This, debugstr_w(pchHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish); + + if(dwFlags != 0) + FIXME("flags %lx not implemented.\n", dwFlags); + if(pPointerStart || pPointerFinish) { + FIXME("Pointers not implemented.\n"); + return E_NOTIMPL; + } + + hres = IMarkupServices_CreateMarkupContainer(iface, &container); + if(FAILED(hres)) + return hres; + + IMarkupContainer_QueryInterface(container, &IID_IHTMLDocument2, (void**)&doc); + IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&node); + IHTMLDocument2_createElement(&This->IHTMLDocument2_iface, (BSTR)L"html", &html); + + IHTMLElement_put_innerHTML(html, (BSTR)L"<head><title></title></head><body></body>"); + IHTMLElement_QueryInterface(html, &IID_IHTMLDOMNode, (void**)&html_node); + IHTMLElement_Release(html); + + IHTMLDOMNode_appendChild(node, html_node, &new_html_node); + IHTMLDOMNode_Release(node); + IHTMLDOMNode_Release(html_node); + IHTMLDOMNode_Release(new_html_node); + + IHTMLDocument2_get_body(doc, &body); + hres = IHTMLElement_put_innerHTML(body, pchHTML); + if (FAILED(hres)) + { + ERR("Failed put_innerHTML hr %#lx\n", hres); + IMarkupContainer_Release(container); + container = NULL; + } + + IHTMLDocument2_Release(doc); + IHTMLElement_Release(body); + + *ppContainerResult = container; + + return hres; }
static HRESULT WINAPI MarkupServices_ParseGlobal(IMarkupServices *iface, diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 384834359f9..c64ed784897 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -8428,8 +8428,8 @@ static void test_MarkupServices_ParseString(IMarkupServices *markup_services, IH IMarkupContainer *markup_container = NULL;
hres = IMarkupServices_ParseString(markup_services, (OLECHAR*)L"<div>Hello World</div>", 0, &markup_container, NULL, NULL); - todo_wine ok(hres == S_OK, "got 0x%08lx\n", hres); - todo_wine ok(markup_container != NULL, "MarkupContainer is null.\n"); + ok(hres == S_OK, "got 0x%08lx\n", hres); + ok(markup_container != NULL, "MarkupContainer is null.\n"); if (!markup_container) return;
hres = IMarkupContainer_QueryInterface(markup_container, &IID_IHTMLDocument2, (void**)&markup_container_doc);