From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlelem.c | 59 ++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/nsembed.c | 1 + 2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index d911d0a0433..2d64e020cec 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -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} }; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 8f456b40ef2..c7683a6d06d 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -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;