Jacek Caban : mshtml: Added HTMLStyle::get_textDecoration* implementation.

Alexandre Julliard julliard at winehq.org
Wed Sep 19 08:16:25 CDT 2007


Module: wine
Branch: master
Commit: 5071f124ab25ab15efc9b48ee1b0260f55e6aaef
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5071f124ab25ab15efc9b48ee1b0260f55e6aaef

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 19 12:42:10 2007 +0200

mshtml: Added HTMLStyle::get_textDecoration* implementation.

---

 dlls/mshtml/htmlstyle.c |   68 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 6b4cf7d..756f772 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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)




More information about the wine-cvs mailing list