Jacek Caban : mshtml: Added IHTMLDocument3::dir property implementation.

Alexandre Julliard julliard at winehq.org
Wed Nov 16 17:39:19 CST 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov 16 10:16:51 2016 -0600

mshtml: Added IHTMLDocument3::dir property implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmldoc.c   | 35 +++++++++++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8fa3f52..47e087d 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -2173,15 +2173,42 @@ static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface,
 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
 {
     HTMLDocument *This = impl_from_IHTMLDocument3(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString dir_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    if(!This->doc_node->nsdoc) {
+        FIXME("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
+    nsAString_InitDepend(&dir_str, v);
+    nsres = nsIDOMHTMLDocument_SetDir(This->doc_node->nsdoc, &dir_str);
+    nsAString_Finish(&dir_str);
+    if(NS_FAILED(nsres)) {
+        ERR("SetDir failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
 {
     HTMLDocument *This = impl_from_IHTMLDocument3(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString dir_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->doc_node->nsdoc) {
+        FIXME("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
+    nsres = nsIDOMHTMLDocument_GetDir(This->doc_node->nsdoc, &dir_str);
+    return return_nsstr(nsres, &dir_str, p);
 }
 
 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index be279cc..60e1bf8 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -6304,6 +6304,42 @@ static void test_default_selection(IHTMLDocument2 *doc)
     IHTMLTxtRange_Release(range);
 }
 
+static void test_doc_dir(IHTMLDocument2 *doc2)
+{
+    IHTMLDocument3 *doc = get_doc3_iface(doc2);
+    BSTR dir;
+    HRESULT hres;
+
+    dir = (BSTR)0xdeadbeef;
+    hres = IHTMLDocument3_get_dir(doc, &dir);
+    ok(hres == S_OK, "get_dir failed: %08x\n", hres);
+    ok(!dir, "dir = %s\n", wine_dbgstr_w(dir));
+
+    dir = a2bstr("rtl");
+    hres = IHTMLDocument3_put_dir(doc, dir);
+    ok(hres == S_OK, "put_dir failed: %08x\n", hres);
+    SysFreeString(dir);
+
+    dir = NULL;
+    hres = IHTMLDocument3_get_dir(doc, &dir);
+    ok(hres == S_OK, "get_dir failed: %08x\n", hres);
+    ok(!strcmp_wa(dir, "rtl"), "dir = %s\n", wine_dbgstr_w(dir));
+    SysFreeString(dir);
+
+    dir = a2bstr("ltr");
+    hres = IHTMLDocument3_put_dir(doc, dir);
+    ok(hres == S_OK, "put_dir failed: %08x\n", hres);
+    SysFreeString(dir);
+
+    dir = NULL;
+    hres = IHTMLDocument3_get_dir(doc, &dir);
+    ok(hres == S_OK, "get_dir failed: %08x\n", hres);
+    ok(!strcmp_wa(dir, "ltr"), "dir = %s\n", wine_dbgstr_w(dir));
+    SysFreeString(dir);
+
+    IHTMLDocument3_Release(doc);
+}
+
 static void test_unique_id(IHTMLDocument2 *doc, IHTMLElement *elem)
 {
     IHTMLDocument3 *doc3 = get_doc3_iface(doc);
@@ -6393,6 +6429,7 @@ static void test_doc_elem(IHTMLDocument2 *doc)
 
     test_elem_client_rect((IUnknown*)elem);
     test_unique_id(doc, elem);
+    test_doc_dir(doc);
 
     IHTMLElement_Release(elem);
 }




More information about the wine-cvs mailing list