LibHTML: Skip over CSS @media rules for now

This commit is contained in:
Andreas Kling 2019-10-19 17:39:38 +02:00
parent 6cbf8a3426
commit fed668f20f
Notes: sideshowbarker 2024-07-19 11:38:26 +09:00

View file

@ -104,6 +104,16 @@ public:
{
}
bool next_is(const char* str) const
{
int len = strlen(str);
for (int i = 0; i < len; ++i) {
if (peek(i) != str[i])
return false;
}
return true;
}
char peek(int offset = 0) const
{
if ((index + offset) < css.length())
@ -335,6 +345,25 @@ public:
void parse_rule()
{
// FIXME: We ignore @media rules for now.
if (next_is("@media")) {
while (peek() != '{')
consume_one();
int level = 0;
for (;;) {
auto ch = consume_one();
if (ch == '{') {
++level;
} else if (ch == '}') {
--level;
if (level == 0)
break;
}
}
consume_whitespace_or_comments();
return;
}
parse_selector_list();
consume_specific('{');
parse_declaration();