Module: wine Branch: master Commit: 48e41c4dd70243ced8412ae911722fdece37e923 URL: http://source.winehq.org/git/wine.git/?a=commit;h=48e41c4dd70243ced8412ae911...
Author: Zhenbo Li litimetal@gmail.com Date: Mon May 26 22:12:50 2014 +0800
mshtml: Added IHTMLTableRow::insertCell method implementation.
---
dlls/mshtml/htmltablerow.c | 23 +++++++++++++++++++++-- dlls/mshtml/tests/dom.c | 12 ++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmltablerow.c b/dlls/mshtml/htmltablerow.c index 731b403..589a38f 100644 --- a/dlls/mshtml/htmltablerow.c +++ b/dlls/mshtml/htmltablerow.c @@ -308,8 +308,27 @@ static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementC static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%d %p)\n", This, index, row); - return E_NOTIMPL; + nsIDOMHTMLElement *nselem; + HTMLElement *elem; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%d %p)\n", This, index, row); + nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem); + if(NS_FAILED(nsres)) { + ERR("Insert Cell at %d failed: %08x\n", index, nsres); + return E_FAIL; + } + + hres = HTMLTableCell_Create(This->element.node.doc, nselem, &elem); + nsIDOMHTMLElement_Release(nselem); + if (FAILED(hres)) { + ERR("Create TableCell failed: %08x\n", hres); + return hres; + } + + *row = (IDispatch *)&elem->IHTMLElement_iface; + return S_OK; }
static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c16e073..4eb02fc 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5737,10 +5737,22 @@ static void _test_tr_possess(unsigned line, IHTMLElement *elem, static void test_tr_modify(IHTMLElement *elem, IHTMLTableRow *row) { HRESULT hres; + IDispatch *disp; + IUnknown *unk;
hres = IHTMLTableRow_deleteCell(row, 0); ok(hres == S_OK, "deleteCell failed: %08x\n", hres); test_tr_possess(elem, row, 1, "td2"); + + hres = IHTMLTableRow_insertCell(row, 0, &disp); + ok(hres == S_OK, "insertCell failed: %08x\n", hres); + ok(disp != NULL, "disp == NULL\n"); + hres = IDispatch_QueryInterface(disp, &IID_IHTMLTableCell, (void **)&unk); + ok(hres == S_OK, "Could not get IID_IHTMLTableCell interface: %08x\n", hres); + if (SUCCEEDED(hres)) + IUnknown_Release(unk); + test_tr_possess(elem, row, 2, "td2"); + IDispatch_Release(disp); }
static void test_tr_elem(IHTMLElement *elem)