Commit 0849a811 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Correctly handle comment nodes in IHTMLElement::[get|put]_title implementation.

parent 29389b87
......@@ -593,6 +593,8 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
return S_OK;
}
static const WCHAR titleW[] = {'t','i','t','l','e',0};
static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = HTMLELEM_THIS(iface);
......@@ -601,6 +603,20 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->nselem) {
VARIANT *var;
HRESULT hres;
hres = dispex_get_dprop_ref(&This->node.dispex, titleW, TRUE, &var);
if(FAILED(hres))
return hres;
VariantClear(var);
V_VT(var) = VT_BSTR;
V_BSTR(var) = v ? SysAllocString(v) : NULL;
return S_OK;
}
nsAString_InitDepend(&title_str, v);
nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
nsAString_Finish(&title_str);
......@@ -618,6 +634,23 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->nselem) {
VARIANT *var;
HRESULT hres;
hres = dispex_get_dprop_ref(&This->node.dispex, titleW, FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
*p = NULL;
}else if(V_VT(var) != VT_BSTR) {
FIXME("title = %s\n", debugstr_variant(var));
return E_FAIL;
}else {
*p = V_BSTR(var) ? SysAllocString(V_BSTR(var)) : NULL;
}
return S_OK;
}
nsAString_Init(&title_str, NULL);
nsres = nsIDOMHTMLElement_GetTitle(This->nselem, &title_str);
if(NS_SUCCEEDED(nsres)) {
......
......@@ -5908,6 +5908,9 @@ static void test_create_elems(IHTMLDocument2 *doc)
ok(type == 8, "type=%d, expected 8\n", type);
test_node_get_value_str((IUnknown*)comment, "testing");
test_elem_title((IUnknown*)comment, NULL);
test_elem_set_title((IUnknown*)comment, "comment title");
test_elem_title((IUnknown*)comment, "comment title");
IHTMLDOMNode_Release(comment);
}
......
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