From b1c7b89125c6fb52a65a87e70bec7fd2678a9b34 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 7 Apr 2017 19:19:09 +0200 Subject: [PATCH] mshtml: Added IHTMLTableCell::rowSpan property implementation. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- 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 64a58625219..8e3a8d17f84 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 7524d552a56..ac0ddff346c 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, + "" + " " + " " + " " + "
td1 texttd2 text
"); + + 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);