Alistair Leslie-Hughes : mshtml: Implement IHTMLStyle put_borderTopColor.

Alexandre Julliard julliard at winehq.org
Wed Feb 2 12:30:16 CST 2011


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

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Thu Jan 27 16:07:45 2011 +1100

mshtml: Implement IHTMLStyle put_borderTopColor.

---

 dlls/mshtml/htmlstyle.c |   12 +++++++++---
 dlls/mshtml/htmlstyle.h |    1 +
 dlls/mshtml/tests/dom.c |   18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 7ca763f..3a976cd 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -351,8 +351,12 @@ HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
 
         static const WCHAR format[] = {'%','d',0};
         static const WCHAR px_format[] = {'%','d','p','x',0};
+        static const WCHAR hex_format[] = {'#','%','0','6','x',0};
 
-        wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
+        if(flags & ATTR_HEX_INT)
+            wsprintfW(str, hex_format, V_I4(value));
+        else
+            wsprintfW(str, flags&ATTR_FIX_PX ? px_format : format, V_I4(value));
         return set_nsstyle_attr(nsstyle, sid, str, flags & ~ATTR_FIX_PX);
     }
     default:
@@ -1537,8 +1541,10 @@ static HRESULT WINAPI HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p)
 static HRESULT WINAPI HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    FIXME("(%p)->(v%d)\n", This, V_VT(&v));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(v%d)\n", This, V_VT(&v));
+
+    return set_nsstyle_attr_var(This->nsstyle, STYLEID_BORDER_TOP_COLOR, &v, ATTR_HEX_INT);
 }
 
 static HRESULT WINAPI HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 044718b..ea4ece3 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -108,3 +108,4 @@ HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
 #define ATTR_FIX_PX      1
 #define ATTR_FIX_URL     2
 #define ATTR_STR_TO_INT  4
+#define ATTR_HEX_INT     8
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index c883a70..9cc25a3 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -5443,6 +5443,24 @@ static void test_default_style(IHTMLStyle *style)
     ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
     VariantClear(&vDefault);
 
+    /* borderTopColor */
+    hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
+    ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("red");
+    hres = IHTMLStyle_put_borderTopColor(style, v);
+    ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
+    VariantClear(&v);
+
+    hres = IHTMLStyle_get_borderTopColor(style, &v);
+    ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
+    ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
+    hres = IHTMLStyle_put_borderTopColor(style, vDefault);
+    ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
+
     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
     ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
     if(SUCCEEDED(hres)) {




More information about the wine-cvs mailing list