Jacek Caban : mshtml: Use nsAString in fix_px_value.
Alexandre Julliard
julliard at winehq.org
Fri Apr 19 17:30:46 CDT 2019
Module: wine
Branch: master
Commit: 983774e3fa2ee64db3db72746eb4c32930211e06
URL: https://source.winehq.org/git/wine.git/?a=commit;h=983774e3fa2ee64db3db72746eb4c32930211e06
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Apr 19 16:36:55 2019 +0200
mshtml: Use nsAString in fix_px_value.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlstyle.c | 22 +++++++++++++---------
dlls/mshtml/mshtml_private.h | 1 +
dlls/mshtml/nsembed.c | 5 +++++
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index c205d67..aa065dd 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index fadea6b..a44eaf5 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 6aa2812..bcfc437 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -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);
More information about the wine-cvs
mailing list