From: Gabriel Ivăncescu gabrielopcode@gmail.com
And simplify attribute nodes' `specified` prop with it.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This will also be useful later. --- dlls/mshtml/dispex.c | 11 +++++++++++ dlls/mshtml/htmlattr.c | 9 +-------- dlls/mshtml/mshtml_private.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 024d7c8fee4..695cdaad0e2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2489,6 +2489,17 @@ HRESULT dispex_prop_name(DispatchEx *dispex, DISPID id, BSTR *ret) return *ret ? S_OK : E_OUTOFMEMORY; }
+const WCHAR *dispex_builtin_prop_name(DispatchEx *dispex, DISPID id) +{ + func_info_t *func; + HRESULT hres; + + hres = get_builtin_func(dispex->info, id, &func); + assert(SUCCEEDED(hres)); + + return func->name; +} + static HRESULT WINAPI DispatchEx_GetMemberName(IWineJSDispatchHost *iface, DISPID id, BSTR *pbstrName) { DispatchEx *This = impl_from_IWineJSDispatchHost(iface); diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 64e57718174..1a95c1b482e 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -89,9 +89,7 @@ static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, V HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); nsIDOMAttr *nsattr; nsAString nsname; - BSTR name; nsresult nsres; - HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
@@ -105,15 +103,10 @@ static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, V return S_OK; }
- hres = dispex_prop_name(&This->elem->node.event_target.dispex, This->dispid, &name); - if(FAILED(hres)) - return hres; - /* FIXME: This is not exactly right, we have some attributes that don't map directly to Gecko attributes. */ - nsAString_InitDepend(&nsname, name); + nsAString_InitDepend(&nsname, dispex_builtin_prop_name(&This->elem->node.event_target.dispex, This->dispid)); nsres = nsIDOMElement_GetAttributeNode(This->elem->dom_element, &nsname, &nsattr); nsAString_Finish(&nsname); - SysFreeString(name); if(NS_FAILED(nsres)) return E_FAIL;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 4c055325575..4319c8b4725 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -648,6 +648,7 @@ HRESULT dispex_next_id(DispatchEx *dispex, DISPID id, BOOL enum_all_own_props, D HRESULT dispex_prop_name(DispatchEx *dispex, DISPID id, BSTR *ret); HRESULT dispex_define_property(DispatchEx *dispex, const WCHAR *name, DWORD flags, VARIANT *v, DISPID *id); HRESULT dispex_index_prop_desc(DispatchEx*,DISPID,struct property_info*); +const WCHAR *dispex_builtin_prop_name(DispatchEx *dispex, DISPID id); IWineJSDispatchHost *dispex_outer_iface(DispatchEx *dispex); HRESULT get_constructor(HTMLInnerWindow *script_global, object_id_t id, DispatchEx **ret); HRESULT get_prototype(HTMLInnerWindow *script_global, object_id_t id, DispatchEx **ret);