Skip to content

Commit 13cf9e2

Browse files
committed
Fixed bug with parsing CSS properties background and border.
1 parent 4f9c99e commit 13cf9e2

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/style.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,20 @@ void litehtml::style::add_property( const tchar_t* name, const tchar_t* val, con
132132
add_property(_t("border-bottom-style"), tok->c_str(), baseurl, important);
133133
} else
134134
{
135-
if(web_color::is_color(tok->c_str()))
136-
{
137-
add_property(_t("border-left-color"), tok->c_str(), baseurl, important);
138-
add_property(_t("border-right-color"), tok->c_str(), baseurl, important);
139-
add_property(_t("border-top-color"), tok->c_str(), baseurl, important);
140-
add_property(_t("border-bottom-color"), tok->c_str(), baseurl, important);
141-
} else
135+
if (t_isdigit((*tok)[0]) || (*tok)[0] == _t('.') ||
136+
value_in_list((*tok), _t("thin;medium;thick")))
142137
{
143138
add_property(_t("border-left-width"), tok->c_str(), baseurl, important);
144139
add_property(_t("border-right-width"), tok->c_str(), baseurl, important);
145140
add_property(_t("border-top-width"), tok->c_str(), baseurl, important);
146141
add_property(_t("border-bottom-width"), tok->c_str(), baseurl, important);
142+
}
143+
else
144+
{
145+
add_property(_t("border-left-color"), tok->c_str(), baseurl, important);
146+
add_property(_t("border-right-color"), tok->c_str(), baseurl, important);
147+
add_property(_t("border-top-color"), tok->c_str(), baseurl, important);
148+
add_property(_t("border-bottom-color"), tok->c_str(), baseurl, important);
147149
}
148150
}
149151
}
@@ -498,10 +500,7 @@ void litehtml::style::parse_short_background( const tstring& val, const tchar_t*
498500
bool origin_found = false;
499501
for(string_vector::iterator tok = tokens.begin(); tok != tokens.end(); tok++)
500502
{
501-
if(web_color::is_color(tok->c_str()))
502-
{
503-
add_parsed_property(_t("background-color"), *tok, important);
504-
} else if(tok->substr(0, 3) == _t("url"))
503+
if(tok->substr(0, 3) == _t("url"))
505504
{
506505
add_parsed_property(_t("background-image"), *tok, important);
507506
if(baseurl)
@@ -538,6 +537,9 @@ void litehtml::style::parse_short_background( const tstring& val, const tchar_t*
538537
{
539538
add_parsed_property(_t("background-position"), *tok, important);
540539
}
540+
} else if (web_color::is_color(tok->c_str()))
541+
{
542+
add_parsed_property(_t("background-color"), *tok, important);
541543
}
542544
}
543545
}

0 commit comments

Comments
 (0)