From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
These are todo_wine because gecko doesn't return them exactly as native. First, it adds some stuff around the url, like: `transparent url(...) repeat scroll 0% 0%`.
It also doesn't escape the opening parentheses like native does (to `%28`), and escapes `\t` and `\n` to `\9 ` and `\a ` respectively when retrieved. Also backslashes seem to be kept when retrieved *exactly* as when they were input on native, but not with Gecko. This is seemingly done in AppendEscapedCSSIdent, but seems hard to fix for this case. I'm not sure if that's worth replicating in practice...
The thing is that even if we consumed backslashes normally (without escaping), Gecko would return *escaped* backslashes, so it would still not match native! For example the raw string `a\b` (3 characters) is returned as `a\b` by native IE, but `ab` with the current patch (because escaping `b` does nothing), and would be `a\b` if we didn't treat backslashes specially.
Also, I tried to test url() for `cursor` or `border` but url() in them doesn't seem to be supported on native IE in old modes (the latter even gives E_INVALIDARG). Not sure if that's worth replicating either. --- dlls/mshtml/tests/style.c | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 4b72d144354..5d6f9842f81 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -323,6 +323,17 @@ static void test_set_csstext(IHTMLStyle *style) ok(!lstrcmpW(V_BSTR(&v), L"black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v);
+ test_style_set_csstext(style, L"background: url(http://test.winehq.org/i m\ta\g\\e\n((\(.png);"); + + hres = IHTMLStyle_get_background(style, &str); + ok(hres == S_OK, "get_background failed: %08lx\n", hres); + if(compat_mode < COMPAT_IE9) + todo_wine + ok(!lstrcmpW(str, L"url(http://test.winehq.org/i m\ta\g\\e\n%28%28\%28.png)"), "background = %s\n", wine_dbgstr_w(str)); + else + ok(!str, "background = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style); ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE), "Could not get IHTMLCSSStyleDeclaration interface: %08lx\n", hres); @@ -2862,6 +2873,44 @@ static void test_body_style(IHTMLStyle *style) SysFreeString(str); }
+ /* background */ + hres = IHTMLStyle_get_background(style, &sDefault); + ok(hres == S_OK, "get_background failed: %08lx\n", hres); + + str = SysAllocString(L"url("http://test.winehq.org/tests/winehq_snapshot/%5C")"); + hres = IHTMLStyle_put_background(style, str); + ok(hres == S_OK, "put_background failed: %08lx\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_background(style, &str); + ok(hres == S_OK, "get_background failed: %08lx\n", hres); + if(compat_mode < COMPAT_IE9) + todo_wine + ok(!lstrcmpW(str, L"url(http://test.winehq.org/tests/winehq_snapshot/)"), "background = %s\n", wine_dbgstr_w(str)); + else + todo_wine + ok(!lstrcmpW(str, L"url("http://test.winehq.org/tests/winehq_snapshot/%5C")"), "background = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + str = SysAllocString(L"url(http://test.winehq.org/i m\ta\g\\e\n((\(.png)"); + hres = IHTMLStyle_put_background(style, str); + ok(hres == S_OK, "put_background failed: %08lx\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_background(style, &str); + ok(hres == S_OK, "get_background failed: %08lx\n", hres); + if(compat_mode < COMPAT_IE9) + todo_wine + ok(!lstrcmpW(str, L"url(http://test.winehq.org/i m\ta\g\\e\n%28%28\%28.png)"), "background = %s\n", wine_dbgstr_w(str)); + else + todo_wine + ok(!lstrcmpW(str, L"url("http://test.winehq.org/tests/winehq_snapshot/%5C")"), "background = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + hres = IHTMLStyle_put_background(style, sDefault); + ok(hres == S_OK, "put_background failed: %08lx\n", hres); + SysFreeString(sDefault); + /* borderTopWidth */ hres = IHTMLStyle_get_borderTopWidth(style, &vDefault); ok(hres == S_OK, "get_borderTopWidth: %08lx\n", hres);