mshtml: Added support for IHTMLDOMAttribute::nodeValue property on detached attributes.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-03-01 14:31:25 +01:00 committed by Alexandre Julliard
parent 4e9324c43e
commit 6c637ab9c6
3 changed files with 23 additions and 8 deletions

View file

@ -83,6 +83,7 @@ static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface)
if(!ref) {
assert(!This->elem);
release_dispex(&This->dispex);
VariantClear(&This->value);
heap_free(This->name);
heap_free(This);
}
@ -150,10 +151,8 @@ static HRESULT WINAPI HTMLDOMAttribute_put_nodeValue(IHTMLDOMAttribute *iface, V
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
if(!This->elem) {
FIXME("NULL This->elem\n");
return E_UNEXPECTED;
}
if(!This->elem)
return VariantCopy(&This->value, &v);
memset(&ei, 0, sizeof(ei));
@ -167,10 +166,8 @@ static HRESULT WINAPI HTMLDOMAttribute_get_nodeValue(IHTMLDOMAttribute *iface, V
TRACE("(%p)->(%p)\n", This, p);
if(!This->elem) {
FIXME("NULL This->elem\n");
return E_UNEXPECTED;
}
if(!This->elem)
return VariantCopy(p, &This->value);
return get_elem_attr_value_by_dispid(This->elem, This->dispid, 0, p);
}

View file

@ -943,7 +943,9 @@ typedef struct {
LONG ref;
/* name and value are valid only for detached attributes (when elem == NULL). */
WCHAR *name;
VARIANT value;
HTMLElement *elem;
DISPID dispid;

View file

@ -4790,6 +4790,7 @@ static void _get_attr_node_value(unsigned line, IHTMLDOMAttribute *attr, VARIANT
{
HRESULT hres;
V_VT(v) = VT_EMPTY;
hres = IHTMLDOMAttribute_get_nodeValue(attr, v);
ok_(__FILE__,line) (hres == S_OK, "get_nodeValue failed: %08x\n", hres);
ok_(__FILE__,line) (V_VT(v) == vt, "vt=%d, expected %d\n", V_VT(v), vt);
@ -8914,6 +8915,8 @@ static void test_create_elems(IHTMLDocument2 *doc)
ok(hres == S_OK, "createAttribute dailed: %08x\n", hres);
SysFreeString(str);
if(SUCCEEDED(hres)) {
VARIANT v;
test_disp((IUnknown*)attr, &DIID_DispHTMLDOMAttribute, "[object]");
test_ifaces((IUnknown*)attr, attr_iids);
test_no_iface((IUnknown*)attr, &IID_IHTMLDOMNode);
@ -8921,6 +8924,19 @@ static void test_create_elems(IHTMLDocument2 *doc)
test_attr_node_name(attr, "Test");
test_attr_expando(attr, VARIANT_FALSE);
get_attr_node_value(attr, &v, VT_EMPTY);
V_VT(&v) = VT_I4;
V_I4(&v) = 1;
put_attr_node_value(attr, v);
get_attr_node_value(attr, &v, VT_I4);
ok(V_I4(&v) == 1, "nodeValue = %d\n", V_I4(&v));
V_VT(&v) = VT_EMPTY;
put_attr_node_value(attr, v);
get_attr_node_value(attr, &v, VT_EMPTY);
IHTMLDOMAttribute_Release(attr);
}