Zhenbo Li : mshtml: Added IHTMLElement3:: contentEditable property implemention.

Alexandre Julliard julliard at winehq.org
Fri Apr 25 14:15:25 CDT 2014


Module: wine
Branch: master
Commit: 2a8d4a03d3c81bda0182ef40f9969e48925f89a3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2a8d4a03d3c81bda0182ef40f9969e48925f89a3

Author: Zhenbo Li <litimetal at gmail.com>
Date:   Sun Apr 20 10:56:37 2014 +0800

mshtml: Added IHTMLElement3::contentEditable property implemention.

---

 dlls/mshtml/htmlelem3.c |   27 +++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c |   26 ++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlelem3.c b/dlls/mshtml/htmlelem3.c
index 805e8aa..07f4854 100644
--- a/dlls/mshtml/htmlelem3.c
+++ b/dlls/mshtml/htmlelem3.c
@@ -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)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 2ab701e..b863ac2 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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);
     }
 




More information about the wine-cvs mailing list