Commit ea7666a0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Change backslashes to shashes in URLs passed to IHTMLStyle::put_backgroundImage.

parent cc021a86
...@@ -116,7 +116,27 @@ static LPWSTR fix_px_value(LPCWSTR val) ...@@ -116,7 +116,27 @@ static LPWSTR fix_px_value(LPCWSTR val)
return NULL; return NULL;
} }
static LPWSTR fix_url_value(LPCWSTR val)
{
WCHAR *ret, *ptr;
static const WCHAR urlW[] = {'u','r','l','('};
if(strncmpW(val, urlW, sizeof(urlW)/sizeof(WCHAR)) || !strchrW(val, '\\'))
return NULL;
ret = heap_strdupW(val);
for(ptr = ret; *ptr; ptr++) {
if(*ptr == '\\')
*ptr = '/';
}
return ret;
}
#define ATTR_FIX_PX 1 #define ATTR_FIX_PX 1
#define ATTR_FIX_URL 2
static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value, DWORD flags) static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value, DWORD flags)
{ {
...@@ -130,6 +150,8 @@ static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value, DWOR ...@@ -130,6 +150,8 @@ static HRESULT set_style_attr(HTMLStyle *This, LPCWSTR name, LPCWSTR value, DWOR
if(flags & ATTR_FIX_PX) if(flags & ATTR_FIX_PX)
val = fix_px_value(value); val = fix_px_value(value);
if(flags & ATTR_FIX_URL)
val = fix_url_value(value);
nsAString_Init(&str_name, name); nsAString_Init(&str_name, name);
nsAString_Init(&str_value, val ? val : value); nsAString_Init(&str_value, val ? val : value);
...@@ -460,7 +482,7 @@ static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v) ...@@ -460,7 +482,7 @@ static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v)); TRACE("(%p)->(%s)\n", This, debugstr_w(v));
return set_style_attr(This, attrBackgroundImage, v, 0); return set_style_attr(This, attrBackgroundImage, v, ATTR_FIX_URL);
} }
static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment