Jacek Caban : mshtml: Added IHTMLDocument3::uniqueID implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Jan 9 03:32:18 CST 2016
Module: wine
Branch: master
Commit: 8f6097a99bacca0c241c29b54d8f8500b30a78c5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8f6097a99bacca0c241c29b54d8f8500b30a78c5
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jan 6 18:39:39 2016 +0100
mshtml: Added IHTMLDocument3::uniqueID implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmldoc.c | 15 +++++++++++----
dlls/mshtml/mshtml_private.h | 2 ++
dlls/mshtml/tests/dom.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8e59e98..30236aa 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -2018,11 +2018,18 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
return hres;
}
-static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
+static HRESULT WINAPI HTMLDocument3_get_uniqueID(IHTMLDocument3 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument3(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ WCHAR buf[32];
+
+ static const WCHAR formatW[] = {'m','s','_','_','i','d','%','u',0};
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ sprintfW(buf, formatW, ++This->doc_node->unique_id);
+ *p = SysAllocString(buf);
+ return *p ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
@@ -2428,7 +2435,7 @@ static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
HTMLDocument3_recalc,
HTMLDocument3_createTextNode,
HTMLDocument3_get_documentElement,
- HTMLDocument3_uniqueID,
+ HTMLDocument3_get_uniqueID,
HTMLDocument3_attachEvent,
HTMLDocument3_detachEvent,
HTMLDocument3_put_onrowsdelete,
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index c32824e..2b8fa82 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -776,6 +776,8 @@ struct HTMLDocumentNode {
UINT charset;
+ unsigned unique_id;
+
struct list selection_list;
struct list range_list;
struct list plugin_hosts;
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 1be81e5..e90fc70 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6208,6 +6208,35 @@ static void test_default_selection(IHTMLDocument2 *doc)
IHTMLTxtRange_Release(range);
}
+static void test_unique_id(IHTMLDocument2 *doc)
+{
+ IHTMLDocument3 *doc3 = get_doc3_iface(doc);
+ BSTR id, id2;
+ HRESULT hres;
+
+ static const WCHAR prefixW[] = {'m','s','_','_','i','d',0};
+
+ hres = IHTMLDocument3_get_uniqueID(doc3, &id);
+ ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
+ ok(SysStringLen(id) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id));
+
+ hres = IHTMLDocument3_get_uniqueID(doc3, &id2);
+ ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
+ ok(SysStringLen(id2) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id2));
+
+ ok(lstrcmpW(id, id2), "same unique ids %s\n", wine_dbgstr_w(id));
+
+ id[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
+ ok(!lstrcmpW(id, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id));
+ id2[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
+ ok(!lstrcmpW(id2, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id2));
+
+ SysFreeString(id);
+ SysFreeString(id2);
+
+ IHTMLDocument3_Release(doc3);
+}
+
static void test_doc_elem(IHTMLDocument2 *doc)
{
IHTMLDocument2 *doc_node, *owner_doc;
@@ -6244,6 +6273,8 @@ static void test_doc_elem(IHTMLDocument2 *doc)
test_elem_client_rect((IUnknown*)elem);
IHTMLElement_Release(elem);
+
+ test_unique_id(doc);
}
static void test_default_body(IHTMLBodyElement *body)
More information about the wine-cvs
mailing list