HTMLElement element;
IHTMLTableCell IHTMLTableCell_iface;
+
+ nsIDOMHTMLTableCellElement *nscell;
} HTMLTableCell;
static inline HTMLTableCell *impl_from_IHTMLTableCell(IHTMLTableCell *iface)
static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
{
HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ nsAString str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ nsAString_InitDepend(&str, v);
+ nsres = nsIDOMHTMLTableCellElement_SetAlign(This->nscell, &str);
+ nsAString_Finish(&str);
+ if (NS_FAILED(nsres)) {
+ ERR("Set Align failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+ return S_OK;
}
static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p)
{
HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsAString str;
+ nsresult nsres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ nsAString_Init(&str, NULL);
+ nsres = nsIDOMHTMLTableCellElement_GetAlign(This->nscell, &str);
+
+ return return_nsstr(nsres, &str, p);
}
static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v)
static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v)
{
HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
- return E_NOTIMPL;
+ nsAString strColor;
+ nsresult nsres;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+ if(!variant_to_nscolor(&v, &strColor))
+ return S_OK;
+
+ nsres = nsIDOMHTMLTableCellElement_SetBgColor(This->nscell, &strColor);
+ nsAString_Finish(&strColor);
+ if(NS_FAILED(nsres)) {
+ ERR("SetBgColor(%s) failed: %08x\n", debugstr_variant(&v), nsres);
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *p)
{
HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+ nsAString strColor;
+ nsresult nsres;
+ HRESULT hres;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ nsAString_Init(&strColor, NULL);
+ nsres = nsIDOMHTMLTableCellElement_GetBgColor(This->nscell, &strColor);
+
+ if(NS_SUCCEEDED(nsres)) {
+ const PRUnichar *color;
+ nsAString_GetData(&strColor, &color);
+ V_VT(p) = VT_BSTR;
+ hres = nscolor_to_str(color, &V_BSTR(p));
+ }else {
+ ERR("GetBgColor failed: %08x\n", nsres);
+ hres = E_FAIL;
+ }
+ nsAString_Finish(&strColor);
+ return hres;
}
static HRESULT WINAPI HTMLTableCell_put_noWrap(IHTMLTableCell *iface, VARIANT_BOOL v)
static HRESULT WINAPI HTMLTableCell_get_cellIndex(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_GetCellIndex(This->nscell, p);
+ if (NS_FAILED(nsres)) {
+ ERR("Get CellIndex failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ return S_OK;
}
static const IHTMLTableCellVtbl HTMLTableCellVtbl = {
HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{
HTMLTableCell *ret;
+ nsresult nsres;
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableCell_dispex);
+ nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableCellElement, (void**)&ret->nscell);
+
+ /* Share nscell reference with nsnode */
+ assert(nsres == NS_OK && (nsIDOMNode*)ret->nscell == ret->element.node.nsnode);
+ nsIDOMNode_Release(ret->element.node.nsnode);
+
*elem = &ret->element;
return S_OK;
}