mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -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 "{ { } }"
|
while (token && token->precedence <= preclimit && depth > 0) {
|
||||||
* will be handled correctly. --jonas */
|
if (token->type == '{')
|
||||||
#define skip_css_block(scanner) \
|
++depth;
|
||||||
if (skip_css_tokens(scanner, '{')) skip_css_tokens(scanner, '}');
|
else if (token->type == '}')
|
||||||
|
--depth;
|
||||||
|
token = get_next_scanner_token(scanner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Atrules grammer:
|
/* Atrules grammer:
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user