[PATCH] Implement IHTMLStyle4 get/put textOverflow

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Feb 18 05:43:39 CST 2009


---
 dlls/mshtml/htmlstyle.c  |    3 +++
 dlls/mshtml/htmlstyle.h  |    1 +
 dlls/mshtml/htmlstyle3.c |   18 ++++++++++++++----
 dlls/mshtml/tests/dom.c  |   30 ++++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 10f90e1..a6c2ca5 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -113,6 +113,8 @@ 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 attrTextOverflow[] =
+    {'t','e','x','t','-','o','v','e','r','f','l','o','w',0};
 static const WCHAR attrTop[] =
     {'t','o','p',0};
 static const WCHAR attrVerticalAlign[] =
@@ -167,6 +169,7 @@ static const struct{
     {attrPosition,             DISPID_IHTMLSTYLE2_POSITION},
     {attrTextAlign,            DISPID_IHTMLSTYLE_TEXTALIGN},
     {attrTextDecoration,       DISPID_IHTMLSTYLE_TEXTDECORATION},
+    {attrTextOverflow,         DISPID_IHTMLSTYLE4_TEXTOVERFLOW},
     {attrTop,                  DISPID_IHTMLSTYLE_TOP},
     {attrVerticalAlign,        DISPID_IHTMLSTYLE_VERTICALALIGN},
     {attrVisibility,           DISPID_IHTMLSTYLE_VISIBILITY},
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index b900e67..af43a94 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -74,6 +74,7 @@ typedef enum {
     STYLEID_POSITION,
     STYLEID_TEXT_ALIGN,
     STYLEID_TEXT_DECORATION,
+    STYLEID_TEXT_OVERFLOW,
     STYLEID_TOP,
     STYLEID_VERTICAL_ALIGN,
     STYLEID_VISIBILITY,
diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c
index ce1d56e..b3d47b4 100644
--- a/dlls/mshtml/htmlstyle3.c
+++ b/dlls/mshtml/htmlstyle3.c
@@ -395,15 +395,25 @@ static HRESULT WINAPI HTMLStyle4_Invoke(IHTMLStyle4 *iface, DISPID dispIdMember,
 static HRESULT WINAPI HTMLStyle4_put_textOverflow(IHTMLStyle4 *iface, BSTR v)
 {
     HTMLStyle *This = HTMLSTYLE4_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    static const WCHAR styleEllipsis[] = {'e','l','l','i','p','s','i','s',0};
+    static const WCHAR styleClip[] = {'c','l','i','p',0};
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    /* textOverflow can only be one of the following */
+    if(!v || strcmpiW(styleEllipsis, v) == 0    || strcmpiW(styleClip, v) == 0)
+    {
+        return set_nsstyle_attr(This->nsstyle, STYLEID_TEXT_OVERFLOW, v, 0);
+    }
+
+    return E_INVALIDARG;
 }
 
 static HRESULT WINAPI HTMLStyle4_get_textOverflow(IHTMLStyle4 *iface, BSTR *p)
 {
     HTMLStyle *This = HTMLSTYLE4_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, p);
+    return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_OVERFLOW, p);
 }
 
 static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 93b3731..6bb39bd 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2632,6 +2632,8 @@ static void test_style4(IHTMLStyle4 *style4)
     HRESULT hres;
     VARIANT v;
     VARIANT vdefault;
+    BSTR sdefault;
+    BSTR str;
 
     hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
     ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
@@ -2650,6 +2652,34 @@ static void test_style4(IHTMLStyle4 *style4)
     hres = IHTMLStyle4_put_minHeight(style4, vdefault);
     ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
     VariantClear(&vdefault);
+
+    /* textOverflow */
+    hres = IHTMLStyle4_get_textOverflow(style4, &sdefault);
+    ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
+
+    str = a2bstr("invalid");
+    hres = IHTMLStyle4_put_textOverflow(style4, str);
+    ok(hres == E_INVALIDARG, "put_textOverflow passed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = a2bstr("ellipsis");
+    hres = IHTMLStyle4_put_textOverflow(style4, str);
+    ok(hres == S_OK, "put_textOverflow failed: %08x\n", hres);
+    SysFreeString(str);
+
+    str = a2bstr("clip");
+    hres = IHTMLStyle4_put_textOverflow(style4, str);
+    ok(hres == S_OK, "put_textOverflow failed: %08x\n", hres);
+    SysFreeString(str);
+
+    hres = IHTMLStyle4_get_textOverflow(style4, &str);
+    ok(hres == S_OK, "get_textOverflow failed: %08x\n", hres);
+    todo_wine ok( !strcmp_wa(str, "clip"), "expect clip got (%s)\n", dbgstr_w(str));
+    SysFreeString(str);
+
+    hres = IHTMLStyle4_put_textOverflow(style4, sdefault);
+    ok(hres == S_OK, "put_textOverflow failed: %08x\n", hres);
+    SysFreeString(sdefault);
 }
 
 static void test_default_style(IHTMLStyle *style)
-- 
1.5.4.3


--------------030807080903050001070103--



More information about the wine-patches mailing list