mshtml: Restructure element getAttribute.
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
f41d896618
commit
368199c640
|
@ -1158,6 +1158,9 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
|
||||||
LONG lFlags, VARIANT *AttributeValue)
|
LONG lFlags, VARIANT *AttributeValue)
|
||||||
{
|
{
|
||||||
HTMLElement *This = impl_from_IHTMLElement(iface);
|
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;
|
DISPID dispid;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -1166,33 +1169,28 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
|
||||||
if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
|
if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
|
||||||
FIXME("Unsupported flags %x\n", lFlags);
|
FIXME("Unsupported flags %x\n", lFlags);
|
||||||
|
|
||||||
if(This->dom_element && dispex_compat_mode(&This->node.event_target.dispex) >= COMPAT_MODE_IE8) {
|
if(compat_mode < COMPAT_MODE_IE8 || !This->dom_element) {
|
||||||
nsAString name_str, value_str;
|
hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
|
||||||
nsresult nsres;
|
lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
V_VT(AttributeValue) = VT_NULL;
|
||||||
|
return (hres == DISP_E_UNKNOWNNAME) ? S_OK : hres;
|
||||||
|
}
|
||||||
|
|
||||||
nsAString_InitDepend(&name_str, strAttributeName);
|
hres = get_elem_attr_value_by_dispid(This, dispid, AttributeValue);
|
||||||
nsAString_InitDepend(&value_str, NULL);
|
if(FAILED(hres))
|
||||||
nsres = nsIDOMElement_GetAttribute(This->dom_element, &name_str, &value_str);
|
return hres;
|
||||||
nsAString_Finish(&name_str);
|
|
||||||
return return_nsstr_variant(nsres, &value_str, 0, AttributeValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, strAttributeName,
|
if(lFlags & ATTRFLAG_ASSTRING)
|
||||||
lFlags&ATTRFLAG_CASESENSITIVE ? fdexNameCaseSensitive : fdexNameCaseInsensitive, &dispid);
|
hres = attr_value_to_string(AttributeValue);
|
||||||
if(hres == DISP_E_UNKNOWNNAME) {
|
|
||||||
V_VT(AttributeValue) = VT_NULL;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
V_VT(AttributeValue) = VT_NULL;
|
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = get_elem_attr_value_by_dispid(This, dispid, AttributeValue);
|
nsAString_InitDepend(&name_str, strAttributeName);
|
||||||
if(SUCCEEDED(hres) && (lFlags & ATTRFLAG_ASSTRING))
|
nsAString_InitDepend(&value_str, NULL);
|
||||||
hres = attr_value_to_string(AttributeValue);
|
nsres = nsIDOMElement_GetAttribute(This->dom_element, &name_str, &value_str);
|
||||||
return hres;
|
nsAString_Finish(&name_str);
|
||||||
|
return return_nsstr_variant(nsres, &value_str, 0, AttributeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
|
static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
|
||||||
|
|
Loading…
Reference in New Issue