Jacek Caban : mshtml: Added IHTMLStyle::[get|put] _verticalAlign implementation.

Alexandre Julliard julliard at winehq.org
Tue Oct 7 08:53:53 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct  6 09:51:21 2008 -0500

mshtml: Added IHTMLStyle::[get|put]_verticalAlign implementation.

---

 dlls/mshtml/htmlstyle.c |   31 +++++++++++++++++++++++++++----
 dlls/mshtml/htmlstyle.h |    1 +
 dlls/mshtml/tests/dom.c |   21 +++++++++++++++++++++
 3 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 874624e..dd5cbb2 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -71,6 +71,8 @@ static const WCHAR attrTextDecoration[] =
     {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
 static const WCHAR attrTop[] =
     {'t','o','p',0};
+static const WCHAR attrVerticalAlign[] =
+    {'v','e','r','t','i','c','a','l','-','a','l','i','g','n',0};
 static const WCHAR attrVisibility[] =
     {'v','i','s','i','b','i','l','i','t','y',0};
 static const WCHAR attrWidth[] =
@@ -96,6 +98,7 @@ static const LPCWSTR style_strings[] = {
     attrPaddingLeft,
     attrTextDecoration,
     attrTop,
+    attrVerticalAlign,
     attrVisibility,
     attrWidth,
 };
@@ -728,15 +731,35 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIA
 static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(v%d)\n", This, V_VT(&v));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    switch(V_VT(&v)) {
+    case VT_BSTR:
+        return set_style_attr(This, STYLEID_VERTICAL_ALIGN, V_BSTR(&v), 0);
+    default:
+        FIXME("not implemented vt %d\n", V_VT(&v));
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    BSTR ret;
+    HRESULT hres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    hres = get_style_attr(This, STYLEID_VERTICAL_ALIGN, &ret);
+    if(FAILED(hres))
+        return hres;
+
+    V_VT(p) = VT_BSTR;
+    V_BSTR(p) = ret;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 371df89..4a7e121 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -50,6 +50,7 @@ typedef enum {
     STYLEID_PADDING_LEFT,
     STYLEID_TEXT_DECORATION,
     STYLEID_TOP,
+    STYLEID_VERTICAL_ALIGN,
     STYLEID_VISIBILITY,
     STYLEID_WIDTH
 } styleid_t;
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 6618930..bb4e7ef 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2154,6 +2154,27 @@ static void test_default_style(IHTMLStyle *style)
     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
     ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", dbgstr_w(str));
     SysFreeString(str);
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLStyle_get_verticalAlign(style, &v);
+    ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+    ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
+    VariantClear(&v);
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr("middle");
+    hres = IHTMLStyle_put_verticalAlign(style, v);
+    ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
+    VariantClear(&v);
+
+    V_VT(&v) = VT_EMPTY;
+    hres = IHTMLStyle_get_verticalAlign(style, &v);
+    ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
+    ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
+    ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+
 }
 
 static void test_default_selection(IHTMLDocument2 *doc)




More information about the wine-cvs mailing list