mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
CSS: Count nested blocks when skipping.
When skipping "@media print { #foo {bar: baz} pre {white-space: normal} }", the previous code would look for the first "{" and then the first "}", and fail to skip the "pre" rule. Seen at support.microsoft.com. I originally posted this change as part of attachment 383 to bug 722.
This commit is contained in:
parent
9c1873a517
commit
64da6774c2
@ -90,12 +90,23 @@ ride_on:
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
skip_css_block(struct scanner *scanner)
|
||||
{
|
||||
if (skip_css_tokens(scanner, '{')) {
|
||||
const int preclimit = get_css_precedence('}');
|
||||
int depth = 1;
|
||||
struct scanner_token *token = get_scanner_token(scanner);
|
||||
|
||||
/* TODO: We should handle support for skipping blocks better like "{ { } }"
|
||||
* will be handled correctly. --jonas */
|
||||
#define skip_css_block(scanner) \
|
||||
if (skip_css_tokens(scanner, '{')) skip_css_tokens(scanner, '}');
|
||||
|
||||
while (token && token->precedence <= preclimit && depth > 0) {
|
||||
if (token->type == '{')
|
||||
++depth;
|
||||
else if (token->type == '}')
|
||||
--depth;
|
||||
token = get_next_scanner_token(scanner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Atrules grammer:
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user