Jacek Caban : mshtml: Add IHTMLTableCell::width property implementation.

Alexandre Julliard julliard at winehq.org
Thu May 28 17:11:11 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu May 28 23:06:54 2020 +0200

mshtml: Add IHTMLTableCell::width property implementation.

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

---

 dlls/mshtml/htmltable.c | 25 +++++++++++++++++++++----
 dlls/mshtml/tests/dom.c | 23 +++++++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c
index 1429631d44..43a4f6ba08 100644
--- a/dlls/mshtml/htmltable.c
+++ b/dlls/mshtml/htmltable.c
@@ -332,15 +332,32 @@ static HRESULT WINAPI HTMLTableCell_get_borderColorDark(IHTMLTableCell *iface, V
 static HRESULT WINAPI HTMLTableCell_put_width(IHTMLTableCell *iface, VARIANT v)
 {
     HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+    HRESULT hres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    hres = variant_to_nsstr(&v, FALSE, &nsstr);
+    if(FAILED(hres))
+        return hres;
+
+    nsres = nsIDOMHTMLTableCellElement_SetWidth(This->nscell, &nsstr);
+    nsAString_Finish(&nsstr);
+    return map_nsresult(nsres);
 }
 
 static HRESULT WINAPI HTMLTableCell_get_width(IHTMLTableCell *iface, VARIANT *p)
 {
     HTMLTableCell *This = impl_from_IHTMLTableCell(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 = nsIDOMHTMLTableCellElement_GetWidth(This->nscell, &nsstr);
+    return return_nsstr_variant(nsres, &nsstr, NSSTR_IMPLICIT_PX, p);
 }
 
 static HRESULT WINAPI HTMLTableCell_put_height(IHTMLTableCell *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 433e0d561a..25b8b3536c 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -7649,6 +7649,29 @@ static void test_td_elem(IHTMLDocument2 *doc, IHTMLElement *div)
     ok(V_VT(&v) == VT_BSTR && !lstrcmpW(V_BSTR(&v), L"110"), "height = %s\n", wine_dbgstr_variant(&v));
     VariantClear(&v);
 
+    V_VT(&v) = VT_I4;
+    V_I4(&v) = 200;
+    hres = IHTMLTableCell_put_width(cell, v);
+    ok(hres == S_OK, "put_width failed: %08x\n", hres);
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLTableCell_get_width(cell, &v);
+    ok(hres == S_OK, "get_width failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR && !lstrcmpW(V_BSTR(&v), L"200"), "width = %s\n", wine_dbgstr_variant(&v));
+    VariantClear(&v);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = SysAllocString(L"210px");
+    hres = IHTMLTableCell_put_width(cell, v);
+    ok(hres == S_OK, "put_width failed: %08x\n", hres);
+    SysFreeString(V_BSTR(&v));
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLTableCell_get_width(cell, &v);
+    ok(hres == S_OK, "get_width failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR && !lstrcmpW(V_BSTR(&v), L"210"), "width = %s\n", wine_dbgstr_variant(&v));
+    VariantClear(&v);
+
     /* Restore Original */
     hres = IHTMLTableCell_put_bgColor(cell, vDefaultbg);
     ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);




More information about the wine-cvs mailing list