Commit 983774e3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use nsAString in fix_px_value.

parent 6b74a99d
......@@ -858,9 +858,12 @@ static const style_tbl_entry_t *lookup_style_tbl(const WCHAR *name)
return NULL;
}
static LPWSTR fix_px_value(LPCWSTR val)
static void fix_px_value(nsAString *nsstr)
{
LPCWSTR ptr = val;
const WCHAR *val, *ptr;
nsAString_GetData(nsstr, &val);
ptr = val;
while(*ptr) {
while(*ptr && isspaceW(*ptr))
......@@ -884,14 +887,14 @@ static LPWSTR fix_px_value(LPCWSTR val)
TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret));
return ret;
nsAString_SetData(nsstr, ret);
heap_free(ret);
break;
}
while(*ptr && !isspaceW(*ptr))
ptr++;
}
return NULL;
}
static LPWSTR fix_url_value(LPCWSTR val)
......@@ -968,11 +971,12 @@ static HRESULT var_to_styleval(CSSStyle *style, const VARIANT *v, const style_tb
static inline HRESULT set_style_property(CSSStyle *style, styleid_t sid, const WCHAR *value)
{
nsAString value_str;
unsigned flags = 0;
WCHAR *val = NULL;
HRESULT hres;
if(value && *value && dispex_compat_mode(&style->dispex) < COMPAT_MODE_IE9) {
unsigned flags = style_tbl[sid].flags;
flags = style_tbl[sid].flags;
if(style_tbl[sid].allowed_values) {
const WCHAR **iter;
......@@ -989,13 +993,13 @@ static inline HRESULT set_style_property(CSSStyle *style, styleid_t sid, const W
}
}
if(flags & ATTR_FIX_PX)
val = fix_px_value(value);
else if(flags & ATTR_FIX_URL)
if(flags & ATTR_FIX_URL)
val = fix_url_value(value);
}
nsAString_InitDepend(&value_str, val ? val : value);
if(flags & ATTR_FIX_PX)
fix_px_value(&value_str);
hres = set_nsstyle_property(style->nsstyle, sid, &value_str);
nsAString_Finish(&value_str);
heap_free(val);
......
......@@ -968,6 +968,7 @@ void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
......
......@@ -843,6 +843,11 @@ UINT32 nsAString_GetData(const nsAString *str, const PRUnichar **data)
return NS_StringGetData(str, data, NULL);
}
void nsAString_SetData(nsAString *str, const PRUnichar *data)
{
NS_StringSetData(str, data, PR_UINT32_MAX);
}
void nsAString_Finish(nsAString *str)
{
NS_StringContainerFinish(str);
......
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