Jacek Caban : mshtml: Added IHTMLTableCell:: rowSpan property implementation.

Alexandre Julliard julliard at winehq.org
Fri Apr 7 15:17:03 CDT 2017


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Apr  7 19:19:09 2017 +0200

mshtml: Added IHTMLTableCell::rowSpan property implementation.

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

---

 dlls/mshtml/htmltablecell.c | 29 +++++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c     | 41 ++++++++++++++++++++++++++++++-----------
 2 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/dlls/mshtml/htmltablecell.c b/dlls/mshtml/htmltablecell.c
index 64a5862..8e3a8d1 100644
--- a/dlls/mshtml/htmltablecell.c
+++ b/dlls/mshtml/htmltablecell.c
@@ -100,15 +100,36 @@ static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdM
 static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
 {
     HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
-    FIXME("(%p)->(%d)\n", This, v);
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%d)\n", This, v);
+
+    if(v <= 0)
+        return E_INVALIDARG;
+
+    nsres = nsIDOMHTMLTableCellElement_SetRowSpan(This->nscell, v);
+    if(NS_FAILED(nsres)) {
+        ERR("SetRowSpan failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
 {
     HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMHTMLTableCellElement_GetRowSpan(This->nscell, p);
+    if(NS_FAILED(nsres)) {
+        ERR("GetRowSpan failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 7524d55..ac0ddff 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -7234,23 +7234,31 @@ static void test_tr_elem(IHTMLElement *elem)
     IHTMLTableRow_Release(row);
 }
 
-static void test_td_elem(IHTMLElement *elem)
+static void test_td_elem(IHTMLDocument2 *doc, IHTMLElement *div)
 {
     IHTMLTableCell *cell;
+    IHTMLElement *elem;
     HRESULT hres;
     LONG lval;
     BSTR str;
     VARIANT vbg, vDefaultbg;
 
+    test_elem_set_innerhtml((IUnknown*)div,
+                            "<table id=\"tbl\"><tbody>"
+                            "  <tr></tr>"
+                            "  <tr id=\"row2\"><td id=\"td1\">td1 text</td><td id=\"td2\">td2 text</td><td></td></tr>"
+                            "  <tr></tr>"
+                            "</tbody></table>");
+
+    elem = get_doc_elem_by_id(doc, "td1");
     hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLTableCell, (void**)&cell);
     ok(hres == S_OK, "Could not get IHTMLTableRow iface: %08x\n", hres);
-    if(FAILED(hres))
-        return;
+    IHTMLElement_Release(elem);
 
     lval = 0xdeadbeef;
     hres = IHTMLTableCell_get_cellIndex(cell, &lval);
     ok(hres == S_OK, "get cellIndex failed: %08x\n", hres);
-    ok(lval == 1, "Expected 1, got %d\n", lval);
+    ok(!lval, "Expected 0, got %d\n", lval);
 
     str = a2bstr("left");
     hres = IHTMLTableCell_put_align(cell, str);
@@ -7300,6 +7308,23 @@ static void test_td_elem(IHTMLElement *elem)
     ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
     VariantClear(&vDefaultbg);
 
+    hres = IHTMLTableCell_get_rowSpan(cell, &lval);
+    ok(hres == S_OK, "get_rowSpan failed: %08x\n", hres);
+    ok(lval == 1, "rowSpan = %d\n", lval);
+
+    hres = IHTMLTableCell_put_rowSpan(cell, -1);
+    ok(hres == E_INVALIDARG, "put_rowSpan failed: %08x\n", hres);
+
+    hres = IHTMLTableCell_put_rowSpan(cell, 0);
+    ok(hres == E_INVALIDARG, "put_rowSpan failed: %08x\n", hres);
+
+    hres = IHTMLTableCell_put_rowSpan(cell, 2);
+    ok(hres == S_OK, "put_rowSpan failed: %08x\n", hres);
+
+    hres = IHTMLTableCell_get_rowSpan(cell, &lval);
+    ok(hres == S_OK, "get_rowSpan failed: %08x\n", hres);
+    ok(lval == 2, "rowSpan = %d\n", lval);
+
     IHTMLTableCell_Release(cell);
 }
 
@@ -8543,13 +8568,6 @@ static void test_elems(IHTMLDocument2 *doc)
         IHTMLElement_Release(elem);
     }
 
-    elem = get_doc_elem_by_id(doc, "td2");
-    ok(elem != NULL, "elem == NULL\n");
-    if(elem) {
-        test_td_elem(elem);
-        IHTMLElement_Release(elem);
-    }
-
     elem = get_doc_elem_by_id(doc, "row2");
     ok(elem != NULL, "elem == NULL\n");
     if(elem) {
@@ -9246,6 +9264,7 @@ static void test_elems2(IHTMLDocument2 *doc)
         IHTMLElement_Release(elem);
     }
 
+    test_td_elem(doc, div);
     test_attr(doc, div);
     test_blocked(doc, div);
     test_elem_names(doc);




More information about the wine-cvs mailing list