Jacek Caban : mshtml: Added IHTMLUniqueName::get_uniqueID implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 11 08:22:28 CST 2016


Module: wine
Branch: master
Commit: a52cb2b87a8f74af7c7d40c413557f5f826cf690
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a52cb2b87a8f74af7c7d40c413557f5f826cf690

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jan 11 14:01:57 2016 +0100

mshtml: Added IHTMLUniqueName::get_uniqueID implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmldoc.c        |  7 +------
 dlls/mshtml/htmlelem.c       | 18 ++++++++++++++++--
 dlls/mshtml/mshtml_private.h |  3 +++
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 30236aa..87be653 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -2021,15 +2021,10 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
 static HRESULT WINAPI HTMLDocument3_get_uniqueID(IHTMLDocument3 *iface, BSTR *p)
 {
     HTMLDocument *This = impl_from_IHTMLDocument3(iface);
-    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;
+    return elem_unique_id(++This->doc_node->unique_id, p);
 }
 
 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 61110c5..cb0b864 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -3843,6 +3843,17 @@ static HRESULT WINAPI HTMLUniqueName_Invoke(IHTMLUniqueName *iface, DISPID dispI
             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
+HRESULT elem_unique_id(unsigned id, BSTR *p)
+{
+    WCHAR buf[32];
+
+    static const WCHAR formatW[] = {'m','s','_','_','i','d','%','u',0};
+
+    sprintfW(buf, formatW, id);
+    *p = SysAllocString(buf);
+    return *p ? S_OK : E_OUTOFMEMORY;
+}
+
 static void ensure_unique_id(HTMLElement *elem)
 {
     if(!elem->unique_id)
@@ -3863,8 +3874,11 @@ static HRESULT WINAPI HTMLUniqueName_get_uniqueNumber(IHTMLUniqueName *iface, LO
 static HRESULT WINAPI HTMLUniqueName_get_uniqueID(IHTMLUniqueName *iface, BSTR *p)
 {
     HTMLElement *This = impl_from_IHTMLUniqueName(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    ensure_unique_id(This);
+    return elem_unique_id(This->unique_id, p);
 }
 
 static const IHTMLUniqueNameVtbl HTMLUniqueNameVtbl = {
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index b613f70..51adb38 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -713,6 +713,7 @@ typedef struct {
     HTMLStyle *runtime_style;
     HTMLAttributeCollection *attrs;
     WCHAR *filter;
+    unsigned unique_id;
 } HTMLElement;
 
 #define HTMLELEMENT_TIDS    \
@@ -1019,6 +1020,8 @@ nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PR
 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
 
+HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
+
 /* commands */
 typedef struct {
     DWORD id;




More information about the wine-cvs mailing list