Jacek Caban : mshtml: Use helpers in IHTMLStyle::paddingLeft implementation .

Alexandre Julliard julliard at winehq.org
Thu Jan 26 14:49:24 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jan 26 14:34:22 2012 +0100

mshtml: Use helpers in IHTMLStyle::paddingLeft implementation.

---

 dlls/mshtml/htmlstyle.c   |   27 +++------------------------
 dlls/mshtml/tests/style.c |    2 ++
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 684f744..0487992 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -1611,39 +1611,18 @@ static HRESULT WINAPI HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
 
-    TRACE("(%p)->(vt=%d)\n", This, V_VT(&v));
-
-    switch(V_VT(&v)) {
-    case VT_I4: {
-        WCHAR buf[14];
-
-        wsprintfW(buf, px_formatW, V_I4(&v));
-        return set_style_attr(This, STYLEID_PADDING_LEFT, buf, 0);
-    }
-    case VT_BSTR:
-        return set_style_attr(This, STYLEID_PADDING_LEFT, V_BSTR(&v), 0);
-    default:
-        FIXME("unsupported vt=%d\n", V_VT(&v));
-    }
+    TRACE("(%p)->(v%d)\n", This, V_VT(&v));
 
-    return E_NOTIMPL;
+    return set_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, &v, ATTR_FIX_PX);
 }
 
 static HRESULT WINAPI HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    BSTR ret;
-    HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, p);
 
-    hres = get_style_attr(This, STYLEID_PADDING_LEFT, &ret);
-    if(FAILED(hres))
-        return hres;
-
-    V_VT(p) = VT_BSTR;
-    V_BSTR(p) = ret;
-    return S_OK;
+    return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0);
 }
 
 static HRESULT WINAPI HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index 03a433f..793b51c 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -1289,6 +1289,8 @@ static void test_body_style(IHTMLStyle *style)
     /* PaddingLeft */
     hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
     ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
+    ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
+    ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
 
     V_VT(&v) = VT_BSTR;
     V_BSTR(&v) = a2bstr("10");




More information about the wine-cvs mailing list