From 78b8ee543f73934121b3a8e126c1c27336ca8ed9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 7 Sep 2018 14:45:03 +0200 Subject: [PATCH] mshtml: Added IHTMLCSSStyleDeclaration::get_cssText implementation. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlstyle.c | 29 ++++++++++------------------- dlls/mshtml/tests/style.c | 9 ++++++++- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 2e2777a51b8..d6ea37d3768 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -2472,26 +2472,10 @@ static HRESULT WINAPI HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v) static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - 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; + return IHTMLCSSStyleDeclaration_get_cssText(&This->IHTMLCSSStyleDeclaration_iface, p); } static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v) @@ -5802,8 +5786,15 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_cssText(IHTMLCSSStyleDeclarati static HRESULT WINAPI HTMLCSSStyleDeclaration_get_cssText(IHTMLCSSStyleDeclaration *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString text_str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + /* NOTE: Quicks mode should use different formatting (uppercase, no ';' at the end of rule). */ + nsAString_Init(&text_str, NULL); + nsres = nsIDOMCSSStyleDeclaration_GetCssText(This->nsstyle, &text_str); + return return_nsstr(nsres, &text_str, p); } static HRESULT WINAPI HTMLCSSStyleDeclaration_put_cursor(IHTMLCSSStyleDeclaration *iface, BSTR v) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index b33cd01ed56..cbd3257df93 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -380,10 +380,17 @@ static void test_set_csstext(IHTMLStyle *style) SysFreeString(str); hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str); - ok(hres == S_OK, "get_cssText failed: %08x\n", hres); + ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres); ok(!strcmp_wa(str, "left"), "cssFloat = %s\n", wine_dbgstr_w(str)); SysFreeString(str); + hres = IHTMLCSSStyleDeclaration_get_cssText(css_style, &str); + ok(hres == S_OK, "get_cssText failed: %08x\n", hres); + todo_wine_if(compat_mode < COMPAT_IE9) + ok(!strcmp_wa(str, compat_mode >= COMPAT_IE9 ? "float: left;" : "FLOAT: 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);