Jacek Caban : mshtml: Added IHTMLTable::cellSpacing property implementation .

Alexandre Julliard julliard at winehq.org
Tue Jul 30 14:14:22 CDT 2013


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jul 30 14:10:16 2013 +0200

mshtml: Added IHTMLTable::cellSpacing property implementation.

---

 dlls/mshtml/htmltable.c |   42 ++++++++++++++++++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c
index f3c7ba8..64157e7 100644
--- a/dlls/mshtml/htmltable.c
+++ b/dlls/mshtml/htmltable.c
@@ -170,15 +170,49 @@ static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
 static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
 {
     HTMLTable *This = impl_from_IHTMLTable(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
-    return E_NOTIMPL;
+    nsAString nsstr;
+    WCHAR buf[64];
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    switch(V_VT(&v)) {
+    case VT_BSTR:
+        nsAString_InitDepend(&nsstr, V_BSTR(&v));
+        break;
+    case VT_I4: {
+        static const WCHAR formatW[] = {'%','d',0};
+        sprintfW(buf, formatW, V_I4(&v));
+        nsAString_InitDepend(&nsstr, buf);
+        break;
+    }
+    default:
+        FIXME("unsupported arg %s\n", debugstr_variant(&v));
+        return E_NOTIMPL;
+    }
+
+    nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
+    nsAString_Finish(&nsstr);
+    if(NS_FAILED(nsres)) {
+        ERR("SetCellSpacing failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
 {
     HTMLTable *This = impl_from_IHTMLTable(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&nsstr, NULL);
+    nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
+    V_VT(p) = VT_BSTR;
+    return return_nsstr(nsres, &nsstr, &V_BSTR(p));
 }
 
 static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index da44190..8d3b951 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -5513,11 +5513,29 @@ static void test_tr_elem(IHTMLElement *elem)
     IHTMLTableRow_Release(row);
 }
 
+#define test_table_cell_spacing(a,b) _test_table_cell_spacing(__LINE__,a,b)
+static void _test_table_cell_spacing(unsigned line, IHTMLTable *table, const char *exstr)
+{
+    VARIANT v;
+    HRESULT hres;
+
+    V_VT(&v) = VT_ERROR;
+    hres = IHTMLTable_get_cellSpacing(table, &v);
+    ok_(__FILE__,line)(hres == S_OK, "get_cellSpacing failed: %08x\n", hres);
+    ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
+    if(exstr)
+        ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exstr), "cellSpacing = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exstr);
+    else
+        ok_(__FILE__,line)(!V_BSTR(&v), "cellSpacing = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+}
+
 static void test_table_elem(IHTMLElement *elem)
 {
     IHTMLElementCollection *col;
     IHTMLTable *table;
     IHTMLDOMNode *node;
+    VARIANT v;
     HRESULT hres;
 
     static const elem_type_t row_types[] = {ET_TR,ET_TR};
@@ -5557,6 +5575,21 @@ static void test_table_elem(IHTMLElement *elem)
     test_elem_collection((IUnknown*)col, tbodies_types, sizeof(tbodies_types)/sizeof(*tbodies_types));
     IHTMLElementCollection_Release(col);
 
+    test_table_cell_spacing(table, NULL);
+
+    V_VT(&v) = VT_I4;
+    V_I4(&v) = 10;
+    hres = IHTMLTable_put_cellSpacing(table, v);
+    ok(hres == S_OK, "put_cellSpacing = %08x\n", hres);
+    test_table_cell_spacing(table, "10");
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("11");
+    hres = IHTMLTable_put_cellSpacing(table, v);
+    ok(hres == S_OK, "put_cellSpacing = %08x\n", hres);
+    test_table_cell_spacing(table, "11");
+    VariantClear(&v);
+
     IHTMLTable_Release(table);
 }
 




More information about the wine-cvs mailing list