[PATCH] Implement IHTMLStyle put_borderTopColor

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Jan 26 23:07:45 CST 2011


---
 dlls/mshtml/htmlstyle.c |   12 +++++++++---
 dlls/mshtml/htmlstyle.h |    2 ++
 dlls/mshtml/tests/dom.c |   18 ++++++++++++++++++
 3 files changed, 29 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..9abaadc 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -108,3 +108,5 @@ 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)) {
-- 
1.7.1


--------------080105080106030602010907--



More information about the wine-patches mailing list