mshtml: Added IHTMLElement3::contentEditable property implemention.

This commit is contained in:
Zhenbo Li 2014-04-20 10:56:37 +08:00 committed by Alexandre Julliard
parent 2858f1ee63
commit 2a8d4a03d3
2 changed files with 49 additions and 4 deletions

View File

@ -174,15 +174,34 @@ static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement3(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsresult nsres;
nsAString str;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&str, v);
nsres = nsIDOMHTMLElement_SetContentEditable(This->nselem, &str);
nsAString_Finish(&str);
if (NS_FAILED(nsres)){
ERR("SetContentEditable(%s) failed!\n", debugstr_w(v));
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
{
HTMLElement *This = impl_from_IHTMLElement3(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsresult nsres;
nsAString str;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&str, NULL);
nsres = nsIDOMHTMLElement_GetContentEditable(This->nselem, &str);
return return_nsstr(nsres, &str, p);
}
static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)

View File

@ -3012,6 +3012,31 @@ static void _test_attr_specified(unsigned line, IHTMLDOMAttribute *attr, VARIANT
ok_(__FILE__,line)(specified == expected, "specified = %x, expected %x\n", specified, expected);
}
static void test_contenteditable(IUnknown *unk)
{
IHTMLElement3 *elem3 = get_elem3_iface(unk);
HRESULT hres;
BSTR str, strDefault;
hres = IHTMLElement3_get_contentEditable(elem3, &strDefault);
ok(hres == S_OK, "get_contentEditable failed: 0x%08x\n", hres);
str = a2bstr("true");
hres = IHTMLElement3_put_contentEditable(elem3, str);
ok(hres == S_OK, "put_contentEditable(%s) failed: 0x%08x\n", wine_dbgstr_w(str), hres);
SysFreeString(str);
hres = IHTMLElement3_get_contentEditable(elem3, &str);
ok(hres == S_OK, "get_contentEditable failed: 0x%08x\n", hres);
ok(!strcmp_wa(str, "true"), "Got %s, expected %s\n", wine_dbgstr_w(str), "true");
/* Restore origin contentEditable */
hres = IHTMLElement3_put_contentEditable(elem3, strDefault);
ok(hres == S_OK, "put_contentEditable(%s) failed: 0x%08x\n", wine_dbgstr_w(strDefault), hres);
SysFreeString(strDefault);
IHTMLElement3_Release(elem3);
}
#define test_input_type(i,t) _test_input_type(__LINE__,i,t)
static void _test_input_type(unsigned line, IHTMLInputElement *input, const char *extype)
{
@ -6612,6 +6637,7 @@ static void test_elems(IHTMLDocument2 *doc)
if(elem) {
test_dynamic_properties(elem);
test_attr_collection(elem);
test_contenteditable((IUnknown*)elem);
IHTMLElement_Release(elem);
}