mshtml: Restructure element setAttribute.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
95a106bc93
commit
f41d896618
|
@ -1086,14 +1086,22 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
|
|||
VARIANT AttributeValue, LONG lFlags)
|
||||
{
|
||||
HTMLElement *This = impl_from_IHTMLElement(iface);
|
||||
compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex);
|
||||
nsAString name_str, value_str;
|
||||
nsresult nsres;
|
||||
DISPID dispid;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
|
||||
|
||||
if(This->dom_element && dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8) {
|
||||
nsAString name_str, value_str;
|
||||
nsresult nsres;
|
||||
if(compat_mode < COMPAT_MODE_IE8 || !This->dom_element) {
|
||||
hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
|
||||
(lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive) | fdexNameEnsure, &dispid);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return set_elem_attr_value_by_dispid(This, dispid, &AttributeValue);
|
||||
}
|
||||
|
||||
hres = variant_to_nsstr(&AttributeValue, FALSE, &value_str);
|
||||
if(FAILED(hres))
|
||||
|
@ -1105,15 +1113,9 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
|
|||
nsAString_Finish(&value_str);
|
||||
if(NS_FAILED(nsres))
|
||||
WARN("SetAttribute failed: %08x\n", nsres);
|
||||
return map_nsresult(nsres);
|
||||
}
|
||||
hres = map_nsresult(nsres);
|
||||
|
||||
hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
|
||||
(lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive) | fdexNameEnsure, &dispid);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return set_elem_attr_value_by_dispid(This, dispid, &AttributeValue);
|
||||
}
|
||||
|
||||
HRESULT get_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, VARIANT *ret)
|
||||
|
|
Loading…
Reference in New Issue