Jacek Caban : mshtml: Added IHTMLStyle::get_cssText implementation.

Alexandre Julliard julliard at winehq.org
Tue Mar 10 10:53:16 CDT 2009


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Mar  9 20:45:48 2009 +0100

mshtml: Added IHTMLStyle::get_cssText implementation.

---

 dlls/mshtml/htmlstyle.c |   22 ++++++++++++++++++++--
 dlls/mshtml/tests/dom.c |   18 ++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 3727c8e..5fa31c8 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -2063,8 +2063,26 @@ static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
 {
     HTMLStyle *This = HTMLSTYLE_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString text_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    /* FIXME: Gecko style formatting is different than IE (uppercase). */
+    nsAString_Init(&text_str, NULL);
+    nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str);
+    if(NS_SUCCEEDED(nsres)) {
+        const PRUnichar *text;
+
+        nsAString_GetData(&text_str, &text);
+        *p = *text ? SysAllocString(text) : NULL;
+    }else {
+        FIXME("GetCssStyle failed: %08x\n", nsres);
+        *p = NULL;
+    }
+
+    nsAString_Finish(&text_str);
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, long v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index a5b9cc6..fa36c6e 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1927,6 +1927,22 @@ static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
     }
 }
 
+#define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
+static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
+{
+    BSTR text = (void*)0xdeadbeef;
+    HRESULT hres;
+
+    hres = IHTMLStyle_get_cssText(style, &text);
+    ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
+    if(extext)
+        ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", dbgstr_w(text));
+    else
+        ok_(__FILE__,line)(!text, "cssText = %s\n", dbgstr_w(text));
+
+    SysFreeString(text);
+}
+
 static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n,
         const elem_type_t *elem_types, long len)
 {
@@ -2608,6 +2624,8 @@ static void test_default_style(IHTMLStyle *style)
     test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
     test_ifaces((IUnknown*)style, style_iids);
 
+    test_style_csstext(style, NULL);
+
     hres = IHTMLStyle_get_position(style, &str);
     ok(hres == S_OK, "get_position failed: %08x\n", hres);
     ok(!str, "str=%s\n", dbgstr_w(str));




More information about the wine-cvs mailing list