Piotr Caban : mshtml: Added HTMLAttributeCollection_get_dispid implementation.

Alexandre Julliard julliard at winehq.org
Fri Sep 2 13:13:38 CDT 2011


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Sep  2 14:17:40 2011 +0200

mshtml: Added HTMLAttributeCollection_get_dispid implementation.

---

 dlls/mshtml/htmlelem.c |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index ff8d022..8b5b7f0 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -2269,9 +2269,10 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST
     return hres;
 }
 
-static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTMLDOMAttribute **attr)
+static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr)
 {
     HTMLDOMAttribute *iter;
+    LONG pos = 0;
     HRESULT hres;
 
     *attr = NULL;
@@ -2280,6 +2281,7 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTML
             *attr = iter;
             break;
         }
+        pos++;
     }
 
     if(!*attr) {
@@ -2288,12 +2290,15 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, HTML
             return E_UNEXPECTED;
         }
 
+        pos++;
         hres = HTMLDOMAttribute_Create(This->elem, id, attr);
         if(FAILED(hres))
             return hres;
     }
 
     IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface);
+    if(list_pos)
+        *list_pos = pos;
     return S_OK;
 }
 
@@ -2341,7 +2346,7 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa
     if(FAILED(hres))
         return hres;
 
-    hres = get_domattr(This, id, &attr);
+    hres = get_domattr(This, id, NULL, &attr);
     if(FAILED(hres))
         return hres;
 
@@ -2433,7 +2438,7 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec
         return hres;
     }
 
-    hres = get_domattr(This, id, &attr);
+    hres = get_domattr(This, id, NULL, &attr);
     if(FAILED(hres))
         return hres;
 
@@ -2561,7 +2566,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *i
     if(FAILED(hres))
         return hres;
 
-    hres = get_domattr(This, id, &attr);
+    hres = get_domattr(This, id, NULL, &attr);
     if(FAILED(hres))
         return hres;
 
@@ -2598,8 +2603,23 @@ static inline HTMLAttributeCollection *HTMLAttributeCollection_from_DispatchEx(D
 static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
 {
     HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
-    FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
-    return E_NOTIMPL;
+    HTMLDOMAttribute *attr;
+    LONG pos;
+    HRESULT hres;
+
+    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
+
+    hres = get_attr_dispid_by_name(This, name, dispid);
+    if(FAILED(hres))
+        return hres;
+
+    hres = get_domattr(This, *dispid, &pos, &attr);
+    if(FAILED(hres))
+        return hres;
+    IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface);
+
+    *dispid = MSHTML_DISPID_CUSTOM_MIN+pos;
+    return S_OK;
 }
 
 static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,




More information about the wine-cvs mailing list