Skip to content

Commit

Permalink
fix(textview): no effect after changing the "content" property
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Aug 19, 2018
1 parent bfc0069 commit d1ab50d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gui/css_fontstyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int OnParseContent(LCUI_CSSParserStyleContext ctx, const char *str)
char *content;

len = strlen(str);
if (len < 1 || str[0] == '"' && str[len - 1] != '"') {
if (len < 1 || (str[0] == '"' && str[len - 1] != '"')) {
return -1;
}
content = malloc(sizeof(char) * (len + 1));
Expand Down
7 changes: 4 additions & 3 deletions src/gui/widget/textview.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ static void TextView_UpdateStyle(LCUI_Widget w)
LCUI_TextStyleRec ts;
LCUI_TextView txt = GetData(w);
LCUI_CSSFontStyle fs = &txt->style;
const wchar_t *content = fs->content;

CSSFontStyle_Compute(fs, w->style);
CSSFontStyle_GetTextStyle(fs, &ts);
Expand All @@ -190,8 +189,10 @@ static void TextView_UpdateStyle(LCUI_Widget w)
TextView_SetTaskForAutoWrap(w, fs->white_space != SV_NOWRAP);
TextView_SetTaskForWordBreak(w, ComputeWordBreakMode(w->style));
TextView_SetTaskForTextStyle(w, &ts);
if (content != fs->content) {
TextView_SetTextW(w, fs->content);
if (fs->content) {
if (!txt->content || wcscmp(fs->content, txt->content) != 0) {
TextView_SetTextW(w, fs->content);
}
}
txt->tasks[TASK_UPDATE].is_valid = TRUE;
Widget_AddTask(w, LCUI_WTASK_USER);
Expand Down

0 comments on commit d1ab50d

Please sign in to comment.