Commit 821b1090 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement getAttributeNS for Elements.

parent 840ec530
......@@ -4813,8 +4813,33 @@ static HRESULT WINAPI HTMLElement6_Invoke(IHTMLElement6 *iface, DISPID dispIdMem
static HRESULT WINAPI HTMLElement6_getAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *AttributeValue)
{
HTMLElement *This = impl_from_IHTMLElement6(iface);
FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
return E_NOTIMPL;
nsAString ns_str, name_str, value_str;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(strAttributeName), AttributeValue);
if(!This->dom_element) {
FIXME("No dom_element\n");
return E_NOTIMPL;
}
hres = variant_to_nsstr(pvarNS, FALSE, &ns_str);
if(FAILED(hres))
return hres;
nsAString_InitDepend(&name_str, strAttributeName);
nsAString_InitDepend(&value_str, NULL);
nsres = nsIDOMElement_GetAttributeNS(This->dom_element, &ns_str, &name_str, &value_str);
nsAString_Finish(&ns_str);
nsAString_Finish(&name_str);
hres = return_nsstr_variant(nsres, &value_str, 0, AttributeValue);
if(SUCCEEDED(hres) && V_VT(AttributeValue) == VT_NULL) {
V_VT(AttributeValue) = VT_BSTR;
V_BSTR(AttributeValue) = NULL;
}
return hres;
}
static HRESULT WINAPI HTMLElement6_setAttributeNS(IHTMLElement6 *iface, VARIANT *pvarNS, BSTR strAttributeName, VARIANT *pvarAttributeValue)
......@@ -6791,6 +6816,35 @@ static IHTMLEventObj *HTMLElement_set_current_event(DispatchEx *dispex, IHTMLEve
return default_set_current_event(This->node.doc->window, event);
}
static HRESULT IHTMLElement6_getAttributeNS_hook(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
{
VARIANT args[2];
HRESULT hres;
DISPPARAMS new_dp = { args, NULL, 2, 0 };
if(!(flags & DISPATCH_METHOD) || dp->cArgs < 2 || dp->cNamedArgs)
return S_FALSE;
switch(V_VT(&dp->rgvarg[dp->cArgs - 1])) {
case VT_EMPTY:
case VT_BSTR:
case VT_NULL:
return S_FALSE;
default:
break;
}
hres = change_type(&args[1], &dp->rgvarg[dp->cArgs - 1], VT_BSTR, caller);
if(FAILED(hres))
return hres;
args[0] = dp->rgvarg[dp->cArgs - 2];
hres = dispex_call_builtin(dispex, DISPID_IHTMLELEMENT6_GETATTRIBUTENS, &new_dp, res, ei, caller);
VariantClear(&args[1]);
return hres;
}
static HRESULT IHTMLElement6_setAttribute_hook(DispatchEx *dispex, WORD flags, DISPPARAMS *dp,
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
{
......@@ -6823,6 +6877,7 @@ static HRESULT IHTMLElement6_setAttribute_hook(DispatchEx *dispex, WORD flags, D
void HTMLElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
{
static const dispex_hook_t elem6_ie10_hooks[] = {
{DISPID_IHTMLELEMENT6_GETATTRIBUTENS, IHTMLElement6_getAttributeNS_hook},
{DISPID_IHTMLELEMENT6_IE9_SETATTRIBUTE, IHTMLElement6_setAttribute_hook},
{DISPID_UNKNOWN}
};
......
......@@ -998,6 +998,7 @@ HRESULT variant_to_nsstr(VARIANT *v, BOOL hex_int, nsAString *nsstr)
WCHAR buf[32];
switch(V_VT(v)) {
case VT_EMPTY:
case VT_NULL:
nsAString_InitDepend(nsstr, NULL);
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment