Module: wine Branch: master Commit: c19b6dbf6be66d7f955d87a125ac9ef5cd86295e URL: http://source.winehq.org/git/wine.git/?a=commit;h=c19b6dbf6be66d7f955d87a125...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Nov 6 11:42:45 2014 +0100
mshtml: Added IHTMLTable:cellPadding property implementation.
---
dlls/mshtml/htmltable.c | 30 ++++++++++++++++++++++++++---- dlls/mshtml/mshtml_private.h | 7 +++++++ dlls/mshtml/tests/dom.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 8e64efa..0e8e55b 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -288,15 +288,37 @@ static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p) static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + nsAString val; + HRESULT hres; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + hres = var2str(&v, &val); + if(FAILED(hres)) + return hres; + + nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val); + nsAString_Finish(&val); + if(NS_FAILED(nsres)) { + ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres); + return E_FAIL; + } + + return S_OK; }
static HRESULT WINAPI HTMLTable_get_cellPadding(IHTMLTable *iface, VARIANT *p) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&val, NULL); + nsres = nsIDOMHTMLTableElement_GetCellPadding(This->nstable, &val); + return return_nsstr_variant(nsres, &val, p); }
static HRESULT WINAPI HTMLTable_put_background(IHTMLTable *iface, BSTR v) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1c932f2..abe7995 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -833,8 +833,15 @@ BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN; void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN; UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN; void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN; + HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
+static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) +{ + V_VT(p) = VT_BSTR; + return return_nsstr(nsres, nsstr, &V_BSTR(p)); +} + nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN; HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN; void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c1ca092..f0f03b8 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -6335,6 +6335,23 @@ static void _test_table_cell_spacing(unsigned line, IHTMLTable *table, const cha VariantClear(&v); }
+#define test_table_cell_padding(a,b) _test_table_cell_padding(__LINE__,a,b) +static void _test_table_cell_padding(unsigned line, IHTMLTable *table, const char *exstr) +{ + VARIANT v; + HRESULT hres; + + V_VT(&v) = VT_ERROR; + hres = IHTMLTable_get_cellPadding(table, &v); + ok_(__FILE__,line)(hres == S_OK, "get_cellPadding 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), "cellPadding = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exstr); + else + ok_(__FILE__,line)(!V_BSTR(&v), "cellPadding = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); +} + static void test_table_modify(IHTMLTable *table) { IDispatch *disp; @@ -6437,6 +6454,27 @@ static void test_table_elem(IHTMLElement *elem) test_table_cell_spacing(table, "11"); VariantClear(&v);
+ test_table_cell_padding(table, NULL); + + V_VT(&v) = VT_I4; + V_I4(&v) = 10; + hres = IHTMLTable_put_cellPadding(table, v); + ok(hres == S_OK, "put_cellPadding = %08x\n", hres); + test_table_cell_padding(table, "10"); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("11"); + hres = IHTMLTable_put_cellPadding(table, v); + ok(hres == S_OK, "put_cellPadding = %08x\n", hres); + test_table_cell_padding(table, "11"); + VariantClear(&v); + + V_VT(&v) = VT_R8; + V_R8(&v) = 5; + hres = IHTMLTable_put_cellPadding(table, v); + ok(hres == S_OK, "put_cellPadding = %08x\n", hres); + test_table_cell_padding(table, "5"); + bstr = a2bstr("left"); hres = IHTMLTable_put_align(table, bstr); ok(hres == S_OK, "set_align failed: %08x\n", hres); @@ -6531,7 +6569,6 @@ static void test_table_elem(IHTMLElement *elem) ok(!strcmp_wa(V_BSTR(&v), "11"), "Expected 11, got %s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v);
- bstr = a2bstr("box"); hres = IHTMLTable_put_frame(table, bstr); ok(hres == S_OK, "put_frame = %08x\n", hres);