Commit 5071f124 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added HTMLStyle::get_textDecoration* implementation.

parent b5dadf95
......@@ -58,6 +58,13 @@ static const WCHAR attrFontStyle[] =
{'f','o','n','t','-','s','t','y','l','e',0};
static const WCHAR attrFontWeight[] =
{'f','o','n','t','-','w','e','i','g','h','t',0};
static const WCHAR attrTextDecoration[] =
{'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
static const WCHAR valLineThrough[] =
{'l','i','n','e','-','t','h','r','o','u','g','h',0};
static const WCHAR valUnderline[] =
{'u','n','d','e','r','l','i','n','e',0};
static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value)
{
......@@ -83,27 +90,56 @@ static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value)
return S_OK;
}
static HRESULT get_style_attr(HTMLStyle *This, LPCWSTR name, BSTR *p)
static HRESULT get_style_attr_nsval(HTMLStyle *This, LPCWSTR name, nsAString *value)
{
nsAString str_name, str_value;
const PRUnichar *value;
nsAString str_name;
nsresult nsres;
nsAString_Init(&str_name, name);
nsAString_Init(&str_value, NULL);
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &str_name, &str_value);
if(NS_FAILED(nsres))
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &str_name, value);
if(NS_FAILED(nsres)) {
ERR("SetProperty failed: %08x\n", nsres);
return E_FAIL;
}
nsAString_Finish(&str_name);
return NS_OK;
}
static HRESULT get_style_attr(HTMLStyle *This, LPCWSTR name, BSTR *p)
{
nsAString str_value;
const PRUnichar *value;
nsAString_Init(&str_value, NULL);
get_style_attr_nsval(This, name, &str_value);
nsAString_GetData(&str_value, &value, NULL);
*p = *value ? SysAllocString(value) : NULL;
nsAString_Finish(&str_name);
nsAString_Finish(&str_value);
TRACE("%s -> %s\n", debugstr_w(name), debugstr_w(*p));
return S_OK;
}
static HRESULT check_style_attr_value(HTMLStyle *This, LPCWSTR name, LPCWSTR exval, VARIANT_BOOL *p)
{
nsAString str_value;
const PRUnichar *value;
nsAString_Init(&str_value, NULL);
get_style_attr_nsval(This, name, &str_value);
nsAString_GetData(&str_value, &value, NULL);
*p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
nsAString_Finish(&str_value);
TRACE("%s -> %x\n", debugstr_w(name), *p);
return S_OK;
}
......@@ -480,8 +516,10 @@ static HRESULT WINAPI HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v)
static HRESULT WINAPI HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return get_style_attr(This, attrTextDecoration, p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v)
......@@ -508,8 +546,10 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, V
static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return check_style_attr_value(This, attrTextDecoration, valUnderline, p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
......@@ -536,8 +576,10 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface,
static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return check_style_attr_value(This, attrTextDecoration, valLineThrough, p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment