From: Santino Mazza <smazza(a)codeweavers.com>
---
dlls/mshtml/htmldoc.c | 59 +++++++++++++++++++++++++++++++++++--
dlls/mshtml/tests/htmldoc.c | 20 ++++++-------
2 files changed, 67 insertions(+), 12 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index c34fe804720..ccb6d736c01 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -5346,9 +5346,64 @@ 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(hres != S_OK)
+ return hres;
+
+ hres = IMarkupContainer_QueryInterface(container, &IID_IHTMLDocument2,
(void**)&doc);
+ if(hres != S_OK) {
+ IMarkupContainer_Release(container);
+ return hres;
+ }
+
+ hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&node);
+ if(hres != S_OK) {
+ IHTMLDocument2_Release(doc);
+ IMarkupContainer_Release(container);
+ return hres;
+ }
+
+ IHTMLDocument2_createElement(&This->IHTMLDocument2_iface,
(BSTR)L"html", &html);
+ IHTMLElement_put_innerHTML(html,
(BSTR)L"<head><title></title></head><body></body>");
+
+ hres = IHTMLElement_QueryInterface(html, &IID_IHTMLDOMNode,
(void**)&html_node);
+ if(hres != S_OK) {
+ IHTMLElement_Release(html);
+ IHTMLDocument2_Release(doc);
+ IMarkupContainer_Release(container);
+ return hres;
+ }
+ 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);
+ IHTMLElement_put_innerHTML(body, pchHTML);
+
+ IHTMLDocument2_Release(doc);
+ IHTMLElement_Release(body);
+
+ *ppContainerResult = container;
+
+ return S_OK;
}
static HRESULT WINAPI MarkupServices_ParseGlobal(IMarkupServices *iface,
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index e28cf8aed00..a7b3c8466ee 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -8408,33 +8408,33 @@ 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);
+ ok(hres == S_OK, "got 0x%08lx\n", hres);
if (markup_container == NULL)
{
- todo_wine win_skip("got null markup container\n");
+ win_skip("got null markup container\n");
return;
}
hres = IMarkupContainer_QueryInterface(markup_container, &IID_IHTMLDocument2,
(void**)&markup_container_doc);
- todo_wine ok(hres == S_OK, "failed to query interface of MarkupContainer
0x%08lx\n", hres);
+ ok(hres == S_OK, "failed to query interface of MarkupContainer 0x%08lx\n",
hres);
markup_container_elements_count = get_document_elements_count(markup_container_doc);
- todo_wine ok(markup_container_elements_count == 5, "expected markup container to
have 5 elements but got %ld\n",
+ ok(markup_container_elements_count == 5, "expected markup container to have 5
elements but got %ld\n",
markup_container_elements_count);
document_elements_count = get_document_elements_count(doc);
- todo_wine ok(document_elements_count != markup_container_elements_count,
+ ok(document_elements_count != markup_container_elements_count,
"expected document to not have the same elements count of the
markup container %ld == %ld\n",
document_elements_count, markup_container_elements_count);
hres = IHTMLDocument2_get_body(markup_container_doc, &body);
- todo_wine ok(hres == S_OK, "got 0x%08lx\n", hres);
- todo_wine ok(body != NULL, "got null body\n");
+ ok(hres == S_OK, "got 0x%08lx\n", hres);
+ ok(body != NULL, "got null body\n");
hres = IHTMLElement_get_innerText(body, &inner_text);
- todo_wine ok(hres == S_OK, "failed to get inner text error 0x%08lx\n",
hres);
- todo_wine ok(inner_text != NULL, "got a null pointer for inner text\n");
- todo_wine ok(!wcscmp(inner_text, L"Hello World"), "strings don't
match, got %ls\n", inner_text);
+ ok(hres == S_OK, "failed to get inner text error 0x%08lx\n", hres);
+ ok(inner_text != NULL, "got a null pointer for inner text\n");
+ ok(!wcscmp(inner_text, L"Hello World"), "strings don't match, got
%ls\n", inner_text);
free(inner_text);
IHTMLElement_Release(body);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/5685