Jacek Caban : mshtml: Added IHTMLCSSStyleDeclaration:: put_cssStyle implementation.

Alexandre Julliard julliard at winehq.org
Fri Sep 7 16:49:26 CDT 2018


Module: wine
Branch: master
Commit: 45f8c03cc73a84201db8e5e7570d62fa518bde7a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=45f8c03cc73a84201db8e5e7570d62fa518bde7a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep  7 14:44:50 2018 +0200

mshtml: Added IHTMLCSSStyleDeclaration::put_cssStyle implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlstyle.c   | 28 +++++++++++++++-------------
 dlls/mshtml/tests/style.c | 23 +++++++++++++++++++++++
 2 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index fbdf633..2e2777a 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -2463,20 +2463,10 @@ static HRESULT WINAPI HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p)
 static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
-    nsAString text_str;
-    nsresult nsres;
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
 
-    nsAString_InitDepend(&text_str, v);
-    nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
-    nsAString_Finish(&text_str);
-    if(NS_FAILED(nsres)) {
-        FIXME("SetCssStyle failed: %08x\n", nsres);
-        return E_FAIL;
-    }
-
-    return S_OK;
+    return IHTMLCSSStyleDeclaration_put_cssText(&This->IHTMLCSSStyleDeclaration_iface, v);
 }
 
 static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p)
@@ -5793,8 +5783,20 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_get_pageBreakAfter(IHTMLCSSStyleDe
 static HRESULT WINAPI HTMLCSSStyleDeclaration_put_cssText(IHTMLCSSStyleDeclaration *iface, BSTR v)
 {
     HTMLStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsAString text_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    nsAString_InitDepend(&text_str, v);
+    nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
+    nsAString_Finish(&text_str);
+    if(NS_FAILED(nsres)) {
+        FIXME("SetCssStyle failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLCSSStyleDeclaration_get_cssText(IHTMLCSSStyleDeclaration *iface, BSTR *p)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c
index ca1909c..b33cd01 100644
--- a/dlls/mshtml/tests/style.c
+++ b/dlls/mshtml/tests/style.c
@@ -355,7 +355,9 @@ static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *
 
 static void test_set_csstext(IHTMLStyle *style)
 {
+    IHTMLCSSStyleDeclaration *css_style;
     VARIANT v;
+    BSTR str;
     HRESULT hres;
 
     test_style_set_csstext(style, "background-color: black;");
@@ -365,6 +367,27 @@ static void test_set_csstext(IHTMLStyle *style)
     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
     ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
     VariantClear(&v);
+
+    hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
+    ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE),
+       "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres);
+    if(FAILED(hres))
+        return;
+
+    str = a2bstr("float: left;");
+    hres = IHTMLCSSStyleDeclaration_put_cssText(css_style, str);
+    ok(hres == S_OK, "put_cssText failed: %08x\n", hres);
+    SysFreeString(str);
+
+    hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
+    ok(hres == S_OK, "get_cssText failed: %08x\n", hres);
+    ok(!strcmp_wa(str, "left"), "cssFloat = %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
+    hres = IHTMLCSSStyleDeclaration_put_cssText(css_style, NULL);
+    ok(hres == S_OK, "put_cssText failed: %08x\n", hres);
+
+    IHTMLCSSStyleDeclaration_Release(css_style);
 }
 
 static void test_style2(IHTMLStyle2 *style2)




More information about the wine-cvs mailing list