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

Alexandre Julliard julliard at winehq.org
Wed Oct 8 08:32:50 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Oct  7 14:45:31 2008 -0500

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

---

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

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 61a644d..b315f55 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -72,6 +72,8 @@ static const WCHAR attrPaddingLeft[] =
     {'p','a','d','d','i','n','g','-','l','e','f','t',0};
 static const WCHAR attrPosition[] =
     {'p','o','s','i','t','i','o','n',0};
+static const WCHAR attrTextAlign[] =
+    {'t','e','x','t','-','a','l','i','g','n',0};
 static const WCHAR attrTextDecoration[] =
     {'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
 static const WCHAR attrTop[] =
@@ -108,6 +110,7 @@ static const struct{
     {attrMarginRight,          DISPID_IHTMLSTYLE_MARGINRIGHT},
     {attrPaddingLeft,          DISPID_IHTMLSTYLE_PADDINGLEFT},
     {attrPosition,             DISPID_IHTMLSTYLE2_POSITION},
+    {attrTextAlign,            DISPID_IHTMLSTYLE_TEXTALIGN},
     {attrTextDecoration,       DISPID_IHTMLSTYLE_TEXTDECORATION},
     {attrTop,                  DISPID_IHTMLSTYLE_TOP},
     {attrVerticalAlign,        DISPID_IHTMLSTYLE_VERTICALALIGN},
@@ -847,15 +850,19 @@ static HRESULT WINAPI HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p)
 static HRESULT WINAPI HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    return set_style_attr(This, STYLEID_TEXT_ALIGN, v, 0);
 }
 
 static HRESULT WINAPI HTMLStyle_get_textAlign(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, STYLEID_TEXT_ALIGN, p);
 }
 
 static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index e07f48b..0ed7d6d 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -50,6 +50,7 @@ typedef enum {
     STYLEID_MARGIN_RIGHT,
     STYLEID_PADDING_LEFT,
     STYLEID_POSITION,
+    STYLEID_TEXT_ALIGN,
     STYLEID_TEXT_DECORATION,
     STYLEID_TOP,
     STYLEID_VERTICAL_ALIGN,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 973c17f..c23a6fb 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2250,6 +2250,22 @@ static void test_default_style(IHTMLStyle *style)
     ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
 
+    str = (void*)0xdeadbeef;
+    hres = IHTMLStyle_get_textAlign(style, &str);
+    ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
+    ok(!str, "textAlign != NULL\n");
+
+    str = a2bstr("center");
+    hres = IHTMLStyle_put_textAlign(style, str);
+    ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = NULL;
+    hres = IHTMLStyle_get_textAlign(style, &str);
+    ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "center"), "textAlign = %s\n", dbgstr_w(V_BSTR(&v)));
+    SysFreeString(str);
+
     V_VT(&v) = VT_EMPTY;
     hres = IHTMLStyle_get_zIndex(style, &v);
     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);




More information about the wine-cvs mailing list