aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libserver/css/css_parser.cxx2
-rw-r--r--src/libserver/css/css_tokeniser.cxx11
-rw-r--r--src/libserver/css/css_tokeniser.hxx2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx
index 49b42021c..d7b1c8ca8 100644
--- a/src/libserver/css/css_parser.cxx
+++ b/src/libserver/css/css_parser.cxx
@@ -833,6 +833,8 @@ TEST_SUITE("css parser") {
"em { color: rgba(100%,0%,0%,1) } /* the same, with explicit opacity of 1 */\n",
"p { color: rgba(0,0,255,0.5) } /* semi-transparent solid blue */\n",
"p { color: rgba(100%, 50%, 0%, 0.1) } /* very transparent solid orange */",
+ ".chat-icon[_ng-cnj-c0]::before{content:url(group-2.63e87cd21fbf8c966dd.svg);width:60px;height:60px;display:block}",
+ "tt{color:#1e3482}",
};
rspamd_mempool_t *pool = rspamd_mempool_new(rspamd_mempool_suggest_size(),
diff --git a/src/libserver/css/css_tokeniser.cxx b/src/libserver/css/css_tokeniser.cxx
index 5b0a0c086..0374193bf 100644
--- a/src/libserver/css/css_tokeniser.cxx
+++ b/src/libserver/css/css_tokeniser.cxx
@@ -177,7 +177,7 @@ css_parser_token::adjust_dim(const css_parser_token &dim_token) -> bool
/*
* Consume functions: return a token and advance lexer offset
*/
-auto css_tokeniser::consume_ident() -> struct css_parser_token
+auto css_tokeniser::consume_ident(bool allow_number) -> struct css_parser_token
{
auto i = offset;
auto need_escape = false;
@@ -211,7 +211,7 @@ auto css_tokeniser::consume_ident() -> struct css_parser_token
while (i < input.size()) {
auto c = input[i];
- auto is_plain_c = allow_middle_minus ? is_plain_ident(c) :
+ auto is_plain_c = (allow_number || allow_middle_minus) ? is_plain_ident(c) :
is_plain_ident_start(c);
if (!is_plain_c) {
if (c == '\\' && i + 1 < input.size ()) {
@@ -533,8 +533,8 @@ auto css_tokeniser::next_token(void) -> struct css_parser_token
case '\r':
case '\v': {
/* Consume as much space as we can */
- while (i < input.size() && g_ascii_isspace(c)) {
- c = input[i++];
+ while (i < input.size() && g_ascii_isspace(input[i])) {
+ i++;
}
auto ret = make_token<css_parser_token::token_type::whitespace_token>(
@@ -675,7 +675,8 @@ auto css_tokeniser::next_token(void) -> struct css_parser_token
if ((is_plain_ident(next_c) || next_c == '-') &&
(is_plain_ident(next_next_c) || next_next_c == '-')) {
offset = i + 1;
- auto ident_token = consume_ident();
+ /* We consume indent, but we allow numbers there */
+ auto ident_token = consume_ident(true);
if (ident_token.type == css_parser_token::token_type::ident_token) {
/* Update type */
diff --git a/src/libserver/css/css_tokeniser.hxx b/src/libserver/css/css_tokeniser.hxx
index 4a484ecd6..a45e56f3f 100644
--- a/src/libserver/css/css_tokeniser.hxx
+++ b/src/libserver/css/css_tokeniser.hxx
@@ -194,7 +194,7 @@ private:
mutable std::list<css_parser_token> backlog;
auto consume_number() -> struct css_parser_token;
- auto consume_ident() -> struct css_parser_token;
+ auto consume_ident(bool allow_number = false) -> struct css_parser_token;
};
}